@project-sunbird/collection-editor-react 0.1.14 → 0.1.16

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.
@@ -1,4 +1,4 @@
1
- (function(ve,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],h):(ve=typeof globalThis<"u"?globalThis:ve||self,h(ve.CollectionEditorReact={},ve.React,ve.ReactDOM,ve.jsxRuntime))})(this,function(ve,h,Be,l){"use strict";var Gh=ve=>{throw TypeError(ve)};var dl=(ve,h,Be)=>h.has(ve)||Gh("Cannot "+Be);var E=(ve,h,Be)=>(dl(ve,h,"read from private field"),Be?Be.call(ve):h.get(ve)),re=(ve,h,Be)=>h.has(ve)?Gh("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(ve):h.set(ve,Be),R=(ve,h,Be,l)=>(dl(ve,h,"write to private field"),l?l.call(ve,Be):h.set(ve,Be),Be),ye=(ve,h,Be)=>(dl(ve,h,"access private method"),Be);var no=(ve,h,Be,l)=>({set _(so){R(ve,h,so,Be)},get _(){return E(ve,h,l)}});var Xr,Ir,Pn,Fh,sr,Zr,$h,Mn,Tr,Ln,jh,Jr,Bh,Fn,en,$n,zt,tn,tt,As,rn,Lt,Qh,yr,Uh,Tt,be,Ps,wt,nn,jn,fr,Nr,Ms,Bn,Un,sn,on,xr,Vn,De,Vs,fl,hl,pl,gl,yl,vl,ml,Yh,Vh,Ls,ir,yt,an,or,Fr,zh,hr,Xt,Fs,qh,ar,Hh,He,kr,Ar,zn,qn,Pr,Hn,Wn,Wh;function so(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Oe=so(h);var Gn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zh=(Fh=class extends Gn{constructor(){super();re(this,Xr);re(this,Ir);re(this,Pn);R(this,Pn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Ir)||this.setEventListener(E(this,Pn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Ir))==null||t.call(this),R(this,Ir,void 0))}setEventListener(t){var r;R(this,Pn,t),(r=E(this,Ir))==null||r.call(this),R(this,Ir,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Xr)!==t&&(R(this,Xr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Xr)=="boolean"?E(this,Xr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xr=new WeakMap,Ir=new WeakMap,Pn=new WeakMap,Fh),io=new Zh,Jh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ep=($h=class{constructor(){re(this,sr,Jh);re(this,Zr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Zr)&&e!==E(this,sr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,sr),provider:e}),R(this,sr,e),process.env.NODE_ENV!=="production"&&R(this,Zr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&R(this,Zr,!0),E(this,sr).setTimeout(e,t)}clearTimeout(e){E(this,sr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&R(this,Zr,!0),E(this,sr).setInterval(e,t)}clearInterval(e){E(this,sr).clearInterval(e)}},sr=new WeakMap,Zr=new WeakMap,$h),$r=new ep;function tp(e){setTimeout(e,0)}var rp=typeof window>"u"||"Deno"in globalThis;function Ot(){}function np(e,t){return typeof e=="function"?e(t):e}function oo(e){return typeof e=="number"&&e>=0&&e!==1/0}function bl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function vr(e,t){return typeof e=="function"?e(t):e}function kt(e,t){return typeof e=="function"?e(t):e}function _l(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==ao(o,t.options))return!1}else if(!Yn(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function wl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Qn(t.options.mutationKey)!==Qn(i))return!1}else if(!Yn(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function ao(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qn)(e)}function Qn(e){return JSON.stringify(e,(t,r)=>uo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Yn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Yn(e[r],t[r])):!1}var sp=Object.prototype.hasOwnProperty;function lo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Sl(e)&&Sl(t);if(!n&&!(uo(e)&&uo(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],y=e[f],g=t[f];if(y===g){c[f]=y,(n?u<i:sp.call(e,f))&&d++;continue}if(y===null||g===null||typeof y!="object"||typeof g!="object"){c[f]=g;continue}const _=lo(y,g,r+1);c[f]=_,_===y&&d++}return i===a&&d===i?e:c}function co(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Sl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function uo(e){if(!Cl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Cl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Cl(e){return Object.prototype.toString.call(e)==="[object Object]"}function ip(e){return new Promise(t=>{$r.setTimeout(t,e)})}function fo(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return lo(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return lo(e,t)}return t}function op(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ap(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var zs=Symbol();function Ol(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===zs&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===zs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function El(e,t){return typeof e=="function"?e(...t):!!e}function lp(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var Rn=(()=>{let e=()=>rp;return{isServer(){return e()},setIsServer(t){e=t}}})();function ho(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var cp=tp;function up(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=cp;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var st=up(),dp=(jh=class extends Gn{constructor(){super();re(this,Mn,!0);re(this,Tr);re(this,Ln);R(this,Ln,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,Tr)||this.setEventListener(E(this,Ln))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Tr))==null||t.call(this),R(this,Tr,void 0))}setEventListener(t){var r;R(this,Ln,t),(r=E(this,Tr))==null||r.call(this),R(this,Tr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Mn)!==t&&(R(this,Mn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Mn)}},Mn=new WeakMap,Tr=new WeakMap,Ln=new WeakMap,jh),qs=new dp;function fp(e){return Math.min(1e3*2**e,3e4)}function Dl(e){return(e??"online")==="online"?qs.isOnline():!0}var po=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Il(e){let t=!1,r=0,n;const s=ho(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new po(p);y(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>io.isFocused()&&(e.networkMode==="always"||qs.isOnline())&&e.canRun(),u=()=>Dl(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},y=p=>{i()||(n==null||n(),s.reject(p))},g=()=>new Promise(p=>{var v;n=m=>{(i()||d())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),_=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var I;if(i())return;const b=e.retry??(Rn.isServer()?0:3),S=e.retryDelay??fp,w=typeof S=="function"?S(r,m):S,O=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!O){y(m);return}r++,(I=e.onFail)==null||I.call(e,r,m),ip(w).then(()=>d()?void 0:g()).then(()=>{t?y(m):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():g().then(_),s)}}var Tl=(Bh=class{constructor(){re(this,Jr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),oo(this.gcTime)&&R(this,Jr,$r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Rn.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Jr)!==void 0&&($r.clearTimeout(E(this,Jr)),R(this,Jr,void 0))}},Jr=new WeakMap,Bh);function hp(e){return{onFetch:(t,r)=>{var u,f,y,g,_;const n=t.options,s=(y=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:y.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const v=S=>{lp(S,()=>t.signal,()=>p=!0)},m=Ol(t.options,t.fetchOptions),b=async(S,w,O)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const k=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:w,direction:O?"backward":"forward",meta:t.options.meta};return v(M),M})(),P=await m(k),{maxPages:B}=t.options,N=O?ap:op;return{pages:N(S.pages,P,B),pageParams:N(S.pageParams,w,B)}};if(s&&i.length){const S=s==="backward",w=S?pp:Nl,O={pages:i,pageParams:o},I=w(n,O);a=await b(O,I,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Nl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Nl(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function pp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var gp=(Uh=class extends Tl{constructor(t){super();re(this,Lt);re(this,Fn);re(this,en);re(this,$n);re(this,zt);re(this,tn);re(this,tt);re(this,As);re(this,rn);R(this,rn,!1),R(this,As,t.defaultOptions),this.setOptions(t.options),this.observers=[],R(this,tn,t.client),R(this,zt,E(this,tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,R(this,en,Al(this.options)),this.state=t.state??E(this,en),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Fn)}get promise(){var t;return(t=E(this,tt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,As),...t},t!=null&&t._type&&R(this,Fn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Al(this.options);r.data!==void 0&&(this.setState(kl(r.data,r.dataUpdatedAt)),R(this,en,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,zt).remove(this)}setData(t,r){const n=fo(this.state.data,t,this.options);return ye(this,Lt,yr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){ye(this,Lt,yr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,tt))==null?void 0:n.promise;return(s=E(this,tt))==null||s.cancel(t),r?r.then(Ot).catch(Ot):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,en)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>vr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!bl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,tt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,tt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,zt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,tt)&&(E(this,rn)||ye(this,Lt,Qh).call(this)?E(this,tt).cancel({revert:!0}):E(this,tt).cancelRetry()),this.scheduleGc()),E(this,zt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ye(this,Lt,yr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,y,g,_,p,v,m,b,S;if(this.state.fetchStatus!=="idle"&&((d=E(this,tt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,tt))return E(this,tt).continueRetry(),E(this,tt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(O=>O.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(R(this,rn,!0),n.signal)})},i=()=>{const w=Ol(this.options,r),I=(()=>{const k={client:E(this,tn),queryKey:this.queryKey,meta:this.meta};return s(k),k})();return R(this,rn,!1),this.options.persister?this.options.persister(w,I,this):w(I)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,tn),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,Fn)==="infinite"?hp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),R(this,$n,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&ye(this,Lt,yr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),R(this,tt,Il({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof po&&w.revert&&this.setState({...E(this,$n),fetchStatus:"idle"}),n.abort()},onFail:(w,O)=>{ye(this,Lt,yr).call(this,{type:"failed",failureCount:w,error:O})},onPause:()=>{ye(this,Lt,yr).call(this,{type:"pause"})},onContinue:()=>{ye(this,Lt,yr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,tt).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(g=(y=E(this,zt).config).onSuccess)==null||g.call(y,w,this),(p=(_=E(this,zt).config).onSettled)==null||p.call(_,w,this.state.error,this),w}catch(w){if(w instanceof po){if(w.silent)return E(this,tt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw ye(this,Lt,yr).call(this,{type:"error",error:w}),(m=(v=E(this,zt).config).onError)==null||m.call(v,w,this),(S=(b=E(this,zt).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Fn=new WeakMap,en=new WeakMap,$n=new WeakMap,zt=new WeakMap,tn=new WeakMap,tt=new WeakMap,As=new WeakMap,rn=new WeakMap,Lt=new WeakSet,Qh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},yr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...xl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...kl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return R(this,$n,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),st.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,zt).notify({query:this,type:"updated",action:t})})},Uh);function xl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Dl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function kl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Al(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var yp=(Vh=class extends Gn{constructor(t,r){super();re(this,De);re(this,Tt);re(this,be);re(this,Ps);re(this,wt);re(this,nn);re(this,jn);re(this,fr);re(this,Nr);re(this,Ms);re(this,Bn);re(this,Un);re(this,sn);re(this,on);re(this,xr);re(this,Vn,new Set);this.options=r,R(this,Tt,t),R(this,Nr,null),R(this,fr,ho()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,be).addObserver(this),Pl(E(this,be),this.options)?ye(this,De,Vs).call(this):this.updateResult(),ye(this,De,gl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return go(E(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return go(E(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ye(this,De,yl).call(this),ye(this,De,vl).call(this),E(this,be).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,be);if(this.options=E(this,Tt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kt(this.options.enabled,E(this,be))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ye(this,De,ml).call(this),E(this,be).setOptions(this.options),r._defaulted&&!co(this.options,r)&&E(this,Tt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,be),observer:this});const s=this.hasListeners();s&&Ml(E(this,be),n,this.options,r)&&ye(this,De,Vs).call(this),this.updateResult(),s&&(E(this,be)!==n||kt(this.options.enabled,E(this,be))!==kt(r.enabled,E(this,be))||vr(this.options.staleTime,E(this,be))!==vr(r.staleTime,E(this,be)))&&ye(this,De,fl).call(this);const i=ye(this,De,hl).call(this);s&&(E(this,be)!==n||kt(this.options.enabled,E(this,be))!==kt(r.enabled,E(this,be))||i!==E(this,xr))&&ye(this,De,pl).call(this,i)}getOptimisticResult(t){const r=E(this,Tt).getQueryCache().build(E(this,Tt),t),n=this.createResult(r,t);return mp(this,n)&&(R(this,wt,n),R(this,jn,this.options),R(this,nn,E(this,be).state)),n}getCurrentResult(){return E(this,wt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,fr).status==="pending"&&E(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,Vn).add(t)}getCurrentQuery(){return E(this,be)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Tt).defaultQueryOptions(t),n=E(this,Tt).getQueryCache().build(E(this,Tt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return ye(this,De,Vs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,wt)))}createResult(t,r){var B;const n=E(this,be),s=this.options,i=E(this,wt),o=E(this,nn),a=E(this,jn),d=t!==n?t.state:E(this,Ps),{state:u}=t;let f={...u},y=!1,g;if(r._optimisticResults){const N=this.hasListeners(),M=!N&&Pl(t,r),V=N&&Ml(t,n,r,s);(M||V)&&(f={...f,...xl(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:p,status:v}=f;g=f.data;let m=!1;if(r.placeholderData!==void 0&&g===void 0&&v==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,m=!0):N=typeof r.placeholderData=="function"?r.placeholderData((B=E(this,Un))==null?void 0:B.state.data,E(this,Un)):r.placeholderData,N!==void 0&&(v="success",g=fo(i==null?void 0:i.data,N,r),y=!0)}if(r.select&&g!==void 0&&!m)if(i&&g===(o==null?void 0:o.data)&&r.select===E(this,Ms))g=E(this,Bn);else try{R(this,Ms,r.select),g=r.select(g),g=fo(i==null?void 0:i.data,g,r),R(this,Bn,g),R(this,Nr,null)}catch(N){R(this,Nr,N)}E(this,Nr)&&(_=E(this,Nr),g=E(this,Bn),p=Date.now(),v="error");const b=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",O=S&&b,I=g!==void 0,P={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:O,isLoading:O,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:w&&!I,isPaused:f.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:w&&I,isStale:yo(t,r),refetch:this.refetch,promise:E(this,fr),isEnabled:kt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=P.data!==void 0,M=P.status==="error"&&!N,V=j=>{M?j.reject(P.error):N&&j.resolve(P.data)},A=()=>{const j=R(this,fr,P.promise=ho());V(j)},U=E(this,fr);switch(U.status){case"pending":t.queryHash===n.queryHash&&V(U);break;case"fulfilled":(M||P.data!==U.value)&&A();break;case"rejected":(!M||P.error!==U.reason)&&A();break}}return P}updateResult(){const t=E(this,wt),r=this.createResult(E(this,be),this.options);if(R(this,nn,E(this,be).state),R(this,jn,this.options),E(this,nn).data!==void 0&&R(this,Un,E(this,be)),co(r,t))return;R(this,wt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,Vn).size)return!0;const o=new Set(i??E(this,Vn));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,wt)).some(a=>{const c=a;return E(this,wt)[c]!==t[c]&&o.has(c)})};ye(this,De,Yh).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ye(this,De,gl).call(this)}},Tt=new WeakMap,be=new WeakMap,Ps=new WeakMap,wt=new WeakMap,nn=new WeakMap,jn=new WeakMap,fr=new WeakMap,Nr=new WeakMap,Ms=new WeakMap,Bn=new WeakMap,Un=new WeakMap,sn=new WeakMap,on=new WeakMap,xr=new WeakMap,Vn=new WeakMap,De=new WeakSet,Vs=function(t){ye(this,De,ml).call(this);let r=E(this,be).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ot)),r},fl=function(){ye(this,De,yl).call(this);const t=vr(this.options.staleTime,E(this,be));if(Rn.isServer()||E(this,wt).isStale||!oo(t))return;const n=bl(E(this,wt).dataUpdatedAt,t)+1;R(this,sn,$r.setTimeout(()=>{E(this,wt).isStale||this.updateResult()},n))},hl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,be)):this.options.refetchInterval)??!1},pl=function(t){ye(this,De,vl).call(this),R(this,xr,t),!(Rn.isServer()||kt(this.options.enabled,E(this,be))===!1||!oo(E(this,xr))||E(this,xr)===0)&&R(this,on,$r.setInterval(()=>{(this.options.refetchIntervalInBackground||io.isFocused())&&ye(this,De,Vs).call(this)},E(this,xr)))},gl=function(){ye(this,De,fl).call(this),ye(this,De,pl).call(this,ye(this,De,hl).call(this))},yl=function(){E(this,sn)!==void 0&&($r.clearTimeout(E(this,sn)),R(this,sn,void 0))},vl=function(){E(this,on)!==void 0&&($r.clearInterval(E(this,on)),R(this,on,void 0))},ml=function(){const t=E(this,Tt).getQueryCache().build(E(this,Tt),this.options);if(t===E(this,be))return;const r=E(this,be);R(this,be,t),R(this,Ps,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Yh=function(t){st.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,wt))}),E(this,Tt).getQueryCache().notify({query:E(this,be),type:"observerResultsUpdated"})})},Vh);function vp(e,t){return kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&kt(t.retryOnMount,e)===!1)}function Pl(e,t){return vp(e,t)||e.state.data!==void 0&&go(e,t,t.refetchOnMount)}function go(e,t,r){if(kt(t.enabled,e)!==!1&&vr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&yo(e,t)}return!1}function Ml(e,t,r,n){return(e!==t||kt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&yo(e,r)}function yo(e,t){return kt(t.enabled,e)!==!1&&e.isStaleByTime(vr(t.staleTime,e))}function mp(e,t){return!co(e.getCurrentResult(),t)}var bp=(zh=class extends Tl{constructor(t){super();re(this,or);re(this,Ls);re(this,ir);re(this,yt);re(this,an);R(this,Ls,t.client),this.mutationId=t.mutationId,R(this,yt,t.mutationCache),R(this,ir,[]),this.state=t.state||_p(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,ir).includes(t)||(E(this,ir).push(t),this.clearGcTimeout(),E(this,yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){R(this,ir,E(this,ir).filter(r=>r!==t)),this.scheduleGc(),E(this,yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,ir).length||(this.state.status==="pending"?this.scheduleGc():E(this,yt).remove(this))}continue(){var t;return((t=E(this,an))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,y,g,_,p,v,m,b,S,w,O,I,k;const r=()=>{ye(this,or,Fr).call(this,{type:"continue"})},n={client:E(this,Ls),meta:this.options.meta,mutationKey:this.options.mutationKey};R(this,an,Il({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,B)=>{ye(this,or,Fr).call(this,{type:"failed",failureCount:P,error:B})},onPause:()=>{ye(this,or,Fr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,yt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,an).canStart();try{if(s)r();else{ye(this,or,Fr).call(this,{type:"pending",variables:t,isPaused:i}),E(this,yt).config.onMutate&&await E(this,yt).config.onMutate(t,this,n);const B=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));B!==this.state.context&&ye(this,or,Fr).call(this,{type:"pending",context:B,variables:t,isPaused:i})}const P=await E(this,an).start();return await((d=(c=E(this,yt).config).onSuccess)==null?void 0:d.call(c,P,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,P,t,this.state.context,n)),await((g=(y=E(this,yt).config).onSettled)==null?void 0:g.call(y,P,null,this.state.variables,this.state.context,this,n)),await((p=(_=this.options).onSettled)==null?void 0:p.call(_,P,null,t,this.state.context,n)),ye(this,or,Fr).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(v=E(this,yt).config).onError)==null?void 0:m.call(v,P,t,this.state.context,this,n))}catch(B){Promise.reject(B)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,P,t,this.state.context,n))}catch(B){Promise.reject(B)}try{await((O=(w=E(this,yt).config).onSettled)==null?void 0:O.call(w,void 0,P,this.state.variables,this.state.context,this,n))}catch(B){Promise.reject(B)}try{await((k=(I=this.options).onSettled)==null?void 0:k.call(I,void 0,P,t,this.state.context,n))}catch(B){Promise.reject(B)}throw ye(this,or,Fr).call(this,{type:"error",error:P}),P}finally{E(this,yt).runNext(this)}}},Ls=new WeakMap,ir=new WeakMap,yt=new WeakMap,an=new WeakMap,or=new WeakSet,Fr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),st.batch(()=>{E(this,ir).forEach(n=>{n.onMutationUpdate(t)}),E(this,yt).notify({mutation:this,type:"updated",action:t})})},zh);function _p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wp=(qh=class extends Gn{constructor(t={}){super();re(this,hr);re(this,Xt);re(this,Fs);this.config=t,R(this,hr,new Set),R(this,Xt,new Map),R(this,Fs,0)}build(t,r,n){const s=new bp({client:t,mutationCache:this,mutationId:++no(this,Fs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,hr).add(t);const r=Hs(t);if(typeof r=="string"){const n=E(this,Xt).get(r);n?n.push(t):E(this,Xt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hr).delete(t)){const r=Hs(t);if(typeof r=="string"){const n=E(this,Xt).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&E(this,Xt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Hs(t);if(typeof r=="string"){const n=E(this,Xt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Hs(t);if(typeof r=="string"){const s=(n=E(this,Xt).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){st.batch(()=>{E(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hr).clear(),E(this,Xt).clear()})}getAll(){return Array.from(E(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>wl(r,n))}findAll(t={}){return this.getAll().filter(r=>wl(t,r))}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return st.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ot))))}},hr=new WeakMap,Xt=new WeakMap,Fs=new WeakMap,qh);function Hs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Sp=(Hh=class extends Gn{constructor(t={}){super();re(this,ar);this.config=t,R(this,ar,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??ao(s,r);let o=this.get(i);return o||(o=new gp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ar).has(t.queryHash)||(E(this,ar).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ar).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ar).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){st.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ar).get(t)}getAll(){return[...E(this,ar).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>_l(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>_l(t,n)):r}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){st.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){st.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ar=new WeakMap,Hh),Cp=(Wh=class{constructor(e={}){re(this,He);re(this,kr);re(this,Ar);re(this,zn);re(this,qn);re(this,Pr);re(this,Hn);re(this,Wn);R(this,He,e.queryCache||new Sp),R(this,kr,e.mutationCache||new wp),R(this,Ar,e.defaultOptions||{}),R(this,zn,new Map),R(this,qn,new Map),R(this,Pr,0)}mount(){no(this,Pr)._++,E(this,Pr)===1&&(R(this,Hn,io.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onFocus())})),R(this,Wn,qs.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onOnline())})))}unmount(){var e,t;no(this,Pr)._--,E(this,Pr)===0&&((e=E(this,Hn))==null||e.call(this),R(this,Hn,void 0),(t=E(this,Wn))==null||t.call(this),R(this,Wn,void 0))}isFetching(e){return E(this,He).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,kr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,He).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,He).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(vr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,He).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=E(this,He).get(n.queryHash),i=s==null?void 0:s.state.data,o=np(t,i);if(o!==void 0)return E(this,He).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return st.batch(()=>E(this,He).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,He).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,He);st.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,He);return st.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=st.batch(()=>E(this,He).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ot).catch(Ot)}invalidateQueries(e,t={}){return st.batch(()=>(E(this,He).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=st.batch(()=>E(this,He).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ot)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ot)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,He).build(this,t);return r.isStaleByTime(vr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ot).catch(Ot)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ot).catch(Ot)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return qs.isOnline()?E(this,kr).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,He)}getMutationCache(){return E(this,kr)}getDefaultOptions(){return E(this,Ar)}setDefaultOptions(e){R(this,Ar,e)}setQueryDefaults(e,t){E(this,zn).set(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,zn).values()],r={};return t.forEach(n=>{Yn(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,qn).set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,qn).values()],r={};return t.forEach(n=>{Yn(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Ar).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ao(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===zs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Ar).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,He).clear(),E(this,kr).clear()}},He=new WeakMap,kr=new WeakMap,Ar=new WeakMap,zn=new WeakMap,qn=new WeakMap,Pr=new WeakMap,Hn=new WeakMap,Wn=new WeakMap,Wh),Ll=Oe.createContext(void 0),Op=e=>{const t=Oe.useContext(Ll);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ep=({client:e,children:t})=>(Oe.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Ll.Provider,{value:e,children:t})),Fl=Oe.createContext(!1),Dp=()=>Oe.useContext(Fl);Fl.Provider;function Ip(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Tp=Oe.createContext(Ip()),Np=()=>Oe.useContext(Tp),xp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?El(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},kp=e=>{Oe.useEffect(()=>{e.clearReset()},[e])},Ap=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||El(r,[e.error,n])),Pp=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Mp=(e,t)=>e.isLoading&&e.isFetching&&!t,Lp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,$l=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Fp(e,t,r){var g,_,p,v;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Dp(),s=Np(),i=Op(),o=i.defaultQueryOptions(e);(_=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||_.call(g,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Pp(o),xp(o,s,a),kp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Oe.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),y=!n&&c;if(Oe.useSyncExternalStore(Oe.useCallback(m=>{const b=y?u.subscribe(st.batchCalls(m)):Ot;return u.updateResult(),b},[u,y]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Oe.useEffect(()=>{u.setOptions(o)},[o,u]),Lp(o,f))throw $l(o,u,s);if(Ap({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((v=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||v.call(p,o,f),o.experimental_prefetchInRender&&!Rn.isServer()&&Mp(f,n)){const m=d?$l(o,u,s):a==null?void 0:a.promise;m==null||m.catch(Ot).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function vo(e,t){return Fp(e,yp)}let $p={data:""},jp=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||$p},Bp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Up=/\/\*[^]*?\*\/| +/g,jl=/\n+/g,mr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?mr(o,i):i+"{"+mr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=mr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=mr.p?mr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},br={},Bl=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Bl(e[r]);return t}return e},Vp=(e,t,r,n,s)=>{let i=Bl(e),o=br[i]||(br[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!br[o]){let c=i!==e?e:(d=>{let u,f,y=[{}];for(;u=Bp.exec(d.replace(Up,""));)u[4]?y.shift():u[3]?(f=u[3].replace(jl," ").trim(),y.unshift(y[0][f]=y[0][f]||{})):y[0][u[1]]=u[2].replace(jl," ").trim();return y[0]})(e);br[o]=mr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&br.g;return r&&(br.g=br[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(br[o],t,n,a),o},zp=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":mr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Ws(e){let t=this||{},r=e.call?e(t.p):e;return Vp(r.unshift?r.raw?zp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,jp(t.target),t.g,t.o,t.k)}let Ul,mo,bo;Ws.bind({g:1});let ur=Ws.bind({k:1});function qp(e,t,r,n){mr.p=t,Ul=e,mo=r,bo=n}function _r(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:mo&&mo()},a),r.o=/go\d/.test(c),a.className=Ws.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),bo&&d[0]&&bo(a),Ul(d,a)}return s}}var Hp=e=>typeof e=="function",Ks=(e,t)=>Hp(e)?e(t):e,Wp=(()=>{let e=0;return()=>(++e).toString()})(),Vl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Kp=20,_o="default",zl=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return zl(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},Gs=[],ql={toasts:[],pausedAt:void 0,settings:{toastLimit:Kp}},Jt={},Hl=(e,t=_o)=>{Jt[t]=zl(Jt[t]||ql,e),Gs.forEach(([r,n])=>{r===t&&n(Jt[t])})},Wl=e=>Object.keys(Jt).forEach(t=>Hl(e,t)),Gp=e=>Object.keys(Jt).find(t=>Jt[t].toasts.some(r=>r.id===e)),Qs=(e=_o)=>t=>{Hl(t,e)},Qp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Yp=(e={},t=_o)=>{let[r,n]=h.useState(Jt[t]||ql),s=h.useRef(Jt[t]);h.useEffect(()=>(s.current!==Jt[t]&&n(Jt[t]),Gs.push([t,n]),()=>{let o=Gs.findIndex(([a])=>a===t);o>-1&&Gs.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||Qp[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},Rp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||Wp()}),Xn=e=>(t,r)=>{let n=Rp(t,e,r);return Qs(n.toasterId||Gp(n.id))({type:2,toast:n}),n.id},Re=(e,t)=>Xn("blank")(e,t);Re.error=Xn("error"),Re.success=Xn("success"),Re.loading=Xn("loading"),Re.custom=Xn("custom"),Re.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Qs(t)(r):Wl(r)},Re.dismissAll=e=>Re.dismiss(void 0,e),Re.remove=(e,t)=>{let r={type:4,toastId:e};t?Qs(t)(r):Wl(r)},Re.removeAll=e=>Re.remove(void 0,e),Re.promise=(e,t,r)=>{let n=Re.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ks(t.success,s):void 0;return i?Re.success(i,{id:n,...r,...r==null?void 0:r.success}):Re.dismiss(n),s}).catch(s=>{let i=t.error?Ks(t.error,s):void 0;i?Re.error(i,{id:n,...r,...r==null?void 0:r.error}):Re.dismiss(n)}),e};var Xp=1e3,Zp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Yp(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,y=Xp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},y);s.set(f,g)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),y=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Re.dismiss(g.id);return}return setTimeout(()=>Re.dismiss(g.id,t),_)});return()=>{y.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=h.useCallback(Qs(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,y)=>{o({type:1,toast:{id:f,height:y}})},[o]),d=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=h.useCallback((f,y)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:p}=y||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),b=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...g?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return h.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let y=s.get(f.id);y&&(clearTimeout(y),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},Jp=ur`
1
+ (function(me,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],h):(me=typeof globalThis<"u"?globalThis:me||self,h(me.CollectionEditorReact={},me.React,me.ReactDOM,me.jsxRuntime))})(this,function(me,h,Be,l){"use strict";var Gh=me=>{throw TypeError(me)};var fl=(me,h,Be)=>h.has(me)||Gh("Cannot "+Be);var E=(me,h,Be)=>(fl(me,h,"read from private field"),Be?Be.call(me):h.get(me)),ne=(me,h,Be)=>h.has(me)?Gh("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(me):h.set(me,Be),X=(me,h,Be,l)=>(fl(me,h,"write to private field"),l?l.call(me,Be):h.set(me,Be),Be),ve=(me,h,Be)=>(fl(me,h,"access private method"),Be);var so=(me,h,Be,l)=>({set _(io){X(me,h,io,Be)},get _(){return E(me,h,l)}});var Xr,Ir,An,Fh,sr,Zr,$h,Pn,Tr,Mn,jh,Jr,Bh,Ln,en,Fn,zt,tn,tt,As,rn,Lt,Qh,yr,Uh,Tt,_e,Ps,wt,nn,$n,fr,Nr,Ms,jn,Bn,sn,on,xr,Un,De,Vs,hl,pl,gl,yl,vl,ml,bl,Yh,Vh,Ls,ir,yt,an,or,Fr,zh,hr,Xt,Fs,qh,ar,Hh,He,kr,Ar,Vn,zn,Pr,qn,Hn,Wh;function io(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Oe=io(h);var Kn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zh=(Fh=class extends Kn{constructor(){super();ne(this,Xr);ne(this,Ir);ne(this,An);X(this,An,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Ir)||this.setEventListener(E(this,An))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Ir))==null||t.call(this),X(this,Ir,void 0))}setEventListener(t){var r;X(this,An,t),(r=E(this,Ir))==null||r.call(this),X(this,Ir,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Xr)!==t&&(X(this,Xr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Xr)=="boolean"?E(this,Xr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xr=new WeakMap,Ir=new WeakMap,An=new WeakMap,Fh),oo=new Zh,Jh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ep=($h=class{constructor(){ne(this,sr,Jh);ne(this,Zr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Zr)&&e!==E(this,sr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,sr),provider:e}),X(this,sr,e),process.env.NODE_ENV!=="production"&&X(this,Zr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&X(this,Zr,!0),E(this,sr).setTimeout(e,t)}clearTimeout(e){E(this,sr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&X(this,Zr,!0),E(this,sr).setInterval(e,t)}clearInterval(e){E(this,sr).clearInterval(e)}},sr=new WeakMap,Zr=new WeakMap,$h),$r=new ep;function tp(e){setTimeout(e,0)}var rp=typeof window>"u"||"Deno"in globalThis;function Ot(){}function np(e,t){return typeof e=="function"?e(t):e}function ao(e){return typeof e=="number"&&e>=0&&e!==1/0}function _l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function vr(e,t){return typeof e=="function"?e(t):e}function kt(e,t){return typeof e=="function"?e(t):e}function wl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==lo(o,t.options))return!1}else if(!Qn(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Sl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Gn(t.options.mutationKey)!==Gn(i))return!1}else if(!Qn(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function lo(e,t){return((t==null?void 0:t.queryKeyHashFn)||Gn)(e)}function Gn(e){return JSON.stringify(e,(t,r)=>fo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Qn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Qn(e[r],t[r])):!1}var sp=Object.prototype.hasOwnProperty;function co(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Cl(e)&&Cl(t);if(!n&&!(fo(e)&&fo(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],y=e[f],g=t[f];if(y===g){c[f]=y,(n?u<i:sp.call(e,f))&&d++;continue}if(y===null||g===null||typeof y!="object"||typeof g!="object"){c[f]=g;continue}const _=co(y,g,r+1);c[f]=_,_===y&&d++}return i===a&&d===i?e:c}function uo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Cl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function fo(e){if(!Ol(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Ol(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ol(e){return Object.prototype.toString.call(e)==="[object Object]"}function ip(e){return new Promise(t=>{$r.setTimeout(t,e)})}function ho(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return co(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return co(e,t)}return t}function op(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ap(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var zs=Symbol();function El(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===zs&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===zs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Dl(e,t){return typeof e=="function"?e(...t):!!e}function lp(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var Yn=(()=>{let e=()=>rp;return{isServer(){return e()},setIsServer(t){e=t}}})();function po(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var cp=tp;function up(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=cp;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var st=up(),dp=(jh=class extends Kn{constructor(){super();ne(this,Pn,!0);ne(this,Tr);ne(this,Mn);X(this,Mn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,Tr)||this.setEventListener(E(this,Mn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Tr))==null||t.call(this),X(this,Tr,void 0))}setEventListener(t){var r;X(this,Mn,t),(r=E(this,Tr))==null||r.call(this),X(this,Tr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Pn)!==t&&(X(this,Pn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Pn)}},Pn=new WeakMap,Tr=new WeakMap,Mn=new WeakMap,jh),qs=new dp;function fp(e){return Math.min(1e3*2**e,3e4)}function Il(e){return(e??"online")==="online"?qs.isOnline():!0}var go=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Tl(e){let t=!1,r=0,n;const s=po(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new go(p);y(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>oo.isFocused()&&(e.networkMode==="always"||qs.isOnline())&&e.canRun(),u=()=>Il(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},y=p=>{i()||(n==null||n(),s.reject(p))},g=()=>new Promise(p=>{var v;n=m=>{(i()||d())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),_=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var I;if(i())return;const b=e.retry??(Yn.isServer()?0:3),S=e.retryDelay??fp,w=typeof S=="function"?S(r,m):S,O=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!O){y(m);return}r++,(I=e.onFail)==null||I.call(e,r,m),ip(w).then(()=>d()?void 0:g()).then(()=>{t?y(m):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():g().then(_),s)}}var Nl=(Bh=class{constructor(){ne(this,Jr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ao(this.gcTime)&&X(this,Jr,$r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Yn.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Jr)!==void 0&&($r.clearTimeout(E(this,Jr)),X(this,Jr,void 0))}},Jr=new WeakMap,Bh);function hp(e){return{onFetch:(t,r)=>{var u,f,y,g,_;const n=t.options,s=(y=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:y.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const v=S=>{lp(S,()=>t.signal,()=>p=!0)},m=El(t.options,t.fetchOptions),b=async(S,w,O)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const k=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:w,direction:O?"backward":"forward",meta:t.options.meta};return v(M),M})(),P=await m(k),{maxPages:B}=t.options,N=O?ap:op;return{pages:N(S.pages,P,B),pageParams:N(S.pageParams,w,B)}};if(s&&i.length){const S=s==="backward",w=S?pp:xl,O={pages:i,pageParams:o},I=w(n,O);a=await b(O,I,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:xl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function xl(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function pp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var gp=(Uh=class extends Nl{constructor(t){super();ne(this,Lt);ne(this,Ln);ne(this,en);ne(this,Fn);ne(this,zt);ne(this,tn);ne(this,tt);ne(this,As);ne(this,rn);X(this,rn,!1),X(this,As,t.defaultOptions),this.setOptions(t.options),this.observers=[],X(this,tn,t.client),X(this,zt,E(this,tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,X(this,en,Pl(this.options)),this.state=t.state??E(this,en),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Ln)}get promise(){var t;return(t=E(this,tt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,As),...t},t!=null&&t._type&&X(this,Ln,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Pl(this.options);r.data!==void 0&&(this.setState(Al(r.data,r.dataUpdatedAt)),X(this,en,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,zt).remove(this)}setData(t,r){const n=ho(this.state.data,t,this.options);return ve(this,Lt,yr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){ve(this,Lt,yr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,tt))==null?void 0:n.promise;return(s=E(this,tt))==null||s.cancel(t),r?r.then(Ot).catch(Ot):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,en)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>vr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!_l(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,tt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,tt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,zt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,tt)&&(E(this,rn)||ve(this,Lt,Qh).call(this)?E(this,tt).cancel({revert:!0}):E(this,tt).cancelRetry()),this.scheduleGc()),E(this,zt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ve(this,Lt,yr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,y,g,_,p,v,m,b,S;if(this.state.fetchStatus!=="idle"&&((d=E(this,tt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,tt))return E(this,tt).continueRetry(),E(this,tt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(O=>O.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(X(this,rn,!0),n.signal)})},i=()=>{const w=El(this.options,r),I=(()=>{const k={client:E(this,tn),queryKey:this.queryKey,meta:this.meta};return s(k),k})();return X(this,rn,!1),this.options.persister?this.options.persister(w,I,this):w(I)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,tn),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,Ln)==="infinite"?hp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),X(this,Fn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&ve(this,Lt,yr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),X(this,tt,Tl({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof go&&w.revert&&this.setState({...E(this,Fn),fetchStatus:"idle"}),n.abort()},onFail:(w,O)=>{ve(this,Lt,yr).call(this,{type:"failed",failureCount:w,error:O})},onPause:()=>{ve(this,Lt,yr).call(this,{type:"pause"})},onContinue:()=>{ve(this,Lt,yr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,tt).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(g=(y=E(this,zt).config).onSuccess)==null||g.call(y,w,this),(p=(_=E(this,zt).config).onSettled)==null||p.call(_,w,this.state.error,this),w}catch(w){if(w instanceof go){if(w.silent)return E(this,tt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw ve(this,Lt,yr).call(this,{type:"error",error:w}),(m=(v=E(this,zt).config).onError)==null||m.call(v,w,this),(S=(b=E(this,zt).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Ln=new WeakMap,en=new WeakMap,Fn=new WeakMap,zt=new WeakMap,tn=new WeakMap,tt=new WeakMap,As=new WeakMap,rn=new WeakMap,Lt=new WeakSet,Qh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},yr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...kl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Al(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return X(this,Fn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),st.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,zt).notify({query:this,type:"updated",action:t})})},Uh);function kl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Il(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Al(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Pl(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var yp=(Vh=class extends Kn{constructor(t,r){super();ne(this,De);ne(this,Tt);ne(this,_e);ne(this,Ps);ne(this,wt);ne(this,nn);ne(this,$n);ne(this,fr);ne(this,Nr);ne(this,Ms);ne(this,jn);ne(this,Bn);ne(this,sn);ne(this,on);ne(this,xr);ne(this,Un,new Set);this.options=r,X(this,Tt,t),X(this,Nr,null),X(this,fr,po()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,_e).addObserver(this),Ml(E(this,_e),this.options)?ve(this,De,Vs).call(this):this.updateResult(),ve(this,De,yl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return yo(E(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return yo(E(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ve(this,De,vl).call(this),ve(this,De,ml).call(this),E(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,_e);if(this.options=E(this,Tt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kt(this.options.enabled,E(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ve(this,De,bl).call(this),E(this,_e).setOptions(this.options),r._defaulted&&!uo(this.options,r)&&E(this,Tt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,_e),observer:this});const s=this.hasListeners();s&&Ll(E(this,_e),n,this.options,r)&&ve(this,De,Vs).call(this),this.updateResult(),s&&(E(this,_e)!==n||kt(this.options.enabled,E(this,_e))!==kt(r.enabled,E(this,_e))||vr(this.options.staleTime,E(this,_e))!==vr(r.staleTime,E(this,_e)))&&ve(this,De,hl).call(this);const i=ve(this,De,pl).call(this);s&&(E(this,_e)!==n||kt(this.options.enabled,E(this,_e))!==kt(r.enabled,E(this,_e))||i!==E(this,xr))&&ve(this,De,gl).call(this,i)}getOptimisticResult(t){const r=E(this,Tt).getQueryCache().build(E(this,Tt),t),n=this.createResult(r,t);return mp(this,n)&&(X(this,wt,n),X(this,$n,this.options),X(this,nn,E(this,_e).state)),n}getCurrentResult(){return E(this,wt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,fr).status==="pending"&&E(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,Un).add(t)}getCurrentQuery(){return E(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Tt).defaultQueryOptions(t),n=E(this,Tt).getQueryCache().build(E(this,Tt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return ve(this,De,Vs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,wt)))}createResult(t,r){var B;const n=E(this,_e),s=this.options,i=E(this,wt),o=E(this,nn),a=E(this,$n),d=t!==n?t.state:E(this,Ps),{state:u}=t;let f={...u},y=!1,g;if(r._optimisticResults){const N=this.hasListeners(),M=!N&&Ml(t,r),V=N&&Ll(t,n,r,s);(M||V)&&(f={...f,...kl(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:p,status:v}=f;g=f.data;let m=!1;if(r.placeholderData!==void 0&&g===void 0&&v==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,m=!0):N=typeof r.placeholderData=="function"?r.placeholderData((B=E(this,Bn))==null?void 0:B.state.data,E(this,Bn)):r.placeholderData,N!==void 0&&(v="success",g=ho(i==null?void 0:i.data,N,r),y=!0)}if(r.select&&g!==void 0&&!m)if(i&&g===(o==null?void 0:o.data)&&r.select===E(this,Ms))g=E(this,jn);else try{X(this,Ms,r.select),g=r.select(g),g=ho(i==null?void 0:i.data,g,r),X(this,jn,g),X(this,Nr,null)}catch(N){X(this,Nr,N)}E(this,Nr)&&(_=E(this,Nr),g=E(this,jn),p=Date.now(),v="error");const b=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",O=S&&b,I=g!==void 0,P={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:O,isLoading:O,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:w&&!I,isPaused:f.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:w&&I,isStale:vo(t,r),refetch:this.refetch,promise:E(this,fr),isEnabled:kt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=P.data!==void 0,M=P.status==="error"&&!N,V=j=>{M?j.reject(P.error):N&&j.resolve(P.data)},A=()=>{const j=X(this,fr,P.promise=po());V(j)},U=E(this,fr);switch(U.status){case"pending":t.queryHash===n.queryHash&&V(U);break;case"fulfilled":(M||P.data!==U.value)&&A();break;case"rejected":(!M||P.error!==U.reason)&&A();break}}return P}updateResult(){const t=E(this,wt),r=this.createResult(E(this,_e),this.options);if(X(this,nn,E(this,_e).state),X(this,$n,this.options),E(this,nn).data!==void 0&&X(this,Bn,E(this,_e)),uo(r,t))return;X(this,wt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,Un).size)return!0;const o=new Set(i??E(this,Un));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,wt)).some(a=>{const c=a;return E(this,wt)[c]!==t[c]&&o.has(c)})};ve(this,De,Yh).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ve(this,De,yl).call(this)}},Tt=new WeakMap,_e=new WeakMap,Ps=new WeakMap,wt=new WeakMap,nn=new WeakMap,$n=new WeakMap,fr=new WeakMap,Nr=new WeakMap,Ms=new WeakMap,jn=new WeakMap,Bn=new WeakMap,sn=new WeakMap,on=new WeakMap,xr=new WeakMap,Un=new WeakMap,De=new WeakSet,Vs=function(t){ve(this,De,bl).call(this);let r=E(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ot)),r},hl=function(){ve(this,De,vl).call(this);const t=vr(this.options.staleTime,E(this,_e));if(Yn.isServer()||E(this,wt).isStale||!ao(t))return;const n=_l(E(this,wt).dataUpdatedAt,t)+1;X(this,sn,$r.setTimeout(()=>{E(this,wt).isStale||this.updateResult()},n))},pl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,_e)):this.options.refetchInterval)??!1},gl=function(t){ve(this,De,ml).call(this),X(this,xr,t),!(Yn.isServer()||kt(this.options.enabled,E(this,_e))===!1||!ao(E(this,xr))||E(this,xr)===0)&&X(this,on,$r.setInterval(()=>{(this.options.refetchIntervalInBackground||oo.isFocused())&&ve(this,De,Vs).call(this)},E(this,xr)))},yl=function(){ve(this,De,hl).call(this),ve(this,De,gl).call(this,ve(this,De,pl).call(this))},vl=function(){E(this,sn)!==void 0&&($r.clearTimeout(E(this,sn)),X(this,sn,void 0))},ml=function(){E(this,on)!==void 0&&($r.clearInterval(E(this,on)),X(this,on,void 0))},bl=function(){const t=E(this,Tt).getQueryCache().build(E(this,Tt),this.options);if(t===E(this,_e))return;const r=E(this,_e);X(this,_e,t),X(this,Ps,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Yh=function(t){st.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,wt))}),E(this,Tt).getQueryCache().notify({query:E(this,_e),type:"observerResultsUpdated"})})},Vh);function vp(e,t){return kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&kt(t.retryOnMount,e)===!1)}function Ml(e,t){return vp(e,t)||e.state.data!==void 0&&yo(e,t,t.refetchOnMount)}function yo(e,t,r){if(kt(t.enabled,e)!==!1&&vr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&vo(e,t)}return!1}function Ll(e,t,r,n){return(e!==t||kt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&vo(e,r)}function vo(e,t){return kt(t.enabled,e)!==!1&&e.isStaleByTime(vr(t.staleTime,e))}function mp(e,t){return!uo(e.getCurrentResult(),t)}var bp=(zh=class extends Nl{constructor(t){super();ne(this,or);ne(this,Ls);ne(this,ir);ne(this,yt);ne(this,an);X(this,Ls,t.client),this.mutationId=t.mutationId,X(this,yt,t.mutationCache),X(this,ir,[]),this.state=t.state||_p(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,ir).includes(t)||(E(this,ir).push(t),this.clearGcTimeout(),E(this,yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){X(this,ir,E(this,ir).filter(r=>r!==t)),this.scheduleGc(),E(this,yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,ir).length||(this.state.status==="pending"?this.scheduleGc():E(this,yt).remove(this))}continue(){var t;return((t=E(this,an))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,y,g,_,p,v,m,b,S,w,O,I,k;const r=()=>{ve(this,or,Fr).call(this,{type:"continue"})},n={client:E(this,Ls),meta:this.options.meta,mutationKey:this.options.mutationKey};X(this,an,Tl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,B)=>{ve(this,or,Fr).call(this,{type:"failed",failureCount:P,error:B})},onPause:()=>{ve(this,or,Fr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,yt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,an).canStart();try{if(s)r();else{ve(this,or,Fr).call(this,{type:"pending",variables:t,isPaused:i}),E(this,yt).config.onMutate&&await E(this,yt).config.onMutate(t,this,n);const B=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));B!==this.state.context&&ve(this,or,Fr).call(this,{type:"pending",context:B,variables:t,isPaused:i})}const P=await E(this,an).start();return await((d=(c=E(this,yt).config).onSuccess)==null?void 0:d.call(c,P,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,P,t,this.state.context,n)),await((g=(y=E(this,yt).config).onSettled)==null?void 0:g.call(y,P,null,this.state.variables,this.state.context,this,n)),await((p=(_=this.options).onSettled)==null?void 0:p.call(_,P,null,t,this.state.context,n)),ve(this,or,Fr).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(v=E(this,yt).config).onError)==null?void 0:m.call(v,P,t,this.state.context,this,n))}catch(B){Promise.reject(B)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,P,t,this.state.context,n))}catch(B){Promise.reject(B)}try{await((O=(w=E(this,yt).config).onSettled)==null?void 0:O.call(w,void 0,P,this.state.variables,this.state.context,this,n))}catch(B){Promise.reject(B)}try{await((k=(I=this.options).onSettled)==null?void 0:k.call(I,void 0,P,t,this.state.context,n))}catch(B){Promise.reject(B)}throw ve(this,or,Fr).call(this,{type:"error",error:P}),P}finally{E(this,yt).runNext(this)}}},Ls=new WeakMap,ir=new WeakMap,yt=new WeakMap,an=new WeakMap,or=new WeakSet,Fr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),st.batch(()=>{E(this,ir).forEach(n=>{n.onMutationUpdate(t)}),E(this,yt).notify({mutation:this,type:"updated",action:t})})},zh);function _p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wp=(qh=class extends Kn{constructor(t={}){super();ne(this,hr);ne(this,Xt);ne(this,Fs);this.config=t,X(this,hr,new Set),X(this,Xt,new Map),X(this,Fs,0)}build(t,r,n){const s=new bp({client:t,mutationCache:this,mutationId:++so(this,Fs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,hr).add(t);const r=Hs(t);if(typeof r=="string"){const n=E(this,Xt).get(r);n?n.push(t):E(this,Xt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hr).delete(t)){const r=Hs(t);if(typeof r=="string"){const n=E(this,Xt).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&E(this,Xt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Hs(t);if(typeof r=="string"){const n=E(this,Xt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Hs(t);if(typeof r=="string"){const s=(n=E(this,Xt).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){st.batch(()=>{E(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hr).clear(),E(this,Xt).clear()})}getAll(){return Array.from(E(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Sl(r,n))}findAll(t={}){return this.getAll().filter(r=>Sl(t,r))}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return st.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ot))))}},hr=new WeakMap,Xt=new WeakMap,Fs=new WeakMap,qh);function Hs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Sp=(Hh=class extends Kn{constructor(t={}){super();ne(this,ar);this.config=t,X(this,ar,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??lo(s,r);let o=this.get(i);return o||(o=new gp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ar).has(t.queryHash)||(E(this,ar).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ar).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ar).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){st.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ar).get(t)}getAll(){return[...E(this,ar).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>wl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>wl(t,n)):r}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){st.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){st.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ar=new WeakMap,Hh),Cp=(Wh=class{constructor(e={}){ne(this,He);ne(this,kr);ne(this,Ar);ne(this,Vn);ne(this,zn);ne(this,Pr);ne(this,qn);ne(this,Hn);X(this,He,e.queryCache||new Sp),X(this,kr,e.mutationCache||new wp),X(this,Ar,e.defaultOptions||{}),X(this,Vn,new Map),X(this,zn,new Map),X(this,Pr,0)}mount(){so(this,Pr)._++,E(this,Pr)===1&&(X(this,qn,oo.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onFocus())})),X(this,Hn,qs.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onOnline())})))}unmount(){var e,t;so(this,Pr)._--,E(this,Pr)===0&&((e=E(this,qn))==null||e.call(this),X(this,qn,void 0),(t=E(this,Hn))==null||t.call(this),X(this,Hn,void 0))}isFetching(e){return E(this,He).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,kr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,He).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,He).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(vr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,He).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=E(this,He).get(n.queryHash),i=s==null?void 0:s.state.data,o=np(t,i);if(o!==void 0)return E(this,He).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return st.batch(()=>E(this,He).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,He).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,He);st.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,He);return st.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=st.batch(()=>E(this,He).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ot).catch(Ot)}invalidateQueries(e,t={}){return st.batch(()=>(E(this,He).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=st.batch(()=>E(this,He).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ot)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ot)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,He).build(this,t);return r.isStaleByTime(vr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ot).catch(Ot)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ot).catch(Ot)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return qs.isOnline()?E(this,kr).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,He)}getMutationCache(){return E(this,kr)}getDefaultOptions(){return E(this,Ar)}setDefaultOptions(e){X(this,Ar,e)}setQueryDefaults(e,t){E(this,Vn).set(Gn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Vn).values()],r={};return t.forEach(n=>{Qn(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,zn).set(Gn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,zn).values()],r={};return t.forEach(n=>{Qn(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Ar).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=lo(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===zs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Ar).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,He).clear(),E(this,kr).clear()}},He=new WeakMap,kr=new WeakMap,Ar=new WeakMap,Vn=new WeakMap,zn=new WeakMap,Pr=new WeakMap,qn=new WeakMap,Hn=new WeakMap,Wh),Fl=Oe.createContext(void 0),Op=e=>{const t=Oe.useContext(Fl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ep=({client:e,children:t})=>(Oe.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Fl.Provider,{value:e,children:t})),$l=Oe.createContext(!1),Dp=()=>Oe.useContext($l);$l.Provider;function Ip(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Tp=Oe.createContext(Ip()),Np=()=>Oe.useContext(Tp),xp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Dl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},kp=e=>{Oe.useEffect(()=>{e.clearReset()},[e])},Ap=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Dl(r,[e.error,n])),Pp=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Mp=(e,t)=>e.isLoading&&e.isFetching&&!t,Lp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,jl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Fp(e,t,r){var g,_,p,v;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Dp(),s=Np(),i=Op(),o=i.defaultQueryOptions(e);(_=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||_.call(g,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Pp(o),xp(o,s,a),kp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Oe.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),y=!n&&c;if(Oe.useSyncExternalStore(Oe.useCallback(m=>{const b=y?u.subscribe(st.batchCalls(m)):Ot;return u.updateResult(),b},[u,y]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Oe.useEffect(()=>{u.setOptions(o)},[o,u]),Lp(o,f))throw jl(o,u,s);if(Ap({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((v=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||v.call(p,o,f),o.experimental_prefetchInRender&&!Yn.isServer()&&Mp(f,n)){const m=d?jl(o,u,s):a==null?void 0:a.promise;m==null||m.catch(Ot).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function mo(e,t){return Fp(e,yp)}let $p={data:""},jp=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||$p},Bp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Up=/\/\*[^]*?\*\/| +/g,Bl=/\n+/g,mr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?mr(o,i):i+"{"+mr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=mr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=mr.p?mr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},br={},Ul=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Ul(e[r]);return t}return e},Vp=(e,t,r,n,s)=>{let i=Ul(e),o=br[i]||(br[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!br[o]){let c=i!==e?e:(d=>{let u,f,y=[{}];for(;u=Bp.exec(d.replace(Up,""));)u[4]?y.shift():u[3]?(f=u[3].replace(Bl," ").trim(),y.unshift(y[0][f]=y[0][f]||{})):y[0][u[1]]=u[2].replace(Bl," ").trim();return y[0]})(e);br[o]=mr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&br.g;return r&&(br.g=br[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(br[o],t,n,a),o},zp=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":mr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Ws(e){let t=this||{},r=e.call?e(t.p):e;return Vp(r.unshift?r.raw?zp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,jp(t.target),t.g,t.o,t.k)}let Vl,bo,_o;Ws.bind({g:1});let ur=Ws.bind({k:1});function qp(e,t,r,n){mr.p=t,Vl=e,bo=r,_o=n}function _r(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:bo&&bo()},a),r.o=/go\d/.test(c),a.className=Ws.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),_o&&d[0]&&_o(a),Vl(d,a)}return s}}var Hp=e=>typeof e=="function",Ks=(e,t)=>Hp(e)?e(t):e,Wp=(()=>{let e=0;return()=>(++e).toString()})(),zl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Kp=20,wo="default",ql=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return ql(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},Gs=[],Hl={toasts:[],pausedAt:void 0,settings:{toastLimit:Kp}},Jt={},Wl=(e,t=wo)=>{Jt[t]=ql(Jt[t]||Hl,e),Gs.forEach(([r,n])=>{r===t&&n(Jt[t])})},Kl=e=>Object.keys(Jt).forEach(t=>Wl(e,t)),Gp=e=>Object.keys(Jt).find(t=>Jt[t].toasts.some(r=>r.id===e)),Qs=(e=wo)=>t=>{Wl(t,e)},Qp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Yp=(e={},t=wo)=>{let[r,n]=h.useState(Jt[t]||Hl),s=h.useRef(Jt[t]);h.useEffect(()=>(s.current!==Jt[t]&&n(Jt[t]),Gs.push([t,n]),()=>{let o=Gs.findIndex(([a])=>a===t);o>-1&&Gs.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||Qp[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},Rp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||Wp()}),Rn=e=>(t,r)=>{let n=Rp(t,e,r);return Qs(n.toasterId||Gp(n.id))({type:2,toast:n}),n.id},Re=(e,t)=>Rn("blank")(e,t);Re.error=Rn("error"),Re.success=Rn("success"),Re.loading=Rn("loading"),Re.custom=Rn("custom"),Re.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Qs(t)(r):Kl(r)},Re.dismissAll=e=>Re.dismiss(void 0,e),Re.remove=(e,t)=>{let r={type:4,toastId:e};t?Qs(t)(r):Kl(r)},Re.removeAll=e=>Re.remove(void 0,e),Re.promise=(e,t,r)=>{let n=Re.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ks(t.success,s):void 0;return i?Re.success(i,{id:n,...r,...r==null?void 0:r.success}):Re.dismiss(n),s}).catch(s=>{let i=t.error?Ks(t.error,s):void 0;i?Re.error(i,{id:n,...r,...r==null?void 0:r.error}):Re.dismiss(n)}),e};var Xp=1e3,Zp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Yp(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,y=Xp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},y);s.set(f,g)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),y=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Re.dismiss(g.id);return}return setTimeout(()=>Re.dismiss(g.id,t),_)});return()=>{y.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=h.useCallback(Qs(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,y)=>{o({type:1,toast:{id:f,height:y}})},[o]),d=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=h.useCallback((f,y)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:p}=y||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),b=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...g?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return h.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let y=s.get(f.id);y&&(clearTimeout(y),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},Jp=ur`
2
2
  from {
3
3
  transform: scale(0) rotate(45deg);
4
4
  opacity: 0;
@@ -169,21 +169,21 @@ to {
169
169
  color: inherit;
170
170
  flex: 1 1 auto;
171
171
  white-space: pre-line;
172
- `,bg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Vl()?[gg,yg]:[hg(r),pg(r)];return{animation:t?`${ur(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ur(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},_g=Oe.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?bg(e.position||t||"top-center",e.visible):{opacity:0},i=Oe.createElement(fg,{toast:e}),o=Oe.createElement(mg,{...e.ariaProps},Ks(e.message,e));return Oe.createElement(vg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Oe.createElement(Oe.Fragment,null,i,o))});qp(Oe.createElement);var wg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Oe.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Oe.createElement("div",{ref:i,className:t,style:r},s)},Sg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Vl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Cg=Ws`
172
+ `,bg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=zl()?[gg,yg]:[hg(r),pg(r)];return{animation:t?`${ur(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ur(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},_g=Oe.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?bg(e.position||t||"top-center",e.visible):{opacity:0},i=Oe.createElement(fg,{toast:e}),o=Oe.createElement(mg,{...e.ariaProps},Ks(e.message,e));return Oe.createElement(vg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Oe.createElement(Oe.Fragment,null,i,o))});qp(Oe.createElement);var wg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Oe.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Oe.createElement("div",{ref:i,className:t,style:r},s)},Sg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:zl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Cg=Ws`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,Ys=16,Og=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=Zp(r,i);return Oe.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ys,left:Ys,right:Ys,bottom:Ys,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,y=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),g=Sg(f,y);return Oe.createElement(wg,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Cg:"",style:g},u.type==="custom"?Ks(u.message,u):s?s(u):Oe.createElement(_g,{toast:u,position:f}))}))},Ee=Re;function Eg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Rs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wo(e){return"nodeType"in e}function _t(e){var t,r;return e?cn(e)?e:wo(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function So(e){const{Document:t}=_t(e);return e instanceof t}function Zn(e){return cn(e)?!1:e instanceof _t(e).HTMLElement}function Kl(e){return e instanceof _t(e).SVGElement}function un(e){return e?cn(e)?e.document:wo(e)?So(e)?e:Zn(e)||Kl(e)?e.ownerDocument:document:document:document}const Ht=Rs?h.useLayoutEffect:h.useEffect;function Xs(e){const t=h.useRef(e);return Ht(()=>{t.current=e}),h.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Dg(){const e=h.useRef(null),t=h.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Jn(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Ht(()=>{r.current!==e&&(r.current=e)},t),r}function es(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Zs(e){const t=Xs(e),r=h.useRef(null),n=h.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Js(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let Co={};function ts(e,t){return h.useMemo(()=>{if(t)return t;const r=Co[e]==null?0:Co[e]+1;return Co[e]=r,e+"-"+r},[e,t])}function Gl(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const dn=Gl(1),rs=Gl(-1);function Ig(e){return"clientX"in e&&"clientY"in e}function ei(e){if(!e)return!1;const{KeyboardEvent:t}=_t(e.target);return t&&e instanceof t}function Tg(e){if(!e)return!1;const{TouchEvent:t}=_t(e.target);return t&&e instanceof t}function ti(e){if(Tg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ig(e)?{x:e.clientX,y:e.clientY}:null}const wr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[wr.Translate.toString(e),wr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Ql="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ng(e){return e.matches(Ql)?e:e.querySelector(Ql)}const xg={display:"none"};function kg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:xg},r)}function Ag(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Pg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Yl=h.createContext(null);function Mg(e){const t=h.useContext(Yl);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lg(){const[e]=h.useState(()=>new Set),t=h.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[h.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Fg={draggable:`
177
+ `,Ys=16,Og=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=Zp(r,i);return Oe.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ys,left:Ys,right:Ys,bottom:Ys,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,y=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),g=Sg(f,y);return Oe.createElement(wg,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Cg:"",style:g},u.type==="custom"?Ks(u.message,u):s?s(u):Oe.createElement(_g,{toast:u,position:f}))}))},Ee=Re;function Eg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Rs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function So(e){return"nodeType"in e}function _t(e){var t,r;return e?cn(e)?e:So(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Co(e){const{Document:t}=_t(e);return e instanceof t}function Xn(e){return cn(e)?!1:e instanceof _t(e).HTMLElement}function Gl(e){return e instanceof _t(e).SVGElement}function un(e){return e?cn(e)?e.document:So(e)?Co(e)?e:Xn(e)||Gl(e)?e.ownerDocument:document:document:document}const Ht=Rs?h.useLayoutEffect:h.useEffect;function Xs(e){const t=h.useRef(e);return Ht(()=>{t.current=e}),h.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Dg(){const e=h.useRef(null),t=h.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Zn(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Ht(()=>{r.current!==e&&(r.current=e)},t),r}function Jn(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Zs(e){const t=Xs(e),r=h.useRef(null),n=h.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Js(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let Oo={};function es(e,t){return h.useMemo(()=>{if(t)return t;const r=Oo[e]==null?0:Oo[e]+1;return Oo[e]=r,e+"-"+r},[e,t])}function Ql(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const dn=Ql(1),ts=Ql(-1);function Ig(e){return"clientX"in e&&"clientY"in e}function ei(e){if(!e)return!1;const{KeyboardEvent:t}=_t(e.target);return t&&e instanceof t}function Tg(e){if(!e)return!1;const{TouchEvent:t}=_t(e.target);return t&&e instanceof t}function ti(e){if(Tg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ig(e)?{x:e.clientX,y:e.clientY}:null}const wr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[wr.Translate.toString(e),wr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Yl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ng(e){return e.matches(Yl)?e:e.querySelector(Yl)}const xg={display:"none"};function kg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:xg},r)}function Ag(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Pg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Rl=h.createContext(null);function Mg(e){const t=h.useContext(Rl);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lg(){const[e]=h.useState(()=>new Set),t=h.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[h.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Fg={draggable:`
178
178
  To pick up a draggable item, press the space bar.
179
179
  While dragging, use the arrow keys to move the item.
180
180
  Press space again to drop the item in its new position, or press escape to cancel.
181
- `},$g={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function jg(e){let{announcements:t=$g,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Fg}=e;const{announce:i,announcement:o}=Pg(),a=ts("DndLiveRegion"),[c,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),Mg(h.useMemo(()=>({onDragStart(f){let{active:y}=f;i(t.onDragStart({active:y}))},onDragMove(f){let{active:y,over:g}=f;t.onDragMove&&i(t.onDragMove({active:y,over:g}))},onDragOver(f){let{active:y,over:g}=f;i(t.onDragOver({active:y,over:g}))},onDragEnd(f){let{active:y,over:g}=f;i(t.onDragEnd({active:y,over:g}))},onDragCancel(f){let{active:y,over:g}=f;i(t.onDragCancel({active:y,over:g}))}}),[i,t])),!c)return null;const u=h.createElement(h.Fragment,null,h.createElement(kg,{id:n,value:s.draggable}),h.createElement(Ag,{id:a,announcement:o}));return r?Be.createPortal(u,r):u}var Xe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Xe||(Xe={}));function ri(){}function Oo(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Rl(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Wt=Object.freeze({x:0,y:0});function Xl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bg(e,t){const r=ti(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Zl(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Ug(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Jl(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function ec(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function tc(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Vg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=tc(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Xl(tc(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(Zl)},zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Jl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Jl(c),u=s.reduce((y,g,_)=>y+Xl(d[_],g),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Zl)};function qg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const Hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=qg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Ug)};function Wg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function rc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Wt}function Kg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Gg=Kg(1);function nc(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Qg(e,t,r){const n=nc(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Yg={ignoreTransform:!1};function fn(e,t){t===void 0&&(t=Yg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=_t(e).getComputedStyle(e);d&&(r=Qg(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function sc(e){return fn(e,{ignoreTransform:!0})}function Rg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Xg(e,t){return t===void 0&&(t=_t(e).getComputedStyle(e)),t.position==="fixed"}function Zg(e,t){t===void 0&&(t=_t(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function ni(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(So(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Zn(s)||Kl(s)||r.includes(s))return r;const i=_t(e).getComputedStyle(s);return s!==e&&Zg(s,i)&&r.push(s),Xg(s,i)?r:n(s.parentNode)}return e?n(e):r}function ic(e){const[t]=ni(e,1);return t??null}function Eo(e){return!Rs||!e?null:cn(e)?e:wo(e)?So(e)||e===un(e).scrollingElement?window:Zn(e)?e:null:null}function oc(e){return cn(e)?e.scrollX:e.scrollLeft}function ac(e){return cn(e)?e.scrollY:e.scrollTop}function Do(e){return{x:oc(e),y:ac(e)}}var Ze;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ze||(Ze={}));function lc(e){return!Rs||!e?!1:e===document.scrollingElement}function cc(e){const t={x:0,y:0},r=lc(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const Jg={x:.2,y:.2};function ey(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Jg);const{isTop:d,isBottom:u,isLeft:f,isRight:y}=cc(e),g={x:0,y:0},_={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+p.height?(g.y=Ze.Backward,_.y=n*Math.abs((t.top+p.height-i)/p.height)):!u&&c>=t.bottom-p.height&&(g.y=Ze.Forward,_.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!y&&a>=t.right-p.width?(g.x=Ze.Forward,_.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(g.x=Ze.Backward,_.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:g,speed:_}}function ty(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function uc(e){return e.reduce((t,r)=>dn(t,Do(r)),Wt)}function ry(e){return e.reduce((t,r)=>t+oc(r),0)}function ny(e){return e.reduce((t,r)=>t+ac(r),0)}function dc(e,t){if(t===void 0&&(t=fn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);ic(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sy=[["x",["left","right"],ry],["y",["top","bottom"],ny]];class Io{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ni(r),s=uc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of sy)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ns{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function iy(e){const{EventTarget:t}=_t(e);return e instanceof t?e:un(e)}function To(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var $t;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($t||($t={}));function fc(e){e.preventDefault()}function oy(e){e.stopPropagation()}var me;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(me||(me={}));const hc={start:[me.Space,me.Enter],cancel:[me.Esc],end:[me.Space,me.Enter,me.Tab]},ay=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case me.Right:return{...r,x:r.x+25};case me.Left:return{...r,x:r.x-25};case me.Down:return{...r,y:r.y+25};case me.Up:return{...r,y:r.y-25}}};class No{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ns(un(r)),this.windowListeners=new ns(_t(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($t.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&dc(n),r(Wt)}handleKeyDown(t){if(ei(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=hc,coordinateGetter:o=ay,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Wt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const y=rs(f,u),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const p of _){const v=t.code,{isTop:m,isRight:b,isLeft:S,isBottom:w,maxScroll:O,minScroll:I}=cc(p),k=ty(p),P={x:Math.min(v===me.Right?k.right-k.width/2:k.right,Math.max(v===me.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===me.Down?k.bottom-k.height/2:k.bottom,Math.max(v===me.Down?k.top:k.top+k.height/2,f.y))},B=v===me.Right&&!b||v===me.Left&&!S,N=v===me.Down&&!w||v===me.Up&&!m;if(B&&P.x!==f.x){const M=p.scrollLeft+y.x,V=v===me.Right&&M<=O.x||v===me.Left&&M>=I.x;if(V&&!y.y){p.scrollTo({left:M,behavior:a});return}V?g.x=p.scrollLeft-M:g.x=v===me.Right?p.scrollLeft-O.x:p.scrollLeft-I.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(N&&P.y!==f.y){const M=p.scrollTop+y.y,V=v===me.Down&&M<=O.y||v===me.Up&&M>=I.y;if(V&&!y.x){p.scrollTo({top:M,behavior:a});return}V?g.y=p.scrollTop-M:g.y=v===me.Down?p.scrollTop-O.y:p.scrollTop-I.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,dn(rs(f,this.referenceCoordinates),g))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}No.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=hc,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function pc(e){return!!(e&&"distance"in e)}function gc(e){return!!(e&&"delay"in e)}class xo{constructor(t,r,n){var s;n===void 0&&(n=iy(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=un(o),this.documentListeners=new ns(this.document),this.listeners=new ns(n),this.windowListeners=new ns(_t(o)),this.initialCoordinates=(s=ti(i))!=null?s:Wt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.DragStart,fc),this.windowListeners.add($t.VisibilityChange,this.handleCancel),this.windowListeners.add($t.ContextMenu,fc),this.documentListeners.add($t.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(pc(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add($t.Click,oy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($t.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=ti(t))!=null?r:Wt,d=rs(s,c);if(!n&&a){if(pc(a)){if(a.tolerance!=null&&To(d,a.tolerance))return this.handleCancel();if(To(d,a.distance))return this.handleStart()}if(gc(a)&&To(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===me.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ly={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class si extends xo{constructor(t){const{event:r}=t,n=un(r.target);super(t,ly,n)}}si.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const cy={move:{name:"mousemove"},end:{name:"mouseup"}};var ko;(function(e){e[e.RightClick=2]="RightClick"})(ko||(ko={}));class uy extends xo{constructor(t){super(t,cy,un(t.event.target))}}uy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===ko.RightClick?!1:(n==null||n({event:r}),!0)}}];const Ao={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dy extends xo{constructor(t){super(t,Ao)}static setup(){return window.addEventListener(Ao.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ao.move.name,t)};function t(){}}}dy.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var ss;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ss||(ss={}));var ii;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ii||(ii={}));function fy(e){let{acceleration:t,activator:r=ss.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ii.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:y}=e;const g=py({delta:f,disabled:!i}),[_,p]=Dg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),b=h.useMemo(()=>{switch(r){case ss.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ss.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const I=S.current;if(!I)return;const k=v.current.x*m.current.x,P=v.current.y*m.current.y;I.scrollBy(k,P)},[]),O=h.useMemo(()=>a===ii.TreeOrder?[...d].reverse():d,[a,d]);h.useEffect(()=>{if(!i||!d.length||!b){p();return}for(const I of O){if((n==null?void 0:n(I))===!1)continue;const k=d.indexOf(I),P=u[k];if(!P)continue;const{direction:B,speed:N}=ey(I,P,b,t,y);for(const M of["x","y"])g[M][B[M]]||(N[M]=0,B[M]=0);if(N.x>0||N.y>0){p(),S.current=I,_(w,o),v.current=N,m.current=B;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(b),JSON.stringify(g),_,d,O,u,JSON.stringify(y)])}const hy={x:{[Ze.Backward]:!1,[Ze.Forward]:!1},y:{[Ze.Backward]:!1,[Ze.Forward]:!1}};function py(e){let{delta:t,disabled:r}=e;const n=Js(t);return es(s=>{if(r||!n||!s)return hy;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ze.Backward]:s.x[Ze.Backward]||i.x===-1,[Ze.Forward]:s.x[Ze.Forward]||i.x===1},y:{[Ze.Backward]:s.y[Ze.Backward]||i.y===-1,[Ze.Forward]:s.y[Ze.Forward]||i.y===1}}},[r,t,n])}function gy(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return es(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function yy(e,t){return h.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var is;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(is||(is={}));var Po;(function(e){e.Optimized="optimized"})(Po||(Po={}));const yc=new Map;function vy(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:d}=s,u=h.useRef(e),f=v(),y=Jn(f),g=h.useCallback(function(m){m===void 0&&(m=[]),!y.current&&o(b=>b===null?m:b.concat(m.filter(S=>!b.includes(S))))},[y]),_=h.useRef(null),p=es(m=>{if(f&&!r)return yc;if(!m||m===yc||u.current!==e||i!=null){const b=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){b.set(S.id,S.rect.current);continue}const w=S.node.current,O=w?new Io(c(w),w):null;S.rect.current=O,O&&b.set(S.id,O)}return b}return m},[e,i,r,f,c]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{f||g()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:i!=null};function v(){switch(d){case is.Always:return!1;case is.BeforeDragging:return r;default:return!r}}}function Mo(e,t){return es(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function my(e,t){return Mo(e,t)}function by(e){let{callback:t,disabled:r}=e;const n=Xs(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function oi(e){let{callback:t,disabled:r}=e;const n=Xs(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function _y(e){return new Io(fn(e),e)}function vc(e,t,r){t===void 0&&(t=_y);const[n,s]=h.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=by({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=oi({callback:i});return Ht(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function wy(e){const t=Mo(e);return rc(e,t)}const mc=[];function Sy(e){const t=h.useRef(e),r=es(n=>e?n&&n!==mc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ni(e):mc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Cy(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=Eo(i.target);o&&r(a=>a?(a.set(o,Do(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=Eo(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Do(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=Eo(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>dn(i,o),Wt):uc(e):Wt,[e,t])}function bc(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Wt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?rs(e,r.current):Wt}function Oy(e){h.useEffect(()=>{if(!Rs)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Ey(e,t){return h.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function _c(e){return h.useMemo(()=>e?Rg(e):null,[e])}const wc=[];function Dy(e,t){t===void 0&&(t=fn);const[r]=e,n=_c(r?_t(r):null),[s,i]=h.useState(wc);function o(){i(()=>e.length?e.map(c=>lc(c)?n:new Io(t(c),c)):wc)}const a=oi({callback:o});return Ht(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Sc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zn(t)?t:e}function Iy(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(d=>{for(const{target:u}of d)if(Zn(u)){n(f=>{const y=t(u);return f?{...f,width:y.width,height:y.height}:y});break}},[t]),i=oi({callback:s}),o=h.useCallback(d=>{const u=Sc(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=Zs(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Ty=[{sensor:si,options:{}},{sensor:No,options:{}}],Ny={current:{}},ai={draggable:{measure:sc},droppable:{measure:sc,strategy:is.WhileDragging,frequency:Po.Optimized},dragOverlay:{measure:fn}};class os extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const xy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new os,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ri},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ai,measureDroppableContainers:ri,windowRect:null,measuringScheduled:!1},Cc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ri,draggableNodes:new Map,over:null,measureDroppableContainers:ri},as=h.createContext(Cc),Oc=h.createContext(xy);function ky(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new os}}}function Ay(e,t){switch(t.type){case Xe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Xe.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Xe.DragEnd:case Xe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Xe.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new os(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Xe.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new os(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Xe.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new os(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Py(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(as),i=Js(n),o=Js(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ei(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Ng(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Ec(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function My(e){return h.useMemo(()=>({draggable:{...ai.draggable,...e==null?void 0:e.draggable},droppable:{...ai.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ai.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Ly(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=h.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Ht(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=rc(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const y=ic(d);y&&y.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const li=h.createContext({...Wt,scaleX:1,scaleY:1});var Sr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Sr||(Sr={}));const Dc=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Ty,collisionDetection:f=Hg,measuring:y,modifiers:g,..._}=t;const p=h.useReducer(Ay,void 0,ky),[v,m]=p,[b,S]=Lg(),[w,O]=h.useState(Sr.Uninitialized),I=w===Sr.Initialized,{draggable:{active:k,nodes:P,translate:B},droppable:{containers:N}}=v,M=k!=null?P.get(k):null,V=h.useRef({initial:null,translated:null}),A=h.useMemo(()=>{var nt;return k!=null?{id:k,data:(nt=M==null?void 0:M.data)!=null?nt:Ny,rect:V}:null},[k,M]),U=h.useRef(null),[j,J]=h.useState(null),[se,ge]=h.useState(null),_e=Jn(_,Object.values(_)),we=ts("DndDescribedBy",o),G=h.useMemo(()=>N.getEnabled(),[N]),L=My(y),{droppableRects:X,measureDroppableContainers:F,measuringScheduled:Y}=vy(G,{dragging:I,dependencies:[B.x,B.y],config:L.droppable}),K=gy(P,k),oe=h.useMemo(()=>se?ti(se):null,[se]),Se=ln(),Ae=my(K,L.draggable.measure);Ly({activeNode:k!=null?P.get(k):null,config:Se.layoutShiftCompensation,initialRect:Ae,measure:L.draggable.measure});const ie=vc(K,L.draggable.measure,Ae),ne=vc(K?K.parentElement:null),de=h.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=N.getNodeFor((r=de.current.over)==null?void 0:r.id),Ke=Iy({measure:L.dragOverlay.measure}),Pe=(n=Ke.nodeRef.current)!=null?n:K,te=I?(s=Ke.rect)!=null?s:ie:null,Ye=!!(Ke.nodeRef.current&&Ke.rect),vt=wy(Ye?null:ie),St=_c(Pe?_t(Pe):null),Ge=Sy(I?je??K:null),rt=Dy(Ge),mt=Ec(g,{transform:{x:B.x-vt.x,y:B.y-vt.y,scaleX:1,scaleY:1},activatorEvent:se,active:A,activeNodeRect:ie,containerNodeRect:ne,draggingNodeRect:te,over:de.current.over,overlayNodeRect:Ke.rect,scrollableAncestors:Ge,scrollableAncestorRects:rt,windowRect:St}),to=oe?dn(oe,B):null,cl=Cy(Ge),Kh=bc(cl),ro=bc(cl,[ie]),C=dn(mt,Kh),T=te?Gg(te,mt):null,x=A&&T?f({active:A,collisionRect:T,droppableRects:X,droppableContainers:G,pointerCoordinates:to}):null,z=ec(x,"id"),[q,Q]=h.useState(null),H=Ye?mt:dn(mt,ro),ee=Wg(H,(i=q==null?void 0:q.rect)!=null?i:null,ie),he=h.useRef(null),ze=h.useCallback((nt,bt)=>{let{sensor:Ct,options:Zt}=bt;if(U.current==null)return;const qt=P.get(U.current);if(!qt)return;const Ft=nt.nativeEvent,lr=new Ct({active:U.current,activeNode:qt,event:Ft,options:Zt,context:de,onAbort(lt){if(!P.get(lt))return;const{onDragAbort:cr}=_e.current,gr={id:lt};cr==null||cr(gr),b({type:"onDragAbort",event:gr})},onPending(lt,Mr,cr,gr){if(!P.get(lt))return;const{onDragPending:Bs}=_e.current,Lr={id:lt,constraint:Mr,initialCoordinates:cr,offset:gr};Bs==null||Bs(Lr),b({type:"onDragPending",event:Lr})},onStart(lt){const Mr=U.current;if(Mr==null)return;const cr=P.get(Mr);if(!cr)return;const{onDragStart:gr}=_e.current,js={activatorEvent:Ft,active:{id:Mr,data:cr.data,rect:V}};Be.unstable_batchedUpdates(()=>{gr==null||gr(js),O(Sr.Initializing),m({type:Xe.DragStart,initialCoordinates:lt,active:Mr}),b({type:"onDragStart",event:js}),J(he.current),ge(Ft)})},onMove(lt){m({type:Xe.DragMove,coordinates:lt})},onEnd:Kn(Xe.DragEnd),onCancel:Kn(Xe.DragCancel)});he.current=lr;function Kn(lt){return async function(){const{active:cr,collisions:gr,over:js,scrollAdjustedTranslate:Bs}=de.current;let Lr=null;if(cr&&Bs){const{cancelDrop:Us}=_e.current;Lr={activatorEvent:Ft,active:cr,collisions:gr,delta:Bs,over:js},lt===Xe.DragEnd&&typeof Us=="function"&&await Promise.resolve(Us(Lr))&&(lt=Xe.DragCancel)}U.current=null,Be.unstable_batchedUpdates(()=>{m({type:lt}),O(Sr.Uninitialized),Q(null),J(null),ge(null),he.current=null;const Us=lt===Xe.DragEnd?"onDragEnd":"onDragCancel";if(Lr){const ul=_e.current[Us];ul==null||ul(Lr),b({type:Us,event:Lr})}})}}},[P]),Nt=h.useCallback((nt,bt)=>(Ct,Zt)=>{const qt=Ct.nativeEvent,Ft=P.get(Zt);if(U.current!==null||!Ft||qt.dndKit||qt.defaultPrevented)return;const lr={active:Ft};nt(Ct,bt.options,lr)===!0&&(qt.dndKit={capturedBy:bt.sensor},U.current=Zt,ze(Ct,bt))},[P,ze]),xt=yy(u,Nt);Oy(u),Ht(()=>{ie&&w===Sr.Initializing&&O(Sr.Initialized)},[ie,w]),h.useEffect(()=>{const{onDragMove:nt}=_e.current,{active:bt,activatorEvent:Ct,collisions:Zt,over:qt}=de.current;if(!bt||!Ct)return;const Ft={active:bt,activatorEvent:Ct,collisions:Zt,delta:{x:C.x,y:C.y},over:qt};Be.unstable_batchedUpdates(()=>{nt==null||nt(Ft),b({type:"onDragMove",event:Ft})})},[C.x,C.y]),h.useEffect(()=>{const{active:nt,activatorEvent:bt,collisions:Ct,droppableContainers:Zt,scrollAdjustedTranslate:qt}=de.current;if(!nt||U.current==null||!bt||!qt)return;const{onDragOver:Ft}=_e.current,lr=Zt.get(z),Kn=lr&&lr.rect.current?{id:lr.id,rect:lr.rect.current,data:lr.data,disabled:lr.disabled}:null,lt={active:nt,activatorEvent:bt,collisions:Ct,delta:{x:qt.x,y:qt.y},over:Kn};Be.unstable_batchedUpdates(()=>{Q(Kn),Ft==null||Ft(lt),b({type:"onDragOver",event:lt})})},[z]),Ht(()=>{de.current={activatorEvent:se,active:A,activeNode:K,collisionRect:T,collisions:x,droppableRects:X,draggableNodes:P,draggingNode:Pe,draggingNodeRect:te,droppableContainers:N,over:q,scrollableAncestors:Ge,scrollAdjustedTranslate:C},V.current={initial:te,translated:T}},[A,K,x,T,P,Pe,te,X,N,q,Ge,C]),fy({...Se,delta:B,draggingRect:T,pointerCoordinates:to,scrollableAncestors:Ge,scrollableAncestorRects:rt});const pr=h.useMemo(()=>({active:A,activeNode:K,activeNodeRect:ie,activatorEvent:se,collisions:x,containerNodeRect:ne,dragOverlay:Ke,draggableNodes:P,droppableContainers:N,droppableRects:X,over:q,measureDroppableContainers:F,scrollableAncestors:Ge,scrollableAncestorRects:rt,measuringConfiguration:L,measuringScheduled:Y,windowRect:St}),[A,K,ie,se,x,ne,Ke,P,N,X,q,F,Ge,rt,L,Y,St]),$s=h.useMemo(()=>({activatorEvent:se,activators:xt,active:A,activeNodeRect:ie,ariaDescribedById:{draggable:we},dispatch:m,draggableNodes:P,over:q,measureDroppableContainers:F}),[se,xt,A,ie,m,we,P,q,F]);return h.createElement(Yl.Provider,{value:S},h.createElement(as.Provider,{value:$s},h.createElement(Oc.Provider,{value:pr},h.createElement(li.Provider,{value:ee},d)),h.createElement(Py,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(jg,{...a,hiddenTextDescribedById:we}));function ln(){const nt=(j==null?void 0:j.autoScrollEnabled)===!1,bt=typeof c=="object"?c.enabled===!1:c===!1,Ct=I&&!nt&&!bt;return typeof c=="object"?{...c,enabled:Ct}:{enabled:Ct}}}),Fy=h.createContext(null),Ic="button",$y="Draggable";function Tc(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=ts($y),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:y}=h.useContext(as),{role:g=Ic,roleDescription:_="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?li:Fy),[b,S]=Zs(),[w,O]=Zs(),I=Ey(o,t),k=Jn(r);Ht(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:k}),()=>{const B=f.get(t);B&&B.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&g===Ic?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,g,p,v,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:P,isDragging:v,listeners:n?void 0:I,node:b,over:y,setNodeRef:S,setActivatorNodeRef:O,transform:m}}function Nc(){return h.useContext(Oc)}const jy="Droppable",By={timeout:25};function Uy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=ts(jy),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=h.useContext(as),u=h.useRef({disabled:r}),f=h.useRef(!1),y=h.useRef(null),g=h.useRef(null),{disabled:_,updateMeasurementsFor:p,timeout:v}={...By,...s},m=Jn(p??n),b=h.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),g.current=null},v)},[v]),S=oi({callback:b,disabled:_||!o}),w=h.useCallback((P,B)=>{S&&(B&&(S.unobserve(B),f.current=!1),P&&S.observe(P))},[S]),[O,I]=Zs(w),k=Jn(t);return h.useEffect(()=>{!S||!O.current||(S.disconnect(),f.current=!1,S.observe(O.current))},[O,S]),h.useEffect(()=>(a({type:Xe.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:y,data:k}}),()=>a({type:Xe.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==u.current.disabled&&(a({type:Xe.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:y,isOver:(c==null?void 0:c.id)===n,node:O,over:c,setNodeRef:I}}function Vy(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=Js(r);return!r&&!n&&a&&s(a),Ht(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const zy={x:0,y:0,scaleX:1,scaleY:1};function qy(e){let{children:t}=e;return h.createElement(as.Provider,{value:Cc},h.createElement(li.Provider,{value:zy},t))}const Hy={position:"fixed",touchAction:"none"},Wy=e=>ei(e)?"transform 250ms ease":void 0,Ky=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=Wy}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},y={...Hy,width:a.width,height:a.height,top:a.top,left:a.left,transform:wr.Transform.toString(f),transformOrigin:s&&n?Bg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return h.createElement(r,{className:o,style:y,ref:t},i)}),Gy={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:wr.Transform.toString(t)},{transform:wr.Transform.toString(r)}]},sideEffects:(e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}})({styles:{active:{opacity:"0"}}})};function Qy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Xs((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=Sc(o);if(!d)return;const{transform:u}=_t(o).getComputedStyle(o),f=nc(u);if(!f)return;const y=typeof t=="function"?t:Yy(t);return dc(c,s.draggable.measure),y({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Yy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Gy,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},y={x:c.x-u.x,y:c.y-u.y,...f},g=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:y}}),[_]=g,p=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...d}),m=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{m.onfinish=()=>{v==null||v(),b()}})}}let xc=0;function Ry(e){return h.useMemo(()=>{if(e!=null)return xc++,xc},[e])}const Xy=h.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:y,containerNodeRect:g,draggableNodes:_,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:O}=Nc(),I=h.useContext(li),k=Ry(f==null?void 0:f.id),P=Ec(o,{activatorEvent:u,active:f,activeNodeRect:y,containerNodeRect:g,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:I,windowRect:O}),B=Mo(y),N=Qy({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),M=B?v.setRef:void 0;return h.createElement(qy,null,h.createElement(Vy,{animation:N},f&&k?h.createElement(Ky,{key:k,id:f.id,ref:M,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:B,style:{zIndex:d,...s},transform:P},r):null))});/**
181
+ `},$g={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function jg(e){let{announcements:t=$g,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Fg}=e;const{announce:i,announcement:o}=Pg(),a=es("DndLiveRegion"),[c,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),Mg(h.useMemo(()=>({onDragStart(f){let{active:y}=f;i(t.onDragStart({active:y}))},onDragMove(f){let{active:y,over:g}=f;t.onDragMove&&i(t.onDragMove({active:y,over:g}))},onDragOver(f){let{active:y,over:g}=f;i(t.onDragOver({active:y,over:g}))},onDragEnd(f){let{active:y,over:g}=f;i(t.onDragEnd({active:y,over:g}))},onDragCancel(f){let{active:y,over:g}=f;i(t.onDragCancel({active:y,over:g}))}}),[i,t])),!c)return null;const u=h.createElement(h.Fragment,null,h.createElement(kg,{id:n,value:s.draggable}),h.createElement(Ag,{id:a,announcement:o}));return r?Be.createPortal(u,r):u}var Xe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Xe||(Xe={}));function ri(){}function Eo(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Xl(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Wt=Object.freeze({x:0,y:0});function Zl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bg(e,t){const r=ti(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Jl(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Ug(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function ec(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function tc(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function rc(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Vg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=rc(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Zl(rc(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(Jl)},zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=ec(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=ec(c),u=s.reduce((y,g,_)=>y+Zl(d[_],g),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Jl)};function qg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const Hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=qg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Ug)};function Wg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function nc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Wt}function Kg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Gg=Kg(1);function sc(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Qg(e,t,r){const n=sc(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Yg={ignoreTransform:!1};function fn(e,t){t===void 0&&(t=Yg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=_t(e).getComputedStyle(e);d&&(r=Qg(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function ic(e){return fn(e,{ignoreTransform:!0})}function Rg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Xg(e,t){return t===void 0&&(t=_t(e).getComputedStyle(e)),t.position==="fixed"}function Zg(e,t){t===void 0&&(t=_t(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function ni(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Co(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Xn(s)||Gl(s)||r.includes(s))return r;const i=_t(e).getComputedStyle(s);return s!==e&&Zg(s,i)&&r.push(s),Xg(s,i)?r:n(s.parentNode)}return e?n(e):r}function oc(e){const[t]=ni(e,1);return t??null}function Do(e){return!Rs||!e?null:cn(e)?e:So(e)?Co(e)||e===un(e).scrollingElement?window:Xn(e)?e:null:null}function ac(e){return cn(e)?e.scrollX:e.scrollLeft}function lc(e){return cn(e)?e.scrollY:e.scrollTop}function Io(e){return{x:ac(e),y:lc(e)}}var Ze;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ze||(Ze={}));function cc(e){return!Rs||!e?!1:e===document.scrollingElement}function uc(e){const t={x:0,y:0},r=cc(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const Jg={x:.2,y:.2};function ey(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Jg);const{isTop:d,isBottom:u,isLeft:f,isRight:y}=uc(e),g={x:0,y:0},_={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+p.height?(g.y=Ze.Backward,_.y=n*Math.abs((t.top+p.height-i)/p.height)):!u&&c>=t.bottom-p.height&&(g.y=Ze.Forward,_.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!y&&a>=t.right-p.width?(g.x=Ze.Forward,_.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(g.x=Ze.Backward,_.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:g,speed:_}}function ty(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function dc(e){return e.reduce((t,r)=>dn(t,Io(r)),Wt)}function ry(e){return e.reduce((t,r)=>t+ac(r),0)}function ny(e){return e.reduce((t,r)=>t+lc(r),0)}function fc(e,t){if(t===void 0&&(t=fn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);oc(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sy=[["x",["left","right"],ry],["y",["top","bottom"],ny]];class To{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ni(r),s=dc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of sy)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class rs{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function iy(e){const{EventTarget:t}=_t(e);return e instanceof t?e:un(e)}function No(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var $t;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($t||($t={}));function hc(e){e.preventDefault()}function oy(e){e.stopPropagation()}var be;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(be||(be={}));const pc={start:[be.Space,be.Enter],cancel:[be.Esc],end:[be.Space,be.Enter,be.Tab]},ay=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case be.Right:return{...r,x:r.x+25};case be.Left:return{...r,x:r.x-25};case be.Down:return{...r,y:r.y+25};case be.Up:return{...r,y:r.y-25}}};class xo{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new rs(un(r)),this.windowListeners=new rs(_t(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($t.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&fc(n),r(Wt)}handleKeyDown(t){if(ei(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=pc,coordinateGetter:o=ay,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Wt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const y=ts(f,u),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const p of _){const v=t.code,{isTop:m,isRight:b,isLeft:S,isBottom:w,maxScroll:O,minScroll:I}=uc(p),k=ty(p),P={x:Math.min(v===be.Right?k.right-k.width/2:k.right,Math.max(v===be.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===be.Down?k.bottom-k.height/2:k.bottom,Math.max(v===be.Down?k.top:k.top+k.height/2,f.y))},B=v===be.Right&&!b||v===be.Left&&!S,N=v===be.Down&&!w||v===be.Up&&!m;if(B&&P.x!==f.x){const M=p.scrollLeft+y.x,V=v===be.Right&&M<=O.x||v===be.Left&&M>=I.x;if(V&&!y.y){p.scrollTo({left:M,behavior:a});return}V?g.x=p.scrollLeft-M:g.x=v===be.Right?p.scrollLeft-O.x:p.scrollLeft-I.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(N&&P.y!==f.y){const M=p.scrollTop+y.y,V=v===be.Down&&M<=O.y||v===be.Up&&M>=I.y;if(V&&!y.x){p.scrollTo({top:M,behavior:a});return}V?g.y=p.scrollTop-M:g.y=v===be.Down?p.scrollTop-O.y:p.scrollTop-I.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,dn(ts(f,this.referenceCoordinates),g))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xo.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=pc,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function gc(e){return!!(e&&"distance"in e)}function yc(e){return!!(e&&"delay"in e)}class ko{constructor(t,r,n){var s;n===void 0&&(n=iy(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=un(o),this.documentListeners=new rs(this.document),this.listeners=new rs(n),this.windowListeners=new rs(_t(o)),this.initialCoordinates=(s=ti(i))!=null?s:Wt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.DragStart,hc),this.windowListeners.add($t.VisibilityChange,this.handleCancel),this.windowListeners.add($t.ContextMenu,hc),this.documentListeners.add($t.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(yc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(gc(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add($t.Click,oy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($t.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=ti(t))!=null?r:Wt,d=ts(s,c);if(!n&&a){if(gc(a)){if(a.tolerance!=null&&No(d,a.tolerance))return this.handleCancel();if(No(d,a.distance))return this.handleStart()}if(yc(a)&&No(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===be.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ly={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class si extends ko{constructor(t){const{event:r}=t,n=un(r.target);super(t,ly,n)}}si.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const cy={move:{name:"mousemove"},end:{name:"mouseup"}};var Ao;(function(e){e[e.RightClick=2]="RightClick"})(Ao||(Ao={}));class uy extends ko{constructor(t){super(t,cy,un(t.event.target))}}uy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Ao.RightClick?!1:(n==null||n({event:r}),!0)}}];const Po={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dy extends ko{constructor(t){super(t,Po)}static setup(){return window.addEventListener(Po.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Po.move.name,t)};function t(){}}}dy.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var ns;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ns||(ns={}));var ii;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ii||(ii={}));function fy(e){let{acceleration:t,activator:r=ns.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ii.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:y}=e;const g=py({delta:f,disabled:!i}),[_,p]=Dg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),b=h.useMemo(()=>{switch(r){case ns.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ns.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const I=S.current;if(!I)return;const k=v.current.x*m.current.x,P=v.current.y*m.current.y;I.scrollBy(k,P)},[]),O=h.useMemo(()=>a===ii.TreeOrder?[...d].reverse():d,[a,d]);h.useEffect(()=>{if(!i||!d.length||!b){p();return}for(const I of O){if((n==null?void 0:n(I))===!1)continue;const k=d.indexOf(I),P=u[k];if(!P)continue;const{direction:B,speed:N}=ey(I,P,b,t,y);for(const M of["x","y"])g[M][B[M]]||(N[M]=0,B[M]=0);if(N.x>0||N.y>0){p(),S.current=I,_(w,o),v.current=N,m.current=B;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(b),JSON.stringify(g),_,d,O,u,JSON.stringify(y)])}const hy={x:{[Ze.Backward]:!1,[Ze.Forward]:!1},y:{[Ze.Backward]:!1,[Ze.Forward]:!1}};function py(e){let{delta:t,disabled:r}=e;const n=Js(t);return Jn(s=>{if(r||!n||!s)return hy;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ze.Backward]:s.x[Ze.Backward]||i.x===-1,[Ze.Forward]:s.x[Ze.Forward]||i.x===1},y:{[Ze.Backward]:s.y[Ze.Backward]||i.y===-1,[Ze.Forward]:s.y[Ze.Forward]||i.y===1}}},[r,t,n])}function gy(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Jn(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function yy(e,t){return h.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var ss;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ss||(ss={}));var Mo;(function(e){e.Optimized="optimized"})(Mo||(Mo={}));const vc=new Map;function vy(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:d}=s,u=h.useRef(e),f=v(),y=Zn(f),g=h.useCallback(function(m){m===void 0&&(m=[]),!y.current&&o(b=>b===null?m:b.concat(m.filter(S=>!b.includes(S))))},[y]),_=h.useRef(null),p=Jn(m=>{if(f&&!r)return vc;if(!m||m===vc||u.current!==e||i!=null){const b=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){b.set(S.id,S.rect.current);continue}const w=S.node.current,O=w?new To(c(w),w):null;S.rect.current=O,O&&b.set(S.id,O)}return b}return m},[e,i,r,f,c]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{f||g()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:i!=null};function v(){switch(d){case ss.Always:return!1;case ss.BeforeDragging:return r;default:return!r}}}function Lo(e,t){return Jn(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function my(e,t){return Lo(e,t)}function by(e){let{callback:t,disabled:r}=e;const n=Xs(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function oi(e){let{callback:t,disabled:r}=e;const n=Xs(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function _y(e){return new To(fn(e),e)}function mc(e,t,r){t===void 0&&(t=_y);const[n,s]=h.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=by({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=oi({callback:i});return Ht(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function wy(e){const t=Lo(e);return nc(e,t)}const bc=[];function Sy(e){const t=h.useRef(e),r=Jn(n=>e?n&&n!==bc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ni(e):bc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Cy(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=Do(i.target);o&&r(a=>a?(a.set(o,Io(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=Do(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Io(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=Do(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>dn(i,o),Wt):dc(e):Wt,[e,t])}function _c(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Wt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ts(e,r.current):Wt}function Oy(e){h.useEffect(()=>{if(!Rs)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Ey(e,t){return h.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function wc(e){return h.useMemo(()=>e?Rg(e):null,[e])}const Sc=[];function Dy(e,t){t===void 0&&(t=fn);const[r]=e,n=wc(r?_t(r):null),[s,i]=h.useState(Sc);function o(){i(()=>e.length?e.map(c=>cc(c)?n:new To(t(c),c)):Sc)}const a=oi({callback:o});return Ht(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Cc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xn(t)?t:e}function Iy(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(d=>{for(const{target:u}of d)if(Xn(u)){n(f=>{const y=t(u);return f?{...f,width:y.width,height:y.height}:y});break}},[t]),i=oi({callback:s}),o=h.useCallback(d=>{const u=Cc(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=Zs(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Ty=[{sensor:si,options:{}},{sensor:xo,options:{}}],Ny={current:{}},ai={draggable:{measure:ic},droppable:{measure:ic,strategy:ss.WhileDragging,frequency:Mo.Optimized},dragOverlay:{measure:fn}};class is extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const xy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new is,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ri},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ai,measureDroppableContainers:ri,windowRect:null,measuringScheduled:!1},Oc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ri,draggableNodes:new Map,over:null,measureDroppableContainers:ri},os=h.createContext(Oc),Ec=h.createContext(xy);function ky(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new is}}}function Ay(e,t){switch(t.type){case Xe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Xe.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Xe.DragEnd:case Xe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Xe.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new is(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Xe.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new is(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Xe.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new is(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Py(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(os),i=Js(n),o=Js(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ei(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Ng(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Dc(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function My(e){return h.useMemo(()=>({draggable:{...ai.draggable,...e==null?void 0:e.draggable},droppable:{...ai.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ai.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Ly(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=h.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Ht(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=nc(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const y=oc(d);y&&y.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const li=h.createContext({...Wt,scaleX:1,scaleY:1});var Sr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Sr||(Sr={}));const Ic=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Ty,collisionDetection:f=Hg,measuring:y,modifiers:g,..._}=t;const p=h.useReducer(Ay,void 0,ky),[v,m]=p,[b,S]=Lg(),[w,O]=h.useState(Sr.Uninitialized),I=w===Sr.Initialized,{draggable:{active:k,nodes:P,translate:B},droppable:{containers:N}}=v,M=k!=null?P.get(k):null,V=h.useRef({initial:null,translated:null}),A=h.useMemo(()=>{var nt;return k!=null?{id:k,data:(nt=M==null?void 0:M.data)!=null?nt:Ny,rect:V}:null},[k,M]),U=h.useRef(null),[j,J]=h.useState(null),[ie,ye]=h.useState(null),we=Zn(_,Object.values(_)),Se=es("DndDescribedBy",o),G=h.useMemo(()=>N.getEnabled(),[N]),F=My(y),{droppableRects:Y,measureDroppableContainers:L,measuringScheduled:R}=vy(G,{dragging:I,dependencies:[B.x,B.y],config:F.droppable}),K=gy(P,k),oe=h.useMemo(()=>ie?ti(ie):null,[ie]),ge=ln(),Ae=my(K,F.draggable.measure);Ly({activeNode:k!=null?P.get(k):null,config:ge.layoutShiftCompensation,initialRect:Ae,measure:F.draggable.measure});const re=mc(K,F.draggable.measure,Ae),se=mc(K?K.parentElement:null),de=h.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=N.getNodeFor((r=de.current.over)==null?void 0:r.id),Ke=Iy({measure:F.dragOverlay.measure}),Pe=(n=Ke.nodeRef.current)!=null?n:K,te=I?(s=Ke.rect)!=null?s:re:null,Ye=!!(Ke.nodeRef.current&&Ke.rect),vt=wy(Ye?null:re),St=wc(Pe?_t(Pe):null),Ge=Sy(I?je??K:null),rt=Dy(Ge),mt=Dc(g,{transform:{x:B.x-vt.x,y:B.y-vt.y,scaleX:1,scaleY:1},activatorEvent:ie,active:A,activeNodeRect:re,containerNodeRect:se,draggingNodeRect:te,over:de.current.over,overlayNodeRect:Ke.rect,scrollableAncestors:Ge,scrollableAncestorRects:rt,windowRect:St}),ro=oe?dn(oe,B):null,ul=Cy(Ge),Kh=_c(ul),no=_c(ul,[re]),C=dn(mt,Kh),T=te?Gg(te,mt):null,x=A&&T?f({active:A,collisionRect:T,droppableRects:Y,droppableContainers:G,pointerCoordinates:ro}):null,z=tc(x,"id"),[q,Q]=h.useState(null),H=Ye?mt:dn(mt,no),ee=Wg(H,(i=q==null?void 0:q.rect)!=null?i:null,re),he=h.useRef(null),ze=h.useCallback((nt,bt)=>{let{sensor:Ct,options:Zt}=bt;if(U.current==null)return;const qt=P.get(U.current);if(!qt)return;const Ft=nt.nativeEvent,lr=new Ct({active:U.current,activeNode:qt,event:Ft,options:Zt,context:de,onAbort(lt){if(!P.get(lt))return;const{onDragAbort:cr}=we.current,gr={id:lt};cr==null||cr(gr),b({type:"onDragAbort",event:gr})},onPending(lt,Mr,cr,gr){if(!P.get(lt))return;const{onDragPending:Bs}=we.current,Lr={id:lt,constraint:Mr,initialCoordinates:cr,offset:gr};Bs==null||Bs(Lr),b({type:"onDragPending",event:Lr})},onStart(lt){const Mr=U.current;if(Mr==null)return;const cr=P.get(Mr);if(!cr)return;const{onDragStart:gr}=we.current,js={activatorEvent:Ft,active:{id:Mr,data:cr.data,rect:V}};Be.unstable_batchedUpdates(()=>{gr==null||gr(js),O(Sr.Initializing),m({type:Xe.DragStart,initialCoordinates:lt,active:Mr}),b({type:"onDragStart",event:js}),J(he.current),ye(Ft)})},onMove(lt){m({type:Xe.DragMove,coordinates:lt})},onEnd:Wn(Xe.DragEnd),onCancel:Wn(Xe.DragCancel)});he.current=lr;function Wn(lt){return async function(){const{active:cr,collisions:gr,over:js,scrollAdjustedTranslate:Bs}=de.current;let Lr=null;if(cr&&Bs){const{cancelDrop:Us}=we.current;Lr={activatorEvent:Ft,active:cr,collisions:gr,delta:Bs,over:js},lt===Xe.DragEnd&&typeof Us=="function"&&await Promise.resolve(Us(Lr))&&(lt=Xe.DragCancel)}U.current=null,Be.unstable_batchedUpdates(()=>{m({type:lt}),O(Sr.Uninitialized),Q(null),J(null),ye(null),he.current=null;const Us=lt===Xe.DragEnd?"onDragEnd":"onDragCancel";if(Lr){const dl=we.current[Us];dl==null||dl(Lr),b({type:Us,event:Lr})}})}}},[P]),Nt=h.useCallback((nt,bt)=>(Ct,Zt)=>{const qt=Ct.nativeEvent,Ft=P.get(Zt);if(U.current!==null||!Ft||qt.dndKit||qt.defaultPrevented)return;const lr={active:Ft};nt(Ct,bt.options,lr)===!0&&(qt.dndKit={capturedBy:bt.sensor},U.current=Zt,ze(Ct,bt))},[P,ze]),xt=yy(u,Nt);Oy(u),Ht(()=>{re&&w===Sr.Initializing&&O(Sr.Initialized)},[re,w]),h.useEffect(()=>{const{onDragMove:nt}=we.current,{active:bt,activatorEvent:Ct,collisions:Zt,over:qt}=de.current;if(!bt||!Ct)return;const Ft={active:bt,activatorEvent:Ct,collisions:Zt,delta:{x:C.x,y:C.y},over:qt};Be.unstable_batchedUpdates(()=>{nt==null||nt(Ft),b({type:"onDragMove",event:Ft})})},[C.x,C.y]),h.useEffect(()=>{const{active:nt,activatorEvent:bt,collisions:Ct,droppableContainers:Zt,scrollAdjustedTranslate:qt}=de.current;if(!nt||U.current==null||!bt||!qt)return;const{onDragOver:Ft}=we.current,lr=Zt.get(z),Wn=lr&&lr.rect.current?{id:lr.id,rect:lr.rect.current,data:lr.data,disabled:lr.disabled}:null,lt={active:nt,activatorEvent:bt,collisions:Ct,delta:{x:qt.x,y:qt.y},over:Wn};Be.unstable_batchedUpdates(()=>{Q(Wn),Ft==null||Ft(lt),b({type:"onDragOver",event:lt})})},[z]),Ht(()=>{de.current={activatorEvent:ie,active:A,activeNode:K,collisionRect:T,collisions:x,droppableRects:Y,draggableNodes:P,draggingNode:Pe,draggingNodeRect:te,droppableContainers:N,over:q,scrollableAncestors:Ge,scrollAdjustedTranslate:C},V.current={initial:te,translated:T}},[A,K,x,T,P,Pe,te,Y,N,q,Ge,C]),fy({...ge,delta:B,draggingRect:T,pointerCoordinates:ro,scrollableAncestors:Ge,scrollableAncestorRects:rt});const pr=h.useMemo(()=>({active:A,activeNode:K,activeNodeRect:re,activatorEvent:ie,collisions:x,containerNodeRect:se,dragOverlay:Ke,draggableNodes:P,droppableContainers:N,droppableRects:Y,over:q,measureDroppableContainers:L,scrollableAncestors:Ge,scrollableAncestorRects:rt,measuringConfiguration:F,measuringScheduled:R,windowRect:St}),[A,K,re,ie,x,se,Ke,P,N,Y,q,L,Ge,rt,F,R,St]),$s=h.useMemo(()=>({activatorEvent:ie,activators:xt,active:A,activeNodeRect:re,ariaDescribedById:{draggable:Se},dispatch:m,draggableNodes:P,over:q,measureDroppableContainers:L}),[ie,xt,A,re,m,Se,P,q,L]);return h.createElement(Rl.Provider,{value:S},h.createElement(os.Provider,{value:$s},h.createElement(Ec.Provider,{value:pr},h.createElement(li.Provider,{value:ee},d)),h.createElement(Py,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(jg,{...a,hiddenTextDescribedById:Se}));function ln(){const nt=(j==null?void 0:j.autoScrollEnabled)===!1,bt=typeof c=="object"?c.enabled===!1:c===!1,Ct=I&&!nt&&!bt;return typeof c=="object"?{...c,enabled:Ct}:{enabled:Ct}}}),Fy=h.createContext(null),Tc="button",$y="Draggable";function Nc(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=es($y),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:y}=h.useContext(os),{role:g=Tc,roleDescription:_="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?li:Fy),[b,S]=Zs(),[w,O]=Zs(),I=Ey(o,t),k=Zn(r);Ht(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:k}),()=>{const B=f.get(t);B&&B.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&g===Tc?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,g,p,v,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:P,isDragging:v,listeners:n?void 0:I,node:b,over:y,setNodeRef:S,setActivatorNodeRef:O,transform:m}}function xc(){return h.useContext(Ec)}const jy="Droppable",By={timeout:25};function Uy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=es(jy),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=h.useContext(os),u=h.useRef({disabled:r}),f=h.useRef(!1),y=h.useRef(null),g=h.useRef(null),{disabled:_,updateMeasurementsFor:p,timeout:v}={...By,...s},m=Zn(p??n),b=h.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),g.current=null},v)},[v]),S=oi({callback:b,disabled:_||!o}),w=h.useCallback((P,B)=>{S&&(B&&(S.unobserve(B),f.current=!1),P&&S.observe(P))},[S]),[O,I]=Zs(w),k=Zn(t);return h.useEffect(()=>{!S||!O.current||(S.disconnect(),f.current=!1,S.observe(O.current))},[O,S]),h.useEffect(()=>(a({type:Xe.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:y,data:k}}),()=>a({type:Xe.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==u.current.disabled&&(a({type:Xe.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:y,isOver:(c==null?void 0:c.id)===n,node:O,over:c,setNodeRef:I}}function Vy(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=Js(r);return!r&&!n&&a&&s(a),Ht(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const zy={x:0,y:0,scaleX:1,scaleY:1};function qy(e){let{children:t}=e;return h.createElement(os.Provider,{value:Oc},h.createElement(li.Provider,{value:zy},t))}const Hy={position:"fixed",touchAction:"none"},Wy=e=>ei(e)?"transform 250ms ease":void 0,Ky=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=Wy}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},y={...Hy,width:a.width,height:a.height,top:a.top,left:a.left,transform:wr.Transform.toString(f),transformOrigin:s&&n?Bg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return h.createElement(r,{className:o,style:y,ref:t},i)}),Gy={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:wr.Transform.toString(t)},{transform:wr.Transform.toString(r)}]},sideEffects:(e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}})({styles:{active:{opacity:"0"}}})};function Qy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Xs((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=Cc(o);if(!d)return;const{transform:u}=_t(o).getComputedStyle(o),f=sc(u);if(!f)return;const y=typeof t=="function"?t:Yy(t);return fc(c,s.draggable.measure),y({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Yy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Gy,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},y={x:c.x-u.x,y:c.y-u.y,...f},g=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:y}}),[_]=g,p=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...d}),m=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{m.onfinish=()=>{v==null||v(),b()}})}}let kc=0;function Ry(e){return h.useMemo(()=>{if(e!=null)return kc++,kc},[e])}const Xy=h.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:y,containerNodeRect:g,draggableNodes:_,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:O}=xc(),I=h.useContext(li),k=Ry(f==null?void 0:f.id),P=Dc(o,{activatorEvent:u,active:f,activeNodeRect:y,containerNodeRect:g,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:I,windowRect:O}),B=Lo(y),N=Qy({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),M=B?v.setRef:void 0;return h.createElement(qy,null,h.createElement(Vy,{animation:N},f&&k?h.createElement(Ky,{key:k,id:f.id,ref:M,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:B,style:{zIndex:d,...s},transform:P},r):null))});/**
182
182
  * @license lucide-react v0.400.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
185
185
  * See the LICENSE file in the root directory of this source tree.
186
- */const Zy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kc=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
186
+ */const Zy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ac=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
187
187
  * @license lucide-react v0.400.0 - ISC
188
188
  *
189
189
  * This source code is licensed under the ISC license.
@@ -193,12 +193,12 @@ to {
193
193
  *
194
194
  * This source code is licensed under the ISC license.
195
195
  * See the LICENSE file in the root directory of this source tree.
196
- */const ev=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>h.createElement("svg",{ref:c,...Jy,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:kc("lucide",s),...a},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
196
+ */const ev=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>h.createElement("svg",{ref:c,...Jy,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ac("lucide",s),...a},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
197
197
  * @license lucide-react v0.400.0 - ISC
198
198
  *
199
199
  * This source code is licensed under the ISC license.
200
200
  * See the LICENSE file in the root directory of this source tree.
201
- */const le=(e,t)=>{const r=h.forwardRef(({className:n,...s},i)=>h.createElement(ev,{ref:i,iconNode:t,className:kc(`lucide-${Zy(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
201
+ */const le=(e,t)=>{const r=h.forwardRef(({className:n,...s},i)=>h.createElement(ev,{ref:i,iconNode:t,className:Ac(`lucide-${Zy(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
202
202
  * @license lucide-react v0.400.0 - ISC
203
203
  *
204
204
  * This source code is licensed under the ISC license.
@@ -223,12 +223,12 @@ to {
223
223
  *
224
224
  * This source code is licensed under the ISC license.
225
225
  * See the LICENSE file in the root directory of this source tree.
226
- */const ls=le("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
226
+ */const as=le("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
227
227
  * @license lucide-react v0.400.0 - ISC
228
228
  *
229
229
  * This source code is licensed under the ISC license.
230
230
  * See the LICENSE file in the root directory of this source tree.
231
- */const Ac=le("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
231
+ */const Pc=le("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
232
232
  * @license lucide-react v0.400.0 - ISC
233
233
  *
234
234
  * This source code is licensed under the ISC license.
@@ -238,17 +238,17 @@ to {
238
238
  *
239
239
  * This source code is licensed under the ISC license.
240
240
  * See the LICENSE file in the root directory of this source tree.
241
- */const Pc=le("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
241
+ */const Mc=le("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
242
242
  * @license lucide-react v0.400.0 - ISC
243
243
  *
244
244
  * This source code is licensed under the ISC license.
245
245
  * See the LICENSE file in the root directory of this source tree.
246
- */const Lo=le("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
246
+ */const Fo=le("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
247
247
  * @license lucide-react v0.400.0 - ISC
248
248
  *
249
249
  * This source code is licensed under the ISC license.
250
250
  * See the LICENSE file in the root directory of this source tree.
251
- */const Fo=le("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
251
+ */const $o=le("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
252
252
  * @license lucide-react v0.400.0 - ISC
253
253
  *
254
254
  * This source code is licensed under the ISC license.
@@ -263,12 +263,12 @@ to {
263
263
  *
264
264
  * This source code is licensed under the ISC license.
265
265
  * See the LICENSE file in the root directory of this source tree.
266
- */const Mc=le("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
266
+ */const Lc=le("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
267
267
  * @license lucide-react v0.400.0 - ISC
268
268
  *
269
269
  * This source code is licensed under the ISC license.
270
270
  * See the LICENSE file in the root directory of this source tree.
271
- */const $o=le("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
271
+ */const jo=le("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
272
272
  * @license lucide-react v0.400.0 - ISC
273
273
  *
274
274
  * This source code is licensed under the ISC license.
@@ -283,7 +283,7 @@ to {
283
283
  *
284
284
  * This source code is licensed under the ISC license.
285
285
  * See the LICENSE file in the root directory of this source tree.
286
- */const Lc=le("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
286
+ */const Fc=le("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
287
287
  * @license lucide-react v0.400.0 - ISC
288
288
  *
289
289
  * This source code is licensed under the ISC license.
@@ -293,7 +293,7 @@ to {
293
293
  *
294
294
  * This source code is licensed under the ISC license.
295
295
  * See the LICENSE file in the root directory of this source tree.
296
- */const Fc=le("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
296
+ */const $c=le("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
297
297
  * @license lucide-react v0.400.0 - ISC
298
298
  *
299
299
  * This source code is licensed under the ISC license.
@@ -303,12 +303,12 @@ to {
303
303
  *
304
304
  * This source code is licensed under the ISC license.
305
305
  * See the LICENSE file in the root directory of this source tree.
306
- */const $c=le("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
306
+ */const jc=le("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
307
307
  * @license lucide-react v0.400.0 - ISC
308
308
  *
309
309
  * This source code is licensed under the ISC license.
310
310
  * See the LICENSE file in the root directory of this source tree.
311
- */const jo=le("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
311
+ */const Bo=le("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
312
312
  * @license lucide-react v0.400.0 - ISC
313
313
  *
314
314
  * This source code is licensed under the ISC license.
@@ -323,12 +323,12 @@ to {
323
323
  *
324
324
  * This source code is licensed under the ISC license.
325
325
  * See the LICENSE file in the root directory of this source tree.
326
- */const Bo=le("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
326
+ */const Uo=le("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
327
327
  * @license lucide-react v0.400.0 - ISC
328
328
  *
329
329
  * This source code is licensed under the ISC license.
330
330
  * See the LICENSE file in the root directory of this source tree.
331
- */const Uo=le("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
331
+ */const Vo=le("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
332
332
  * @license lucide-react v0.400.0 - ISC
333
333
  *
334
334
  * This source code is licensed under the ISC license.
@@ -353,12 +353,12 @@ to {
353
353
  *
354
354
  * This source code is licensed under the ISC license.
355
355
  * See the LICENSE file in the root directory of this source tree.
356
- */const cs=le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
356
+ */const ls=le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
357
357
  * @license lucide-react v0.400.0 - ISC
358
358
  *
359
359
  * This source code is licensed under the ISC license.
360
360
  * See the LICENSE file in the root directory of this source tree.
361
- */const jc=le("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
361
+ */const Bc=le("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
362
362
  * @license lucide-react v0.400.0 - ISC
363
363
  *
364
364
  * This source code is licensed under the ISC license.
@@ -373,7 +373,7 @@ to {
373
373
  *
374
374
  * This source code is licensed under the ISC license.
375
375
  * See the LICENSE file in the root directory of this source tree.
376
- */const Vo=le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
376
+ */const zo=le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
377
377
  * @license lucide-react v0.400.0 - ISC
378
378
  *
379
379
  * This source code is licensed under the ISC license.
@@ -393,12 +393,12 @@ to {
393
393
  *
394
394
  * This source code is licensed under the ISC license.
395
395
  * See the LICENSE file in the root directory of this source tree.
396
- */const zo=le("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
396
+ */const qo=le("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
397
397
  * @license lucide-react v0.400.0 - ISC
398
398
  *
399
399
  * This source code is licensed under the ISC license.
400
400
  * See the LICENSE file in the root directory of this source tree.
401
- */const Bc=le("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
401
+ */const Uc=le("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
402
402
  * @license lucide-react v0.400.0 - ISC
403
403
  *
404
404
  * This source code is licensed under the ISC license.
@@ -408,12 +408,12 @@ to {
408
408
  *
409
409
  * This source code is licensed under the ISC license.
410
410
  * See the LICENSE file in the root directory of this source tree.
411
- */const qo=le("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
411
+ */const Ho=le("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
412
412
  * @license lucide-react v0.400.0 - ISC
413
413
  *
414
414
  * This source code is licensed under the ISC license.
415
415
  * See the LICENSE file in the root directory of this source tree.
416
- */const jr=le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wv={},Uc=e=>{let t;const r=new Set,n=(u,f)=>{const y=typeof u=="function"?u(t):u;if(!Object.is(y,t)){const g=t;t=f??(typeof y!="object"||y===null)?y:Object.assign({},t,y),r.forEach(_=>_(t,g))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(wv?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=t=e(n,s,c);return c},Sv=e=>e?Uc(e):Uc;function Vc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ho={exports:{}},Wo={},ui={exports:{}},Ko={};/**
416
+ */const jr=le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wv={},Vc=e=>{let t;const r=new Set,n=(u,f)=>{const y=typeof u=="function"?u(t):u;if(!Object.is(y,t)){const g=t;t=f??(typeof y!="object"||y===null)?y:Object.assign({},t,y),r.forEach(_=>_(t,g))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(wv?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=t=e(n,s,c);return c},Sv=e=>e?Vc(e):Vc;function zc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wo={exports:{}},Ko={},ui={exports:{}},Go={};/**
417
417
  * @license React
418
418
  * use-sync-external-store-shim.production.js
419
419
  *
@@ -421,7 +421,7 @@ to {
421
421
  *
422
422
  * This source code is licensed under the MIT license found in the
423
423
  * LICENSE file in the root directory of this source tree.
424
- */var zc;function Cv(){if(zc)return Ko;zc=1;var e=h;function t(f,y){return f===y&&(f!==0||1/f===1/y)||f!==f&&y!==y}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,y){var g=y(),_=n({inst:{value:g,getSnapshot:y}}),p=_[0].inst,v=_[1];return i(function(){p.value=g,p.getSnapshot=y,c(p)&&v({inst:p})},[f,g,y]),s(function(){return c(p)&&v({inst:p}),f(function(){c(p)&&v({inst:p})})},[f]),o(g),g}function c(f){var y=f.getSnapshot;f=f.value;try{var g=y();return!r(f,g)}catch{return!0}}function d(f,y){return y()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Ko.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Ko}var Go={};/**
424
+ */var qc;function Cv(){if(qc)return Go;qc=1;var e=h;function t(f,y){return f===y&&(f!==0||1/f===1/y)||f!==f&&y!==y}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,y){var g=y(),_=n({inst:{value:g,getSnapshot:y}}),p=_[0].inst,v=_[1];return i(function(){p.value=g,p.getSnapshot=y,c(p)&&v({inst:p})},[f,g,y]),s(function(){return c(p)&&v({inst:p}),f(function(){c(p)&&v({inst:p})})},[f]),o(g),g}function c(f){var y=f.getSnapshot;f=f.value;try{var g=y();return!r(f,g)}catch{return!0}}function d(f,y){return y()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Go.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Go}var Qo={};/**
425
425
  * @license React
426
426
  * use-sync-external-store-shim.development.js
427
427
  *
@@ -429,7 +429,7 @@ to {
429
429
  *
430
430
  * This source code is licensed under the MIT license found in the
431
431
  * LICENSE file in the root directory of this source tree.
432
- */var qc;function Ov(){return qc||(qc=1,process.env.NODE_ENV!=="production"&&function(){function e(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}function t(g,_){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=_();if(!f){var v=_();i(p,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=o({inst:{value:p,getSnapshot:_}});var m=v[0].inst,b=v[1];return c(function(){m.value=p,m.getSnapshot=_,r(m)&&b({inst:m})},[g,p,_]),a(function(){return r(m)&&b({inst:m}),g(function(){r(m)&&b({inst:m})})},[g]),d(p),p}function r(g){var _=g.getSnapshot;g=g.value;try{var p=_();return!i(g,p)}catch{return!0}}function n(g,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=h,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Go.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Go}var Hc;function Qo(){return Hc||(Hc=1,process.env.NODE_ENV==="production"?ui.exports=Cv():ui.exports=Ov()),ui.exports}/**
432
+ */var Hc;function Ov(){return Hc||(Hc=1,process.env.NODE_ENV!=="production"&&function(){function e(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}function t(g,_){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=_();if(!f){var v=_();i(p,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=o({inst:{value:p,getSnapshot:_}});var m=v[0].inst,b=v[1];return c(function(){m.value=p,m.getSnapshot=_,r(m)&&b({inst:m})},[g,p,_]),a(function(){return r(m)&&b({inst:m}),g(function(){r(m)&&b({inst:m})})},[g]),d(p),p}function r(g){var _=g.getSnapshot;g=g.value;try{var p=_();return!i(g,p)}catch{return!0}}function n(g,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=h,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Qo.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Qo}var Wc;function Yo(){return Wc||(Wc=1,process.env.NODE_ENV==="production"?ui.exports=Cv():ui.exports=Ov()),ui.exports}/**
433
433
  * @license React
434
434
  * use-sync-external-store-shim/with-selector.production.js
435
435
  *
@@ -437,7 +437,7 @@ to {
437
437
  *
438
438
  * This source code is licensed under the MIT license found in the
439
439
  * LICENSE file in the root directory of this source tree.
440
- */var Wc;function Ev(){if(Wc)return Wo;Wc=1;var e=h,t=Qo();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Wo.useSyncExternalStoreWithSelector=function(d,u,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(I){if(!b){if(b=!0,S=I,I=y(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return w=k}return w=I}if(k=w,n(S,I))return k;var P=y(I);return g!==void 0&&g(k,P)?(S=I,k):(S=I,w=P)}var b=!1,S,w,O=f===void 0?null:f;return[function(){return m(u())},O===null?void 0:function(){return m(O())}]},[u,f,y,g]);var v=s(d,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Wo}var Yo={};/**
440
+ */var Kc;function Ev(){if(Kc)return Ko;Kc=1;var e=h,t=Yo();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Ko.useSyncExternalStoreWithSelector=function(d,u,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(I){if(!b){if(b=!0,S=I,I=y(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return w=k}return w=I}if(k=w,n(S,I))return k;var P=y(I);return g!==void 0&&g(k,P)?(S=I,k):(S=I,w=P)}var b=!1,S,w,O=f===void 0?null:f;return[function(){return m(u())},O===null?void 0:function(){return m(O())}]},[u,f,y,g]);var v=s(d,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Ko}var Ro={};/**
441
441
  * @license React
442
442
  * use-sync-external-store-shim/with-selector.development.js
443
443
  *
@@ -445,22 +445,22 @@ to {
445
445
  *
446
446
  * This source code is licensed under the MIT license found in the
447
447
  * LICENSE file in the root directory of this source tree.
448
- */var Kc;function Dv(){return Kc||(Kc=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,r=Qo(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Yo.useSyncExternalStoreWithSelector=function(d,u,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(I){if(!b){if(b=!0,S=I,I=y(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return w=k}return w=I}if(k=w,n(S,I))return k;var P=y(I);return g!==void 0&&g(k,P)?(S=I,k):(S=I,w=P)}var b=!1,S,w,O=f===void 0?null:f;return[function(){return m(u())},O===null?void 0:function(){return m(O())}]},[u,f,y,g]);var v=s(d,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Yo}process.env.NODE_ENV==="production"?Ho.exports=Ev():Ho.exports=Dv();var Iv=Ho.exports;const Tv=Vc(Iv),Gc={},{useDebugValue:Nv}=h,{useSyncExternalStoreWithSelector:xv}=Tv;let Qc=!1;const kv=e=>e;function Av(e,t=kv,r){(Gc?"production":void 0)!=="production"&&r&&!Qc&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Qc=!0);const n=xv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Nv(n),n}const Yc=e=>{(Gc?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Sv(e):e,r=(n,s)=>Av(t,n,s);return Object.assign(r,t),r},di=e=>e?Yc(e):Yc,ce=di(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ce.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),Pv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ce},Symbol.toStringTag,{value:"Module"}));function Br(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 Rc(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=Rc(s.children,t,r+1);if(i>=0)return i}}return-1}const Mv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Xc(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Mv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Xc(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function Ro(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Ro(r.children,t):[]}))}function Zc(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:Zc(s.children,t,r,n)}:s})}function Jc(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?Jc(r.children,t):[]}})}function Lv(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 Fv(e,t){const r=Br(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Br(e,s.parent):void 0;return n}const xe=di((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=Br(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ce.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:Xc(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),ce.getState().setIsDirty(!0)},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=ce.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=Rc(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:Ro(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Zc(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Br(i.treeData,r);if(!o)return i;let a=Ro(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a}}),ce.getState().setIsDirty(!0)},addResource:(r,n)=>{var u,f,y;const s=ce.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Br(t().treeData,r.identifier))return!1;const a=((y=s==null?void 0:s.config)==null?void 0:y.maxContentsLimit)??1200;if(Lv(t().treeData)>=a)return!1;const d={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};return e(g=>({treeData:fi(g.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{ce.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=Jc(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Br(t().treeData,r),getChildrenOf:r=>{const n=Br(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Fv(t().treeData,r)})),$v=di(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),jv={spin:"_spin_1ah4d_9"},Bv=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:jv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Te=({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(Bv,{size:14}):null,i]}),Ne={overlay:"_overlay_w9xez_1",modal:"_modal_w9xez_11",modalHeader:"_modalHeader_w9xez_23",modalHeaderClose:"_modalHeaderClose_w9xez_33",modalBody:"_modalBody_w9xez_51",modalFooter:"_modalFooter_w9xez_58",checkRow:"_checkRow_w9xez_65",formGroup:"_formGroup_w9xez_108",textarea:"_textarea_w9xez_119",sliderGroup:"_sliderGroup_w9xez_140",sliderValue:"_sliderValue_w9xez_152",sliderLabels:"_sliderLabels_w9xez_160",sectionTitle:"_sectionTitle_w9xez_168"},Uv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ce(u=>{var f,y;return(y=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:y.objectType})||"Content",s=ce(u=>u.publishChecklist)??[],[i,o]=h.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Ne.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ne.modal,children:[l.jsxs("div",{className:Ne.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Ne.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ne.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Ne.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Ne.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(y=>({...y,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Ne.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Te,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},Vv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Ne.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ne.modal,children:[l.jsxs("div",{className:Ne.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Ne.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ne.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ne.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Ne.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:y=>a(Number(y.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Ne.sliderValue,children:o})]}),l.jsxs("div",{className:Ne.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Ne.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Ne.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:y=>i(y.target.value),rows:4})]})]}):l.jsxs("div",{className:Ne.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Ne.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:y=>i(y.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Ne.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Te,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function eu(e,t){return function(){return e.apply(t,arguments)}}const{toString:zv}=Object.prototype,{getPrototypeOf:gn}=Object,{iterator:us,toStringTag:tu}=Symbol,hi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ds=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),hi(r,t))return!0;r=gn(r)}return!1},qv=(e,t)=>e!=null&&ds(e,t)?e[t]:void 0,Xo=(e=>t=>{const r=zv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Kt=e=>(e=e.toLowerCase(),t=>Xo(t)===e),pi=e=>t=>typeof t===e,{isArray:Ur}=Array,yn=pi("undefined");function vn(e){return e!==null&&!yn(e)&&e.constructor!==null&&!yn(e.constructor)&&Et(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ru=Kt("ArrayBuffer");function Hv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ru(e.buffer),t}const Wv=pi("string"),Et=pi("function"),nu=pi("number"),mn=e=>e!==null&&typeof e=="object",Kv=e=>e===!0||e===!1,gi=e=>{if(!mn(e))return!1;const t=gn(e);return(t===null||t===Object.prototype||gn(t)===null)&&!ds(e,tu)&&!ds(e,us)},Gv=e=>{if(!mn(e)||vn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Qv=Kt("Date"),Yv=Kt("File"),Rv=e=>!!(e&&typeof e.uri<"u"),Xv=e=>e&&typeof e.getParts<"u",Zv=Kt("Blob"),Jv=Kt("FileList"),em=e=>mn(e)&&Et(e.pipe);function tm(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const su=tm(),iu=typeof su.FormData<"u"?su.FormData:void 0,rm=e=>{if(!e)return!1;if(iu&&e instanceof iu)return!0;const t=gn(e);if(!t||t===Object.prototype||!Et(e.append))return!1;const r=Xo(e);return r==="formdata"||r==="object"&&Et(e.toString)&&e.toString()==="[object FormData]"},nm=Kt("URLSearchParams"),[sm,im,om,am]=["ReadableStream","Request","Response","Headers"].map(Kt),lm=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Ur(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(vn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function ou(e,t){if(vn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,au=e=>!yn(e)&&e!==Vr;function Zo(...e){const{caseless:t,skipUndefined:r}=au(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&ou(n,o)||o,c=hi(n,a)?n[a]:void 0;gi(c)&&gi(i)?n[a]=Zo(c,i):gi(i)?n[a]=Zo({},i):Ur(i)?n[a]=i.slice():(!r||!yn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||vn(a)||(fs(a,s),typeof a!="object"||Ur(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];_m.call(a,u)&&s(a[u],u)}}return n}const cm=(e,t,r,{allOwnKeys:n}={})=>(fs(t,(s,i)=>{r&&Et(s)?Object.defineProperty(e,i,{__proto__:null,value:eu(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),um=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),dm=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},fm=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&gn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},hm=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},pm=e=>{if(!e)return null;if(Ur(e))return e;let t=e.length;if(!nu(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},gm=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gn(Uint8Array)),ym=(e,t)=>{const n=(e&&e[us]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},vm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},mm=Kt("HTMLFormElement"),bm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:_m}=Object.prototype,wm=Kt("RegExp"),lu=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};fs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Sm=e=>{lu(e,(t,r)=>{if(Et(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Et(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Cm=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Ur(e)?n(e):n(String(e).split(t)),r},Om=()=>{},Em=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Dm(e){return!!(e&&Et(e.append)&&e[tu]==="FormData"&&e[us])}const Im=e=>{const t=new WeakSet,r=n=>{if(mn(n)){if(t.has(n))return;if(vn(n))return n;if(!("toJSON"in n)){t.add(n);const s=Ur(n)?[]:{};return fs(n,(i,o)=>{const a=r(i);!yn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Tm=Kt("AsyncFunction"),Nm=e=>e&&(mn(e)||Et(e))&&Et(e.then)&&Et(e.catch),cu=((e,t)=>e?setImmediate:t?((r,n)=>(Vr.addEventListener("message",({source:s,data:i})=>{s===Vr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Vr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Et(Vr.postMessage)),xm=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||cu,uu=e=>e!=null&&Et(e[us]),D={isArray:Ur,isArrayBuffer:ru,isBuffer:vn,isFormData:rm,isArrayBufferView:Hv,isString:Wv,isNumber:nu,isBoolean:Kv,isObject:mn,isPlainObject:gi,isEmptyObject:Gv,isReadableStream:sm,isRequest:im,isResponse:om,isHeaders:am,isUndefined:yn,isDate:Qv,isFile:Yv,isReactNativeBlob:Rv,isReactNative:Xv,isBlob:Zv,isRegExp:wm,isFunction:Et,isStream:em,isURLSearchParams:nm,isTypedArray:gm,isFileList:Jv,forEach:fs,merge:Zo,extend:cm,trim:lm,stripBOM:um,inherits:dm,toFlatObject:fm,kindOf:Xo,kindOfTest:Kt,endsWith:hm,toArray:pm,forEachEntry:ym,matchAll:vm,isHTMLForm:mm,hasOwnProperty:hi,hasOwnProp:hi,hasOwnInPrototypeChain:ds,getSafeProp:qv,reduceDescriptors:lu,freezeMethods:Sm,toObjectSet:Cm,toCamelCase:bm,noop:Om,toFiniteNumber:Em,findKey:ou,global:Vr,isContextDefined:au,isSpecCompliantForm:Dm,toJSONObject:Im,isAsyncFn:Tm,isThenable:Nm,setImmediate:cu,asap:xm,isIterable:uu,isSafeIterable:e=>e!=null&&ds(e,us)&&uu(e)},km=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Am=e=>{const t={};let r,n,s;return e&&e.split(`
449
- `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&km[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Pm(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const Mm=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Lm=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Jo(e,t){return D.isArray(e)?e.map(r=>Jo(r,t)):Pm(String(e).replace(t,""))}const Fm=e=>Jo(e,Mm),$m=e=>Jo(e,Lm);function du(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=$m(r)}),t}const fu=Symbol("internals");function hs(e){return e&&String(e).trim().toLowerCase()}function yi(e){return e===!1||e==null?e:D.isArray(e)?e.map(yi):Fm(String(e))}function jm(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Bm=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ea(e,t,r,n,s){if(D.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!D.isString(t)){if(D.isString(n))return t.indexOf(n)!==-1;if(D.isRegExp(n))return n.test(t)}}function Um(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Vm(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let ct=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=hs(c);if(!u)return;const f=D.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=yi(a))}const o=(a,c)=>D.forEach(a,(d,u)=>i(d,u,c));if(D.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(D.isString(t)&&(t=t.trim())&&!Bm(t))o(Am(t),r);else if(D.isObject(t)&&D.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!D.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],D.hasOwnProp(a,d)?(c=a[d],a[d]=D.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=hs(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return jm(s);if(D.isFunction(r))return r.call(this,s,n);if(D.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=hs(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||ea(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=hs(o),o){const a=D.findKey(n,o);a&&(!r||ea(n,n[a],a,r))&&(delete n[a],s=!0)}}return D.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||ea(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return D.forEach(this,(s,i)=>{const o=D.findKey(n,i);if(o){r[o]=yi(s),delete r[i];return}const a=t?Um(i):String(i).trim();a!==i&&delete r[i],r[a]=yi(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return D.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&D.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
450
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[fu]=this[fu]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=hs(o);n[a]||(Vm(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};ct.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(ct.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),D.freezeMethods(ct);const zm="[REDACTED ****]";function qm(e){if(D.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(D.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Hm(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||D.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof ct&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);D.isUndefined(d)||(o[c]=d)});else{if(!D.isPlainObject(i)&&qm(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?zm:s(c);D.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let Z=class Rh extends Error{static from(t,r,n,s,i,o){const a=new Rh(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&D.hasOwnProp(t,"redact")?t.redact:void 0,n=D.isArray(r)&&r.length>0?Hm(t,r):D.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Z.ERR_BAD_OPTION="ERR_BAD_OPTION",Z.ECONNABORTED="ECONNABORTED",Z.ETIMEDOUT="ETIMEDOUT",Z.ECONNREFUSED="ECONNREFUSED",Z.ERR_NETWORK="ERR_NETWORK",Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Z.ERR_DEPRECATED="ERR_DEPRECATED",Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Z.ERR_CANCELED="ERR_CANCELED",Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Z.ERR_INVALID_URL="ERR_INVALID_URL",Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Wm=null,hu=100;function ta(e){return D.isPlainObject(e)||D.isArray(e)}function pu(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function ra(e,t,r){return e?e.concat(t).map(function(s,i){return s=pu(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Km(e){return D.isArray(e)&&!e.some(ta)}const Gm=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function vi(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!D.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?hu:r.maxDepth,d=a&&D.isSpecCompliantForm(t),u=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(D.isDate(m))return m.toISOString();if(D.isBoolean(m))return m.toString();if(!d&&D.isBlob(m))throw new Z("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(m)||D.isTypedArray(m)?d&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function y(m){if(m>c)throw new Z("Object is too deeply nested ("+m+" levels). Max depth: "+c,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(m,b){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(O,I){if(!D.isObject(I))return I;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(I),y(b+S.length-1),I})}function _(m,b,S){let w=m;if(D.isReactNative(t)&&D.isReactNativeBlob(m))return t.append(ra(S,b,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(D.endsWith(b,"{}"))b=n?b:b.slice(0,-2),m=g(m,1);else if(D.isArray(m)&&Km(m)||(D.isFileList(m)||D.endsWith(b,"[]"))&&(w=D.toArray(m)))return b=pu(b),w.forEach(function(I,k){!(D.isUndefined(I)||I===null)&&t.append(o===!0?ra([b],k,i):o===null?b:b+"[]",f(I))}),!1}return ta(m)?!0:(t.append(ra(S,b,i),f(m)),!1)}const p=Object.assign(Gm,{defaultVisitor:_,convertValue:f,isVisitable:ta});function v(m,b,S=0){if(!D.isUndefined(m)){if(y(S),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(m),D.forEach(m,function(O,I){(!(D.isUndefined(O)||O===null)&&s.call(t,O,D.isString(I)?I.trim():I,b,p))===!0&&v(O,b?b.concat(I):[I],S+1)}),u.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return v(e),t}function gu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function na(e,t){this._pairs=[],e&&vi(e,this,t)}const yu=na.prototype;yu.append=function(t,r){this._pairs.push([t,r])},yu.toString=function(t){const r=t?function(n){return t.call(this,n,gu)}:gu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Qm(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function vu(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||Qm,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new na(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class mu{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){D.forEach(this.handlers,function(n){n!==null&&t(n)})}}const sa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ym={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:na,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ia=typeof window<"u"&&typeof document<"u",oa=typeof navigator=="object"&&navigator||void 0,Rm=ia&&(!oa||["ReactNative","NativeScript","NS"].indexOf(oa.product)<0),Xm=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zm=ia&&window.location.href||"http://localhost",it={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ia,hasStandardBrowserEnv:Rm,hasStandardBrowserWebWorkerEnv:Xm,navigator:oa,origin:Zm},Symbol.toStringTag,{value:"Module"})),...Ym};function Jm(e,t){return vi(e,new it.classes.URLSearchParams,{visitor:function(r,n,s,i){return it.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const bu=hu;function _u(e){if(e>bu)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+bu,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function eb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)_u(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function tb(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function wu(e){function t(r,n,s,i){_u(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&D.isArray(s)?s.length:o,c?(D.hasOwnProp(s,o)?s[o]=D.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!D.hasOwnProp(s,o)||!D.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&D.isArray(s[o])&&(s[o]=tb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(eb(n),s,r,0)}),r}return null}const bn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function rb(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const ps={transitional:sa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=D.isObject(t);if(i&&D.isHTMLForm(t)&&(t=new FormData(t)),D.isFormData(t))return s?JSON.stringify(wu(t)):t;if(D.isArrayBuffer(t)||D.isBuffer(t)||D.isStream(t)||D.isFile(t)||D.isBlob(t)||D.isReadableStream(t))return t;if(D.isArrayBufferView(t))return t.buffer;if(D.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=bn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jm(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=bn(this,"env"),u=d&&d.FormData;return vi(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),rb(t)):t}],transformResponse:[function(t){const r=bn(this,"transitional")||ps.transitional,n=r&&r.forcedJSONParsing,s=bn(this,"responseType"),i=s==="json";if(D.isResponse(t)||D.isReadableStream(t))return t;if(t&&D.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,bn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Z.from(c,Z.ERR_BAD_RESPONSE,this,null,bn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:it.classes.FormData,Blob:it.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch","query"],e=>{ps.headers[e]={}});function aa(e,t){const r=this||ps,n=t||r,s=ct.from(n.headers);let i=n.data;return D.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Su(e){return!!(e&&e.__CANCEL__)}let gs=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Cu(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Z("Request failed with status code "+r.status,r.status>=400&&r.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,r.config,r.request,r))}function nb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function sb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,y=0;for(;f!==s;)y+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const g=u&&d-u;return g?Math.round(y*1e3/g):void 0}}function ib(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const mi=(e,t,r=3)=>{let n=0;const s=sb(50,250);return ib(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},Ou=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Eu=e=>(...t)=>D.asap(()=>e(...t)),ob=it.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,it.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,ab=it.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];D.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),D.isString(n)&&a.push(`path=${n}`),D.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),D.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function lb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function cb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const ub=/^https?:(?!\/\/)/i,db=/[\t\n\r]/g;function fb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function hb(e){return fb(e).replace(db,"")}function Du(e,t){if(typeof e=="string"&&ub.test(hb(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Iu(e,t,r,n){Du(t,n);let s=!lb(t);return e&&(s||r===!1)?(Du(e,n),cb(e,t)):t}const Tu=e=>e instanceof ct?{...e}:e;function zr(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,y,g){return D.isPlainObject(u)&&D.isPlainObject(f)?D.merge.call({caseless:g},u,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(u,f,y,g){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u,y,g)}else return n(u,f,y,g)}function i(u,f){if(!D.isUndefined(f))return n(void 0,f)}function o(u,f){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,u))return f[u]}else return;const y=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(y)&&D.hasOwnProp(y,u))return y[u]}function c(u,f,y){if(D.hasOwnProp(t,y))return n(u,f);if(D.hasOwnProp(e,y))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,y)=>s(Tu(u),Tu(f),y,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const y=D.hasOwnProp(d,f)?d[f]:s,g=D.hasOwnProp(e,f)?e[f]:void 0,_=D.hasOwnProp(t,f)?t[f]:void 0,p=y(g,_,f);D.isUndefined(p)&&y!==c||(r[f]=p)}),D.hasOwnProp(t,"validateStatus")&&D.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(D.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const pb=["content-type","content-length"];function gb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{pb.includes(n.toLowerCase())&&e.set(n,s)})}const yb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Nu(e){const t=zr({},e),r=y=>D.hasOwnProp(t,y)?t[y]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=ct.from(a),t.url=vu(Iu(d,f,u,t),r("params"),r("paramsSerializer")),c){const y=D.getSafeProp(c,"username")||"",g=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(y+":"+(g?yb(g):"")))}if(D.isFormData(n)&&(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&gb(a,n.getHeaders(),r("formDataHeaderPolicy"))),it.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&ob(t.url))){const g=i&&o&&ab.read(o);g&&a.set(i,g)}return t}const vb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=Nu(e);let i=s.data;const o=ct.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,y,g,_;function p(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=ct.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:S,config:e,request:v};Cu(function(k){r(k),p()},function(k){n(k),p()},O),v=null}"onloadend"in v?v.onloadend=m:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(m)},v.onabort=function(){v&&(n(new Z("Request aborted",Z.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const O=w&&w.message?w.message:"Network Error",I=new Z(O,Z.ERR_NETWORK,e,v);I.event=w||null,n(I),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||sa;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Z(w,O.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&D.forEach(du(o),function(w,O){v.setRequestHeader(O,w)}),D.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),d&&([y,_]=mi(d,!0),v.addEventListener("progress",y)),c&&v.upload&&([f,g]=mi(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=S=>{v&&(n(!S||S.type?new gs(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=nb(s.url);if(b&&!it.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}v.send(i||null)})},mb=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof Z?d:new gs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>D.asap(o),a},bb=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},_b=async function*(e,t){for await(const r of wb(e))yield*bb(r,t)},wb=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},xu=(e,t,r,n)=>{const s=_b(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let y=i+=f;r(y)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},bi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Sb=(e,t,r)=>t+2<r&&bi(e.charCodeAt(t+1))&&bi(e.charCodeAt(t+2));function Cb(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let g=0;g<a;g++)if(n.charCodeAt(g)===37&&g+2<a){const _=n.charCodeAt(g+1),p=n.charCodeAt(g+2);bi(_)&&bi(p)&&(o-=2,g+=2)}let c=0,d=a-1;const u=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const y=Math.floor(o/4)*3-(c||0);return y>0?y:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Sb(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const la="1.18.0",ku=64*1024,{isFunction:_i}=D,Ob=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Au=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Pu=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Eb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Db=e=>{const t=D.global!==void 0&&D.global!==null?D.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=D.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?_i(s):typeof fetch=="function",c=_i(i),d=_i(o);if(!a)return!1;const u=a&&_i(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),y=c&&u&&Pu(()=>{let m=!1;const b=new i(it.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!S}),g=d&&u&&Pu(()=>D.isReadableStream(new o("").body)),_={stream:g&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!_[m]&&(_[m]=(b,S)=>{let w=b&&b[m];if(w)return w.call(b);throw new Z(`Response type '${m}' is not supported`,Z.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(D.isBlob(m))return m.size;if(D.isSpecCompliantForm(m))return(await new i(it.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(D.isArrayBufferView(m)||D.isArrayBuffer(m))return m.byteLength;if(D.isURLSearchParams(m)&&(m=m+""),D.isString(m))return(await f(m)).byteLength},v=async(m,b)=>{const S=D.toFiniteNumber(m.getContentLength());return S??p(b)};return async m=>{let{url:b,method:S,data:w,signal:O,cancelToken:I,timeout:k,onDownloadProgress:P,onUploadProgress:B,responseType:N,headers:M,withCredentials:V="same-origin",fetchOptions:A,maxContentLength:U,maxBodyLength:j}=Nu(m);const J=D.isNumber(U)&&U>-1,se=D.isNumber(j)&&j>-1,ge=K=>D.hasOwnProp(m,K)?m[K]:void 0;let _e=s||fetch;N=N?(N+"").toLowerCase():"text";let we=mb([O,I&&I.toAbortSignal()],k),G=null;const L=we&&we.unsubscribe&&(()=>{we.unsubscribe()});let X,F=null;const Y=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,m,G);try{let K;const oe=ge("auth");if(oe){const te=D.getSafeProp(oe,"username")||"",Ye=D.getSafeProp(oe,"password")||"";K={username:te,password:Ye}}if(Eb(b)){const te=new URL(b,it.origin);if(!K&&(te.username||te.password)){const Ye=Au(te.username),vt=Au(te.password);K={username:Ye,password:vt}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(K&&(M.delete("authorization"),M.set("Authorization","Basic "+btoa(Ob((K.username||"")+":"+(K.password||""))))),J&&typeof b=="string"&&b.startsWith("data:")&&Cb(b)>U)throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G);if(se&&S!=="get"&&S!=="head"){const te=await p(w);if(typeof te=="number"&&isFinite(te)&&(X=te,te>j))throw Y()}const Se=se&&(D.isReadableStream(w)||D.isStream(w)),Ae=(te,Ye,vt)=>xu(te,ku,St=>{if(se&&St>j)throw F=Y();Ye&&Ye(St)},vt);if(y&&S!=="get"&&S!=="head"&&(B||Se)){if(X=X??await v(M,w),X!==0||Se){let te=new i(b,{method:"POST",body:w,duplex:"half"}),Ye;if(D.isFormData(w)&&(Ye=te.headers.get("content-type"))&&M.setContentType(Ye),te.body){const[vt,St]=B&&Ou(X,mi(Eu(B)))||[];w=Ae(te.body,vt,St)}}}else if(Se&&!c&&u&&S!=="get"&&S!=="head")w=Ae(w);else if(Se&&c&&!y&&S!=="get"&&S!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,m,G);D.isString(V)||(V=V?"include":"omit");const ie=c&&"credentials"in i.prototype;if(D.isFormData(w)){const te=M.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&M.delete("content-type")}M.set("User-Agent","axios/"+la,!1);const ne={...A,signal:we,method:S.toUpperCase(),headers:du(M.normalize()),body:w,duplex:"half",credentials:ie?V:void 0};G=c&&new i(b,ne);let de=await(c?_e(G,A):_e(b,ne));const je=ct.from(de.headers);if(J){const te=D.toFiniteNumber(je.getContentLength());if(te!=null&&te>U)throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G)}const Ke=g&&(N==="stream"||N==="response");if(g&&de.body&&(P||J||Ke&&L)){const te={};["status","statusText","headers"].forEach(mt=>{te[mt]=de[mt]});const Ye=D.toFiniteNumber(je.getContentLength()),[vt,St]=P&&Ou(Ye,mi(Eu(P),!0))||[];let Ge=0;const rt=mt=>{if(J&&(Ge=mt,Ge>U))throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G);vt&&vt(mt)};de=new o(xu(de.body,ku,rt,()=>{St&&St(),L&&L()}),te)}N=N||"text";let Pe=await _[D.findKey(_,N)||"text"](de,m);if(J&&!g&&!Ke){let te;if(Pe!=null&&(typeof Pe.byteLength=="number"?te=Pe.byteLength:typeof Pe.size=="number"?te=Pe.size:typeof Pe=="string"&&(te=typeof n=="function"?new n().encode(Pe).byteLength:Pe.length)),typeof te=="number"&&te>U)throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G)}return!Ke&&L&&L(),await new Promise((te,Ye)=>{Cu(te,Ye,{data:Pe,headers:ct.from(de.headers),status:de.status,statusText:de.statusText,config:m,request:G})})}catch(K){if(L&&L(),we&&we.aborted&&we.reason instanceof Z){const oe=we.reason;throw oe.config=m,G&&(oe.request=G),K!==oe&&(oe.cause=K),oe}throw F?(G&&!F.request&&(F.request=G),F):K instanceof Z?(G&&!K.request&&(K.request=G),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,m,G,K&&K.response),{cause:K.cause||K}):Z.from(K,K&&K.code,m,G,K&&K.response)}}},Ib=new Map,Mu=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=Ib;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Db(t)),u=d;return d};Mu();const ca={http:Wm,xhr:vb,fetch:{get:Mu}};D.forEach(ca,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Lu=e=>`- ${e}`,Tb=e=>D.isFunction(e)||e===null||e===!1;function Nb(e,t){e=D.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Tb(n)&&(s=ca[(a=String(n)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(D.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
- `+o.map(Lu).join(`
452
- `):" "+Lu(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Fu={getAdapter:Nb,adapters:ca};function ua(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new gs(null,e)}function $u(e){return ua(e),e.headers=ct.from(e.headers),e.data=aa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Fu.getAdapter(e.adapter||ps.adapter,e)(e).then(function(n){ua(e),e.response=n;try{n.data=aa.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=ct.from(n.headers),n},function(n){if(!Su(n)&&(ua(e),n&&n.response)){e.response=n.response;try{n.response.data=aa.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=ct.from(n.response.headers)}return Promise.reject(n)})}const wi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ju={};wi.transitional=function(t,r,n){function s(i,o){return"[Axios v"+la+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(r?" in "+r:"")),Z.ERR_DEPRECATED);return r&&!ju[o]&&(ju[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}},wi.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function xb(e,t,r){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new Z("option "+i+" must be "+c,Z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const Si={assertOptions:xb,validators:wi},ut=Si.validators;let qr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new mu,response:new mu}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
448
+ */var Gc;function Dv(){return Gc||(Gc=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,r=Yo(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Ro.useSyncExternalStoreWithSelector=function(d,u,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(I){if(!b){if(b=!0,S=I,I=y(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return w=k}return w=I}if(k=w,n(S,I))return k;var P=y(I);return g!==void 0&&g(k,P)?(S=I,k):(S=I,w=P)}var b=!1,S,w,O=f===void 0?null:f;return[function(){return m(u())},O===null?void 0:function(){return m(O())}]},[u,f,y,g]);var v=s(d,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ro}process.env.NODE_ENV==="production"?Wo.exports=Ev():Wo.exports=Dv();var Iv=Wo.exports;const Tv=zc(Iv),Qc={},{useDebugValue:Nv}=h,{useSyncExternalStoreWithSelector:xv}=Tv;let Yc=!1;const kv=e=>e;function Av(e,t=kv,r){(Qc?"production":void 0)!=="production"&&r&&!Yc&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Yc=!0);const n=xv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Nv(n),n}const Rc=e=>{(Qc?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Sv(e):e,r=(n,s)=>Av(t,n,s);return Object.assign(r,t),r},di=e=>e?Rc(e):Rc,ce=di(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ce.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),Pv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ce},Symbol.toStringTag,{value:"Module"}));function Br(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 Xc(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=Xc(s.children,t,r+1);if(i>=0)return i}}return-1}const Mv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Zc(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Mv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Zc(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function Xo(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Xo(r.children,t):[]}))}function Jc(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:Jc(s.children,t,r,n)}:s})}function eu(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?eu(r.children,t):[]}})}function Lv(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 Fv(e,t){const r=Br(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Br(e,s.parent):void 0;return n}const xe=di((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=Br(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ce.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:Zc(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),ce.getState().setIsDirty(!0)},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=ce.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=Xc(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:Xo(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Jc(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Br(i.treeData,r);if(!o)return i;let a=Xo(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a}}),ce.getState().setIsDirty(!0)},addResource:(r,n)=>{var u,f,y;const s=ce.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Br(t().treeData,r.identifier))return!1;const a=((y=s==null?void 0:s.config)==null?void 0:y.maxContentsLimit)??1200;if(Lv(t().treeData)>=a)return!1;const d={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};return e(g=>({treeData:fi(g.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{ce.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=eu(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Br(t().treeData,r),getChildrenOf:r=>{const n=Br(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Fv(t().treeData,r)})),$v=di(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),jv={spin:"_spin_1ah4d_9"},Bv=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:jv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Te=({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(Bv,{size:14}):null,i]}),Ne={overlay:"_overlay_w9xez_1",modal:"_modal_w9xez_11",modalHeader:"_modalHeader_w9xez_23",modalHeaderClose:"_modalHeaderClose_w9xez_33",modalBody:"_modalBody_w9xez_51",modalFooter:"_modalFooter_w9xez_58",checkRow:"_checkRow_w9xez_65",formGroup:"_formGroup_w9xez_108",textarea:"_textarea_w9xez_119",sliderGroup:"_sliderGroup_w9xez_140",sliderValue:"_sliderValue_w9xez_152",sliderLabels:"_sliderLabels_w9xez_160",sectionTitle:"_sectionTitle_w9xez_168"},Uv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ce(u=>{var f,y;return(y=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:y.objectType})||"Content",s=ce(u=>u.publishChecklist)??[],[i,o]=h.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Ne.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ne.modal,children:[l.jsxs("div",{className:Ne.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Ne.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ne.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Ne.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Ne.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(y=>({...y,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Ne.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Te,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},Vv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Ne.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ne.modal,children:[l.jsxs("div",{className:Ne.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Ne.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ne.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ne.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Ne.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:y=>a(Number(y.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Ne.sliderValue,children:o})]}),l.jsxs("div",{className:Ne.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Ne.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Ne.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:y=>i(y.target.value),rows:4})]})]}):l.jsxs("div",{className:Ne.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Ne.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:y=>i(y.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Ne.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Te,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function tu(e,t){return function(){return e.apply(t,arguments)}}const{toString:zv}=Object.prototype,{getPrototypeOf:gn}=Object,{iterator:cs,toStringTag:ru}=Symbol,hi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),us=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),hi(r,t))return!0;r=gn(r)}return!1},qv=(e,t)=>e!=null&&us(e,t)?e[t]:void 0,Zo=(e=>t=>{const r=zv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Kt=e=>(e=e.toLowerCase(),t=>Zo(t)===e),pi=e=>t=>typeof t===e,{isArray:Ur}=Array,yn=pi("undefined");function vn(e){return e!==null&&!yn(e)&&e.constructor!==null&&!yn(e.constructor)&&Et(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const nu=Kt("ArrayBuffer");function Hv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&nu(e.buffer),t}const Wv=pi("string"),Et=pi("function"),su=pi("number"),mn=e=>e!==null&&typeof e=="object",Kv=e=>e===!0||e===!1,gi=e=>{if(!mn(e))return!1;const t=gn(e);return(t===null||t===Object.prototype||gn(t)===null)&&!us(e,ru)&&!us(e,cs)},Gv=e=>{if(!mn(e)||vn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Qv=Kt("Date"),Yv=Kt("File"),Rv=e=>!!(e&&typeof e.uri<"u"),Xv=e=>e&&typeof e.getParts<"u",Zv=Kt("Blob"),Jv=Kt("FileList"),em=e=>mn(e)&&Et(e.pipe);function tm(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const iu=tm(),ou=typeof iu.FormData<"u"?iu.FormData:void 0,rm=e=>{if(!e)return!1;if(ou&&e instanceof ou)return!0;const t=gn(e);if(!t||t===Object.prototype||!Et(e.append))return!1;const r=Zo(e);return r==="formdata"||r==="object"&&Et(e.toString)&&e.toString()==="[object FormData]"},nm=Kt("URLSearchParams"),[sm,im,om,am]=["ReadableStream","Request","Response","Headers"].map(Kt),lm=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ds(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Ur(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(vn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function au(e,t){if(vn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lu=e=>!yn(e)&&e!==Vr;function Jo(...e){const{caseless:t,skipUndefined:r}=lu(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&au(n,o)||o,c=hi(n,a)?n[a]:void 0;gi(c)&&gi(i)?n[a]=Jo(c,i):gi(i)?n[a]=Jo({},i):Ur(i)?n[a]=i.slice():(!r||!yn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||vn(a)||(ds(a,s),typeof a!="object"||Ur(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];_m.call(a,u)&&s(a[u],u)}}return n}const cm=(e,t,r,{allOwnKeys:n}={})=>(ds(t,(s,i)=>{r&&Et(s)?Object.defineProperty(e,i,{__proto__:null,value:tu(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),um=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),dm=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},fm=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&gn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},hm=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},pm=e=>{if(!e)return null;if(Ur(e))return e;let t=e.length;if(!su(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},gm=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gn(Uint8Array)),ym=(e,t)=>{const n=(e&&e[cs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},vm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},mm=Kt("HTMLFormElement"),bm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:_m}=Object.prototype,wm=Kt("RegExp"),cu=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ds(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Sm=e=>{cu(e,(t,r)=>{if(Et(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Et(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Cm=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Ur(e)?n(e):n(String(e).split(t)),r},Om=()=>{},Em=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Dm(e){return!!(e&&Et(e.append)&&e[ru]==="FormData"&&e[cs])}const Im=e=>{const t=new WeakSet,r=n=>{if(mn(n)){if(t.has(n))return;if(vn(n))return n;if(!("toJSON"in n)){t.add(n);const s=Ur(n)?[]:{};return ds(n,(i,o)=>{const a=r(i);!yn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Tm=Kt("AsyncFunction"),Nm=e=>e&&(mn(e)||Et(e))&&Et(e.then)&&Et(e.catch),uu=((e,t)=>e?setImmediate:t?((r,n)=>(Vr.addEventListener("message",({source:s,data:i})=>{s===Vr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Vr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Et(Vr.postMessage)),xm=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||uu,du=e=>e!=null&&Et(e[cs]),D={isArray:Ur,isArrayBuffer:nu,isBuffer:vn,isFormData:rm,isArrayBufferView:Hv,isString:Wv,isNumber:su,isBoolean:Kv,isObject:mn,isPlainObject:gi,isEmptyObject:Gv,isReadableStream:sm,isRequest:im,isResponse:om,isHeaders:am,isUndefined:yn,isDate:Qv,isFile:Yv,isReactNativeBlob:Rv,isReactNative:Xv,isBlob:Zv,isRegExp:wm,isFunction:Et,isStream:em,isURLSearchParams:nm,isTypedArray:gm,isFileList:Jv,forEach:ds,merge:Jo,extend:cm,trim:lm,stripBOM:um,inherits:dm,toFlatObject:fm,kindOf:Zo,kindOfTest:Kt,endsWith:hm,toArray:pm,forEachEntry:ym,matchAll:vm,isHTMLForm:mm,hasOwnProperty:hi,hasOwnProp:hi,hasOwnInPrototypeChain:us,getSafeProp:qv,reduceDescriptors:cu,freezeMethods:Sm,toObjectSet:Cm,toCamelCase:bm,noop:Om,toFiniteNumber:Em,findKey:au,global:Vr,isContextDefined:lu,isSpecCompliantForm:Dm,toJSONObject:Im,isAsyncFn:Tm,isThenable:Nm,setImmediate:uu,asap:xm,isIterable:du,isSafeIterable:e=>e!=null&&us(e,cs)&&du(e)},km=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Am=e=>{const t={};let r,n,s;return e&&e.split(`
449
+ `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&km[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Pm(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const Mm=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Lm=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ea(e,t){return D.isArray(e)?e.map(r=>ea(r,t)):Pm(String(e).replace(t,""))}const Fm=e=>ea(e,Mm),$m=e=>ea(e,Lm);function fu(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=$m(r)}),t}const hu=Symbol("internals");function fs(e){return e&&String(e).trim().toLowerCase()}function yi(e){return e===!1||e==null?e:D.isArray(e)?e.map(yi):Fm(String(e))}function jm(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Bm=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ta(e,t,r,n,s){if(D.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!D.isString(t)){if(D.isString(n))return t.indexOf(n)!==-1;if(D.isRegExp(n))return n.test(t)}}function Um(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Vm(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let ct=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=fs(c);if(!u)return;const f=D.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=yi(a))}const o=(a,c)=>D.forEach(a,(d,u)=>i(d,u,c));if(D.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(D.isString(t)&&(t=t.trim())&&!Bm(t))o(Am(t),r);else if(D.isObject(t)&&D.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!D.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],D.hasOwnProp(a,d)?(c=a[d],a[d]=D.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=fs(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return jm(s);if(D.isFunction(r))return r.call(this,s,n);if(D.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=fs(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||ta(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=fs(o),o){const a=D.findKey(n,o);a&&(!r||ta(n,n[a],a,r))&&(delete n[a],s=!0)}}return D.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||ta(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return D.forEach(this,(s,i)=>{const o=D.findKey(n,i);if(o){r[o]=yi(s),delete r[i];return}const a=t?Um(i):String(i).trim();a!==i&&delete r[i],r[a]=yi(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return D.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&D.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
450
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[hu]=this[hu]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=fs(o);n[a]||(Vm(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};ct.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(ct.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),D.freezeMethods(ct);const zm="[REDACTED ****]";function qm(e){if(D.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(D.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Hm(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||D.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof ct&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);D.isUndefined(d)||(o[c]=d)});else{if(!D.isPlainObject(i)&&qm(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?zm:s(c);D.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let Z=class Rh extends Error{static from(t,r,n,s,i,o){const a=new Rh(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&D.hasOwnProp(t,"redact")?t.redact:void 0,n=D.isArray(r)&&r.length>0?Hm(t,r):D.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Z.ERR_BAD_OPTION="ERR_BAD_OPTION",Z.ECONNABORTED="ECONNABORTED",Z.ETIMEDOUT="ETIMEDOUT",Z.ECONNREFUSED="ECONNREFUSED",Z.ERR_NETWORK="ERR_NETWORK",Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Z.ERR_DEPRECATED="ERR_DEPRECATED",Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Z.ERR_CANCELED="ERR_CANCELED",Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Z.ERR_INVALID_URL="ERR_INVALID_URL",Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Wm=null,pu=100;function ra(e){return D.isPlainObject(e)||D.isArray(e)}function gu(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function na(e,t,r){return e?e.concat(t).map(function(s,i){return s=gu(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Km(e){return D.isArray(e)&&!e.some(ra)}const Gm=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function vi(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!D.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?pu:r.maxDepth,d=a&&D.isSpecCompliantForm(t),u=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(D.isDate(m))return m.toISOString();if(D.isBoolean(m))return m.toString();if(!d&&D.isBlob(m))throw new Z("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(m)||D.isTypedArray(m)?d&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function y(m){if(m>c)throw new Z("Object is too deeply nested ("+m+" levels). Max depth: "+c,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(m,b){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(O,I){if(!D.isObject(I))return I;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(I),y(b+S.length-1),I})}function _(m,b,S){let w=m;if(D.isReactNative(t)&&D.isReactNativeBlob(m))return t.append(na(S,b,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(D.endsWith(b,"{}"))b=n?b:b.slice(0,-2),m=g(m,1);else if(D.isArray(m)&&Km(m)||(D.isFileList(m)||D.endsWith(b,"[]"))&&(w=D.toArray(m)))return b=gu(b),w.forEach(function(I,k){!(D.isUndefined(I)||I===null)&&t.append(o===!0?na([b],k,i):o===null?b:b+"[]",f(I))}),!1}return ra(m)?!0:(t.append(na(S,b,i),f(m)),!1)}const p=Object.assign(Gm,{defaultVisitor:_,convertValue:f,isVisitable:ra});function v(m,b,S=0){if(!D.isUndefined(m)){if(y(S),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(m),D.forEach(m,function(O,I){(!(D.isUndefined(O)||O===null)&&s.call(t,O,D.isString(I)?I.trim():I,b,p))===!0&&v(O,b?b.concat(I):[I],S+1)}),u.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return v(e),t}function yu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function sa(e,t){this._pairs=[],e&&vi(e,this,t)}const vu=sa.prototype;vu.append=function(t,r){this._pairs.push([t,r])},vu.toString=function(t){const r=t?function(n){return t.call(this,n,yu)}:yu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Qm(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mu(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||Qm,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new sa(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class bu{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){D.forEach(this.handlers,function(n){n!==null&&t(n)})}}const ia={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ym={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:sa,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},oa=typeof window<"u"&&typeof document<"u",aa=typeof navigator=="object"&&navigator||void 0,Rm=oa&&(!aa||["ReactNative","NativeScript","NS"].indexOf(aa.product)<0),Xm=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zm=oa&&window.location.href||"http://localhost",it={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:oa,hasStandardBrowserEnv:Rm,hasStandardBrowserWebWorkerEnv:Xm,navigator:aa,origin:Zm},Symbol.toStringTag,{value:"Module"})),...Ym};function Jm(e,t){return vi(e,new it.classes.URLSearchParams,{visitor:function(r,n,s,i){return it.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const _u=pu;function wu(e){if(e>_u)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+_u,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function eb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)wu(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function tb(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function Su(e){function t(r,n,s,i){wu(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&D.isArray(s)?s.length:o,c?(D.hasOwnProp(s,o)?s[o]=D.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!D.hasOwnProp(s,o)||!D.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&D.isArray(s[o])&&(s[o]=tb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(eb(n),s,r,0)}),r}return null}const bn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function rb(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const hs={transitional:ia,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=D.isObject(t);if(i&&D.isHTMLForm(t)&&(t=new FormData(t)),D.isFormData(t))return s?JSON.stringify(Su(t)):t;if(D.isArrayBuffer(t)||D.isBuffer(t)||D.isStream(t)||D.isFile(t)||D.isBlob(t)||D.isReadableStream(t))return t;if(D.isArrayBufferView(t))return t.buffer;if(D.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=bn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jm(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=bn(this,"env"),u=d&&d.FormData;return vi(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),rb(t)):t}],transformResponse:[function(t){const r=bn(this,"transitional")||hs.transitional,n=r&&r.forcedJSONParsing,s=bn(this,"responseType"),i=s==="json";if(D.isResponse(t)||D.isReadableStream(t))return t;if(t&&D.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,bn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Z.from(c,Z.ERR_BAD_RESPONSE,this,null,bn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:it.classes.FormData,Blob:it.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch","query"],e=>{hs.headers[e]={}});function la(e,t){const r=this||hs,n=t||r,s=ct.from(n.headers);let i=n.data;return D.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Cu(e){return!!(e&&e.__CANCEL__)}let ps=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ou(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Z("Request failed with status code "+r.status,r.status>=400&&r.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,r.config,r.request,r))}function nb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function sb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,y=0;for(;f!==s;)y+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const g=u&&d-u;return g?Math.round(y*1e3/g):void 0}}function ib(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const mi=(e,t,r=3)=>{let n=0;const s=sb(50,250);return ib(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},Eu=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Du=e=>(...t)=>D.asap(()=>e(...t)),ob=it.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,it.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,ab=it.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];D.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),D.isString(n)&&a.push(`path=${n}`),D.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),D.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function lb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function cb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const ub=/^https?:(?!\/\/)/i,db=/[\t\n\r]/g;function fb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function hb(e){return fb(e).replace(db,"")}function Iu(e,t){if(typeof e=="string"&&ub.test(hb(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Tu(e,t,r,n){Iu(t,n);let s=!lb(t);return e&&(s||r===!1)?(Iu(e,n),cb(e,t)):t}const Nu=e=>e instanceof ct?{...e}:e;function zr(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,y,g){return D.isPlainObject(u)&&D.isPlainObject(f)?D.merge.call({caseless:g},u,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(u,f,y,g){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u,y,g)}else return n(u,f,y,g)}function i(u,f){if(!D.isUndefined(f))return n(void 0,f)}function o(u,f){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,u))return f[u]}else return;const y=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(y)&&D.hasOwnProp(y,u))return y[u]}function c(u,f,y){if(D.hasOwnProp(t,y))return n(u,f);if(D.hasOwnProp(e,y))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,y)=>s(Nu(u),Nu(f),y,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const y=D.hasOwnProp(d,f)?d[f]:s,g=D.hasOwnProp(e,f)?e[f]:void 0,_=D.hasOwnProp(t,f)?t[f]:void 0,p=y(g,_,f);D.isUndefined(p)&&y!==c||(r[f]=p)}),D.hasOwnProp(t,"validateStatus")&&D.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(D.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const pb=["content-type","content-length"];function gb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{pb.includes(n.toLowerCase())&&e.set(n,s)})}const yb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function xu(e){const t=zr({},e),r=y=>D.hasOwnProp(t,y)?t[y]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=ct.from(a),t.url=mu(Tu(d,f,u,t),r("params"),r("paramsSerializer")),c){const y=D.getSafeProp(c,"username")||"",g=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(y+":"+(g?yb(g):"")))}if(D.isFormData(n)&&(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&gb(a,n.getHeaders(),r("formDataHeaderPolicy"))),it.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&ob(t.url))){const g=i&&o&&ab.read(o);g&&a.set(i,g)}return t}const vb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=xu(e);let i=s.data;const o=ct.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,y,g,_;function p(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=ct.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:S,config:e,request:v};Ou(function(k){r(k),p()},function(k){n(k),p()},O),v=null}"onloadend"in v?v.onloadend=m:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(m)},v.onabort=function(){v&&(n(new Z("Request aborted",Z.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const O=w&&w.message?w.message:"Network Error",I=new Z(O,Z.ERR_NETWORK,e,v);I.event=w||null,n(I),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||ia;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Z(w,O.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&D.forEach(fu(o),function(w,O){v.setRequestHeader(O,w)}),D.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),d&&([y,_]=mi(d,!0),v.addEventListener("progress",y)),c&&v.upload&&([f,g]=mi(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=S=>{v&&(n(!S||S.type?new ps(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=nb(s.url);if(b&&!it.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}v.send(i||null)})},mb=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof Z?d:new ps(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>D.asap(o),a},bb=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},_b=async function*(e,t){for await(const r of wb(e))yield*bb(r,t)},wb=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},ku=(e,t,r,n)=>{const s=_b(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let y=i+=f;r(y)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},bi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Sb=(e,t,r)=>t+2<r&&bi(e.charCodeAt(t+1))&&bi(e.charCodeAt(t+2));function Cb(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let g=0;g<a;g++)if(n.charCodeAt(g)===37&&g+2<a){const _=n.charCodeAt(g+1),p=n.charCodeAt(g+2);bi(_)&&bi(p)&&(o-=2,g+=2)}let c=0,d=a-1;const u=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const y=Math.floor(o/4)*3-(c||0);return y>0?y:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Sb(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const ca="1.18.0",Au=64*1024,{isFunction:_i}=D,Ob=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Pu=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Mu=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Eb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Db=e=>{const t=D.global!==void 0&&D.global!==null?D.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=D.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?_i(s):typeof fetch=="function",c=_i(i),d=_i(o);if(!a)return!1;const u=a&&_i(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),y=c&&u&&Mu(()=>{let m=!1;const b=new i(it.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!S}),g=d&&u&&Mu(()=>D.isReadableStream(new o("").body)),_={stream:g&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!_[m]&&(_[m]=(b,S)=>{let w=b&&b[m];if(w)return w.call(b);throw new Z(`Response type '${m}' is not supported`,Z.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(D.isBlob(m))return m.size;if(D.isSpecCompliantForm(m))return(await new i(it.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(D.isArrayBufferView(m)||D.isArrayBuffer(m))return m.byteLength;if(D.isURLSearchParams(m)&&(m=m+""),D.isString(m))return(await f(m)).byteLength},v=async(m,b)=>{const S=D.toFiniteNumber(m.getContentLength());return S??p(b)};return async m=>{let{url:b,method:S,data:w,signal:O,cancelToken:I,timeout:k,onDownloadProgress:P,onUploadProgress:B,responseType:N,headers:M,withCredentials:V="same-origin",fetchOptions:A,maxContentLength:U,maxBodyLength:j}=xu(m);const J=D.isNumber(U)&&U>-1,ie=D.isNumber(j)&&j>-1,ye=K=>D.hasOwnProp(m,K)?m[K]:void 0;let we=s||fetch;N=N?(N+"").toLowerCase():"text";let Se=mb([O,I&&I.toAbortSignal()],k),G=null;const F=Se&&Se.unsubscribe&&(()=>{Se.unsubscribe()});let Y,L=null;const R=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,m,G);try{let K;const oe=ye("auth");if(oe){const te=D.getSafeProp(oe,"username")||"",Ye=D.getSafeProp(oe,"password")||"";K={username:te,password:Ye}}if(Eb(b)){const te=new URL(b,it.origin);if(!K&&(te.username||te.password)){const Ye=Pu(te.username),vt=Pu(te.password);K={username:Ye,password:vt}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(K&&(M.delete("authorization"),M.set("Authorization","Basic "+btoa(Ob((K.username||"")+":"+(K.password||""))))),J&&typeof b=="string"&&b.startsWith("data:")&&Cb(b)>U)throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G);if(ie&&S!=="get"&&S!=="head"){const te=await p(w);if(typeof te=="number"&&isFinite(te)&&(Y=te,te>j))throw R()}const ge=ie&&(D.isReadableStream(w)||D.isStream(w)),Ae=(te,Ye,vt)=>ku(te,Au,St=>{if(ie&&St>j)throw L=R();Ye&&Ye(St)},vt);if(y&&S!=="get"&&S!=="head"&&(B||ge)){if(Y=Y??await v(M,w),Y!==0||ge){let te=new i(b,{method:"POST",body:w,duplex:"half"}),Ye;if(D.isFormData(w)&&(Ye=te.headers.get("content-type"))&&M.setContentType(Ye),te.body){const[vt,St]=B&&Eu(Y,mi(Du(B)))||[];w=Ae(te.body,vt,St)}}}else if(ge&&!c&&u&&S!=="get"&&S!=="head")w=Ae(w);else if(ge&&c&&!y&&S!=="get"&&S!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,m,G);D.isString(V)||(V=V?"include":"omit");const re=c&&"credentials"in i.prototype;if(D.isFormData(w)){const te=M.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&M.delete("content-type")}M.set("User-Agent","axios/"+ca,!1);const se={...A,signal:Se,method:S.toUpperCase(),headers:fu(M.normalize()),body:w,duplex:"half",credentials:re?V:void 0};G=c&&new i(b,se);let de=await(c?we(G,A):we(b,se));const je=ct.from(de.headers);if(J){const te=D.toFiniteNumber(je.getContentLength());if(te!=null&&te>U)throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G)}const Ke=g&&(N==="stream"||N==="response");if(g&&de.body&&(P||J||Ke&&F)){const te={};["status","statusText","headers"].forEach(mt=>{te[mt]=de[mt]});const Ye=D.toFiniteNumber(je.getContentLength()),[vt,St]=P&&Eu(Ye,mi(Du(P),!0))||[];let Ge=0;const rt=mt=>{if(J&&(Ge=mt,Ge>U))throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G);vt&&vt(mt)};de=new o(ku(de.body,Au,rt,()=>{St&&St(),F&&F()}),te)}N=N||"text";let Pe=await _[D.findKey(_,N)||"text"](de,m);if(J&&!g&&!Ke){let te;if(Pe!=null&&(typeof Pe.byteLength=="number"?te=Pe.byteLength:typeof Pe.size=="number"?te=Pe.size:typeof Pe=="string"&&(te=typeof n=="function"?new n().encode(Pe).byteLength:Pe.length)),typeof te=="number"&&te>U)throw new Z("maxContentLength size of "+U+" exceeded",Z.ERR_BAD_RESPONSE,m,G)}return!Ke&&F&&F(),await new Promise((te,Ye)=>{Ou(te,Ye,{data:Pe,headers:ct.from(de.headers),status:de.status,statusText:de.statusText,config:m,request:G})})}catch(K){if(F&&F(),Se&&Se.aborted&&Se.reason instanceof Z){const oe=Se.reason;throw oe.config=m,G&&(oe.request=G),K!==oe&&(oe.cause=K),oe}throw L?(G&&!L.request&&(L.request=G),L):K instanceof Z?(G&&!K.request&&(K.request=G),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,m,G,K&&K.response),{cause:K.cause||K}):Z.from(K,K&&K.code,m,G,K&&K.response)}}},Ib=new Map,Lu=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=Ib;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Db(t)),u=d;return d};Lu();const ua={http:Wm,xhr:vb,fetch:{get:Lu}};D.forEach(ua,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Fu=e=>`- ${e}`,Tb=e=>D.isFunction(e)||e===null||e===!1;function Nb(e,t){e=D.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Tb(n)&&(s=ua[(a=String(n)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(D.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
+ `+o.map(Fu).join(`
452
+ `):" "+Fu(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const $u={getAdapter:Nb,adapters:ua};function da(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ps(null,e)}function ju(e){return da(e),e.headers=ct.from(e.headers),e.data=la.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),$u.getAdapter(e.adapter||hs.adapter,e)(e).then(function(n){da(e),e.response=n;try{n.data=la.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=ct.from(n.headers),n},function(n){if(!Cu(n)&&(da(e),n&&n.response)){e.response=n.response;try{n.response.data=la.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=ct.from(n.response.headers)}return Promise.reject(n)})}const wi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Bu={};wi.transitional=function(t,r,n){function s(i,o){return"[Axios v"+ca+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(r?" in "+r:"")),Z.ERR_DEPRECATED);return r&&!Bu[o]&&(Bu[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}},wi.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function xb(e,t,r){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new Z("option "+i+" must be "+c,Z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const Si={assertOptions:xb,validators:wi},ut=Si.validators;let qr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new bu,response:new bu}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
453
453
  `);return o===-1?"":s.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
454
454
  `),a=o===-1?-1:i.indexOf(`
455
455
  `,o+1),c=a===-1?"":i.slice(a+1);String(n.stack).endsWith(c)||(n.stack+=`
456
- `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=zr(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Si.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean),legacyInterceptorReqResOrdering:ut.transitional(ut.boolean),advertiseZstdAcceptEncoding:ut.transitional(ut.boolean),validateStatusUndefinedResolves:ut.transitional(ut.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:Si.assertOptions(s,{encode:ut.function,serialize:ut.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Si.assertOptions(r,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&D.merge(i.common,i[r.method]);i&&D.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=ct.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;c=c&&p.synchronous;const v=r.transitional||sa;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,f=0,y;if(!c){const _=[$u.bind(this),void 0];for(_.unshift(...a),_.push(...d),y=_.length,u=Promise.resolve(r);f<y;)u=u.then(_[f++],_[f++]);return u}y=a.length;let g=r;for(;f<y;){const _=a[f++],p=a[f++];try{g=_(g)}catch(v){p.call(this,v);break}}try{u=$u.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,y=d.length;f<y;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=zr(this.defaults,t);const r=Iu(t.baseURL,t.url,t.allowAbsoluteUrls,t);return vu(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){qr.prototype[t]=function(r,n){return this.request(zr(n||{},{method:t,url:r,data:n&&D.hasOwnProp(n,"data")?n.data:void 0}))}}),D.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(zr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}qr.prototype[t]=r(),t!=="query"&&(qr.prototype[t+"Form"]=r(!0))});let kb=class Xh{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 gs(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 Xh(function(s){t=s}),cancel:t}}};function Ab(e){return function(r){return e.apply(null,r)}}function Pb(e){return D.isObject(e)&&e.isAxiosError===!0}const da={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(da).forEach(([e,t])=>{da[t]=e});function Bu(e){const t=new qr(e),r=eu(qr.prototype.request,t);return D.extend(r,qr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Bu(zr(e,s))},r}const We=Bu(ps);We.Axios=qr,We.CanceledError=gs,We.CancelToken=kb,We.isCancel=Su,We.VERSION=la,We.toFormData=vi,We.AxiosError=Z,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=Ab,We.isAxiosError=Pb,We.mergeConfig=zr,We.AxiosHeaders=ct,We.formToJSON=e=>wu(D.isHTMLForm(e)?new FormData(e):e),We.getAdapter=Fu.getAdapter,We.HttpStatusCode=da,We.default=We;const{Axios:aD,AxiosError:lD,CanceledError:cD,isCancel:uD,CancelToken:dD,VERSION:fD,all:hD,Cancel:pD,isAxiosError:gD,spread:yD,toFormData:vD,AxiosHeaders:mD,HttpStatusCode:bD,formToJSON:_D,getAdapter:wD,mergeConfig:SD,create:CD}=We;let fa="";function Uu(e){fa=e}const Me=We.create({timeout:3e4});Me.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Pv),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),fa&&(e.baseURL=fa),e});const Vu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Mb(e,t={}){var c,d,u,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:Vu,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Me.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:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function Lb(e){var r,n,s;return e.length?((s=(n=(r=(await Me.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Vu,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)??[]:[]}function zu(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",o=(r.mimeType??"")==="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",a=r.children,c=Array.isArray(a)?a.map(d=>zu(d,n)):[];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:o,children:c,metadata:r,parent:t}}async function qu(e){var s,i,o,a,c,d,u;const t=await Me.get(`/action/content/v3/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)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=zu(r);return{content:r,rootNode:n}}async function Fb(e,t,r,n){var i;return((i=(await Me.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function $b(e,t=""){await Me.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function jb(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function Bb(e){await Me.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function Ub(e,t){await Me.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function Vb(e,t){await Me.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Ce={container:"_container_r27rp_1",header:"_header_r27rp_13",title:"_title_r27rp_22",closeBtn:"_closeBtn_r27rp_29",body:"_body_r27rp_45",label:"_label_r27rp_54",searchSection:"_searchSection_r27rp_62",searchRow:"_searchRow_r27rp_68",searchInput:"_searchInput_r27rp_74",searchSpinner:"_searchSpinner_r27rp_89",resultsList:"_resultsList_r27rp_105",resultItem:"_resultItem_r27rp_118",userInfo:"_userInfo_r27rp_133",userName:"_userName_r27rp_141",userEmail:"_userEmail_r27rp_150",userOrg:"_userOrg_r27rp_158",noResults:"_noResults_r27rp_167",collabSection:"_collabSection_r27rp_174",sectionTitle:"_sectionTitle_r27rp_179",badge:"_badge_r27rp_189",emptyCollab:"_emptyCollab_r27rp_203",collabList:"_collabList_r27rp_214",collabItem:"_collabItem_r27rp_223",userAvatar:"_userAvatar_r27rp_237",error:"_error_r27rp_251",success:"_success_r27rp_257",footer:"_footer_r27rp_263"},zb=({contentId:e,onClose:t})=>{var P,B;const r=ce(N=>N.editorConfig),n=(P=r==null?void 0:r.context)==null?void 0:P.channel,s=(B=r==null?void 0:r.config)==null?void 0:B.objectType,[i,o]=h.useState(""),[a,c]=h.useState([]),[d,u]=h.useState(!1),[f,y]=h.useState([]),[g,_]=h.useState(!1),[p,v]=h.useState(""),[m,b]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let N=!1;return(async()=>{try{const M=await jb(e),V=(M==null?void 0:M.collaborators)??[];if(!V.length)return;const A=await Lb(V);if(N)return;const U=V.map(j=>A.find(J=>J.identifier===j)??{identifier:j,firstName:j});y(U)}catch{}})(),()=>{N=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const N=i.trim();if(N.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const M=await Mb(N,{rootOrgId:n,objectType:s}),V=new Set(f.map(A=>A.identifier));c(M.filter(A=>!V.has(A.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(N=>{y(M=>M.find(V=>V.identifier===N.identifier)?M:[...M,N]),c(M=>M.filter(V=>V.identifier!==N.identifier)),b(!1)},[]),O=h.useCallback(N=>{y(M=>M.filter(V=>V.identifier!==N)),b(!1)},[]),I=h.useCallback(async()=>{_(!0),v(""),b(!1);try{await Vb(e,f.map(N=>N.identifier)),b(!0)}catch{v("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),k=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:Ce.container,children:[l.jsxs("div",{className:Ce.header,children:[l.jsx("h2",{className:Ce.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ce.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ce.body,children:[l.jsxs("div",{className:Ce.searchSection,children:[l.jsx("label",{className:Ce.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ce.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ce.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:Ce.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Ce.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var M,V,A,U;return l.jsxs("li",{className:Ce.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ce.userInfo,children:[l.jsx("span",{className:Ce.userName,children:k(N)}),N.email&&l.jsx("span",{className:Ce.userEmail,children:N.email}),(((V=(M=N.organisations)==null?void 0:M[0])==null?void 0:V.orgName)??N.rootOrgName)&&l.jsx("span",{className:Ce.userOrg,children:((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName})]}),l.jsx(Te,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Ce.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ce.collabSection,children:[l.jsxs("h3",{className:Ce.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Ce.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Ce.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ce.collabList,children:f.map(N=>{var M,V,A,U;return l.jsxs("li",{className:Ce.collabItem,children:[l.jsx("div",{className:Ce.userAvatar,"aria-hidden":"true",children:k(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ce.userInfo,children:[l.jsx("span",{className:Ce.userName,children:k(N)}),N.email&&l.jsx("span",{className:Ce.userEmail,children:N.email}),(((V=(M=N.organisations)==null?void 0:M[0])==null?void 0:V.orgName)??N.rootOrgName)&&l.jsx("span",{className:Ce.userOrg,children:((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName})]}),l.jsx(Te,{variant:"danger",size:"sm",onClick:()=>O(N.identifier),children:"Remove"})]},N.identifier)})})]}),p&&l.jsx("p",{className:Ce.error,role:"alert",children:p}),m&&l.jsx("p",{className:Ce.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ce.footer,children:[l.jsx(Te,{variant:"ghost",onClick:t,disabled:g,children:"Cancel"}),l.jsx(Te,{variant:"primary",isLoading:g,onClick:I,children:"Save"})]})]})};async function qb(e){return(await Me.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function Hb(e,t){var s;const n=((s=(await Me.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 Wb(e){var n;const r=((n=(await Me.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 ae={topbar:"_topbar_zj8wk_1",left:"_left_zj8wk_15",right:"_right_zj8wk_23",backBtn:"_backBtn_zj8wk_30",title:"_title_zj8wk_49",statusChip:"_statusChip_zj8wk_61",savedIndicator:"_savedIndicator_zj8wk_73",unsaved:"_unsaved_zj8wk_83",iconBtn:"_iconBtn_zj8wk_88",iconBtnLabel:"_iconBtnLabel_zj8wk_115",qrDropdown:"_qrDropdown_zj8wk_119",qrMenu:"_qrMenu_zj8wk_123",reviewBtns:"_reviewBtns_zj8wk_158",sourcingBtns:"_sourcingBtns_zj8wk_167",modalOverlay:"_modalOverlay_zj8wk_176",sbOverlay:"_sbOverlay_zj8wk_186",sbModal:"_sbModal_zj8wk_196",sbModalHeader:"_sbModalHeader_zj8wk_207",sbModalTitle:"_sbModalTitle_zj8wk_215",sbModalClose:"_sbModalClose_zj8wk_222",sbModalBody:"_sbModalBody_zj8wk_235",sbLabel:"_sbLabel_zj8wk_242",sbTextarea:"_sbTextarea_zj8wk_249",sbError:"_sbError_zj8wk_266",sbModalFooter:"_sbModalFooter_zj8wk_273"};function Kb(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Gb(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Hu=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ae.sbModalTitle,children:e}),l.jsx("button",{className:ae.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.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:ae.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ae.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Te,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Qb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ae.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ae.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Yb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ae.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",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:ae.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ae.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Rb=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Ae,ie;const a=xe(ne=>ne.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=Gb(((Ae=a==null?void 0:a.metadata)==null?void 0:Ae.status)??(a==null?void 0:a.status)),u=ce(ne=>{var de,je,Ke,Pe;return((je=(de=ne.editorConfig)==null?void 0:de.context)==null?void 0:je.contentId)??((Pe=(Ke=ne.editorConfig)==null?void 0:Ke.context)==null?void 0:Pe.identifier)??""}),{activeModal:f,modalData:y,closeModal:g,openModal:_}=$v(),p=ce(ne=>ne.buttonLoaders),v=ce(ne=>ne.categoryMeta),m=!v||v.schemaDefaults.generateDIALCodes!=="No",[b,S]=h.useState(!1),[w,O]=h.useState(!1),[I,k]=h.useState(!1),[P,B]=h.useState(!1),N=h.useRef(null),[M,V]=h.useState(!1);h.useEffect(()=>{if(!P)return;const ne=de=>{var je;(je=N.current)!=null&&je.contains(de.target)||B(!1)};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[P]);const[A,U]=h.useState(!1),[j,J]=h.useState(!1),{updateNode:se}=xe(),ge=(ie=a==null?void 0:a.metadata)==null?void 0:ie.qrCodeProcessId,_e=h.useCallback(async ne=>{if(u){V(!1),U(!0);try{const{processId:de,reservedDialcodes:je}=await Hb(u,ne);de&&a&&se(a.id,{qrCodeProcessId:de,reservedDialcodes:je}),Ee.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ee.error("Failed to generate QR Codes. Please try again.")}finally{U(!1)}}},[u,a,se]),we=h.useCallback(async()=>{if(!ge){Ee.error("No QR codes generated yet. Generate QR Codes first.");return}J(!0);try{const ne=await Wb(ge);if(ne.status==="in-process"){Ee("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const de=ne.url;if(!de){Ee.error("QR Codes not ready yet. Please wait and try again.");return}const je=await fetch(de).then(rt=>rt.blob()),Ke=await new Promise(rt=>{const mt=new FileReader;mt.onloadend=()=>rt(mt.result),mt.readAsDataURL(je)}),Pe=(a==null?void 0:a.metadata)??{},te=rt=>Array.isArray(rt)?rt.join("_"):typeof rt=="string"?rt:"",Ye=[u,te(Pe.medium),te(Pe.gradeLevel),te(Pe.subject)].filter(Boolean),vt=new Date().toISOString().replace(/[:.]/g,"-"),St=`${Ye.join("_")}_${vt}.zip`,Ge=document.createElement("a");Ge.href=Ke,Ge.download=St,Ge.style.display="none",document.body.appendChild(Ge),Ge.click(),document.body.removeChild(Ge),Ee.success("QR codes downloaded.")}catch{Ee.error("Failed to download QR Codes.")}finally{J(!1)}},[ge,a,u]),G=e==="edit",L=e==="review",X=e==="sourcingreview",F=e==="read",Y=h.useCallback((ne,de)=>{i({action:ne,data:de})},[i]),K=h.useCallback(()=>{g(),Y("publish")},[g,Y]),oe=h.useCallback((ne,de)=>{const je=y==null?void 0:y.action;g(),je==="approve"?Y("sourcingApprove",{comment:ne,score:de}):Y("reject",{comment:ne})},[g,Y,y]),Se=h.useCallback(ne=>{S(!1),Y("sendBackForCorrections",{comment:ne})},[Y]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ae.topbar,role:"banner",children:[l.jsxs("div",{className:ae.left,children:[l.jsx("button",{className:ae.backBtn,onClick:()=>Y("back"),"aria-label":"Go back",type:"button",children:l.jsx(tv,{size:18})}),l.jsx("h1",{className:ae.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ae.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ae.right,children:[t?l.jsx("span",{className:ae.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ae.savedIndicator} ${ae.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ae.savedIndicator,"aria-live":"polite",children:[l.jsx(hn,{size:14,"aria-hidden":"true"}),"Saved ",Kb(n)]}):null,!F&&!L&&!X&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Te,{variant:"ghost",size:"sm",onClick:()=>Y("saveCollection"),disabled:!s,children:"Save as Draft"})}),G&&l.jsxs(l.Fragment,{children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>k(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(vv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ae.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(_v,{size:16,"aria-hidden":"true"})}),m&&l.jsxs("div",{className:ae.qrDropdown,ref:N,children:[l.jsxs("button",{className:ae.iconBtn,onClick:()=>B(ne=>!ne),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":P,children:[l.jsx(jc,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ae.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),P&&l.jsxs("div",{className:ae.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{B(!1),V(!0)},disabled:A,children:[l.jsx(jc,{size:14}),A?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{B(!1),we()},disabled:j||!ge,children:[l.jsx(ov,{size:14}),j?"Downloading…":"Download QR Codes"]})]})]})]}),L&&l.jsxs("div",{className:ae.reviewBtns,children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:p.publishCollection,isLoading:p.publishCollection,children:[l.jsx(Pc,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Te,{variant:"danger",size:"sm",onClick:()=>O(!0),disabled:p.rejectCollection,isLoading:p.rejectCollection,children:[l.jsx(Fo,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Te,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[l.jsx(gv,{size:14,"aria-hidden":"true"})," Send Back"]})]}),X&&l.jsxs("div",{className:ae.sourcingBtns,children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(mv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Te,{variant:"danger",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(Fo,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(Uv,{contentId:u,onConfirm:K,onCancel:g}),f==="qualityParams"&&l.jsx(Vv,{contentId:u,action:(y==null?void 0:y.action)??"reject",onConfirm:oe,onCancel:g}),f==="manageCollaborators"&&l.jsx("div",{className:ae.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(zb,{contentId:u,onClose:g})}),I&&l.jsx(Qb,{onConfirm:()=>{k(!1),Y("sendForReview")},onCancel:()=>k(!1)}),w&&l.jsx(Hu,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:ne=>{O(!1),Y("reject",{comment:ne})},onCancel:()=>O(!1)}),b&&l.jsx(Hu,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:Se,onCancel:()=>S(!1)}),M&&l.jsx(Yb,{onConfirm:_e,onCancel:()=>V(!1)})]})},Xb=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Be.createPortal(l.jsx("div",{className:Ne.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ne.modal,children:[l.jsxs("div",{className:Ne.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Ne.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Ne.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Ne.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Te,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Te,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var Zb=Qo();const Wu=h.createContext(null);function Dt(){const e=h.useContext(Wu);if(e===null)throw new Error("No Tree Api Provided");return e}const Ku=h.createContext(null);function Jb(){const e=h.useContext(Ku);if(e===null)throw new Error("Provide a NodesContext");return e}const Gu=h.createContext(null);function e_(){const e=h.useContext(Gu);if(e===null)throw new Error("Provide a DnDContext");return e}const Qu=h.createContext(0);function Yu(){h.useContext(Qu)}function Ci(e,t,r){return Math.max(Math.min(e,r),t)}function Ru(e){return e&&e.isLeaf}function Xu(e){return e&&e.isInternal&&!e.isOpen}function Zu(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Ju=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},ed=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function ha(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=ha(r,t);if(n)return n}return null}function Oi(e,t){if(t(e),e.children)for(let r of e.children)Oi(r,t)}function td(e){const t=nd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=t_(t,n);break}r==null||r.focus()}function rd(e){const t=nd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=r_(t,n);break}r==null||r.focus()}function t_(e,t){return t+1<e.length?e[t+1]:e[0]}function r_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function nd(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 ys(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function _n(e){return typeof e=="string"?e:e.id}function n_(e,...t){if(e)return e(...t)}function sd(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function id(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 od(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const s_=Object.freeze(Object.defineProperty({__proto__:null,access:ys,bound:Ci,dfs:ha,focusNextElement:td,focusPrevElement:rd,getInsertIndex:id,getInsertParentId:od,identify:_n,indexOf:ed,isClosed:Xu,isDescendant:Ju,isItem:Ru,isOpenWithEmptyChildren:Zu,safeRun:n_,waitFor:sd,walk:Oi},Symbol.toStringTag,{value:"Module"})),i_={display:"flex",alignItems:"center",zIndex:1},o_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},a_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},l_=h.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({},i_),s),children:[l.jsx("div",{style:Object.assign({},a_)}),l.jsx("div",{style:Object.assign({},o_)})]})});function c_({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 u_(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(f_,Object.assign({},e)):l.jsx(d_,Object.assign({},e))]})}function d_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function f_({node:e}){const t=h.useRef();return h.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 vs="__REACT_ARBORIST_INTERNAL_ROOT__";function ad(e){var t;function r(i,o,a){const c=e.accessId(i),d=new ms({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new ms({tree:e,id:vs,data:{id:vs},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 ms{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===vs}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 ms(Object.assign({},this))}edit(){return this.tree.edit(this)}}function pa(e){return{type:"EDIT",id:e}}function h_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function wn(e){return{type:"FOCUS",id:e}}function p_(){return{type:"TREE_BLUR"}}function g_(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 ga={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 ld(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 y_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:ld(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:ld(e.unfiltered,t)}):e}const Sn=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}}},Cr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:_n(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(_n)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(_n)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:_n(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:_n(e)})};function v_(e=Sn().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 Cn={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 m_(e=Sn().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 Sn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const b_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},__=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},w_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function cd({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(S_,{isDragging:s,children:[l.jsx(C_,{offset:e,children:l.jsx(E_,{id:r,dragIds:n})}),l.jsx(O_,{mouse:t,count:n.length})]})}const S_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:b_,children:t.children}):null});function C_(e){return l.jsx("div",{className:"row preview",style:__(e.offset),children:e.children})}function O_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:w_(r),children:t}):null}const E_=h.memo(function(t){const r=Dt(),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 ya(){return ya=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},ya.apply(null,arguments)}function ud(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function va(e,t){return va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},va(e,t)}function D_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,va(e,t)}var dd=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function I_(e,t){return!!(e===t||dd(e)&&dd(t))}function T_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!I_(e[r],t[r]))return!1;return!0}function ma(e,t){t===void 0&&(t=T_);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 N_=typeof performance=="object"&&typeof performance.now=="function",fd=N_?function(){return performance.now()}:function(){return Date.now()};function hd(e){cancelAnimationFrame(e.id)}function x_(e,t){var r=fd();function n(){fd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var ba=-1;function pd(e){if(e===void 0&&(e=!1),ba===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),ba=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return ba}var On=null;function gd(e){if(e===void 0&&(e=!1),On===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?On="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?On="negative":On="positive-ascending"),document.body.removeChild(t),On}return On}process.env.NODE_ENV;var k_=150,A_=function(t,r){return t},Ei=null,Di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ei=new WeakSet,Di=new WeakSet);function yd(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){D_(y,f);function y(_){var p;return p=f.call(this,_)||this,p._instanceProps=c(p.props,ud(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:ud(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=ma(function(v,m,b,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:b,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=ma(function(v,m,b){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,b=m.direction,S=m.itemSize,w=m.layout,O=p._getItemStyleCache(d&&S,d&&w,d&&b),I;if(O.hasOwnProperty(v))I=O[v];else{var k=r(p.props,v,p._instanceProps),P=s(p.props,v,p._instanceProps),B=b==="horizontal"||w==="horizontal",N=b==="rtl",M=B?k:0;O[v]=I={position:"absolute",left:N?void 0:M,right:N?M:void 0,top:B?0:k,height:B?"100%":P,width:B?P:"100%"}}return I},p._getItemStyleCache=void 0,p._getItemStyleCache=ma(function(v,m,b){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,b=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(O){if(O.scrollOffset===S)return null;var I=p.props.direction,k=S;if(I==="rtl")switch(gd()){case"negative":k=-S;break;case"positive-descending":k=w-b-S;break}return k=Math.max(0,Math.min(k,w-b)),{isScrolling:!0,scrollDirection:O.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,b=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(O){if(O.scrollOffset===w)return null;var I=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:O.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var m=p.props.outerRef;p._outerRef=v,typeof m=="function"?m(v):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=v)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&hd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=x_(p._resetIsScrolling,k_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}y.getDerivedStateFromProps=function(p,v){return P_(p,v),u(p),null};var g=y.prototype;return g.scrollTo=function(p){p=Math.max(0,p),this.setState(function(v){return v.scrollOffset===p?null:{scrollDirection:v.scrollOffset<p?"forward":"backward",scrollOffset:p,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,b=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,b-1));var O=0;if(this._outerRef){var I=this._outerRef;S==="vertical"?O=I.scrollWidth>I.clientWidth?pd():0:O=I.scrollHeight>I.clientHeight?pd():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,O))},g.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,b=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||b==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},g.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var O=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(gd()){case"negative":O.scrollLeft=-S;break;case"positive-ascending":O.scrollLeft=S;break;default:var I=O.clientWidth,k=O.scrollWidth;O.scrollLeft=k-I-S;break}else O.scrollLeft=S;else O.scrollTop=S}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&hd(this._resetIsScrollingTimeoutId)},g.render=function(){var p=this.props,v=p.children,m=p.className,b=p.direction,S=p.height,w=p.innerRef,O=p.innerElementType,I=p.innerTagName,k=p.itemCount,P=p.itemData,B=p.itemKey,N=B===void 0?A_:B,M=p.layout,V=p.outerElementType,A=p.outerTagName,U=p.style,j=p.useIsScrolling,J=p.width,se=this.state.isScrolling,ge=b==="horizontal"||M==="horizontal",_e=ge?this._onScrollHorizontal:this._onScrollVertical,we=this._getRangeToRender(),G=we[0],L=we[1],X=[];if(k>0)for(var F=G;F<=L;F++)X.push(h.createElement(v,{data:P,key:N(F,P),index:F,isScrolling:j?se:void 0,style:this._getItemStyle(F)}));var Y=n(this.props,this._instanceProps);return h.createElement(V||A||"div",{className:m,onScroll:_e,ref:this._outerRefSetter,style:ya({position:"relative",height:S,width:J,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},U)},h.createElement(O||I||"div",{children:X,ref:w,style:{height:ge?"100%":Y,pointerEvents:se?"none":void 0,width:ge?Y:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],b=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,b,S,w)}}if(typeof this.props.onScroll=="function"){var O=this.state,I=O.scrollDirection,k=O.scrollOffset,P=O.scrollUpdateWasRequested;this._callOnScroll(I,k,P)}},g._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,b=this.state,S=b.isScrolling,w=b.scrollDirection,O=b.scrollOffset;if(v===0)return[0,0,0,0];var I=o(this.props,O,this._instanceProps),k=a(this.props,I,O,this._instanceProps),P=!S||w==="backward"?Math.max(1,m):1,B=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,I-P),Math.max(0,Math.min(v-1,k+B)),I,k]},y}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var P_=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Di&&!Di.has(u)&&(Di.add(u),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":Ei&&!Ei.has(u)&&(Ei.add(u),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 d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" 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.'))}},M_=50,En=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 d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},L_=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?vd(t,r,i,0,n):F_(t,r,Math.max(0,i),n)},vd=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=En(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},F_=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&En(t,n,r).offset<s;)n+=o,o*=2;return vd(t,r,Math.min(n,i-1),Math.floor(n/2),s)},md=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 d=n-o-1,u=d*i;return a+u},$_=yd({getItemOffset:function(t,r,n){return En(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:md,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",y=f?u:c,g=En(t,r,i),_=md(t,i),p=Math.max(0,Math.min(_-y,g.offset)),v=Math.max(0,g.offset-y+g.size+o);switch(n==="smart"&&(s>=v-y&&s<=p+y?n="auto":n="center"),n){case"start":return p;case"end":return v;case"center":return Math.round(v+(p-v)/2);case"auto":default:return s>=v&&s<=p?s:s<v?v:p}},getStartIndexForOffset:function(t,r,n){return L_(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,y=En(t,r,s),g=n+f,_=y.offset+y.size,p=r;p<a-1&&_<g;)p++,_+=En(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||M_,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.'))}}),j_=yd({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,d=t.itemCount,u=t.itemSize,f=t.layout,y=t.width,g=a==="horizontal"||f==="horizontal",_=g?y:c,p=Math.max(0,d*u-_),v=Math.min(p,r*u),m=Math.max(0,r*u-_+u+o);switch(n==="smart"&&(s>=m-_&&s<=v+_?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var b=Math.round(m+(v-m)/2);return b<Math.ceil(_/2)?0:b>p+Math.floor(_/2)?p:b}case"auto":default:return s>=m&&s<=v?s:s<m?m: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,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,y=u?d:i,g=Math.ceil((y+n-f)/a);return Math.max(0,Math.min(o-1,r+g-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 B_(){var e,t;const r=Dt(),s=e_().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 U_=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 V_=h.forwardRef(function(t,r){const{children:n}=t,s=U_(t,["children"]),i=Dt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(z_,{}),n]}))}),z_=()=>{const e=Dt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(B_,{})})};var q_=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 H_=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=q_(t,["style"]);const d=Dt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.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)+u+f}px`})},c))});var bd=h.createContext({dragDropManager:void 0}),jt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(jt||(jt={}));function ue(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 _a="dnd-core/INIT_COORDS",Ii="dnd-core/BEGIN_DRAG",wa="dnd-core/PUBLISH_DRAG_SOURCE",Ti="dnd-core/HOVER",Ni="dnd-core/DROP",xi="dnd-core/END_DRAG";function _d(e,t){return{type:_a,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function ki(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ki=function(r){return typeof r}:ki=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ki(e)}function W_(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function K_(e,t){return e.filter(function(r){return r!==t})}function wd(e){return ki(e)==="object"}function G_(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 Q_(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var Y_={type:_a,payload:{clientOffset:null,sourceClientOffset:null}};function R_(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(),d=e.getRegistry();e.dispatch(_d(o)),X_(r,c,d);var u=ew(r,c);if(u===null){e.dispatch(Y_);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");Z_(a),f=a(u)}e.dispatch(_d(o,f));var y=d.getSource(u),g=y.beginDrag(c,u);if(g!=null){J_(g),d.pinSource(u);var _=d.getSourceType(u);return{type:Ii,payload:{itemType:_,item:g,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function X_(e,t,r){ue(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ue(r.getSource(n),"Expected sourceIds to be registered.")})}function Z_(e){ue(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function J_(e){ue(wd(e),"Item must be an object.")}function ew(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 tw(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:wa}}}function Sa(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function rw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;nw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();sw(i,o,a);var c=o.getItemType();return iw(i,a,c),ow(i,o,a),{type:Ti,payload:{targetIds:i,clientOffset:s||null}}}}function nw(e){ue(Array.isArray(e),"Expected targetIds to be an array.")}function sw(e,t,r){ue(t.isDragging(),"Cannot call hover while not dragging."),ue(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ue(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ue(i,"Expected targetIds to be registered.")}}function iw(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Sa(i,r)||e.splice(n,1)}}function ow(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Sd(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 Cd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sd(Object(r),!0).forEach(function(n){aw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lw(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();cw(n);var i=fw(n);i.forEach(function(o,a){var c=uw(o,a,s,n),d={type:Ni,payload:{dropResult:Cd(Cd({},r),c)}};e.dispatch(d)})}}function cw(e){ue(e.isDragging(),"Cannot call drop while not dragging."),ue(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function uw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return dw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function dw(e){ue(typeof e>"u"||wd(e),"Drop result must either be an object or undefined.")}function fw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function hw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();pw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:xi}}}function pw(e){ue(e.isDragging(),"Cannot call endDrag while not dragging.")}function gw(e){return{beginDrag:R_(e),publishDragSource:tw(e),hover:rw(e),drop:lw(e),endDrag:hw(e)}}function yw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vw(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 mw(e,t,r){return t&&vw(e.prototype,t),e}function bs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bw=function(){function e(t,r){var n=this;yw(this,e),bs(this,"store",void 0),bs(this,"monitor",void 0),bs(this,"backend",void 0),bs(this,"isSetUp",!1),bs(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 mw(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),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=gw(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 Bt(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 Od=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ed=function(){return Math.random().toString(36).substring(7).split("").join(".")},Dd={INIT:"@@redux/INIT"+Ed(),REPLACE:"@@redux/REPLACE"+Ed()};function _w(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 ww(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(Ow(e))return"date";if(Cw(e))return"error";var r=Sw(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 Sw(e){return typeof e.constructor=="function"?e.constructor.name:null}function Cw(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Ow(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Dn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=ww(e)),t}function Id(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"?Bt(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"?Bt(1):"Expected the enhancer to be a function. Instead, received: '"+Dn(r)+"'");return r(Id)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(2):"Expected the root reducer to be a function. Instead, received: '"+Dn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(4):"Expected the listener to be a function. Instead, received: '"+Dn(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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 d(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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,d();var b=a.indexOf(p);a.splice(b,1),o=null}}}function y(p){if(!_w(p))throw new Error(process.env.NODE_ENV==="production"?Bt(7):"Actions must be plain objects. Instead, the actual type was: '"+Dn(p)+"'. 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 p.type>"u")throw new Error(process.env.NODE_ENV==="production"?Bt(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"?Bt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,p)}finally{c=!1}for(var v=o=a,m=0;m<v.length;m++){var b=v[m];b()}return p}function g(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(10):"Expected the nextReducer to be a function. Instead, received: '"+Dn(p));s=p,y({type:Dd.REPLACE})}function _(){var p,v=f;return p={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Bt(11):"Expected the observer to be an object. Instead, received: '"+Dn(b)+"'");function S(){b.next&&b.next(u())}S();var w=v(S);return{unsubscribe:w}}},p[Od]=function(){return this},p}return y({type:Dd.INIT}),n={dispatch:y,subscribe:f,getState:u,replaceReducer:g},n[Od]=_,n}var Ew=function(t,r){return t===r};function Dw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Iw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ew;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 Td(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 Nd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Td(Object(r),!0).forEach(function(n){Tw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Td(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xd={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Nw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xd,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case _a:case Ii:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Ti:return Dw(e.clientOffset,r.clientOffset)?e:Nd(Nd({},e),{},{clientOffset:r.clientOffset});case xi:case Ni:return xd;default:return e}}var Ca="dnd-core/ADD_SOURCE",Oa="dnd-core/ADD_TARGET",Ea="dnd-core/REMOVE_SOURCE",Ai="dnd-core/REMOVE_TARGET";function xw(e){return{type:Ca,payload:{sourceId:e}}}function kw(e){return{type:Oa,payload:{targetId:e}}}function Aw(e){return{type:Ea,payload:{sourceId:e}}}function Pw(e){return{type:Ai,payload:{targetId:e}}}function kd(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 Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kd(Object(r),!0).forEach(function(n){Mw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Lw={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Fw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lw,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ii:return Ut(Ut({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case wa:return Ut(Ut({},e),{},{isSourcePublic:!0});case Ti:return Ut(Ut({},e),{},{targetIds:r.targetIds});case Ai:return e.targetIds.indexOf(r.targetId)===-1?e:Ut(Ut({},e),{},{targetIds:K_(e.targetIds,r.targetId)});case Ni:return Ut(Ut({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case xi:return Ut(Ut({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function $w(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Ca:case Oa:return e+1;case Ea:case Ai:return e-1;default:return e}}var Pi=[],Da=[];Pi.__IS_NONE__=!0,Da.__IS_ALL__=!0;function jw(e,t){if(e===Pi)return!1;if(e===Da||typeof t>"u")return!0;var r=Q_(t,e);return r.length>0}function Bw(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Ti:break;case Ca:case Oa:case Ai:case Ea:return Pi;case Ii:case wa:case xi:case Ni:default:return Da}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=G_(n,i),a=o.length>0||!Iw(n,i);if(!a)return Pi;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function Uw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Ad(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 Pd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ad(Object(r),!0).forEach(function(n){Vw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ad(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Bw(e.dirtyHandlerIds,{type:t.type,payload:Pd(Pd({},t.payload),{},{prevTargetIds:W_(e,"dragOperation.targetIds",[])})}),dragOffset:Nw(e.dragOffset,t),refCount:$w(e.refCount,t),dragOperation:Fw(e.dragOperation,t),stateId:Uw(e.stateId)}}function qw(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Md(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hw(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Md(qw(t,n),r)}function Ww(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Md(t,r)}function Kw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gw(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 Qw(e,t,r){return t&&Gw(e.prototype,t),e}function Ld(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Yw=function(){function e(t,r){Kw(this,e),Ld(this,"store",void 0),Ld(this,"registry",void 0),this.store=t,this.registry=r}return Qw(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;ue(typeof r=="function","listener must be a function."),ue(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!jw(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ue(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 ue(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(ue(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 Sa(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(ue(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&&!Sa(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 Hw(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return Ww(this.store.getState().dragOffset)}}]),e}(),Rw=0;function Xw(){return Rw++}function Mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mi=function(r){return typeof r}:Mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Mi(e)}function Zw(e){ue(typeof e.canDrag=="function","Expected canDrag to be a function."),ue(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ue(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Jw(e){ue(typeof e.canDrop=="function","Expected canDrop to be a function."),ue(typeof e.hover=="function","Expected hover to be a function."),ue(typeof e.drop=="function","Expected beginDrag to be a function.")}function Ia(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Ia(r,!1)});return}ue(typeof e=="string"||Mi(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 Fd=typeof global<"u"?global:self,$d=Fd.MutationObserver||Fd.WebKitMutationObserver;function jd(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function eS(e){let t=1;const r=new $d(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const tS=typeof $d=="function"?eS:jd;class rS{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=tS(this.flush),this.requestErrorThrow=jd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class nS{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 sS{create(t){const r=this.freeTasks,n=r.length?r.pop():new nS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Bd=new rS,iS=new sS(Bd.registerPendingError);function oS(e){Bd.enqueueTask(iS.create(e))}function aS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lS(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 cS(e,t,r){return t&&lS(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 uS(e,t){return pS(e)||hS(e,t)||fS(e,t)||dS()}function dS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fS(e,t){if(e){if(typeof e=="string")return Ud(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 Ud(e,t)}}function Ud(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 hS(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 pS(e){if(Array.isArray(e))return e}function gS(e){var t=Xw().toString();switch(e){case jt.SOURCE:return"S".concat(t);case jt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Vd(e){switch(e[0]){case"S":return jt.SOURCE;case"T":return jt.TARGET;default:ue(!1,"Cannot parse handler ID: ".concat(e))}}function zd(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=uS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var yS=function(){function e(t){aS(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 cS(e,[{key:"addSource",value:function(r,n){Ia(r),Zw(n);var s=this.addHandler(jt.SOURCE,r,n);return this.store.dispatch(xw(s)),s}},{key:"addTarget",value:function(r,n){Ia(r,!0),Jw(n);var s=this.addHandler(jt.TARGET,r,n);return this.store.dispatch(kw(s)),s}},{key:"containsHandler",value:function(r){return zd(this.dragSources,r)||zd(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;ue(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 ue(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return ue(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return ue(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Vd(r);return n===jt.SOURCE}},{key:"isTargetId",value:function(r){var n=Vd(r);return n===jt.TARGET}},{key:"removeSource",value:function(r){var n=this;ue(this.getSource(r),"Expected an existing source."),this.store.dispatch(Aw(r)),oS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){ue(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Pw(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);ue(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){ue(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=gS(r);return this.types.set(i,n),r===jt.SOURCE?this.dragSources.set(i,s):r===jt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function vS(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=mS(n),i=new Yw(s,new yS(s)),o=new bw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function mS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Id(zw,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var bS=["children"];function _S(e,t){return OS(e)||CS(e,t)||SS(e,t)||wS()}function wS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
458
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SS(e,t){if(e){if(typeof e=="string")return qd(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 qd(e,t)}}function qd(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 CS(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 OS(e){if(Array.isArray(e))return e}function ES(e,t){if(e==null)return{};var r=DS(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 DS(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 Hd=0,Li=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),IS=h.memo(function(t){var r=t.children,n=ES(t,bS),s=TS(n),i=_S(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=Wd();return++Hd,function(){--Hd===0&&(c[Li]=null)}}},[]),l.jsx(bd.Provider,Object.assign({value:o},{children:r}),void 0)});function TS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=NS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function NS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wd(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Li]||(s[Li]={dragDropManager:vS(e,t,r,n)}),s[Li]}function Wd(){return typeof global<"u"?global:window}function xS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kS(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 AS(e,t,r){return t&&kS(e.prototype,t),e}function Kd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ta=!1,Na=!1,PS=function(){function e(t){xS(this,e),Kd(this,"internalMonitor",void 0),Kd(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return AS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ue(!Ta,"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 Ta=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ta=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ue(!Na,"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 Na=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Na=!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 MS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LS(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 FS(e,t,r){return t&&LS(e.prototype,t),e}function Gd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xa=!1,$S=function(){function e(t){MS(this,e),Gd(this,"internalMonitor",void 0),Gd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return FS(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;ue(!xa,"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 xa=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{xa=!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 jS(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 BS(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(!h.isValidElement(t)){var n=t;return e(n,r),n}var s=t;jS(s);var i=r?function(o){return e(o,r)}:e;return US(s,i)}}function Qd(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=BS(n);t[r]=function(){return s}}}),t}function Yd(e,t){typeof e=="function"?e(t):e.current=t}function US(e,t){var r=e.ref;return ue(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?h.cloneElement(e,{ref:function(s){Yd(r,s),Yd(t,s)}}):h.cloneElement(e,{ref:t})}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 ka(e){return e!==null&&Fi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Aa(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 d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function VS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zS(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 qS(e,t,r){return t&&zS(e.prototype,t),e}function dt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var HS=function(){function e(t){var r=this;VS(this,e),dt(this,"hooks",Qd({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ka(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ka(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),dt(this,"handlerId",null),dt(this,"dragSourceRef",null),dt(this,"dragSourceNode",void 0),dt(this,"dragSourceOptionsInternal",null),dt(this,"dragSourceUnsubscribe",void 0),dt(this,"dragPreviewRef",null),dt(this,"dragPreviewNode",void 0),dt(this,"dragPreviewOptionsInternal",null),dt(this,"dragPreviewUnsubscribe",void 0),dt(this,"lastConnectedHandlerId",null),dt(this,"lastConnectedDragSource",null),dt(this,"lastConnectedDragSourceOptions",null),dt(this,"lastConnectedDragPreview",null),dt(this,"lastConnectedDragPreviewOptions",null),dt(this,"backend",void 0),this.backend=t}return qS(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!Aa(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Aa(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 WS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KS(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 GS(e,t,r){return t&&KS(e.prototype,t),e}function er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var QS=function(){function e(t){var r=this;WS(this,e),er(this,"hooks",Qd({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ka(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),er(this,"handlerId",null),er(this,"dropTargetRef",null),er(this,"dropTargetNode",void 0),er(this,"dropTargetOptionsInternal",null),er(this,"unsubscribeDropTarget",void 0),er(this,"lastConnectedHandlerId",null),er(this,"lastConnectedDropTarget",null),er(this,"lastConnectedDropTargetOptions",null),er(this,"backend",void 0),this.backend=t}return GS(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!Aa(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 YS(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function RS(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Hr=typeof window<"u"?h.useLayoutEffect:h.useEffect;function $i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$i=function(r){return typeof r}:$i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$i(e)}function XS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZS(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 JS(e,t,r){return t&&ZS(e.prototype,t),e}function Pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var eC=function(){function e(t,r,n){XS(this,e),Pa(this,"spec",void 0),Pa(this,"monitor",void 0),Pa(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return JS(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return $i(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 tC(e,t,r){var n=h.useMemo(function(){return new eC(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Wr(){var e=h.useContext(bd),t=e.dragDropManager;return ue(t!=null,"Expected drag drop context"),t}function rC(e){return h.useMemo(function(){var t=e.type;return ue(t!=null,"spec.type must be defined"),t},[e])}function nC(e,t){return aC(e)||oC(e,t)||iC(e,t)||sC()}function sC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iC(e,t){if(e){if(typeof e=="string")return Rd(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 Rd(e,t)}}function Rd(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 oC(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 aC(e){if(Array.isArray(e))return e}function lC(e,t,r){var n=Wr(),s=tC(e,t,r),i=rC(e);Hr(function(){if(i!=null){var a=RS(i,s,n),c=nC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function cC(e){return hC(e)||fC(e)||dC(e)||uC()}function uC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dC(e,t){if(e){if(typeof e=="string")return Ma(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 Ma(e,t)}}function fC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hC(e){if(Array.isArray(e))return Ma(e)}function Ma(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 Xd(e,t){var r=cC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function pC(){var e=Wr();return h.useMemo(function(){return new PS(e)},[e])}function gC(e,t){var r=Wr(),n=h.useMemo(function(){return new HS(r.getBackend())},[r]);return Hr(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),Hr(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var yC=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r};const vC=Vc(yC);function mC(e,t){return SC(e)||wC(e,t)||_C(e,t)||bC()}function bC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
461
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _C(e,t){if(e){if(typeof e=="string")return Zd(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 Zd(e,t)}}function Zd(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 wC(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 SC(e){if(Array.isArray(e))return e}function Jd(e,t,r){var n=h.useState(function(){return t(e)}),s=mC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);vC(i,c)||(o(c),r&&r())},[i,e,r]);return Hr(a),[i,a]}function CC(e,t){return IC(e)||DC(e,t)||EC(e,t)||OC()}function OC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
462
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EC(e,t){if(e){if(typeof e=="string")return ef(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 ef(e,t)}}function ef(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 DC(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 IC(e){if(Array.isArray(e))return e}function TC(e,t,r){var n=Jd(e,t,r),s=CC(n,2),i=s[0],o=s[1];return Hr(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function tf(e,t,r){return TC(t,e||function(){return{}},function(){return r.reconnect()})}function NC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function xC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function kC(e,t){var r=Xd(e,t);ue(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var n=pC(),s=gC(r.options,r.previewOptions);return lC(r,n,s),[tf(r.collect,n,s),NC(s),xC(s)]}function AC(e){var t=e.accept;return h.useMemo(function(){return ue(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function PC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MC(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 LC(e,t,r){return t&&MC(e.prototype,t),e}function rf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var FC=function(){function e(t,r){PC(this,e),rf(this,"spec",void 0),rf(this,"monitor",void 0),this.spec=t,this.monitor=r}return LC(e,[{key:"canDrop",value:function(){var r=this.spec,n=this.monitor;return r.canDrop?r.canDrop(n.getItem(),n):!0}},{key:"hover",value:function(){var r=this.spec,n=this.monitor;r.hover&&r.hover(n.getItem(),n)}},{key:"drop",value:function(){var r=this.spec,n=this.monitor;if(r.drop)return r.drop(n.getItem(),n)}}]),e}();function $C(e,t){var r=h.useMemo(function(){return new FC(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function jC(e,t){return zC(e)||VC(e,t)||UC(e,t)||BC()}function BC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UC(e,t){if(e){if(typeof e=="string")return nf(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 nf(e,t)}}function nf(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 VC(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 zC(e){if(Array.isArray(e))return e}function qC(e,t,r){var n=Wr(),s=$C(e,t),i=AC(e);Hr(function(){var a=YS(i,s,n),c=jC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function HC(){var e=Wr();return h.useMemo(function(){return new $S(e)},[e])}function WC(e){var t=Wr(),r=h.useMemo(function(){return new QS(t.getBackend())},[t]);return Hr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function KC(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function sf(e,t){var r=Xd(e,t),n=HC(),s=WC(r.options);return qC(r,n,s),[tf(r.collect,n,s),KC(s)]}function GC(e,t){return XC(e)||RC(e,t)||YC(e,t)||QC()}function QC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YC(e,t){if(e){if(typeof e=="string")return of(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 of(e,t)}}function of(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 RC(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 XC(e){if(Array.isArray(e))return e}function ZC(e){var t=Wr(),r=t.getMonitor(),n=Jd(r,e),s=GC(n,2),i=s[0],o=s[1];return h.useEffect(function(){return r.subscribeToOffsetChange(o)}),h.useEffect(function(){return r.subscribeToStateChange(o)}),i}function af(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function JC(e,t){return e.filter(function(r){return r!==t})}function e0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function t0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r0(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 n0(e,t,r){return t&&r0(e.prototype,t),e}function lf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s0=function(){function e(t){t0(this,e),lf(this,"entered",[]),lf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return n0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=e0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=JC(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),i0=af(function(){return/firefox/i.test(navigator.userAgent)}),cf=af(function(){return!!window.safari});function o0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a0(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 l0(e,t,r){return t&&a0(e.prototype,t),e}function _s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var uf=function(){function e(t,r){o0(this,e),_s(this,"xs",void 0),_s(this,"ys",void 0),_s(this,"c1s",void 0),_s(this,"c2s",void 0),_s(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(P,B){return t[P]<t[B]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],y=0;y<o.length-1;y++){var g=a[y],_=a[y+1];if(g*_<=0)f.push(0);else{c=o[y];var p=o[y+1],v=c+p;f.push(3*v/((v+p)/g+(v+c)/_))}}f.push(a[a.length-1]);for(var m=[],b=[],S,w=0;w<f.length-1;w++){S=a[w];var O=f[w],I=1/o[w],k=O+f[w+1]-S-S;m.push((S-O-k)*I),b.push(k*I*I)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=b}return l0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var y=n[f];if(y<r)d=f+1;else if(y>r)u=f-1;else return s[f]}c=Math.max(0,u);var g=r-n[c],_=g*g;return s[c]+i[c]*g+o[c]*_+a[c]*g*_}}]),e}(),c0=1;function df(e){var t=e.nodeType===c0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function ji(e){return{x:e.clientX,y:e.clientY}}function u0(e){var t;return e.nodeName==="IMG"&&(i0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function d0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return cf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function f0(e,t,r,n,s){var i=u0(t),o=i?e:t,a=df(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,y=n.anchorY,g=d0(i,t,d,u),_=g.dragPreviewWidth,p=g.dragPreviewHeight,v=function(){var k=new uf([0,.5,1],[c.y,c.y/u*p,c.y+p-u]),P=k.interpolate(y);return cf()&&i&&(P+=(window.devicePixelRatio-1)*p),P},m=function(){var k=new uf([0,.5,1],[c.x,c.x/d*_,c.x+_-d]);return k.interpolate(f)},b=s.offsetX,S=s.offsetY,w=b===0||b,O=S===0||S;return{x:w?b:m(),y:O?S:v()}}var ff="__NATIVE_FILE__",hf="__NATIVE_URL__",pf="__NATIVE_TEXT__",gf="__NATIVE_HTML__";const yf=Object.freeze(Object.defineProperty({__proto__:null,FILE:ff,HTML:gf,TEXT:pf,URL:hf},Symbol.toStringTag,{value:"Module"}));function La(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var Tn;function Bi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fa=(Tn={},Bi(Tn,ff,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Bi(Tn,gf,{exposeProperties:{html:function(t,r){return La(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Bi(Tn,hf,{exposeProperties:{urls:function(t,r){return La(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Bi(Tn,pf,{exposeProperties:{text:function(t,r){return La(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Tn);function h0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p0(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 g0(e,t,r){return t&&p0(e.prototype,t),e}function vf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var y0=function(){function e(t){h0(this,e),vf(this,"item",void 0),vf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return g0(e,[{key:"initializeExposedProperties",value:function(){var r=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(r.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(r){var n=this;if(r){var s={};Object.keys(this.config.exposeProperties).forEach(function(i){s[i]={value:n.config.exposeProperties[i](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,s)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(r,n){return n===r.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function v0(e,t){var r=new y0(Fa[e]);return r.loadDataTransfer(t),r}function $a(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Fa).filter(function(r){var n=Fa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function m0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b0(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 _0(e,t,r){return t&&b0(e.prototype,t),e}function ja(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var w0=function(){function e(t,r){m0(this,e),ja(this,"ownerDocument",null),ja(this,"globalContext",void 0),ja(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return _0(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function mf(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 bf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mf(Object(r),!0).forEach(function(n){pe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function S0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C0(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 O0(e,t,r){return t&&C0(e.prototype,t),e}function pe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E0=function(){function e(t,r,n){var s=this;S0(this,e),pe(this,"options",void 0),pe(this,"actions",void 0),pe(this,"monitor",void 0),pe(this,"registry",void 0),pe(this,"enterLeaveCounter",void 0),pe(this,"sourcePreviewNodes",new Map),pe(this,"sourcePreviewNodeOptions",new Map),pe(this,"sourceNodes",new Map),pe(this,"sourceNodeOptions",new Map),pe(this,"dragStartSourceIds",null),pe(this,"dropTargetIds",[]),pe(this,"dragEnterTargetIds",[]),pe(this,"currentNativeSource",null),pe(this,"currentNativeHandle",null),pe(this,"currentDragSourceNode",null),pe(this,"altKeyPressed",!1),pe(this,"mouseMoveTimeoutTimer",null),pe(this,"asyncEndDragFrameId",null),pe(this,"dragOverTargetIds",null),pe(this,"lastClientOffset",null),pe(this,"hoverRafId",null),pe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&df(o)||null}),pe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),pe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),pe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),pe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=ji(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=$a(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),y=s.sourcePreviewNodes.get(u)||f;if(y){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,p=g.anchorY,v=g.offsetX,m=g.offsetY,b={anchorX:_,anchorY:p},S={offsetX:v,offsetY:m},w=f0(f,y,a,b,S);c.setDragImage(y,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var O=s.getCurrentSourcePreviewNodeOptions(),I=O.captureDraggingState;I?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),pe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=$a(a);c&&s.beginDragNativeItem(c,a)}}),pe(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:ji(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),pe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),pe(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=ji(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),pe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),pe(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else $a(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),pe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:ji(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new w0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new s0(this.isNodeInDocument)}return O0(e,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return bf({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return bf({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(yf).some(function(n){return yf[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=v0(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),e}(),Ui;function D0(){return Ui||(Ui=new Image,Ui.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ui}var I0=function(t,r,n){return new E0(t,r,n)};function T0(e,t){return typeof e=="function"?e(t):e??"NODE"}function N0(e){return e.isDraggable&&!e.isEditing}function x0(e){const t=Dt(),r=t.selectedIds,[n,s,i]=kC(()=>({canDrag:()=>N0(e),type:T0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Cn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Cn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(D0())},[i]),s}function k0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function A0(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function Vi(e,t){return{parentId:e||null,index:t}}function Nn(e,t){return{type:"line",index:e,level:t}}function P0(e){return{type:"highlight",id:e}}function Ba(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=ed(n)+1;return{parentId:s,index:i}}function _f(e){var t;const r=k0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=A0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Vi(i.id,null),cursor:P0(i.id)};if(!c)return{drop:Vi((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:Nn(0,0)};if(Ru(c)){const u=Ci(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ba(c,u),cursor:Nn(c.rowIndex+1,u)}}if(Xu(c)){const u=Ci(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ba(c,u),cursor:Nn(c.rowIndex+1,u)}}if(Zu(c)){const u=Ci(s,0,c.level+1);return u>c.level?{drop:Vi(c.id,0),cursor:Nn(c.rowIndex+1,u)}:{drop:Ba(c,u),cursor:Nn(c.rowIndex+1,u)}}return{drop:Vi(c==null?void 0:c.id,0),cursor:Nn(c.rowIndex+1,c.level+1)}}function M0(e,t){const r=Dt(),[n,s]=sf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=_f({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Cn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function L0(e){const t=Dt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return h.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const wf=h.memo(function({index:t,style:r}){Yu(),Jb();const n=Dt(),s=L0(t),i=h.useRef(null),o=x0(s),a=M0(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),d=n.indent*s.level,u=h.useMemo(()=>({paddingLeft:d}),[d]),f=h.useMemo(()=>{var p,v;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((v=(p=n.props.padding)!==null&&p!==void 0?p:n.props.paddingTop)!==null&&v!==void 0?v:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),y={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};h.useEffect(()=>{var p;!s.isEditing&&s.isFocused&&((p=i.current)===null||p===void 0||p.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:y,children:l.jsx(g,{node:s,tree:n,style:u,dragHandle:o})})});let Ua="",Sf=null;function Cf(){Yu();const e=Dt();return l.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),td(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),rd(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(Sf),Ua+=t.key,Sf=setTimeout(()=>{Ua=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Ua):!1});n&&e.focus(n.id)},children:l.jsx(F0,{})})}function F0(){var e,t;const r=Dt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:V_,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:H_,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx($_,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:wf})):l.jsx(j_,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:wf}))}function Of(e){return e.isFiltered?j0(e.root,e.isMatch.bind(e)):$0(e.root)}function $0(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(Ef),t}function j0(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(Ef),n}function Ef(e,t){e.rowIndex=t}const Df=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Va=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:ft}=s_;class ws{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=ad(this),this.visibleNodes=Of(this),this.idToIndex=Df(this.visibleNodes)}update(t){this.props=t,this.root=ad(this),this.visibleNodes=Of(this),this.idToIndex=Df(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=ys(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ys(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof ms)return t.id;const r=this.props.idAccessor||"id";return ys(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Va(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?od(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:id(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ft(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Va(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield ft(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(pa(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{ws.editPromise=i})}submit(t,r){return Va(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ft(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(pa(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(pa(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ft(this.props.onActivate,r)}resolveEdit(t){const r=ws.editPromise;r&&r(t),ws.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(wn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ft(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(wn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&&ft(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Cr.remove(r)),ft(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(wn(n.id)),n.isSelectable&&(this.dispatch(Cr.add(n.id)),this.dispatch(Cr.anchor(n.id)),this.dispatch(Cr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ft(this.props.onFocus,this.focusedNode),ft(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(wn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(Cr.remove(this.nodesBetween(s,i))),this.dispatch(Cr.add(o)),this.dispatch(Cr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ft(this.props.onFocus,this.focusedNode),ft(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(wn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ft(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(r=>this.get(this.identify(r))).filter(r=>!!r&&r.isSelectable)}setSelection(t){var r;const n=new Set((r=t.ids)===null||r===void 0?void 0:r.map(o=>this.identify(o))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(Cr.set({ids:n,anchor:s,mostRecent:i})),ft(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&Ju(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;ft(this.props.onMove,{dragIds:n,parentId:t===vs?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Cn.cursor({type:"none"}))}showCursor(t){this.dispatch(Cn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(ga.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),ft(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(ga.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),ft(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=ha(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Oi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Oi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),sd(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===vs)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!ys(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(wn(t.id))}onBlur(){this.dispatch(p_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Cf}get renderRow(){return this.props.renderRow||c_}get renderNode(){return this.props.children||u_}get renderDragPreview(){return this.props.renderDragPreview||cd}get renderCursor(){return this.props.renderCursor||l_}}function ht(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 B0=typeof Symbol=="function"&&Symbol.observable||"@@observable",If=B0,za=()=>Math.random().toString(36).substring(7).split("").join("."),U0={INIT:`@@redux/INIT${za()}`,REPLACE:`@@redux/REPLACE${za()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${za()}`},Kr=U0;function Tf(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function V0(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(H0(e))return"date";if(q0(e))return"error";const r=z0(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function z0(e){return typeof e.constructor=="function"?e.constructor.name:null}function q0(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function H0(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=V0(e)),t}function Nf(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ht(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ht(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"?ht(1):`Expected the enhancer to be a function. Instead, received: '${Or(r)}'`);return r(Nf)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((v,m)=>{o.set(m,v)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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 s}function f(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ht(4):`Expected the listener to be a function. Instead, received: '${Or(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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.");let m=!0;d();const b=a++;return o.set(b,v),function(){if(m){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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.");m=!1,d(),o.delete(b),i=null}}}function y(v){if(!Tf(v))throw new Error(process.env.NODE_ENV==="production"?ht(7):`Actions must be plain objects. Instead, the actual type was: '${Or(v)}'. 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 v.type>"u")throw new Error(process.env.NODE_ENV==="production"?ht(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof v.type!="string")throw new Error(process.env.NODE_ENV==="production"?ht(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(v.type)}'. Value was: '${v.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function g(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ht(10):`Expected the nextReducer to be a function. Instead, received: '${Or(v)}`);n=v,y({type:Kr.REPLACE})}function _(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?ht(11):`Expected the observer to be an object. Instead, received: '${Or(m)}'`);function b(){const w=m;w.next&&w.next(u())}return b(),{unsubscribe:v(b)}},[If](){return this}}}return y({type:Kr.INIT}),{dispatch:y,subscribe:f,getState:u,replaceReducer:g,[If]:_}}function xf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function W0(e,t,r,n){const s=Object.keys(t),i=r&&r.type===Kr.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Tf(e))return`The ${i} has unexpected type of "${Or(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===Kr.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function K0(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Kr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Kr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Kr.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function kf(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&xf(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{K0(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=W0(a,r,c,s);f&&xf(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const y=n[f],g=r[y],_=a[y],p=g(_,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ht(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${y}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}u[y]=p,d=d||p!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function G0(e=Sn().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const Q0=kf({nodes:kf({focus:g_,edit:h_,open:y_,selection:v_,drag:G0}),dnd:m_}),Y0=Sn();function R0({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(Nf(Q0,Sn(e))),o=Zb.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>Y0),a=h.useMemo(()=>new ws(i.current,e,n,s),[]),c=h.useRef(0);return h.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),h.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),h.useImperativeHandle(t,()=>a),h.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),h.useEffect(()=>{a.props.searchTerm||i.current.dispatch(ga.clear(!0))},[a.props.searchTerm]),l.jsx(Wu.Provider,{value:a,children:l.jsx(Qu.Provider,{value:c.current,children:l.jsx(Ku.Provider,{value:o.nodes,children:l.jsx(Gu.Provider,{value:o.dnd,children:l.jsx(IS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||I0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function X0(){const e=Dt(),[,t]=sf(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const s=n.getClientOffset();if(!e.listEl.current||!s)return;const{cursor:i,drop:o}=_f({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Cn.hovering(o.parentId,o.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function Z0(e){return X0(),e.children}function J0(){const t=Dt().props.renderContainer||Cf;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function e1(){const e=Dt(),{offset:t,mouse:r,item:n,isDragging:s}=ZC(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||cd;return l.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function t1(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class r1{constructor(t,r={}){this.accessors=t1(r),this.root=n1(t,this.accessors)}get data(){var t,r;return(r=(t=this.root.children)===null||t===void 0?void 0:t.map(n=>n.data))!==null&&r!==void 0?r:[]}create(t){const r=t.parentId?this.find(t.parentId):this.root;if(!r)return null;r.addChild(t.data,t.index)}move(t){const r=this.find(t.id),n=t.parentId?this.find(t.parentId):this.root;!r||!n||(n.addChild(r.data,t.index),r.drop())}update(t){const r=this.find(t.id);r&&r.update(t.changes)}drop(t){const r=this.find(t.id);r&&r.drop()}find(t,r=this.root){if(!r)return null;if(r.id===t)return r;if(r.children){for(let n of r.children){const s=this.find(t,n);if(s)return s}return null}return null}}function n1(e,t){const r=new Af({},null,t,"ROOT");return r.children=e.map(n=>qa(n,r,t)),r}function qa(e,t,r){const n=new Af(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>qa(i,n,r))),n}class Af{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=qa(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let s1=0;function i1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new r1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const p of _.dragIds)o.move({id:p,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:p})=>{o.update({id:p,changes:{name:_}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,index:p,type:v})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(v==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const m={[d]:`simple-tree-id-${s1++}`,name:""};return v==="internal"&&(m[u]=[]),o.create({parentId:_,index:p,data:m}),n(o.data),m},onDelete:_=>{_.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function o1(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
466
- Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=i1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function a1(e,t){const r=o1(e);return l.jsxs(R0,{treeProps:r,imperativeHandle:t,children:[l.jsx(Z0,{children:l.jsx(J0,{})}),l.jsx(e1,{})]})}const l1=h.forwardRef(a1);function Ha(){return xe(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function c1(){return xe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const Pf={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Mf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Lf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],u1=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function d1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function zi(e){const t=d1(e);return{key:t,color:Pf[t]??Pf.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Mf[t]??Mf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const It={row:"_row_i3qt2_1",grip:"_grip_i3qt2_16",menuBtn:"_menuBtn_i3qt2_19",selected:"_selected_i3qt2_23",title:"_title_i3qt2_28",dropTarget:"_dropTarget_i3qt2_33",toggle:"_toggle_i3qt2_50",ctIcon:"_ctIcon_i3qt2_65",folderIcon:"_folderIcon_i3qt2_77",renameInput:"_renameInput_i3qt2_92",dropHere:"_dropHere_i3qt2_101",menuWrap:"_menuWrap_i3qt2_111",menu:"_menu_i3qt2_19",dangerItem:"_dangerItem_i3qt2_163"},f1={video:qo,pdf:$o,h5p:jo,scorm:Uo,audio:Bo,quiz:Lo,default:pn},h1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,d]=h.useState(e.data.name),u=h.useRef(null),f=n==="edit",y=Ha(),g=zi(e.data),_=f1[g.key]??pn,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?nv:m?lv:_;h.useEffect(()=>{if(!s)return;const O=I=>{var k;(k=u.current)!=null&&k.contains(I.target)||i(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(O=>{O.key==="Enter"&&S(),O.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[It.row,p?It.selected:"",e.state.isOver&&m?It.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":m?"true":void 0,role:"treeitem","aria-selected":p,"aria-expanded":m?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:It.grip,"aria-hidden":"true",children:l.jsx(Fc,{size:14})}),l.jsx("button",{className:It.toggle,onClick:O=>{O.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(Ac,{size:14}):l.jsx(ls,{size:14})}),l.jsx("span",{className:`${It.ctIcon} ${v||m?It.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:It.renameInput,value:c,autoFocus:!0,onChange:O=>d(O.target.value),onBlur:S,onKeyDown:w,onClick:O=>O.stopPropagation()}):l.jsx("span",{className:It.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&m&&l.jsx("span",{className:It.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:It.menuWrap,ref:u,children:[l.jsx("button",{className:It.menuBtn,onClick:O=>{O.stopPropagation(),i(I=>!I)},"aria-label":"Node options",children:l.jsx(Mc,{size:14})}),s&&l.jsxs("div",{className:It.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(pv,{size:13})," Rename"]}),m&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Lc,{size:13})," Add sub-unit"]}),e.data.parent&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(cs,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:It.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(zo,{size:13})," Delete"]})]})]})]})};async function p1(e,t){var i,o;const n=((i=(await Me.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((o=n.content)==null?void 0:o.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function g1(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function y1(e,t){var a;const r=await p1(e,t.name),n=await g1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Me.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function v1(e){var r;return((r=(await Me.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Ff(e){var n,s,i;const r=(i=(s=(n=(await Me.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:s.collection)==null?void 0:i.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function m1(e){return Ff(e)}const Ie={container:"_container_jr3ij_1",header:"_header_jr3ij_13",title:"_title_jr3ij_22",closeBtn:"_closeBtn_jr3ij_29",body:"_body_jr3ij_45",dropZone:"_dropZone_jr3ij_54",dragOver:"_dragOver_jr3ij_67",hasFile:"_hasFile_jr3ij_72",hiddenInput:"_hiddenInput_jr3ij_78",fileInfo:"_fileInfo_jr3ij_82",fileIcon:"_fileIcon_jr3ij_89",fileName:"_fileName_jr3ij_93",fileSize:"_fileSize_jr3ij_100",dropHint:"_dropHint_jr3ij_105",dropIcon:"_dropIcon_jr3ij_112",dropText:"_dropText_jr3ij_117",dropSubtext:"_dropSubtext_jr3ij_124",sampleLink:"_sampleLink_jr3ij_130",statusBar:"_statusBar_jr3ij_145",status_uploading:"_status_uploading_jr3ij_154",status_processing:"_status_processing_jr3ij_154",status_done:"_status_done_jr3ij_159",status_error:"_status_error_jr3ij_164",successDetail:"_successDetail_jr3ij_170",spinner:"_spinner_jr3ij_175",spin:"_spin_jr3ij_175",errorMsg:"_errorMsg_jr3ij_191",failedSection:"_failedSection_jr3ij_197",failedTitle:"_failedTitle_jr3ij_203",tableWrap:"_tableWrap_jr3ij_213",failedTable:"_failedTable_jr3ij_219",reasonCell:"_reasonCell_jr3ij_244",footer:"_footer_jr3ij_248"},b1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState("idle"),[u,f]=h.useState(""),[y,g]=h.useState([]),[_,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),b=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>b(),[b]);const S=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=h.useCallback(N=>{f(""),g([]),p(null),d("idle"),S(N)&&i(N)},[]),O=h.useCallback(N=>{N.preventDefault(),a(!1);const M=N.dataTransfer.files[0];M&&w(M)},[w]),I=h.useCallback(N=>{var V;const M=(V=N.target.files)==null?void 0:V[0];M&&w(M),N.target.value=""},[w]),k=h.useCallback(async()=>{try{const N=await m1(e),M=document.createElement("a");M.href=N,M.download="sample_hierarchy.csv",M.target="_blank",M.click()}catch{f("Failed to download sample CSV.")}},[e]),P=h.useCallback(async()=>{if(s){d("uploading"),f(""),g([]);try{const{processId:N}=await y1(e,s);if(!N){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const M=await v1(N);M.status==="COMPLETED"?(b(),d("done"),p(M.successCount??null),M.failedRecords&&M.failedRecords.length>0?g(M.failedRecords):setTimeout(t,1500)):M.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),M.failedRecords&&g(M.failedRecords))}catch{b(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),B={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ie.container,children:[l.jsxs("div",{className:Ie.header,children:[l.jsx("h2",{className:Ie.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ie.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ie.body,children:[l.jsxs("div",{className:`${Ie.dropZone} ${o?Ie.dragOver:""} ${s?Ie.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:O,onClick:()=>{var N;return(N=v.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var M;return N.key==="Enter"&&((M=v.current)==null?void 0:M.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Ie.hiddenInput,onChange:I,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ie.fileInfo,children:[l.jsx("span",{className:Ie.fileIcon,children:"📄"}),l.jsx("span",{className:Ie.fileName,children:s.name}),l.jsxs("span",{className:Ie.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ie.dropHint,children:[l.jsx("span",{className:Ie.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ie.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ie.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ie.sampleLink,onClick:k,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ie.statusBar} ${Ie[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ie.spinner,"aria-hidden":"true"}),B[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ie.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:Ie.errorMsg,role:"alert",children:u}),y.length>0&&l.jsxs("div",{className:Ie.failedSection,children:[l.jsxs("h4",{className:Ie.failedTitle,children:["Failed Rows (",y.length,")"]}),l.jsx("div",{className:Ie.tableWrap,children:l.jsxs("table",{className:Ie.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:y.map((N,M)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??M+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ie.reasonCell,children:N.reason??"Unknown error"})]},M))})]})})]})]}),l.jsxs("div",{className:Ie.footer,children:[l.jsx(Te,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Te,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:P,children:c==="done"?"Uploaded":"Upload"})]})]})},tr={container:"_container_1y30m_1",header:"_header_1y30m_8",headerActions:"_headerActions_1y30m_19",iconBtn:"_iconBtn_1y30m_25",menuWrap:"_menuWrap_1y30m_43",dropdownMenu:"_dropdownMenu_1y30m_47",treeWrapper:"_treeWrapper_1y30m_79",csvModal:"_csvModal_1y30m_95",footer:"_footer_1y30m_105"},_1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var we;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[y,g]=h.useState("create"),{treeData:_,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:b,reorderChildren:S,moveNode:w,setTreeData:O}=xe(),I=e==="edit",k=Ha(),P=I&&k,B=(((we=_[0])==null?void 0:we.children)??[]).some(G=>G.isFolder),N=ce(G=>{var L,X,F,Y;return((X=(L=G.editorConfig)==null?void 0:L.context)==null?void 0:X.contentId)??((Y=(F=G.editorConfig)==null?void 0:F.context)==null?void 0:Y.identifier)??""}),M=ce(G=>{var X,F;const L=(F=(X=G.categoryMeta)==null?void 0:X.sourcingSettings)==null?void 0:F.collection;return(L==null?void 0:L.enableBulkUpload)!==!1});h.useEffect(()=>{const G=s.current;if(!G)return;const L=new ResizeObserver(()=>{a(G.clientHeight||400)});return L.observe(G),a(G.clientHeight||400),()=>L.disconnect()},[]),h.useEffect(()=>{if(!c)return;const G=L=>{var X;(X=i.current)!=null&&X.contains(L.target)||d(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[c]);const V=h.useCallback(G=>{G.length>0&&v(G[0].data.id)},[v]),A=h.useCallback(({parentId:G,index:L,dragIds:X})=>{if(!G)return;const F=X[0],Y=Wa(_,F);if(!Y)return;const K=Y.parent;if(K===G){const oe=Wa(_,G);if(!(oe!=null&&oe.children))return;const Se=oe.children.findIndex(Ae=>Ae.id===F);if(Se<0)return;S(G,Se,L>Se?L-1:L)}else w(F,K??"",G)},[_,S,w]),U=h.useCallback(({ids:G})=>{G.forEach(L=>b(L))},[b]),j=h.useCallback(({parentId:G})=>{var F;const L=G??((F=_[0])==null?void 0:F.id)??"";if(!L)return{id:crypto.randomUUID()};const X=m(L,"unit");return X?{id:X}:(Ee.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,_]),J=h.useCallback(()=>{var L;const G=(L=_[0])==null?void 0:L.id;G&&(m(G,"unit")||Ee.error("Maximum depth reached"))},[_,m]),se=h.useCallback(()=>{p&&(m(p,"subunit")||Ee.error("Maximum depth reached"))},[p,m]),ge=h.useCallback(async()=>{if(d(!1),!!N)try{const G=await Ff(N),L=await fetch(G).then(Y=>Y.blob()),X=URL.createObjectURL(L),F=document.createElement("a");F.href=X,F.download=`${N}-folders.csv`,F.style.display="none",document.body.appendChild(F),F.click(),document.body.removeChild(F),URL.revokeObjectURL(X)}catch{Ee.error("Failed to download CSV")}},[N]),_e=h.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:G}=await qu(N);O([G]),Ee.success("Course outline refreshed.")}catch{Ee.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,O]);return l.jsxs("div",{className:tr.container,children:[l.jsx("div",{className:tr.header,children:l.jsxs("div",{className:tr.headerActions,children:[I&&l.jsxs("div",{className:tr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:tr.iconBtn,onClick:()=>d(G=>!G),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Mc,{size:15})}),c&&l.jsx("div",{className:tr.dropdownMenu,role:"menu",children:M&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:B,title:B?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!B,title:B?void 0:'No folders yet — use "Create" first',onClick:ge,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!B,title:B?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),g("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:tr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(fv,{size:15}):l.jsx(dv,{size:15})})]})}),l.jsx("div",{className:tr.treeWrapper,ref:s,children:l.jsx(l1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:V,onMove:I?A:void 0,onDelete:I?U:void 0,onCreate:I?j:void 0,disableEdit:!I,disableDrop:!I,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:G=>l.jsx(h1,{...G,editorMode:e})})}),I&&l.jsxs("div",{className:tr.footer,children:[l.jsxs(Te,{variant:"ghost",size:"sm",onClick:J,disabled:!P,children:[l.jsx(cs,{size:14})," Add Unit"]}),l.jsxs(Te,{variant:"ghost",size:"sm",onClick:se,disabled:!P||!p,children:[l.jsx(Lc,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:tr.csvModal,children:l.jsx(b1,{contentId:N,mode:y,onComplete:_e,onClose:()=>f(!1)})})]})};function Wa(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Wa(r.children,t);if(n)return n}}}const Ss={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},w1=({crumbs:e})=>{const t=xe(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Ss.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Ss.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(cv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(Ac,{size:13,className:Ss.sep}),n<e.length-1?l.jsx("button",{className:Ss.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Ss.current,children:r.name})]},r.id))]}):null},Cs={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},$f=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],S1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?$f.filter(i=>n.includes(i.id)):$f;return l.jsx("div",{className:Cs.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[Cs.tab,e===i.id?Cs.active:"",r.includes(i.id)?Cs.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Cs.errorDot,"aria-label":"Has errors"})]},i.id))})};var Os=e=>e.type==="checkbox",Gr=e=>e instanceof Date,ot=e=>e==null;const jf=e=>typeof e=="object";var Ue=e=>!ot(e)&&!Array.isArray(e)&&jf(e)&&!Gr(e),Ka=e=>Ue(e)&&e.target?Os(e.target)?e.target.checked:e.target.value:e,Bf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Uf=e=>{const t=e.constructor&&e.constructor.prototype;return Ue(t)&&t.hasOwnProperty("isPrototypeOf")},qi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function qe(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(qi&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Ue(e)&&Uf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=qe(e[s]));return n}const Er={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ga="form",Vf="root",zf=["__proto__","constructor","prototype"];var Es=e=>/^\w*$/.test(e),Le=e=>e===void 0,Hi=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!Ue(e))return r;const n=Es(t)?[t]:Hi(t);if(n.some(i=>zf.includes(i)))return r;const s=n.reduce((i,o)=>ot(i)?void 0:i[o],e);return Le(s)||s===e?Le(e[t])?r:e[t]:s},At=e=>typeof e=="boolean",pt=e=>typeof e=="function",ke=(e,t,r)=>{let n=-1;const s=Es(t)?[t]:Hi(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=Ue(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(zf.includes(a))return;e[a]=c,e=e[a]}};const Qa=h.createContext(null);Qa.displayName="HookFormControlContext";const Ya=()=>h.useContext(Qa);var qf=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Gt.all&&(t._proxyFormState[o]=!n||Gt.all),r&&(r[o]=!0),e[o]}});return s};const Ra=qi?h.useLayoutEffect:h.useEffect;function C1(e){const t=Ya(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=h.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ra(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),h.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),h.useMemo(()=>qf(o,r,c.current,!1),[o,r])}var gt=e=>typeof e=="string",Xa=(e,t,r,n,s)=>gt(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),W(r,i))):(n&&(t.watchAll=!0),r),Za=e=>ot(e)||!jf(e);const Hf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Uf(e);function Pt(e,t,r=new WeakMap){if(e===t)return!0;if(Za(e)||Za(t))return Object.is(e,t);if(Gr(e)&&Gr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Hf(e,n)||Hf(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Gr(a)&&Gr(c)||(Ue(a)||Array.isArray(a))&&(Ue(c)||Array.isArray(c))?!Pt(a,c,r):!Object.is(a,c))return!1}}return!0}function O1(e){const t=Ya(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),d=h.useRef(a),u=h.useRef(void 0),f=h.useRef(r),y=h.useRef(n);d.current=a;const[g,_]=h.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),p=h.useCallback(w=>{const O=Xa(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(O):O},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const O=Xa(n,r._names,w||r._formValues,!1,c.current);if(d.current){const I=d.current(O);Pt(I,u.current)||(_(I),u.current=I)}else _(O)}},[r._formValues,r._names,i,n]);Ra(()=>((f.current!==r||!Pt(y.current,n))&&(f.current=r,y.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{v(w.values)}})),[r,o,n,v]),h.useEffect(()=>r._removeUnmounted());const m=f.current!==r,b=y.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!Pt(b,n);return m||w?p():null},[i,m,n,b,p]);return S!==null?S:g}function Wi(e){const t=Ya(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Bf(s._names.array,r),d=h.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,o)),[s,r,o]),u=O1({control:s,name:r,defaultValue:d,exact:a}),f=C1({control:s,name:r,exact:a}),y=h.useRef(e),g=h.useRef(null),_=h.useRef(s.register(r,{...e.rules,value:u,...At(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const p=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(f.validatingFields,r)},error:{enumerable:!0,get:()=>W(f.errors,r)}}),[f,r]),v=h.useCallback(w=>{const O=Ka(w);return W(s._fields,r)||(_.current=s.register(r,{...y.current.rules,value:O})),_.current.onChange({target:{value:Ka(w),name:r},type:Er.CHANGE})},[r,s]),m=h.useCallback(()=>_.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Er.BLUR}),[r,s._formValues]),b=h.useCallback(w=>{w&&(g.current={focus:()=>pt(w.focus)&&w.focus(),select:()=>pt(w.select)&&w.select(),setCustomValidity:I=>pt(w.setCustomValidity)&&w.setCustomValidity(I),reportValidity:()=>pt(w.reportValidity)&&w.reportValidity()});const O=W(s._fields,r);O&&O._f&&w&&(O._f.ref=g.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:u,...At(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:b}),[r,n,f.disabled,v,m,b,u]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...y.current.rules,...At(y.current.disabled)?{disabled:y.current.disabled}:{}});const O=(I,k)=>{const P=W(s._fields,I);P&&P._f&&(P._f.mount=k)};if(O(r,!0),w){const I=qe(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,y.current.defaultValue)));ke(s._defaultValues,r,I),Le(W(s._formValues,r))&&ke(s._formValues,r,I)}if(!c&&s.register(r),g.current){const I=W(s._fields,r);I&&I._f&&(I._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):O(r,!1)}},[r,s,c,i]),h.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),h.useMemo(()=>({field:S,formState:f,fieldState:p}),[S,f,p])}const Ja=h.createContext(null);Ja.displayName="HookFormContext";const Yt=()=>h.useContext(Ja),E1=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m})=>{const b=h.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m}),[i,_,d,n,r,y,p,f,u,s,v,o,a,m,c,g,t]);return h.createElement(Ja.Provider,{value:b},h.createElement(Qa.Provider,{value:b.control},e))};var D1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Wf=e=>Array.isArray(e)?e.filter(Boolean):[],Ki=e=>Array.isArray(e)?e:[e],Kf=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Gf(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&Ue(s)&&i){const o=Gf(s,i);Ue(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Je=e=>Ue(e)&&!Object.keys(e).length,el=e=>e.type==="file",Gi=e=>{if(!qi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qf=e=>e.type==="select-multiple",tl=e=>e.type==="radio",I1=e=>tl(e)||Os(e),rl=e=>Gi(e)&&e.isConnected;function T1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ot(e)){e=void 0;break}e=e[t[n]],n++}return e}function N1(e){for(const t in e)if(e.hasOwnProperty(t)&&!Le(e[t]))return!1;return!0}function Qe(e,t){if(gt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Es(t)?[t]:Hi(t),n=r.length===1?e:T1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(Ue(n)&&Je(n)||Array.isArray(n)&&N1(n))&&Qe(e,r.slice(0,-1)),e}var x1=e=>{for(const t in e)if(pt(e[t]))return!0;return!1};function Yf(e){return Array.isArray(e)||Ue(e)&&!x1(e)}function nl(e,t={}){for(const r in e){const n=e[r];Yf(n)?(t[r]=Array.isArray(n)?[]:{},nl(n,t[r])):Le(n)||(t[r]=!0)}return t}function sl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>sl(r));return t.some(r=>r!==void 0)?t:void 0}if(Ue(e)){const t={};for(const r in e){const n=sl(e[r]);Le(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Qr(e,t,r){r||(r=nl(t));for(const n in e){const s=e[n];if(Yf(s))Le(t)||Za(r[n])?r[n]=nl(s,Array.isArray(s)?[]:{}):Qr(s,ot(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Pt(s,i)}}return sl(r)||{}}const Rf={value:!1,isValid:!1},Xf={value:!0,isValid:!0};var Zf=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Le(e[0].attributes.value)?Le(e[0].value)||e[0].value===""?Xf:{value:e[0].value,isValid:!0}:Xf:Rf}return Rf},Jf=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Le(e)?e:t?e===""?NaN:e&&+e:r&&gt(e)?new Date(e):n?n(e):e;const eh={isValid:!1,value:null};var th=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,eh):eh;function rh(e){const t=e.ref;return el(t)?t.files:tl(t)?th(e.refs).value:Qf(t)?[...t.selectedOptions].map(({value:r})=>r):Os(t)?Zf(e.refs).value:Jf(Le(t.value)?e.ref.value:t.value,e)}var k1=(e,t,r,n)=>{const s={};for(const i of e){const o=W(t,i);o&&ke(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Qi=e=>e instanceof RegExp,Ds=e=>Le(e)?e:Qi(e)?e.source:Ue(e)?Qi(e.value)?e.value.source:e.value:e,nh=e=>({isOnSubmit:!e||e===Gt.onSubmit,isOnBlur:e===Gt.onBlur,isOnChange:e===Gt.onChange,isOnAll:e===Gt.all,isOnTouch:e===Gt.onTouched});const sh="AsyncFunction";var A1=e=>!!e&&!!e.validate&&!!(pt(e.validate)&&e.validate.constructor.name===sh||Ue(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===sh)),P1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),il=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Is=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=W(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(Is(a,t))break}else if(Ue(a)&&Is(a,t))break}}};function ih(e,t,r){const n=W(e,r);if(n||Es(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=W(t,i),a=W(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var M1=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Je(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Gt.all))},L1=(e,t,r)=>!e||!t||e===t||Ki(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),F1=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,$1=(e,t)=>!Wf(W(e,t)).length&&Qe(e,t),oh=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return ke(s,Vf,t[r]),ke(e,r,s),e};function ah(e,t,r="validate"){if(gt(e)||Array.isArray(e)&&e.every(gt)||At(e)&&!e)return{type:r,message:gt(e)?e:"",ref:t}}var xn=e=>Ue(e)&&!Qi(e)?e:{value:e,message:""},lh=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:y,pattern:g,validate:_,name:p,valueAsNumber:v,mount:m}=e._f,b=W(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=V=>{if(s&&S.reportValidity){const A=At(V)?"":V||"";a?a.forEach(U=>U.setCustomValidity(A)):S.setCustomValidity(A),S.reportValidity()}},O={},I=tl(o),k=Os(o),P=I||k,B=(v||el(o))&&Le(o.value)&&Le(b)||Gi(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,N=D1.bind(null,p,n,O),M=(V,A,U,j=Qt.maxLength,J=Qt.minLength)=>{const se=V?A:U;O[p]={type:V?j:J,message:se,ref:o,...N(V?j:J,se)}};if(i?!Array.isArray(b)||!b.length:c&&(!P&&(B||ot(b))||At(b)&&!b||k&&!Zf(a).isValid||I&&!th(a).isValid)){const{value:V,message:A}=gt(c)?{value:!!c,message:c}:xn(c);if(V&&(O[p]={type:Qt.required,message:A,ref:S,...N(Qt.required,A)},!n))return w(A),O}if(!B&&(!ot(f)||!ot(y))){let V,A;const U=xn(y),j=xn(f);if(!ot(b)&&!isNaN(b)){const J=o.valueAsNumber||b&&+b;ot(U.value)||(V=J>U.value),ot(j.value)||(A=J<j.value)}else{const J=o.valueAsDate||new Date(b),se=we=>new Date(new Date().toDateString()+" "+we),ge=o.type=="time",_e=o.type=="week";gt(U.value)&&b&&(V=ge?se(b)>se(U.value):_e?b>U.value:J>new Date(U.value)),gt(j.value)&&b&&(A=ge?se(b)<se(j.value):_e?b<j.value:J<new Date(j.value))}if((V||A)&&(M(!!V,U.message,j.message,Qt.max,Qt.min),!n))return w(O[p].message),O}if((d||u)&&!B&&(gt(b)||i&&Array.isArray(b))){const V=xn(d),A=xn(u),U=!ot(V.value)&&b.length>+V.value,j=!ot(A.value)&&b.length<+A.value;if((U||j)&&(M(U,V.message,A.message),!n))return w(O[p].message),O}if(g&&!B&&gt(b)){const{value:V,message:A}=xn(g);if(Qi(V)&&!b.match(V)&&(O[p]={type:Qt.pattern,message:A,ref:o,...N(Qt.pattern,A)},!n))return w(A),O}if(_){if(pt(_)){const V=await _(b,r),A=ah(V,S);if(A&&(O[p]={...A,...N(Qt.validate,A.message)},!n))return w(A.message),O}else if(Ue(_)){let V={};for(const A in _){if(!Je(V)&&!n)break;const U=ah(await _[A](b,r),S,A);U&&(V={...U,...N(A,U.message)},w(U.message),n&&(O[p]=V))}if(!Je(V)&&(O[p]={ref:S,...V},!n))return O}}return w(!0),O};const j1={mode:Gt.onSubmit,reValidateMode:Gt.onChange,shouldFocusError:!0},ch={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function B1(e={}){let t={...j1,...e},r={...qe(ch),isLoading:pt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=Ue(t.defaultValues)||Ue(t.values)?qe(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:qe(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let y={...f};const g={array:Kf(),state:Kf()},_=t.criteriaMode===Gt.all,p=C=>T=>{clearTimeout(d),d=setTimeout(C,T)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||y.isValid||C)){let T;t.resolver?(T=Je((await N()).errors),m()):T=await A({fields:n,onlyCheckValid:!0,eventType:Er.VALID}),T!==r.isValid&&g.state.next({isValid:T})}},m=(C,T)=>{!t.disabled&&(f.isValidating||f.validatingFields||y.isValidating||y.validatingFields)&&((C||Array.from(a.mount)).forEach(x=>{x&&(T?ke(r.validatingFields,x,T):Qe(r.validatingFields,x))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},b=()=>{r.dirtyFields=Qr(s,i)},S=(C,T=[],x,z,q=!0,Q=!0)=>{if(z&&x&&!t.disabled){if(o.action=!0,Q&&Array.isArray(W(n,C))){const H=x(W(n,C),z.argA,z.argB);q&&ke(n,C,H)}if(Q&&Array.isArray(W(r.errors,C))){const H=x(W(r.errors,C),z.argA,z.argB);q&&ke(r.errors,C,H),$1(r.errors,C)}if((f.touchedFields||y.touchedFields)&&Q&&Array.isArray(W(r.touchedFields,C))){const H=x(W(r.touchedFields,C),z.argA,z.argB);q&&ke(r.touchedFields,C,H)}(f.dirtyFields||y.dirtyFields)&&b(),g.state.next({name:C,isDirty:j(C,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ke(i,C,T)},w=(C,T)=>{ke(r.errors,C,T),r.errors={...r.errors},g.state.next({errors:r.errors})},O=C=>{r.errors=C,g.state.next({errors:r.errors,isValid:!1})},I=C=>{const T=Es(C)?[C]:Hi(C);let x=i,z=s;for(let q=0;q<T.length-1;q++){const Q=T[q];if(x=ot(x)?x:x[Q],z=ot(z)?z:z[Q],x===null&&z!==null)return!0}return!1},k=(C,T,x,z)=>{const q=W(n,C);if(q){if(I(C))return;const Q=Le(W(i,C)),H=W(i,C,Le(x)?W(s,C):x);Le(H)||z&&z.defaultChecked||T?ke(i,C,T?H:rh(q._f)):ge(C,H),o.mount&&!o.action&&(v(),Q&&r.isDirty&&(f.isDirty||y.isDirty)&&(j()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!Le(W(i,C))&&il(C,a)&&(o.watch=!0))}},P=(C,T,x,z,q)=>{let Q=!1,H=!1;const ee={name:C};if(!t.disabled){if(!x||z){(f.isDirty||y.isDirty)&&(H=r.isDirty,r.isDirty=ee.isDirty=j(),Q=H!==ee.isDirty);const he=Pt(W(s,C),T);H=!!W(r.dirtyFields,C),he!==r.isDirty?r.dirtyFields=Qr(s,i):he?Qe(r.dirtyFields,C):ke(r.dirtyFields,C,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||y.dirtyFields)&&H!==!he}if(x){const he=W(r.touchedFields,C);he||(ke(r.touchedFields,C,x),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||y.touchedFields)&&he!==x)}Q&&q&&g.state.next(ee)}return Q?ee:{}},B=(C,T,x,z)=>{const q=W(r.errors,C),Q=(f.isValid||y.isValid)&&At(T)&&r.isValid!==T;if(t.delayError&&x?(c=p(()=>w(C,x)),c(t.delayError)):(clearTimeout(d),c=null,x?ke(r.errors,C,x):Qe(r.errors,C),r.errors={...r.errors}),(x?!Pt(q,x):q)||!Je(z)||Q){const H={...z,...Q&&At(T)?{isValid:T}:{},errors:r.errors,name:C};r={...r,...H},g.state.next(H)}},N=async C=>(m(C,!0),await t.resolver(i,t.context,k1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),M=async C=>{const{errors:T}=await N(C);if(m(C),C){for(const x of C){const z=W(T,x);z?a.array.has(x)&&Ue(z)&&!Object.keys(z).some(q=>!Number.isNaN(Number(q)))?oh(r.errors,{[x]:z},x):ke(r.errors,x,z):Qe(r.errors,x)}r.errors={...r.errors}}else r.errors=T;return T},V=async({name:C,eventType:T})=>{if(e.validate){const x=await e.validate({formValues:i,formState:r,name:C,eventType:T});if(Ue(x))for(const z in x){const q=x[z];q&&Ae(`${Ga}.${z}`,{message:gt(q.message)?q.message:"",type:q.type||Qt.validate})}else gt(x)||!x?Ae(Ga,{message:x||"",type:Qt.validate}):Se(Ga);return x}return!0},A=async({fields:C,onlyCheckValid:T,name:x,eventType:z,context:q={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(q.runRootValidation=!0,!await V({name:x,eventType:z})&&(q.valid=!1,T)))return q.valid;for(const Q in C){const H=C[Q];if(H){const{_f:ee,...he}=H;if(ee){const ze=a.array.has(ee.name),Nt=H._f&&A1(H._f),xt=f.validatingFields||f.isValidating||y.validatingFields||y.isValidating;Nt&&xt&&m([ee.name],!0);const pr=await lh(H,a.disabled,i,_,t.shouldUseNativeValidation&&!T,ze);if(Nt&&xt&&m([ee.name]),pr[ee.name]&&(q.valid=!1,T)||(!T&&(W(pr,ee.name)?ze?oh(r.errors,pr,ee.name):ke(r.errors,ee.name,pr[ee.name]):Qe(r.errors,ee.name)),e.shouldUseNativeValidation&&pr[ee.name]))break}!Je(he)&&await A({context:q,onlyCheckValid:T,fields:he,name:Q,eventType:z})}}return q.valid},U=()=>{for(const C of a.unMount){const T=W(n,C);T&&(T._f.refs?T._f.refs.every(x=>!rl(x)):!rl(T._f.ref))&&je(C)}a.unMount=new Set},j=(C,T)=>!t.disabled&&(C&&T&&ke(i,C,T),!Pt(K(),s)),J=(C,T,x)=>Xa(C,a,{...o.mount?i:Le(T)?s:gt(C)?{[C]:T}:T},x,T),se=C=>Wf(W(o.mount?i:s,C,t.shouldUnregister?W(s,C,[]):[])),ge=(C,T,x={},z=!1)=>{const q=W(n,C);let Q=T;if(q){const H=q._f;H&&(!H.disabled&&ke(i,C,Jf(T,H)),Q=Gi(H.ref)&&ot(T)?"":T,Qf(H.ref)?[...H.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):H.refs?Os(H.ref)?H.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(he=>he===ee.value):ee.checked=Q===ee.value||!!Q)}):H.refs.forEach(ee=>ee.checked=ee.value===Q):el(H.ref)?H.ref.value="":(H.ref.value=Q,H.ref.type||g.state.next({name:C,values:z?i:qe(i)})))}(x.shouldDirty||x.shouldTouch)&&P(C,Q,x.shouldTouch,x.shouldDirty,!0),x.shouldValidate&&Y(C)},_e=(C,T,x,z=!1)=>{for(const q in T){if(!T.hasOwnProperty(q))return;const Q=T[q],H=C+"."+q,ee=W(n,H);(a.array.has(C)||Ue(Q)||ee&&!ee._f)&&!Gr(Q)?_e(H,Q,x,z):ge(H,Q,x,z)}},we=(C,T,x,z)=>{const q=W(n,C),Q=a.array.has(C),H=z?T:qe(T),ee=W(i,C),he=Pt(ee,H);if(he||ke(i,C,H),Q)g.array.next({name:C,values:z?i:qe(i)}),(f.isDirty||f.dirtyFields||y.isDirty||y.dirtyFields)&&x.shouldDirty&&(b(),g.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:j(C,H)}));else{const ze=Array.isArray(H)&&!H.length||Je(H);!q||q._f||ot(H)||ze?ge(C,H,x,z):_e(C,H,x,z)}if(!he){const ze=il(C,a),Nt=z?i:qe(i);g.state.next({...ze&&r,name:o.mount||ze?C:void 0,values:Nt})}},G=(C,T,x={})=>we(C,T,x,!1),L=(C,T={})=>{const x=pt(C)?C(i):C;if(!Pt(i,x)){i={...i,...x};for(const z of a.mount)we(z,W(x,z),T,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),T.shouldValidate&&v()}},X=async C=>{o.mount=!0;const T=C.target;let x=T.name,z=!0;const q=W(n,x),Q=he=>{z=Number.isNaN(he)||Gr(he)&&isNaN(he.getTime())||Pt(he,W(i,x,he))},H=nh(t.mode),ee=nh(t.reValidateMode);if(q){let he,ze;const Nt=T.type?rh(q._f):Ka(C),xt=C.type===Er.BLUR||C.type===Er.FOCUS_OUT,pr=!P1(q._f)&&!e.validate&&!t.resolver&&!W(r.errors,x)&&!q._f.deps||F1(xt,W(r.touchedFields,x),r.isSubmitted,ee,H),$s=il(x,a,xt);ke(i,x,Nt),xt?(!T||!T.readOnly)&&(q._f.onBlur&&q._f.onBlur(C),c&&c(0)):q._f.onChange&&q._f.onChange(C);const ln=P(x,Nt,xt),nt=!Je(ln)||$s;if(!xt&&g.state.next({name:x,type:C.type,values:qe(i)}),pr)return(f.isValid||y.isValid)&&(t.mode==="onBlur"?xt&&v():xt||v()),nt&&g.state.next({name:x,...$s?{}:ln});if(!t.resolver&&e.validate&&await V({name:x,eventType:C.type}),!xt&&$s&&g.state.next({...r}),t.resolver){const{errors:bt}=await N([x]);if(m([x]),Q(Nt),!z){!Je(ln)&&g.state.next(ln);return}const Ct=ih(r.errors,n,x),Zt=ih(bt,n,Ct.name||x);he=Zt.error,x=Zt.name,ze=Je(bt)}else m([x],!0),he=(await lh(q,a.disabled,i,_,t.shouldUseNativeValidation))[x],m([x]),Q(Nt),z&&(he?ze=!1:(f.isValid||y.isValid)&&(ze=await A({fields:n,onlyCheckValid:!0,name:x,eventType:C.type})));z&&(q._f.deps&&(!Array.isArray(q._f.deps)||q._f.deps.length>0)&&Y(q._f.deps),B(x,ze,he,ln))}},F=(C,T)=>{if(W(r.errors,T)&&C.focus)return C.focus(),1},Y=async(C,T={})=>{let x,z;const q=Ki(C);if(t.resolver){const Q=await M(Le(C)?C:q);x=Je(Q),z=C?!q.some(H=>W(Q,H)):x}else C?(z=(await Promise.all(q.map(async Q=>{const H=W(n,Q);return await A({fields:H&&H._f?{[Q]:H}:H,eventType:Er.TRIGGER})}))).every(Boolean),!(!z&&!r.isValid)&&v()):z=x=await A({fields:n,name:C,eventType:Er.TRIGGER});return g.state.next({...!gt(C)||(f.isValid||y.isValid)&&x!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:x}:{},errors:r.errors}),T.shouldFocus&&!z&&Is(n,F,C?q:a.mount),z},K=(C,T)=>{let x={...o.mount?i:s};return T&&(x=Gf(T.dirtyFields?r.dirtyFields:r.touchedFields,x)),Le(C)?x:gt(C)?W(x,C):C.map(z=>W(x,z))},oe=(C,T)=>({invalid:!!W((T||r).errors,C),isDirty:!!W((T||r).dirtyFields,C),error:W((T||r).errors,C),isValidating:!!W(r.validatingFields,C),isTouched:!!W((T||r).touchedFields,C)}),Se=C=>{const T=C?Ki(C):void 0;T==null||T.forEach(x=>Qe(r.errors,x)),T?T.forEach(x=>{g.state.next({name:x,errors:r.errors})}):g.state.next({errors:{}})},Ae=(C,T,x)=>{const z=(W(n,C,{_f:{}})._f||{}).ref,q=W(r.errors,C)||{},{ref:Q,message:H,type:ee,...he}=q;ke(r.errors,C,{...he,...T,ref:z}),g.state.next({name:C,errors:r.errors,isValid:!1}),x&&x.shouldFocus&&z&&z.focus&&z.focus()},ie=(C,T)=>pt(C)?g.state.subscribe({next:x=>"values"in x&&C(x.values||J(void 0,T),x)}):J(C,T,!0),ne=C=>g.state.subscribe({next:T=>{if(L1(C.name,T.name,C.exact)&&M1(T,C.formState||f,to,C.reRenderRoot)){const x={...i};C.callback({values:x,...r,...T,defaultValues:s})}}}).unsubscribe,de=C=>(o.mount=!0,y={...y,...C.formState},ne({...C,formState:{...u,...C.formState}})),je=(C,T={})=>{for(const x of C?Ki(C):a.mount)a.mount.delete(x),a.array.delete(x),T.keepValue||(Qe(n,x),Qe(i,x)),!T.keepError&&Qe(r.errors,x),!T.keepDirty&&Qe(r.dirtyFields,x),!T.keepTouched&&Qe(r.touchedFields,x),!T.keepIsValidating&&Qe(r.validatingFields,x),!t.shouldUnregister&&!T.keepDefaultValue&&Qe(s,x);g.state.next({values:qe(i)}),g.state.next({...r,...T.keepDirty?{isDirty:j()}:{}}),!T.keepIsValid&&v()},Ke=({disabled:C,name:T})=>{if(At(C)&&o.mount||C||a.disabled.has(T)){const q=a.disabled.has(T)!==!!C;C?a.disabled.add(T):a.disabled.delete(T),q&&o.mount&&!o.action&&v()}},Pe=(C,T={})=>{let x=W(n,C);const z=At(T.disabled)||At(t.disabled),q=!a.registerName.has(C)&&x&&x._f&&!x._f.mount;return ke(n,C,{...x||{},_f:{...x&&x._f?x._f:{ref:{name:C}},name:C,mount:!0,...T}}),a.mount.add(C),x&&!q?Ke({disabled:At(T.disabled)?T.disabled:t.disabled,name:C}):k(C,!0,T.value),{...z?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:Ds(T.min),max:Ds(T.max),minLength:Ds(T.minLength),maxLength:Ds(T.maxLength),pattern:Ds(T.pattern)}:{},name:C,onChange:X,onBlur:X,ref:Q=>{if(Q){a.registerName.add(C),Pe(C,T),a.registerName.delete(C),x=W(n,C);const H=Le(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=I1(H),he=x._f.refs||[];if(ee?he.find(ze=>ze===H):H===x._f.ref)return;ke(n,C,{_f:{...x._f,...ee?{refs:[...he.filter(rl),H,...Array.isArray(W(s,C))?[{}]:[]],ref:{type:H.type,name:C}}:{ref:H}}}),k(C,!1,void 0,H)}else x=W(n,C,{}),x._f&&(x._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(Bf(a.array,C)&&o.action)&&a.unMount.add(C)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Is(n,F,a.mount),Ye=C=>{At(C)&&(g.state.next({disabled:C}),Is(n,(T,x)=>{const z=W(n,x);z&&(T.disabled=z._f.disabled||C,Array.isArray(z._f.refs)&&z._f.refs.forEach(q=>{q.disabled=z._f.disabled||C}))},0,!1))},vt=(C,T)=>async x=>{let z;x&&(x.preventDefault&&x.preventDefault(),x.persist&&x.persist());let q=qe(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:H}=await N();m(),r.errors=Q,q=qe(H)}else await A({fields:n,eventType:Er.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Qe(q,Q);if(Qe(r.errors,Vf),Je(r.errors)){g.state.next({errors:{}});try{await C(q,x)}catch(Q){z=Q}}else T&&await T({...r.errors},x),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!z,submitCount:r.submitCount+1,errors:r.errors}),z)throw z},St=(C,T={})=>{W(n,C)&&(Le(T.defaultValue)?G(C,qe(W(s,C))):(G(C,T.defaultValue),ke(s,C,qe(T.defaultValue))),T.keepTouched||Qe(r.touchedFields,C),T.keepDirty||(Qe(r.dirtyFields,C),r.isDirty=T.defaultValue?j(C,qe(W(s,C))):j()),T.keepError||(Qe(r.errors,C),f.isValid&&v()),g.state.next({...r}))},Ge=(C,T={})=>{const x=C?qe(C):s,z=qe(x),q=Je(C),Q=z;if(T.keepDefaultValues||(s=x),!T.keepValues){if(T.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(Qr(s,i))]);for(const ee of Array.from(H)){const he=W(r.dirtyFields,ee),ze=W(i,ee),Nt=W(Q,ee);he&&!Le(ze)?ke(Q,ee,ze):!he&&!Le(Nt)&&G(ee,Nt)}}else{if(qi&&Le(C))for(const H of a.mount){const ee=W(n,H);if(ee&&ee._f){const he=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Gi(he)){const ze=he.closest("form");if(ze){ze.reset();break}}}}if(T.keepFieldsRef)for(const H of a.mount)G(H,W(Q,H));else n={}}if(t.shouldUnregister){if(i=T.keepDefaultValues?qe(s):{},T.keepFieldsRef)for(const H of a.mount)ke(i,H,W(Q,H))}else i=qe(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!T.keepIsValid||!!T.keepDirtyValues||!t.shouldUnregister&&!Je(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!T.keepIsValid,o.action=!1,T.keepErrors||(r.errors={}),g.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:q?!1:T.keepDirty?r.isDirty:T.keepValues?j():!!(T.keepDefaultValues&&!Pt(C,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q?{}:T.keepDirtyValues?T.keepDefaultValues&&i?Qr(s,i):r.dirtyFields:T.keepDefaultValues&&C?Qr(s,C):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},rt=(C,T)=>Ge(pt(C)?C(i):C,{...t.resetOptions,...T}),mt=(C,T={})=>{const x=W(n,C),z=x&&x._f;if(z){const q=z.refs?z.refs[0]:z.ref;q.focus&&setTimeout(()=>{q.focus(),T.shouldSelect&&pt(q.select)&&q.select()})}},to=C=>{r={...r,...C}},ro={control:{register:Pe,unregister:je,getFieldState:oe,handleSubmit:vt,setError:Ae,_subscribe:ne,_runSchema:N,_updateIsValidating:m,_focusError:te,_getWatch:J,_getDirty:j,_setValid:v,_setFieldArray:S,_setDisabledField:Ke,_setErrors:O,_getFieldArray:se,_reset:Ge,_resetDefaultValues:()=>pt(t.defaultValues)&&t.defaultValues().then(C=>{rt(C,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:U,_disableForm:Ye,_subjects:g,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return a},set _names(C){a=C},get _formState(){return r},get _options(){return t},set _options(C){t={...t,...C}}},subscribe:de,trigger:Y,register:Pe,handleSubmit:vt,watch:ie,setValue:G,setValues:L,getValues:K,reset:rt,resetField:St,resetDefaultValues:(C,T={})=>{if(s=qe(C),!T.keepDirty){const x=Qr(s,i);r.dirtyFields=x,r.isDirty=!Je(x)}T.keepIsValid||v(),g.state.next({...r,defaultValues:s})},clearErrors:Se,unregister:je,setError:Ae,setFocus:mt,getFieldState:oe};return{...ro,formControl:ro}}function U1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...qe(ch),isLoading:pt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!pt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=B1(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,Ra(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),h.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),h.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),h.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),h.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),h.useEffect(()=>{var a;e.values&&!Pt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),h.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=h.useMemo(()=>qf(s,o),[o,s]),t.current}async function uh(e){var r,n;return(n=(r=(await Me.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function dh(e,t){const r=vo({queryKey:["framework",e],queryFn:()=>uh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=vo({queryKey:["framework",n],queryFn:()=>uh(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}async function V1(e){var r,n;return(n=(r=(await Me.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function z1(e){var r,n,s,i,o,a;const t=vo({queryKey:["channel",e],queryFn:()=>V1(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}const q1={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},fh={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},H1={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},hh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},ph=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function W1(e,t,r,n){if(!(e!=null&&e.length))return J1(t,n,r);const s=new Set;return e.filter(i=>{if(n&&(i.code==="dialCode"||i.code==="dialcode")||i.visible===!1)return!1;const o=i.code;return s.has(o)?!1:(s.add(o),!0)}).map(i=>{const o=i.code??"",a=Y1(i),c=R1(i,r,t),d=t[o],u=gh(d,a);return{code:o,label:i.label??o,inputType:a,required:!!(i.required===!0||Array.isArray(i.validations)&&i.validations.some(f=>f.type==="required")),editable:i.editable!==!1,placeholder:i.placeholder,maxLength:i.maxLength,options:G1(c,u,a,r),depends:i.depends,tab:Q1(i),section:i.section,defaultValue:i.defaultValue??i.default,currentValue:u}})}function K1(e){var n,s,i;const t=new Map,r=o=>o==null?void 0:o.forEach(a=>{a.identifier&&t.set(a.identifier,a.name),a.name&&t.set(a.name,a.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(o=>r(o.terms)),(i=e.targetFrameworks)==null||i.forEach(o=>{var a;return(a=o.categories)==null?void 0:a.forEach(c=>r(c.terms))}),t}function G1(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const s=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!s.length)return e;const i=e?[...e]:[],o=new Set(i.map(c=>c.value)),a=K1(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function Q1(e){const t=e.section;if(t&&fh[t])return fh[t];const r=e.code??"";return H1[r]??"details"}function gh(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function Y1(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"||t==="framework"?"select":t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function R1(e,t,r){var a;const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(c=>({label:c,value:c})):n.map(c=>({label:c.name,value:c.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(c=>({label:c,value:c}));const i=e.code??"";if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories")return(a=t.channelAdditionalCategories)==null?void 0:a.map(c=>({label:c,value:c}));const o=e.sourceCategory??hh[i];if(o)return yh(i,o,e,t,r)}function yh(e,t,r,n,s){var f,y,g,_,p;const i=ph.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=v=>({label:v.name,value:i?v.identifier:v.name}),a=(y=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:y.find(v=>v.code===t),c=(p=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:p.find(v=>v.code===t);let d=(ph.has(e)?c==null?void 0:c.terms:a==null?void 0:a.terms)??(c==null?void 0:c.terms)??(a==null?void 0:a.terms)??[];const u=r.depends;if(u!=null&&u.length){const v=u.flatMap(m=>{const b=s[m];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(v.length){const m=d.filter(b=>{const S=b.associations;return!S||!S.length?!0:S.some(w=>v.includes(w.identifier)||v.includes(w.code)||v.includes(w.name))});m.length&&(d=m)}}return d.map(o)}function kn(e,t){const r=hh[e];if(r)return yh(e,r,{},t,{})}const X1=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],Z1=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-NC-ND 4.0",value:"CC BY-NC-ND 4.0"},{label:"CC0 1.0",value:"CC0 1.0"},{label:"All Rights Reserved",value:"All Rights Reserved"}];function at(e,t,r){return gh(e[t],r)}function J1(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:at(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:at(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:at(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:at(e,"primaryCategory","select"),options:[{label:"Course",value:"Course"},{label:"Digital Textbook",value:"Digital Textbook"},{label:"Teacher Resource",value:"Teacher Resource"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"}]},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:at(e,"additionalCategories","multiselect"),options:[{label:"Lesson Plan",value:"Lesson Plan"},{label:"Textbook",value:"Textbook"},{label:"TV Lesson",value:"TV Lesson"},{label:"Revision Material",value:"Revision Material"}]},{code:"board",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:kn("board",r),currentValue:at(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:kn("subject",r),currentValue:at(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:X1,currentValue:at(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:kn("targetBoardIds",r),currentValue:at(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:kn("targetMediumIds",r),currentValue:at(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:kn("targetGradeLevelIds",r),currentValue:at(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:kn("targetSubjectIds",r),currentValue:at(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:Z1,currentValue:at(e,"license","select")})),n}function eO(e,t){const{watch:r,setValue:n}=e;h.useEffect(()=>{const s=r((i,{name:o})=>{o&&t.forEach(a=>{var c;(c=a.depends)!=null&&c.includes(o)&&n(a.code,a.inputType==="multiselect"||a.inputType==="chips"?[]:"",{shouldDirty:!0})})});return()=>s.unsubscribe()},[r,n,t])}const An={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},tO=({title:e,description:t,children:r})=>l.jsxs("div",{className:An.section,children:[l.jsxs("div",{className:An.header,children:[l.jsx("h3",{className:An.title,children:e}),t&&l.jsx("p",{className:An.description,children:t})]}),l.jsx("hr",{className:An.divider}),l.jsx("div",{className:An.fields,children:r})]}),$={field:"_field_1s288_1",fullWidth:"_fullWidth_1s288_7",label:"_label_1s288_11",required:"_required_1s288_19",input:"_input_1s288_24",textarea:"_textarea_1s288_45",inputError:"_inputError_1s288_50",error:"_error_1s288_54",selectBtn:"_selectBtn_1s288_59",selectOpen:"_selectOpen_1s288_83",placeholder:"_placeholder_1s288_87",selectedVal:"_selectedVal_1s288_91",chevronUp:"_chevronUp_1s288_95",dropdown:"_dropdown_1s288_100",option:"_option_1s288_116",optionSelected:"_optionSelected_1s288_134",noOpts:"_noOpts_1s288_139",chipGroup:"_chipGroup_1s288_146",chipInput:"_chipInput_1s288_158",addChipBtn:"_addChipBtn_1s288_167",radioGroup:"_radioGroup_1s288_184",radioLabel:"_radioLabel_1s288_191",iconWrap:"_iconWrap_1s288_199",iconPreview:"_iconPreview_1s288_214",iconPlaceholder:"_iconPlaceholder_1s288_220",removeIconBtn:"_removeIconBtn_1s288_233",tagChip:"_tagChip_1s288_252",tagChipRemove:"_tagChipRemove_1s288_264",nestedSelectRow:"_nestedSelectRow_1s288_278",dialcodeRow:"_dialcodeRow_1s288_287",validateBtn:"_validateBtn_1s288_293",dialcodeValid:"_dialcodeValid_1s288_315",dialcodeSpinner:"_dialcodeSpinner_1s288_325"},vh=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[$.field,s?$.fullWidth:""].join(" "),children:[l.jsxs("label",{className:$.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[$.input,$.textarea,d?$.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[$.input,d?$.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:$.error,children:String(d.message)})]})},rO=({name:e,label:t,options:r,required:n,disabled:s})=>{var p;const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),y=d(e),g=((p=r.find(v=>v.value===y))==null?void 0:p.label)??"Select…",_=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),l.jsxs("div",{className:$.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[$.selectBtn,_?$.inputError:"",i?$.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y?$.selectedVal:$.placeholder,children:g}),l.jsx(ls,{size:14,className:i?$.chevronUp:""})]}),i&&l.jsxs("div",{className:$.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[$.option,y===v.value?$.optionSelected:""].join(" "),onClick:()=>{u(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),y===v.value&&l.jsx(hn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:$.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:$.error,children:String(_.message)})]})},nO=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),y=d(e)??[],g=f[e],_=y.length?`${y.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=y.includes(v)?y.filter(b=>b!==v):[...y,v];u(e,m,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:$.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[$.selectBtn,g?$.inputError:"",i?$.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y.length?$.selectedVal:$.placeholder,children:_}),l.jsx(ls,{size:14,className:i?$.chevronUp:""})]}),i&&l.jsxs("div",{className:$.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[$.option,y.includes(v.value)?$.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(hn,{size:13,style:{opacity:y.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:$.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:$.error,children:String(g.message)})]})},sO=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),d=h.useRef(null),{watch:u,setValue:f,formState:{errors:y}}=Yt(),g=u(e)??[],_=y[e],p=()=>{const m=i.trim();m&&!g.includes(m)&&f(e,[...g,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,g.filter(b=>b!==m),{shouldDirty:!0});return l.jsxs("div",{className:[$.field,$.fullWidth].join(" "),children:[l.jsxs("label",{className:$.label,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsxs("div",{className:$.chipGroup,children:[g.map(m=>l.jsxs("span",{className:"sbx-chip filled",children:[m,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>v(m),"aria-label":`Remove ${m}`,children:"×"})]},m)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:$.chipInput,value:i,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),p()),m.key==="Escape"&&(o(""),c(!1))},onBlur:p,placeholder:s}):l.jsxs("button",{type:"button",className:$.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var m;return(m=d.current)==null?void 0:m.focus()},50)},children:[l.jsx(cs,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:$.error,children:String(_.message)})]})},iO=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Yt(),a=o[e];return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("div",{className:$.radioGroup,children:r.map(c=>l.jsxs("label",{className:$.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:$.error,children:String(a.message)})]})};async function oO(e,t,r,n){var o,a;const i=(a=(o=(await Me.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function aO(e,t){var s,i;const n=(i=(s=(await Me.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function lO(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function cO(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Me.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const fe={overlay:"_overlay_ga6eh_1",modal:"_modal_ga6eh_12",header:"_header_ga6eh_24",title:"_title_ga6eh_33",closeBtn:"_closeBtn_ga6eh_39",tabs:"_tabs_ga6eh_57",tab:"_tab_ga6eh_57",activeTab:"_activeTab_ga6eh_83",body:"_body_ga6eh_88",searchWrap:"_searchWrap_ga6eh_99",searchIcon:"_searchIcon_ga6eh_104",searchInput:"_searchInput_ga6eh_113",grid:"_grid_ga6eh_132",imgCell:"_imgCell_ga6eh_148",imgCellSelected:"_imgCellSelected_ga6eh_166",thumb:"_thumb_ga6eh_171",noThumb:"_noThumb_ga6eh_177",checkBadge:"_checkBadge_ga6eh_183",loadMoreBtn:"_loadMoreBtn_ga6eh_198",loadingRow:"_loadingRow_ga6eh_220",empty:"_empty_ga6eh_230",spinner:"_spinner_ga6eh_237",uploadArea:"_uploadArea_ga6eh_247",dropZone:"_dropZone_ga6eh_256",uploadIcon:"_uploadIcon_ga6eh_277",dropText:"_dropText_ga6eh_281",dropSubtext:"_dropSubtext_ga6eh_288",uploadPreview:"_uploadPreview_ga6eh_294",hiddenInput:"_hiddenInput_ga6eh_301",fileName:"_fileName_ga6eh_305",errorText:"_errorText_ga6eh_311",footer:"_footer_ga6eh_318",cancelBtn:"_cancelBtn_ga6eh_328",confirmBtn:"_confirmBtn_ga6eh_345"},mh=18,bh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,d]=h.useState([]),[u,f]=h.useState(0),[y,g]=h.useState(!1),[_,p]=h.useState(null),[v,m]=h.useState(0),[b,S]=h.useState(null),[w,O]=h.useState(""),[I,k]=h.useState(!1),[P,B]=h.useState(""),N=h.useRef(null),M=ce(F=>{var Y,K;return((K=(Y=F.editorConfig)==null?void 0:Y.context)==null?void 0:K.channel)??""}),V=ce(F=>{var Y,K;return((K=(Y=F.editorConfig)==null?void 0:Y.context)==null?void 0:K.uid)??""}),A=ce(F=>{var Y,K,oe;return((oe=(K=(Y=F.editorConfig)==null?void 0:Y.context)==null?void 0:K.cloudStorage)==null?void 0:oe.presigned_headers)??{}}),U=ce(F=>{var Y,K,oe;return((oe=(K=(Y=F.editorConfig)==null?void 0:Y.config)==null?void 0:K.assetConfig)==null?void 0:oe.size)??1*1024*1024}),j=ce(F=>{var Y,K,oe;return((oe=(K=(Y=F.editorConfig)==null?void 0:Y.config)==null?void 0:K.assetConfig)==null?void 0:oe.accepted)??"image/png,image/jpeg"}),J=h.useCallback(async(F,Y,K=!1)=>{var oe;g(!0);try{const Se={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&V&&(Se.createdBy=V),M&&(Se.channel=M);const ie=((oe=(await Me.post("/action/composite/v3/search",{request:{filters:Se,query:F,limit:mh,offset:Y,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:oe.result)??{},ne=ie.content??[];f(ie.count??0),d(de=>K?[...de,...ne]:ne)}catch{}finally{g(!1)}},[s,V,M]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),J(o,0))},[s]);const se=h.useRef(),ge=F=>{a(F),clearTimeout(se.current),se.current=setTimeout(()=>{d([]),m(0),J(F,0)},400)},_e=()=>{const F=v+mh;m(F),J(o,F,!0)},we=()=>{const F=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";F&&r(F)};h.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const G=F=>{var oe;const Y=(oe=F.target.files)==null?void 0:oe[0];if(F.target.value="",!Y)return;const K=j.split(",").map(Se=>Se.trim());if(!K.includes(Y.type)){const Se=K.map(Ae=>Ae.replace("image/","").toUpperCase()).join(", ");B(`Only ${Se} files are accepted.`);return}if(Y.size>U){const Se=(U/1048576).toFixed(0);B(`Image must be under ${Se} MB.`);return}w&&URL.revokeObjectURL(w),S(Y),O(URL.createObjectURL(Y)),B("")},L=async()=>{if(b){k(!0),B("");try{const F=await oO(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,V,M),Y=await aO(F,b.name);await lO(Y,b,A);const K=Y.split("?")[0],oe=await cO(F,K,b.type);r(oe)}catch(F){B(F instanceof Error?F.message:"Upload failed.")}finally{k(!1)}}},X=c.length<u;return l.jsx("div",{className:fe.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:fe.modal,children:[l.jsxs("div",{className:fe.header,children:[l.jsx("span",{className:fe.title,children:"Select App Icon"}),l.jsx("button",{className:fe.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:18})})]}),l.jsxs("div",{className:fe.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${fe.tab} ${s==="my"?fe.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${fe.tab} ${s==="all"?fe.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${fe.tab} ${s==="upload"?fe.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Bc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:fe.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:fe.searchWrap,children:[l.jsx(Vo,{size:14,className:fe.searchIcon}),l.jsx("input",{type:"search",className:fe.searchInput,placeholder:"Search images…",value:o,onChange:F=>ge(F.target.value)})]}),y&&c.length===0?l.jsxs("div",{className:fe.loadingRow,children:[l.jsx(ci,{size:20,className:fe.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:fe.empty,children:"No images found"}):l.jsx("div",{className:fe.grid,children:c.map(F=>{const Y=F.appIcon??F.artifactUrl??F.downloadUrl??"",K=(_==null?void 0:_.identifier)===F.identifier;return l.jsxs("button",{type:"button",className:`${fe.imgCell} ${K?fe.imgCellSelected:""}`,onClick:()=>p(F),title:F.name,children:[Y?l.jsx("img",{src:Y,alt:F.name,className:fe.thumb}):l.jsx("div",{className:fe.noThumb,children:"IMG"}),K&&l.jsx("div",{className:fe.checkBadge,children:l.jsx(hn,{size:12})})]},F.identifier)})}),X&&!y&&l.jsx("button",{className:fe.loadMoreBtn,onClick:_e,children:"Load More"}),y&&c.length>0&&l.jsx("div",{className:fe.loadingRow,children:l.jsx(ci,{size:16,className:fe.spinner})})]}):l.jsxs("div",{className:fe.uploadArea,children:[l.jsx("div",{className:fe.dropZone,onClick:()=>{var F;return(F=N.current)==null?void 0:F.click()},onDragOver:F=>F.preventDefault(),onDrop:F=>{F.preventDefault();const Y=F.dataTransfer.files[0];Y&&G({target:{files:[Y],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:fe.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Bc,{size:32,className:fe.uploadIcon}),l.jsx("p",{className:fe.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:fe.dropSubtext,children:[j.split(",").map(F=>F.replace("image/","").toUpperCase()).join(", ")," · max ",(U/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:j,className:fe.hiddenInput,onChange:G}),b&&l.jsx("p",{className:fe.fileName,children:b.name}),P&&l.jsx("p",{className:fe.errorText,children:P})]})}),l.jsxs("div",{className:fe.footer,children:[l.jsx("button",{className:fe.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:fe.confirmBtn,disabled:!b||I,onClick:L,children:I?l.jsxs(l.Fragment,{children:[l.jsx(ci,{size:14,className:fe.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:fe.confirmBtn,disabled:!_,onClick:we,children:"Use Selected"})]})]})})},uO=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Yt(),f=a(e),y=u[e],g=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:$.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:$.iconPreview}):l.jsxs("div",{className:$.iconPlaceholder,children:[l.jsx($c,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:$.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(zo,{size:13}),l.jsx("span",{children:"Remove"})]}),y&&l.jsx("span",{className:$.error,children:String(y.message)}),i&&l.jsx(bh,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},dO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[$.input,o?$.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:$.error,children:String(o.message)})]})},fO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),d=h.useRef(null),u=i.value??[],f=p=>{const v=p.trim();!v||u.includes(v)||i.onChange([...u,v])},y=p=>{i.onChange(u.filter(v=>v!==p))},g=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&u.length>0&&y(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[$.field,$.fullWidth].join(" "),children:[l.jsxs("label",{className:$.label,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsxs("div",{className:[$.chipGroup,o?$.inputError:""].join(" "),onClick:()=>{var p;return!n&&((p=d.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(p=>l.jsxs("span",{className:$.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:$.tagChipRemove,onClick:v=>{v.stopPropagation(),y(p)},"aria-label":`Remove ${p}`,children:l.jsx(jr,{size:11})})]},p)),!n&&l.jsx("input",{ref:d,className:$.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:g,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:$.error,children:String(o.message)})]})},hO=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=Wi({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,y)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[u]=y;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};return l.jsxs("div",{className:[$.field,$.fullWidth].join(" "),children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("div",{className:$.nestedSelectRow,children:r.map((u,f)=>{const y=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:$.field,style:{flex:1},children:[l.jsx("label",{className:$.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[$.input,a?$.inputError:""].join(" "),disabled:s||y,value:c[u.code]??"",onChange:g=>d(u.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},u.code)})}),a&&l.jsx("span",{className:$.error,children:String(a.message)})]})},_h=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],pO=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Yt(),f=c(e),y=_h.find(p=>p.value===f),g=(y==null?void 0:y.label)??"Select license…",_=u[e];return h.useEffect(()=>{if(!s)return;const p=v=>{var m;(m=o.current)!=null&&m.contains(v.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),l.jsxs("div",{className:$.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:$.label,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[$.selectBtn,_?$.inputError:"",s?$.selectOpen:""].join(" "),onClick:()=>i(p=>!p),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?$.selectedVal:$.placeholder,children:g}),l.jsx(ls,{size:14,className:s?$.chevronUp:""})]}),s&&l.jsx("div",{className:$.dropdown,role:"listbox",children:_h.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[$.option,f===p.value?$.optionSelected:""].join(" "),onClick:()=>{d(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(hn,{size:13})]},p.value))}),_&&l.jsx("span",{className:$.error,children:String(_.message)})]})},gO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[d,u]=h.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await qb(g),p=_==null?void 0:_.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},y=()=>a==="loading"?l.jsx(ci,{size:16,className:$.dialcodeSpinner}):a==="valid"?l.jsx(Pc,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Fo,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsxs("div",{className:$.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[$.input,o?$.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:g=>{i.onChange(g),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:$.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),y()]}),o&&l.jsx("span",{className:$.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?$.dialcodeValid:$.error,children:d})]})},ol={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},yO=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var ge,_e,we,G;const a=ce(L=>L.editorConfig),c=ce(L=>L.rootFormConfig),d=ce(L=>L.unitFormConfig),{organisationFramework:u,targetFrameworks:f,isLoading:y}=dh((ge=a==null?void 0:a.context)==null?void 0:ge.framework,(_e=a==null?void 0:a.context)==null?void 0:_e.targetFWIds),{frameworks:g,collectionAdditionalCategories:_}=z1((we=a==null?void 0:a.context)==null?void 0:we.channel),p=g==null?void 0:g.map(L=>({label:L.name,value:L.identifier})),v={organisationFramework:u,targetFrameworks:f,orgFrameworks:p,channelAdditionalCategories:_},m=xe(L=>L.selectedNodeId),b=xe(L=>L.treeCache),S=m?b[m]??{}:{},w={...e,...S},O=r?c:d,I=O||(((G=a==null?void 0:a.config.hierarchy)==null?void 0:G.formConfig)??[]),k=W1(I,w,v,r),P=k.filter(L=>L.tab===t&&L.inputType!=="appIcon"),B=U1({mode:"onChange",defaultValues:Object.fromEntries(k.map(L=>{const X=["multiselect","chips","keywords","tagsinput"],F=["nestedselect"];return X.includes(L.inputType)?[L.code,L.currentValue??L.defaultValue??[]]:F.includes(L.inputType)?[L.code,L.currentValue??L.defaultValue??{}]:[L.code,L.currentValue??L.defaultValue??""]}))});eO(B,k);const{updateNode:N}=xe(),M=h.useRef(k);M.current=k;const V=h.useRef(m);V.current=m;const A=h.useRef(i);A.current=i;const U=h.useRef(o);U.current=o,h.useEffect(()=>{B.trigger().then(()=>{const L=B.formState.errors,X=M.current,F=Array.from(new Set(Object.keys(L).map(Y=>{var K;return(K=X.find(oe=>oe.code===Y))==null?void 0:K.tab}).filter(Boolean)));U.current(Object.keys(L).length===0,F)})},[]),h.useEffect(()=>{const L=B.watch((X,{name:F})=>{const Y=V.current;if(!Y)return;const K=M.current,oe=new Set(K.map(ie=>ie.code));if(F&&oe.has(F)){const ie=B.getValues(F);N(Y,{[F]:ie}),A.current({[F]:ie})}else if(!F){const ie=B.getValues(),ne=Object.fromEntries(Object.entries(ie).filter(([de])=>oe.has(de)));Object.keys(ne).length>0&&(N(Y,ne),A.current(ne))}const Se=B.formState.errors,Ae=Array.from(new Set(Object.keys(Se).map(ie=>{var ne;return(ne=K.find(de=>de.code===ie))==null?void 0:ne.tab}).filter(Boolean)));U.current(Object.keys(Se).length===0,Ae)});return()=>L.unsubscribe()},[B]);const j=s!=="edit",J=P.reduce((L,X)=>{const F=L[L.length-1];return F&&F.section===X.section?F.fields.push(X):L.push({section:X.section,fields:[X]}),L},[]),se=L=>{const X={key:L.code,name:L.code,label:L.label,required:L.required,disabled:j||L.editable===!1};switch(L.inputType){case"textarea":return l.jsx(vh,{...X,multiline:!0,maxLength:L.maxLength});case"select":return l.jsx(rO,{...X,options:L.options??[]});case"multiselect":return l.jsx(nO,{...X,options:L.options??[]});case"chips":return l.jsx(sO,{...X});case"radio":return l.jsx(iO,{...X,options:L.options??[]});case"appIcon":return l.jsx(uO,{...X,nodeId:m??""});case"datepicker":case"datetime":return l.jsx(dO,{...X});case"keywords":case"tagsinput":return l.jsx(fO,{...X});case"nestedselect":return l.jsx(hO,{...X,levels:L.levels??[]});case"license":return l.jsx(pO,{...X});case"dialcode":return l.jsx(gO,{...X});default:return l.jsx(vh,{...X,maxLength:L.maxLength})}};return l.jsx(E1,{...B,children:l.jsxs("div",{className:ol.form,children:[J.map((L,X)=>{const F=L.section?q1[L.section]:void 0;return F?l.jsx(tO,{title:F.title,description:F.description,children:L.fields.map(se)},L.section??X):l.jsx("div",{className:ol.ungrouped,children:L.fields.map(se)},X)}),P.length===0&&!y&&l.jsx("p",{className:ol.noFields,children:"No fields configured for this tab."})]})})};function wh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function vO(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Yi(e){return e!==null&&e>=0}function mO(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function bO(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Sh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=wh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Ri={scaleX:1,scaleY:1},_O=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...Ri}:null}const c=wO(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Ri}:s<r&&s>=o?{x:0,y:a.height+c,...Ri}:{x:0,y:0,...Ri}};function wO(e,t,r){const n=e[t],s=e[t-1],i=e[t+1];return n?r<t?s?n.top-(s.top+s.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const Ch="Sortable",Oh=h.createContext({activeIndex:-1,containerId:Ch,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sh,disabled:{draggable:!1,droppable:!1}});function SO(e){let{children:t,id:r,items:n,strategy:s=Sh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=Nc(),f=ts(Ch,r),y=a.rect!==null,g=h.useMemo(()=>n.map(I=>typeof I=="object"&&"id"in I?I.id:I),[n]),_=o!=null,p=o?g.indexOf(o.id):-1,v=d?g.indexOf(d.id):-1,m=h.useRef(g),b=!mO(g,m.current),S=v!==-1&&p===-1||b,w=bO(i);Ht(()=>{b&&_&&u(g)},[b,g,_,u]),h.useEffect(()=>{m.current=g},[g]);const O=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:g,overIndex:v,useDragOverlay:y,sortedRects:vO(g,c),strategy:s}),[p,f,w.draggable,w.droppable,S,g,v,c,y,s]);return h.createElement(Oh.Provider,{value:O},t)}const CO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return wh(r,n,s).indexOf(t)},OO=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},EO={duration:200,easing:"ease"},Eh="transform",DO=wr.Transition.toString({property:Eh,duration:0,easing:"linear"}),IO={roleDescription:"sortable"};function TO(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=h.useState(null),a=h.useRef(r);return Ht(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=fn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),h.useEffect(()=>{i&&o(null)},[i]),i}function NO(e){let{animateLayoutChanges:t=OO,attributes:r,disabled:n,data:s,getNewIndex:i=CO,id:o,strategy:a,resizeObserverConfig:c,transition:d=EO}=e;const{items:u,containerId:f,activeIndex:y,disabled:g,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Oh),S=xO(n,g),w=u.indexOf(o),O=h.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),I=h.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:k,node:P,isOver:B,setNodeRef:N}=Uy({id:o,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...c}}),{active:M,activatorEvent:V,activeNodeRect:A,attributes:U,setNodeRef:j,listeners:J,isDragging:se,over:ge,setActivatorNodeRef:_e,transform:we}=Tc({id:o,data:O,attributes:{...IO,...r},disabled:S.draggable}),G=Eg(N,j),L=!!M,X=L&&!_&&Yi(y)&&Yi(v),F=!m&&se,Y=F&&X?we:null,oe=X?Y??(a??b)({rects:p,activeNodeRect:A,activeIndex:y,overIndex:v,index:w}):null,Se=Yi(y)&&Yi(v)?i({id:o,items:u,activeIndex:y,overIndex:v}):w,Ae=M==null?void 0:M.id,ie=h.useRef({activeId:Ae,items:u,newIndex:Se,containerId:f}),ne=u!==ie.current.items,de=t({active:M,containerId:f,isDragging:se,isSorting:L,id:o,index:w,items:u,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:d,wasDragging:ie.current.activeId!=null}),je=TO({disabled:!de,index:w,node:P,rect:k});return h.useEffect(()=>{L&&ie.current.newIndex!==Se&&(ie.current.newIndex=Se),f!==ie.current.containerId&&(ie.current.containerId=f),u!==ie.current.items&&(ie.current.items=u)},[L,Se,f,u]),h.useEffect(()=>{if(Ae===ie.current.activeId)return;if(Ae&&!ie.current.activeId){ie.current.activeId=Ae;return}const Pe=setTimeout(()=>{ie.current.activeId=Ae},50);return()=>clearTimeout(Pe)},[Ae]),{active:M,activeIndex:y,attributes:U,data:O,rect:k,index:w,newIndex:Se,items:u,isOver:B,isSorting:L,isDragging:se,listeners:J,node:P,overIndex:v,over:ge,setNodeRef:G,setActivatorNodeRef:_e,setDroppableNodeRef:N,setDraggableNodeRef:j,transform:je??oe,transition:Ke()};function Ke(){if(je||ne&&ie.current.newIndex===w)return DO;if(!(F&&!ei(V)||!d)&&(L||de))return wr.Transition.toString({...d,property:Eh})}}function xO(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Xi(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const kO=[me.Down,me.Right,me.Up,me.Left],AO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(kO.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const y=s.get(f.id);if(y)switch(e.code){case me.Down:n.top<y.top&&c.push(f);break;case me.Up:n.top>y.top&&c.push(f);break;case me.Left:n.left>y.left&&c.push(f);break;case me.Right:n.left<y.left&&c.push(f);break}});const d=zg({collisionRect:n,droppableRects:s,droppableContainers:c});let u=ec(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),y=i.get(u),g=y?s.get(y.id):null,_=y==null?void 0:y.node.current;if(_&&g&&f&&y){const v=ni(_).some((I,k)=>a[k]!==I),m=Dh(f,y),b=PO(f,y),S=v||!m?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},w={x:g.left,y:g.top};return S.x&&S.y?w:rs(w,S)}}}};function Dh(e,t){return!Xi(e)||!Xi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function PO(e,t){return!Xi(e)||!Xi(t)||!Dh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Yr={row:"_row_11nth_1",removeBtn:"_removeBtn_11nth_14",grip:"_grip_11nth_17",ctIcon:"_ctIcon_11nth_34",info:"_info_11nth_38",name:"_name_11nth_46",meta:"_meta_11nth_55"},MO={video:qo,pdf:$o,h5p:jo,scorm:Uo,audio:Bo,quiz:Lo,default:pn},LO=({item:e,onRemove:t,isEditable:r})=>{const n=zi(e),s=MO[n.key]??pn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=NO({id:e.id,disabled:!r}),f={transform:wr.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Yr.row,role:"listitem",children:[r&&l.jsx("span",{className:Yr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Fc,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Yr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Yr.info,children:[l.jsx("span",{className:Yr.name,title:e.name,children:e.name}),l.jsx("span",{className:Yr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Yr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(jr,{size:14})})]})},Rr={container:"_container_lzvke_1",header:"_header_lzvke_7",heading:"_heading_lzvke_13",count:"_count_lzvke_21",list:"_list_lzvke_30",emptyState:"_emptyState_lzvke_36",addRow:"_addRow_lzvke_52"},FO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=xe(),i=t?r(t):[],o=e==="edit",a=Rl(Oo(si,{activationConstraint:{distance:5}}),Oo(No,{coordinateGetter:AO})),c=h.useCallback(u=>{const{active:f,over:y}=u;if(!y||f.id===y.id||!t)return;const g=xe.getState().getChildrenOf(t),_=g.findIndex(v=>v.id===f.id),p=g.findIndex(v=>v.id===y.id);_<0||p<0||n(t,_,p)},[t,n]),d=h.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:Rr.container,children:[l.jsxs("div",{className:Rr.header,children:[l.jsx("span",{className:Rr.heading,children:"Content in this unit"}),l.jsx("span",{className:Rr.count,children:i.length})]}),i.length>0?l.jsx(Dc,{sensors:a,collisionDetection:Vg,onDragEnd:c,children:l.jsx(SO,{items:i.map(u=>u.id),strategy:_O,children:l.jsx("div",{className:Rr.list,role:"list",children:i.map(u=>l.jsx(LO,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:Rr.emptyState,children:[l.jsx("p",{children:"No content yet"}),l.jsx("span",{children:"Drag from the library or click Add content"})]}),o&&l.jsxs("button",{className:Rr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(cs,{size:14})," Add content"]})]}):null},Ih={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},$O=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Ih.dropZone} ${e?Ih.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function jO(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Me.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function BO(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Fe={contentPlayerRoot:"_contentPlayerRoot_ryh6z_1",stage:"_stage_ryh6z_9",playerHeader:"_playerHeader_ryh6z_19",playerHeaderThumb:"_playerHeaderThumb_ryh6z_33",playerHeaderTitle:"_playerHeaderTitle_ryh6z_43",typeBadge:"_typeBadge_ryh6z_53",typeDot:"_typeDot_ryh6z_92",aspectRatio:"_aspectRatio_ryh6z_99",playerFrame:"_playerFrame_ryh6z_112",coverOverlay:"_coverOverlay_ryh6z_120",coverHidden:"_coverHidden_ryh6z_132",coverThumb:"_coverThumb_ryh6z_137",coverPlayRing:"_coverPlayRing_ryh6z_146",coverPlayIcon:"_coverPlayIcon_ryh6z_159",coverLabel:"_coverLabel_ryh6z_168",coverSkeleton:"_coverSkeleton_ryh6z_174",playerWrapper:"_playerWrapper_ryh6z_200",infoStrip:"_infoStrip_ryh6z_210",infoChip:"_infoChip_ryh6z_226",infoChipLabel:"_infoChipLabel_ryh6z_245",infoChipIcon:"_infoChipIcon_ryh6z_254",playerError:"_playerError_ryh6z_260",playerErrorIcon:"_playerErrorIcon_ryh6z_274",playerErrorMsg:"_playerErrorMsg_ryh6z_279",qumlRoot:"_qumlRoot_ryh6z_286"},UO=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"],label:"Video",icon:"🎬"},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"],label:"Audio",icon:"🎵"},{key:"pdf",mimes:["application/pdf"],label:"PDF",icon:"📄"},{key:"epub",mimes:["application/epub"],label:"ePub",icon:"📖"},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"],label:"ECML",icon:"✏️"},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"],label:"H5P",icon:"🎮"},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"],label:"SCORM",icon:"📦"}];function VO(e){return UO.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const zO={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},qO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},HO={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},WO="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function al(e){for(const[t,r]of Object.entries(zO))if(r.includes(e))return t;return"default-player"}function KO(e,t,r){var i;const n=r==null?void 0:r.context,s=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((i=n==null?void 0:n.pdata)==null?void 0:i.id)??"sunbird.portal",ver:1,pid:"sunbird-portal"},contentId:e.identifier,sid:(n==null?void 0:n.sid)??"",uid:(n==null?void 0:n.uid)??"",channel:(n==null?void 0:n.channel)??"",did:(n==null?void 0:n.did)??"",timeDiff:0,contextRollup:{},tags:[],app:[(n==null?void 0:n.channel)??""],dims:""},config:{showEndPage:!1,showStartPage:!0,host:"",overlay:{showUser:!1},splash:{text:"",icon:"",bgImage:"",webLink:""},sideMenu:{showDownload:!0,showExit:!1,showShare:!0},apislug:"/action",repos:["/sunbird-plugins/renderer"],plugins:[{id:"org.sunbird.iframeEvent",ver:1,type:"plugin"},{id:"org.sunbird.player.endpage",ver:1.1,type:"plugin"}],enableTelemetryValidation:!1},metadata:t,data:s==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function GO(e){return document.querySelector(`script[src="${e}"]`)?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${e}`)),document.head.appendChild(n)})}async function QO(e,t,r=100){await GO(qO[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const o=setInterval(()=>{i++,customElements.get(e)?(clearInterval(o),n()):i>=r&&(clearInterval(o),s(new Error(`Custom element <${e}> did not register`)))},100)})}const YO=[{key:"author",label:"Author",icon:"👤"},{key:"license",label:"License",icon:"⚖️"},{key:"language",label:"Language",icon:"🌐"},{key:"gradeLevel",label:"Class",icon:"🏫"},{key:"subject",label:"Subject",icon:"📚"},{key:"contentType",label:"Type",icon:"🏷️"}];function RO({node:e}){const t=e.metadata??{},r=YO.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:Fe.infoStrip,children:r.map(n=>l.jsxs("div",{className:Fe.infoChip,children:[n.icon&&l.jsx("span",{className:Fe.infoChipIcon,children:n.icon}),l.jsx("span",{className:Fe.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function XO({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Fe.coverOverlay} ${t?Fe.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Fe.coverThumb}),l.jsx("div",{className:Fe.coverPlayRing,children:l.jsx("div",{className:Fe.coverPlayIcon})}),l.jsx("span",{className:Fe.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Fe.coverSkeleton})})}function ZO({message:e}){return l.jsxs("div",{className:Fe.playerError,children:[l.jsx("span",{className:Fe.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Fe.playerErrorMsg,children:e})]})}function JO({mimeType:e}){const t=VO(e);return l.jsxs("span",{className:Fe.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Fe.typeDot}),t.label]})}const ll=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(tE,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Fe.contentPlayerRoot,children:[l.jsxs("div",{className:Fe.stage,children:[l.jsxs("div",{className:Fe.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Fe.playerHeaderThumb}),l.jsx("span",{className:Fe.playerHeaderTitle,children:e.name}),l.jsx(JO,{mimeType:e.mimeType??""})]}),l.jsx(eE,{node:e})]}),l.jsx(RO,{node:e})]})};function eE({node:e}){var v;const t=ce(m=>m.editorConfig),[r,n]=h.useState(()=>al(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,d]=h.useState(e.metadata??{}),[u,f]=h.useState(!1),y=h.useRef(null),g=h.useRef(null),_=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??WO;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(al(e.mimeType??"")),BO(e.identifier).then(b=>{if(m)return;const S={...e.metadata??{},...b};d(S);const w=b.mimeType??e.mimeType??"";n(al(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=KO(e,c,t);return h.useEffect(()=>{if(!u||r!=="default-player")return;const m=y.current;if(!m)return;m.src=_;const b=()=>{try{const w=m.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(p),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},S=()=>a("Preview player could not be loaded.");return m.addEventListener("load",b),m.addEventListener("error",S),()=>{m.removeEventListener("load",b),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,_,u]),h.useEffect(()=>{if(!u||r==="default-player")return;const m=g.current;if(!m)return;const b=HO[r];if(!b)return;const S=p;QO(b,r).then(()=>{if(!g.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(S)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),m.innerHTML="",m.appendChild(w),setTimeout(()=>{try{w.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Fe.aspectRatio,children:[o?l.jsx(ZO,{message:o}):l.jsx(XO,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:y,id:"contentPlayer",title:e.name,className:Fe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:Fe.playerFrame})]})}function tE({node:e,editorMode:t}){const r=ce(s=>s.editorConfig),n=h.useRef(null);return h.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:Fe.qumlRoot,children:l.jsx("div",{ref:n,className:Fe.playerWrapper})})}const Vt={overlay:"_overlay_ifddx_1",modal:"_modal_ifddx_11",header:"_header_ifddx_21",body:"_body_ifddx_37",hint:"_hint_ifddx_43",list:"_list_ifddx_49",item:"_item_ifddx_55",selected:"_selected_ifddx_68",empty:"_empty_ifddx_73",footer:"_footer_ifddx_79",cancelBtn:"_cancelBtn_ifddx_87",moveBtn:"_moveBtn_ifddx_95"};function rE(e,t,r){const n=[],s=i=>{var o;for(const a of i)a.isFolder&&a.id!==r&&a.id!==t&&n.push(a),(o=a.children)!=null&&o.length&&s(a.children)};return s(e),n}const nE=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=xe(),o=rE(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=h.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Vt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Vt.modal,children:[l.jsxs("div",{className:Vt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:Vt.body,children:[l.jsx("p",{className:Vt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Vt.list,children:[o.map(f=>l.jsxs("li",{className:`${Vt.item} ${a===f.id?Vt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(av,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Vt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Vt.footer,children:[l.jsx("button",{className:Vt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Vt.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},rr={overlay:"_overlay_16at9_1",modal:"_modal_16at9_11",header:"_header_16at9_21",body:"_body_16at9_37",table:"_table_16at9_43",pageInput:"_pageInput_16at9_61",empty:"_empty_16at9_68",footer:"_footer_16at9_74",cancelBtn:"_cancelBtn_16at9_82",saveBtn:"_saveBtn_16at9_90"};function sE(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const iE=({onClose:e})=>{const{treeData:t,updateNode:r}=xe(),n=sE(t),[s,i]=h.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=h.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:rr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:rr.modal,children:[l.jsxs("div",{className:rr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(jr,{size:16})})]}),l.jsx("div",{className:rr.body,children:n.length===0?l.jsx("p",{className:rr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:rr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:rr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:rr.footer,children:[l.jsx("button",{className:rr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:rr.saveBtn,onClick:o,children:[l.jsx(yv,{size:14})," Save"]})]})]})})},Ve={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},oE=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var M,V;const{updateNode:s,markDirty:i}=xe(),o=t==="edit",a=zi(e),c=ce(A=>A.relationalFormConfig),d=A=>c==null?void 0:c.find(U=>U.code===A),u=A=>!c||!!d(A),f=(A,U)=>{var j;return((j=d(A))==null?void 0:j.label)||U},[y,g]=h.useState(!0),_=((M=e.metadata)==null?void 0:M.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((V=e.metadata)==null?void 0:V.keywords)?e.metadata.keywords:[]),[O,I]=h.useState(!!_.optional);h.useEffect(()=>{var U,j;const A=((U=e.metadata)==null?void 0:U.relationalMetadata)??{};v(A.name??e.name??""),w(Array.isArray(A.keywords)?A.keywords:Array.isArray((j=e.metadata)==null?void 0:j.keywords)?e.metadata.keywords:[]),I(!!A.optional)},[e.id]);const k=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},P=()=>{const A=m.trim();if(A&&!S.includes(A)){const U=[...S,A];w(U),s(e.id,{keywords:U}),i()}b("")},B=A=>{const U=S.filter(j=>j!==A);w(U),s(e.id,{keywords:U}),i()},N=A=>{I(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:Ve.container,children:[l.jsxs("div",{className:Ve.panelHeader,children:[l.jsxs("div",{className:Ve.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Ve.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Ve.panelCollapseBtn,onClick:()=>g(A=>!A),"aria-expanded":y,"aria-label":y?"Collapse metadata panel":"Expand metadata panel",title:y?"Collapse":"Expand",children:y?l.jsx(ls,{size:15}):l.jsx(sv,{size:15})})]}),y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ve.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Ve.icon}),l.jsx("input",{type:"text",className:Ve.nameInput,value:p,disabled:!o,onChange:A=>v(A.target.value),onBlur:k,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("div",{className:Ve.fieldHeader,children:l.jsxs("label",{className:Ve.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:Ve.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:Ve.chips,children:S.map(A=>l.jsxs("span",{className:Ve.chip,children:[A,o&&l.jsx("button",{type:"button",className:Ve.chipRemove,onClick:()=>B(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:Ve.keywordInput,children:[l.jsx("input",{type:"text",className:Ve.input,value:m,placeholder:"Add keyword and press Enter",onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),P())}}),l.jsx("button",{type:"button",className:Ve.addBtn,onClick:P,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("label",{className:Ve.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Ve.radioGroup,children:[l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},Ts={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},aE=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=xe(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[Ts.iconBtn,r?Ts.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:Ts.iconImg}):l.jsx("div",{className:Ts.placeholder,children:l.jsx($c,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ts.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(zo,{size:11})})]}),n&&l.jsx(bh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Rt={leafContentLayout:"_leafContentLayout_1osey_1",container:"_container_1osey_17",emptyState:"_emptyState_1osey_26",titleRow:"_titleRow_1osey_36",nodeTitle:"_nodeTitle_1osey_52",formArea:"_formArea_1osey_74",contentListArea:"_contentListArea_1osey_78",dropZone:"_dropZone_1osey_83",reviewComment:"_reviewComment_1osey_90",reviewCommentLabel:"_reviewCommentLabel_1osey_103",reviewCommentText:"_reviewCommentText_1osey_109"},lE=["application/vnd.sunbird.questionset"],cE=({editorMode:e,onToolbarEvent:t})=>{var M,V,A,U;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:y,breadcrumb:g,activeNodeMeta:_,updateNode:p,treeData:v}=xe(),m=ce(j=>{var J,se,ge,_e;return((se=(J=j.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((_e=(ge=j.editorConfig)==null?void 0:ge.context)==null?void 0:_e.identifier)??""}),b=y?Th(v,y):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),O=b&&lE.includes(b.mimeType??""),I=b&&!b.isFolder&&!O&&!S,k=((M=b==null?void 0:b.metadata)==null?void 0:M.rejectComment)??(S?(A=(V=v[0])==null?void 0:V.metadata)==null?void 0:A.rejectComment:void 0),P=h.useCallback(()=>{const j=u.current;if(!j||!y)return;const J=j.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(y,{name:J})},600)},[y,p]),B=h.useCallback(j=>{t({action:"onFormValueChange",data:j})},[t]),N=h.useCallback((j,J)=>{i(J),t({action:"onFormStatusChange",data:{isValid:j,nodeId:y}})},[t,y]);return b?O?l.jsx(ll,{node:b,editorMode:e,type:"quml"}):I?l.jsxs("div",{className:Rt.leafContentLayout,children:[l.jsx(ll,{node:b,editorMode:e,type:"content"}),l.jsx(oE,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(nE,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Rt.container,children:[l.jsx(w1,{crumbs:g}),k&&l.jsxs("div",{className:Rt.reviewComment,role:"alert",children:[l.jsx("span",{className:Rt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Rt.reviewCommentText,children:k})]}),l.jsxs("div",{className:Rt.titleRow,children:[S&&y&&l.jsx(aE,{nodeId:y,value:String(b.appIcon??((U=b.metadata)==null?void 0:U.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Rt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:P,onBlur:P,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(S1,{activeTab:r,onChange:j=>n(j),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Rt.formArea,children:l.jsx(yO,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:B,onFormStatusChange:N},`${y??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Rt.contentListArea,children:l.jsx(FO,{editorMode:e})}),l.jsx($O,{isActive:!1,label:"Drop to add content to this unit",nodeId:y??void 0,className:Rt.dropZone}),c&&l.jsx(iE,{contentId:m,onClose:()=>d(!1)})]}):l.jsx("div",{className:Rt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Th(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Th(r.children,t);if(n)return n}}}const Nh=di((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),uE=20;function xh(){var d;const e=ce(u=>u.editorConfig),t=xe(u=>u.selectedNodeId),r=xe(u=>u.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function u(f,y,g=0){var _;for(const p of f){if(p.id===y)return g;if((_=p.children)!=null&&_.length){const v=u(p.children,y,g+1);if(v>=0)return v}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...Lf];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...Lf]}function dE(){const e=Nh(),t=ce(f=>{var y,g;return((g=(y=f.editorConfig)==null?void 0:y.context)==null?void 0:g.channel)??""}),r=xh(),n=h.useRef(),s=h.useCallback(async(f="",y="all",g={},_=!0,p=!1)=>{var v,m,b,S,w;e.setLoading(!0);try{const O={status:["Live"],primaryCategory:y&&y!=="all"?[y]:r};(v=g==null?void 0:g.board)!=null&&v.length&&(O.board=g.board),(m=g==null?void 0:g.medium)!=null&&m.length&&(O.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(O.gradeLevel=g.gradeLevel),(S=g==null?void 0:g.subject)!=null&&S.length&&(O.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(O.primaryCategory=g.primaryCategory);const I=_?0:e.offset,{content:k,count:P}=await jO({filters:O,query:f,limit:f?50:uE,offset:I,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(k,P):e.appendContent(k,P)}catch(O){console.error("[useLibrary] load error:",O)}finally{e.setLoading(!1)}},[r,t]);h.useEffect(()=>{s()},[t]);const i=h.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=h.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=h.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=h.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=h.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const nr={card:"_card_jzciw_1",addBtn:"_addBtn_jzciw_17",dragging:"_dragging_jzciw_24",ctIcon:"_ctIcon_jzciw_29",info:"_info_jzciw_33",name:"_name_jzciw_41",meta:"_meta_jzciw_50",addBtnMuted:"_addBtnMuted_jzciw_78",added:"_added_jzciw_87",addedBadge:"_addedBadge_jzciw_96"},fE={video:qo,pdf:$o,h5p:jo,scorm:Uo,audio:Bo,quiz:Lo,default:pn},hE=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=zi(e),o=fE[i.key]??pn,a=Ha(),c=c1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:y,isDragging:g}=Tc({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:y,className:[nr.card,g?nr.dragging:"",s?nr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,nr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:nr.info,children:[l.jsx("span",{className:nr.name,title:e.name,children:e.name}),l.jsxs("span",{className:nr.meta,children:[((p=e.organisation)==null?void 0:p[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:nr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(hn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[nr.addBtn,!d&&a?nr.addBtnMuted:""].join(" "),onClick:m=>{m.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(cs,{size:14})})]})},kh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},pE=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:kh.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",kh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),et={panel:"_panel_1cl11_1",header:"_header_1cl11_10",headerTitle:"_headerTitle_1cl11_19",closeBtn:"_closeBtn_1cl11_25",body:"_body_1cl11_43",section:"_section_1cl11_59",sectionLabel:"_sectionLabel_1cl11_65",chips:"_chips_1cl11_73",chip:"_chip_1cl11_73",active:"_active_1cl11_96",footer:"_footer_1cl11_102",resetBtn:"_resetBtn_1cl11_112",applyBtn:"_applyBtn_1cl11_129"},gE=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],yE=new Set(["board","medium","gradeLevel","subject","topic"]),vE=({local:e,toggle:t})=>{const r=xh();return r.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:et.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[et.chip,(e.primaryCategory??[]).includes(n)?et.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},mE=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=ce(p=>p.editorConfig),i=ce(p=>p.searchFormConfig),{organisationFramework:o}=dh((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=h.useState(t),d=i!=null&&i.length?i.filter(p=>yE.has(p.code)).map(p=>({key:p.code,label:p.label||p.code})):gE;h.useEffect(()=>{c(t)},[t]);const u=(p,v)=>{c(m=>{const b=m[p]??[],S=b.includes(v)?b.filter(w=>w!==v):[...b,v];return{...m,[p]:S}})},f=(o==null?void 0:o.categories)??[],y=p=>{var v;return((v=f.find(m=>m.code===p))==null?void 0:v.terms)??[]};return e?l.jsxs("div",{className:et.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:et.header,children:[l.jsx("span",{className:et.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:et.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:et.body,children:[d.map(({key:p,label:v})=>{const m=y(p);return m.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:v}),l.jsx("div",{className:et.chips,children:m.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[et.chip,(a[p]??[]).includes(b.name)?et.active:""].join(" "),onClick:()=>u(p,b.name),children:b.name},b.identifier))})]},p):null}),l.jsx(vE,{local:a,toggle:u})]}),l.jsxs("div",{className:et.footer,children:[l.jsx("button",{type:"button",className:et.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:et.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},dr={header:"_header_6qdpu_10",title:"_title_6qdpu_20",headerActions:"_headerActions_6qdpu_31",iconBtn:"_iconBtn_6qdpu_38",playerArea:"_playerArea_6qdpu_56",footer:"_footer_6qdpu_64",addBtn:"_addBtn_6qdpu_73",modalOverlay:"_modalOverlay_6qdpu_92",modalPanel:"_modalPanel_6qdpu_103"},bE=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Be.createPortal(l.jsx("div",{className:dr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:dr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:dr.header,children:[l.jsx("span",{className:dr.title,title:e.name,children:e.name}),l.jsx("div",{className:dr.headerActions,children:l.jsx("button",{type:"button",className:dr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(jr,{size:16})})})]}),l.jsx("div",{className:dr.playerArea,children:l.jsx(ll,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:dr.footer,children:l.jsx("button",{type:"button",className:dr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},$e={dock:"_dock_1lpg0_1",header:"_header_1lpg0_8",headerLeft:"_headerLeft_1lpg0_17",headerTitle:"_headerTitle_1lpg0_24",count:"_count_1lpg0_30",searchRow:"_searchRow_1lpg0_39",searchWrap:"_searchWrap_1lpg0_47",searchIcon:"_searchIcon_1lpg0_53",searchInput:"_searchInput_1lpg0_62",filterToggleBtn:"_filterToggleBtn_1lpg0_80",filterToggleBtnActive:"_filterToggleBtnActive_1lpg0_99",filterBadge:"_filterBadge_1lpg0_105",filters:"_filters_1lpg0_124",mainArea:"_mainArea_1lpg0_134",sidePanelOverlay:"_sidePanelOverlay_1lpg0_143",cardList:"_cardList_1lpg0_152",skeleton:"_skeleton_1lpg0_168",skeletonIcon:"_skeletonIcon_1lpg0_178",skeletonText:"_skeletonText_1lpg0_186",skeletonLine:"_skeletonLine_1lpg0_193",skeletonLineSm:"_skeletonLineSm_1lpg0_200",loadMoreBtn:"_loadMoreBtn_1lpg0_215",emptyState:"_emptyState_1lpg0_240",collapseBtn:"_collapseBtn_1lpg0_260"};function _E(e){const t=new Set,r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t.add(n.identifier),n.children&&r.push(...n.children)}return t}const wE=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:y,toggleSort:g,loadMore:_}=dE(),{addResource:p,selectedNodeId:v,treeData:m}=xe(),b=e==="edit",[S,w]=h.useState(!1),[O,I]=h.useState({}),[k,P]=h.useState(null),B=h.useMemo(()=>_E(m),[m]),N=h.useCallback(j=>{var ge;if(!v){Ee.error("Select a unit first");return}const J=(ge=m[0])==null?void 0:ge.id;if(v===J){Ee("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(p(j,v)===!1){Ee.error(`"${j.name}" is already in this collection`);return}Ee.success(`Added "${j.name}"`)},[v,p,m]),M=h.useCallback(j=>{I(j),y(j)},[y]),V=h.useCallback(j=>{P(j)},[]),A=h.useCallback(j=>{N(j),P(null)},[N]),U=h.useMemo(()=>Object.values(O).reduce((j,J)=>j+((J==null?void 0:J.length)??0),0),[O]);return l.jsxs("div",{className:$e.dock,children:[l.jsx("div",{className:$e.header,children:l.jsxs("div",{className:$e.headerLeft,children:[l.jsx("button",{type:"button",className:$e.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(hv,{size:15})}),l.jsx(uv,{size:16}),l.jsx("span",{className:$e.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:$e.count,children:i})]})}),l.jsxs("div",{className:$e.searchRow,children:[l.jsxs("div",{className:$e.searchWrap,children:[l.jsx(Vo,{size:14,className:$e.searchIcon}),l.jsx("input",{type:"search",className:$e.searchInput,placeholder:"Search content…",value:a,onChange:j=>u(j.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[$e.filterToggleBtn,c?$e.filterToggleBtnActive:""].join(" "),onClick:g,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(rv,{size:15}):l.jsx(iv,{size:15})}),l.jsxs("button",{type:"button",className:[$e.filterToggleBtn,S?$e.filterToggleBtnActive:""].join(" "),onClick:()=>w(j=>!j),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(bv,{size:15}),U>0&&l.jsx("span",{className:$e.filterBadge,children:U})]})]}),l.jsx("div",{className:$e.filters,children:l.jsx(pE,{filters:u1,active:o,onChange:f})}),l.jsxs("div",{className:$e.mainArea,children:[l.jsx("div",{className:$e.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((j,J)=>l.jsxs("div",{className:$e.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:$e.skeletonIcon}),l.jsxs("div",{className:$e.skeletonText,children:[l.jsx("div",{className:$e.skeletonLine}),l.jsx("div",{className:$e.skeletonLineSm})]})]},J)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(j=>l.jsx(hE,{item:j,onAdd:N,onPreview:V,isDraggable:b,isAdded:B.has(j.identifier)},j.identifier)),d&&l.jsx("button",{type:"button",className:$e.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:$e.emptyState,children:[l.jsx(Vo,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:$e.sidePanelOverlay,children:l.jsx(mE,{isOpen:S,filters:O,onApply:M,onClose:()=>w(!1)})}),k&&l.jsx(bE,{content:k,onAdd:A,onClose:()=>P(null)})]})]})};function SE(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","medium","gradeLevel","subject","additionalCategories","keywords","language"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(y,g=!1){const _={};for(const[p,v]of Object.entries(y))if(!i.has(p)&&!(g&&o.has(p)))if(a.has(p))Array.isArray(v)?_[p]=v:v!=null&&v!==""?_[p]=[v]:_[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(_[p]=m)}else _[p]=v;return _}function u(y){var _;const g={};for(const p of y.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,...b}=v;if(Object.keys(b).length===0)continue;const S=((_=p.metadata)==null?void 0:_.relationalMetadata)??{};g[p.identifier]={name:p.name,...S,...b}}return g}function f(y,g){var S,w;const _=y.identifier,p=t[_],v=_.startsWith("temp-")||!!(p!=null&&p.isNew),m=!y.isFolder&&!g;if(g||v||p&&!m){let O;if(v)O={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=y.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=y.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:y.name,visibility:"Parent",channel:r,...d(y.metadata??{})};else if(g){const{isNew:I,...k}=p??{};O={...d(y.metadata??{},!0),...d(k,!1),name:y.name}}else{const{isNew:I,...k}=p??{};O={name:y.name,visibility:"Parent",...d(k,!0)}}n[_]={metadata:O,objectType:y.objectType||(y.isFolder?"Collection":"Content"),root:g,isNew:v}}const b=y.isFolder?u(y):{};s[_]={name:y.name,children:(y.children??[]).map(O=>O.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(y.children??[]).forEach(O=>f(O,!1))}return e.forEach((y,g)=>f(y,g===0)),{nodesModified:n,hierarchy:s}}function CE(){const[e,t]=h.useState(!1),r=xe(u=>u.treeCache),n=xe(u=>u.treeData),s=ce(u=>u.isDirty),i=ce(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ce(),c=ce(u=>u.editorConfig);return{save:h.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",y=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:g,hierarchy:_}=SE(n,r,f),{identifiers:p}=await Fb(u,g,_,y);p&&Object.keys(p).length>0&&xe.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(g){console.error("[useSaveHierarchy] save failed:",g),Ee.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function OE(e){const t=ce(o=>o.editorConfig),r=ce(o=>o.setButtonLoader),n=ce(o=>o.validateAllForms),s=xe(o=>o.treeData);return{runAction:h.useCallback(async(o,a)=>{var u,f,y,g;const c=((u=t==null?void 0:t.context)==null?void 0:u.contentId)??((f=t==null?void 0:t.context)==null?void 0:f.identifier)??"";if(!c)return Ee.error("No content identifier found."),!1;const d=((y=t==null?void 0:t.context)==null?void 0:y.userId)??((g=t==null?void 0:t.context)==null?void 0:g.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await Bb(c),Ee.success("Content sent for review"),!0):(Ee.error("Some units have missing required fields. Please fill them before sending for review."),!1);case"reject":{r("rejectCollection",!0);const _=(a==null?void 0:a.comment)??"";return await Ub(c,_),Ee.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await $b(c,d),Ee.success("Content published successfully"),!0):(Ee.error("Some units have missing required fields. Please fill them before publishing."),!1);default:return!1}}catch(_){console.error(`[useToolbarActions] ${o} failed`,_);const p=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return Ee.error(`Failed to ${p}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const Mt={shell:"_shell_90fon_1",workspace:"_workspace_90fon_8",sidebarCollapsed:"_sidebarCollapsed_90fon_16",dockCollapsed:"_dockCollapsed_90fon_19",dock:"_dock_90fon_19",outline:"_outline_90fon_40",reopenTab:"_reopenTab_90fon_45",outlineHidden:"_outlineHidden_90fon_79",editor:"_editor_90fon_86",dockHidden:"_dockHidden_90fon_101",dockReopenTab:"_dockReopenTab_90fon_108",dragChip:"_dragChip_90fon_133",dragChipLabel:"_dragChipLabel_90fon_148"},EE=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState(!1),{addResource:y,treeData:g}=xe(),_=ce(A=>A.setFormStatus),[p,v]=h.useState(!0),m=xe(A=>A.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:O}=CE(),{runAction:I}=OE(b);h.useEffect(()=>{if(!w)return;const A=U=>{U.preventDefault(),U.returnValue=""};return window.addEventListener("beforeunload",A),()=>window.removeEventListener("beforeunload",A)},[w]);const k=Rl(Oo(si,{activationConstraint:{distance:8}})),P=h.useCallback(A=>{var j;const U=(j=A.active.data.current)==null?void 0:j.item;U&&i(U)},[]),B=h.useCallback(A=>{var _e,we;i(null);const U=(_e=A.active.data.current)==null?void 0:_e.item;if(!U)return;const j=A.over,J=(j==null?void 0:j.id)??m??void 0;if(!J){Ee.error("Drop onto a unit to add content");return}const se=(we=g[0])==null?void 0:we.id;if(J===se){Ee.error("Drop content onto a unit, not directly on the course.");return}if(!y(U,J)){Ee.error(`"${U.name}" is already in this collection`);return}r==null||r(U,J),Ee.success(`Added "${U.name}" to unit`)},[m,y,r]),N=h.useCallback(async A=>{if(A.action==="onFormStatusChange"){const{isValid:U,nodeId:j}=A.data??{},J=U!==!1;v(J),j&&_(j,J);return}if(A.action==="back"&&w){f(!0);return}if(A.action==="saveCollection"){if(!p){Ee.error("Please fill the required metadata");return}await b(),n==null||n(g),t==null||t(A);return}if(A.action==="sendForReview"||A.action==="reject"||A.action==="publish"){await I(A.action,A.data)&&(t==null||t(A));return}t==null||t(A)},[b,I,t,n,g,w,p]),M=h.useCallback(async()=>{await b(),f(!1),n==null||n(g),t==null||t({action:"back"})},[b,n,t,g]),V=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Dc,{sensors:k,onDragStart:P,onDragEnd:B,children:[l.jsxs("div",{className:Mt.shell,children:[l.jsx(Rb,{editorMode:e,isSaving:S,isDirty:w,lastSaved:O,isFormValid:p,onToolbarEvent:N}),l.jsxs("div",{className:[Mt.workspace,o?Mt.sidebarCollapsed:"",c?Mt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Mt.outline,o?Mt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(_1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(A=>!A)})}),o&&l.jsx("button",{className:Mt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Mt.editor,role:"main","aria-label":"Content editor",children:l.jsx(cE,{editorMode:e,onToolbarEvent:N})}),l.jsx("aside",{className:[Mt.dock,c?Mt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(wE,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(A=>!A)})}),c&&l.jsx("button",{className:Mt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Xy,{dropAnimation:null,children:s?l.jsx("div",{className:Mt.dragChip,children:l.jsx("span",{className:Mt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(Xb,{onSave:M,onDiscard:V,onCancel:()=>f(!1),isSaving:S})]})},DE="v1";function IE(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function Ah(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:IE(e),depends:e.depends,sourceCategory:e.sourceCategory,range:e.range,enum:e.enum,default:e.default,defaultValue:e.defaultValue,index:e.index,section:t,output:e.output}}function Dr(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.title??n.name??void 0;for(const i of n.fields)i.code&&r.push(Ah(i,s))}else n.code&&r.push(Ah(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function TE(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,s]of Object.entries(t))s&&"default"in s&&(r[n]=s.default);return r}async function NE(e,t,r="Collection",n=DE){var d,u;const i=(u=(d=(await Me.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:Dr(o.create),unitForm:Dr(o.unitMetadata),childForm:Dr(o.childMetadata),searchForm:Dr(o.search??o.searchConfig),relationalForm:Dr(o.relationalMetadata),publishChecklist:Dr(o.publishchecklist),reviewChecklist:Dr(o.review),rfcChecklist:Dr(o.requestforchangeschecklist),schemaDefaults:TE(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function xE({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u}=ce(),{setTreeData:f,selectNode:y}=xe();return h.useEffect(()=>{let g=!1;async function _(){var p,v;try{n(!0),i(null),e.apiBaseUrl&&Uu(e.apiBaseUrl),c(e),d(e.config.mode);const m=e.context.contentId??e.context.identifier??"";if(m){const{rootNode:b}=await qu(m);g||(f(b?[b]:[]),b&&y(b.id));const S=e.config.primaryCategory??"Course",w=e.context.channel??"",O=e.config.categoryDefinitionApiVersion??"v1";try{const I=await NE(S,w,e.config.objectType??"Collection",O);if(!g){u(I);const k=((p=I.sourcingSettings)==null?void 0:p.collection)??{},P={};k.maxDepth&&!e.config.maxDepth&&(P.maxDepth=k.maxDepth),k.children&&!e.config.children&&(P.children=k.children),k.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(P.hierarchy={...e.config.hierarchy??{},...k.hierarchy}),Object.keys(P).length>0&&c({...e,config:{...e.config,...P}})}}catch{}}g||a(!0)}catch(m){if(!g){const b=m instanceof Error?m:new Error(String(m));i(b),t==null||t(b)}}finally{g||n(!1)}}return _(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ns={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},kE=new Cp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class AE extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:Ns.errorState,children:[l.jsx("h3",{children:"Something went wrong"}),l.jsx("p",{children:this.state.error.message}),l.jsx("button",{onClick:()=>this.setState({error:null}),children:"Retry"})]}):this.props.children}}function PE(e){const{isLoading:t,error:r}=xE({config:e,onError:e.onError}),n=ce(s=>s.editorMode);return t?l.jsxs("div",{className:Ns.loadingState,children:[l.jsx("div",{className:Ns.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ns.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ns.root}`,children:l.jsx(EE,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Ph=e=>l.jsx(AE,{onError:e.onError,children:l.jsxs(Ep,{client:kE,children:[l.jsx(PE,{...e}),l.jsx(Og,{position:"top-right",toastOptions:{duration:3e3}})]})}),Zi=Symbol.for("r2wc.reactRender"),Mh=Symbol.for("r2wc.shouldRender"),Ji=Symbol.for("r2wc.root");function ME(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function LE(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Lh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Zi]()}}),e[Zi]()}};function FE(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,y){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Lh.expando(y,u,f),Reflect.set(d,u,f,y)):(Lh.expando(y,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Mh]=!0,this[Zi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[Ji].unmount():r.unmountComponentAtNode(this)},a[Zi]=function(){if(this[Mh]===!0){var d={};Object.keys(this).forEach(function(y){s[y]!==!1&&(d[y]=this[y])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[Ji]||(this[Ji]=r.createRoot(u)),this[Ji].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return ME(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var y=n.dashStyleAttributes?LE(d):d;this[y]=f}),o}var xs={},ks=Be;if(process.env.NODE_ENV==="production")xs.createRoot=ks.createRoot,xs.hydrateRoot=ks.hydrateRoot;else{var eo=ks.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;xs.createRoot=function(e,t){eo.usingClientEntryPoint=!0;try{return ks.createRoot(e,t)}finally{eo.usingClientEntryPoint=!1}},xs.hydrateRoot=function(e,t,r){eo.usingClientEntryPoint=!0;try{return ks.hydrateRoot(e,t,r)}finally{eo.usingClientEntryPoint=!1}}}function $E(){if(document.getElementById("sb-ce-react-styles"))return;const e=document.createElement("style");e.id="sb-ce-react-styles",e.textContent="@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');",document.head.insertBefore(e,document.head.firstChild)}function jE(e="sb-collection-editor"){if($E(),typeof customElements>"u"||customElements.get(e))return;const t=FE(Ph,h,xs,{});customElements.define(e,t)}ve.CollectionEditor=Ph,ve.registerCollectionEditor=jE,ve.setApiBaseUrl=Uu,ve.useEditorStore=ce,ve.useLibraryStore=Nh,ve.useTreeStore=xe,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});
456
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=zr(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Si.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean),legacyInterceptorReqResOrdering:ut.transitional(ut.boolean),advertiseZstdAcceptEncoding:ut.transitional(ut.boolean),validateStatusUndefinedResolves:ut.transitional(ut.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:Si.assertOptions(s,{encode:ut.function,serialize:ut.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Si.assertOptions(r,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&D.merge(i.common,i[r.method]);i&&D.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=ct.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;c=c&&p.synchronous;const v=r.transitional||ia;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,f=0,y;if(!c){const _=[ju.bind(this),void 0];for(_.unshift(...a),_.push(...d),y=_.length,u=Promise.resolve(r);f<y;)u=u.then(_[f++],_[f++]);return u}y=a.length;let g=r;for(;f<y;){const _=a[f++],p=a[f++];try{g=_(g)}catch(v){p.call(this,v);break}}try{u=ju.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,y=d.length;f<y;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=zr(this.defaults,t);const r=Tu(t.baseURL,t.url,t.allowAbsoluteUrls,t);return mu(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){qr.prototype[t]=function(r,n){return this.request(zr(n||{},{method:t,url:r,data:n&&D.hasOwnProp(n,"data")?n.data:void 0}))}}),D.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(zr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}qr.prototype[t]=r(),t!=="query"&&(qr.prototype[t+"Form"]=r(!0))});let kb=class Xh{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 ps(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 Xh(function(s){t=s}),cancel:t}}};function Ab(e){return function(r){return e.apply(null,r)}}function Pb(e){return D.isObject(e)&&e.isAxiosError===!0}const fa={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(fa).forEach(([e,t])=>{fa[t]=e});function Uu(e){const t=new qr(e),r=tu(qr.prototype.request,t);return D.extend(r,qr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Uu(zr(e,s))},r}const We=Uu(hs);We.Axios=qr,We.CanceledError=ps,We.CancelToken=kb,We.isCancel=Cu,We.VERSION=ca,We.toFormData=vi,We.AxiosError=Z,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=Ab,We.isAxiosError=Pb,We.mergeConfig=zr,We.AxiosHeaders=ct,We.formToJSON=e=>Su(D.isHTMLForm(e)?new FormData(e):e),We.getAdapter=$u.getAdapter,We.HttpStatusCode=fa,We.default=We;const{Axios:oD,AxiosError:aD,CanceledError:lD,isCancel:cD,CancelToken:uD,VERSION:dD,all:fD,Cancel:hD,isAxiosError:pD,spread:gD,toFormData:yD,AxiosHeaders:vD,HttpStatusCode:mD,formToJSON:bD,getAdapter:_D,mergeConfig:wD,create:SD}=We;let ha="";function Vu(e){ha=e}const Me=We.create({timeout:3e4});Me.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Pv),n=(s=t.getState().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),ha&&(e.baseURL=ha),e});const zu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Mb(e,t={}){var c,d,u,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:zu,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Me.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:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function Lb(e){var r,n,s;return e.length?((s=(n=(r=(await Me.post("/action/user/v1/search",{request:{filters:{userId:e},fields:zu,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)??[]:[]}function qu(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",o=(r.mimeType??"")==="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",a=r.children,c=Array.isArray(a)?a.map(d=>qu(d,n)):[];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:o,children:c,metadata:r,parent:t}}async function Hu(e){var s,i,o,a,c,d,u;const t=await Me.get(`/action/content/v3/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)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=qu(r);return{content:r,rootNode:n}}async function Fb(e,t,r,n){var i;return((i=(await Me.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function $b(e,t=""){await Me.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function jb(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function Bb(e){await Me.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function Ub(e,t){await Me.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function Vb(e,t){await Me.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Ce={container:"_container_r27rp_1",header:"_header_r27rp_13",title:"_title_r27rp_22",closeBtn:"_closeBtn_r27rp_29",body:"_body_r27rp_45",label:"_label_r27rp_54",searchSection:"_searchSection_r27rp_62",searchRow:"_searchRow_r27rp_68",searchInput:"_searchInput_r27rp_74",searchSpinner:"_searchSpinner_r27rp_89",resultsList:"_resultsList_r27rp_105",resultItem:"_resultItem_r27rp_118",userInfo:"_userInfo_r27rp_133",userName:"_userName_r27rp_141",userEmail:"_userEmail_r27rp_150",userOrg:"_userOrg_r27rp_158",noResults:"_noResults_r27rp_167",collabSection:"_collabSection_r27rp_174",sectionTitle:"_sectionTitle_r27rp_179",badge:"_badge_r27rp_189",emptyCollab:"_emptyCollab_r27rp_203",collabList:"_collabList_r27rp_214",collabItem:"_collabItem_r27rp_223",userAvatar:"_userAvatar_r27rp_237",error:"_error_r27rp_251",success:"_success_r27rp_257",footer:"_footer_r27rp_263"},zb=({contentId:e,onClose:t})=>{var P,B;const r=ce(N=>N.editorConfig),n=(P=r==null?void 0:r.context)==null?void 0:P.channel,s=(B=r==null?void 0:r.config)==null?void 0:B.objectType,[i,o]=h.useState(""),[a,c]=h.useState([]),[d,u]=h.useState(!1),[f,y]=h.useState([]),[g,_]=h.useState(!1),[p,v]=h.useState(""),[m,b]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let N=!1;return(async()=>{try{const M=await jb(e),V=(M==null?void 0:M.collaborators)??[];if(!V.length)return;const A=await Lb(V);if(N)return;const U=V.map(j=>A.find(J=>J.identifier===j)??{identifier:j,firstName:j});y(U)}catch{}})(),()=>{N=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const N=i.trim();if(N.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const M=await Mb(N,{rootOrgId:n,objectType:s}),V=new Set(f.map(A=>A.identifier));c(M.filter(A=>!V.has(A.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(N=>{y(M=>M.find(V=>V.identifier===N.identifier)?M:[...M,N]),c(M=>M.filter(V=>V.identifier!==N.identifier)),b(!1)},[]),O=h.useCallback(N=>{y(M=>M.filter(V=>V.identifier!==N)),b(!1)},[]),I=h.useCallback(async()=>{_(!0),v(""),b(!1);try{await Vb(e,f.map(N=>N.identifier)),b(!0)}catch{v("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),k=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:Ce.container,children:[l.jsxs("div",{className:Ce.header,children:[l.jsx("h2",{className:Ce.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ce.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ce.body,children:[l.jsxs("div",{className:Ce.searchSection,children:[l.jsx("label",{className:Ce.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ce.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ce.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:Ce.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Ce.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var M,V,A,U;return l.jsxs("li",{className:Ce.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ce.userInfo,children:[l.jsx("span",{className:Ce.userName,children:k(N)}),N.email&&l.jsx("span",{className:Ce.userEmail,children:N.email}),(((V=(M=N.organisations)==null?void 0:M[0])==null?void 0:V.orgName)??N.rootOrgName)&&l.jsx("span",{className:Ce.userOrg,children:((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName})]}),l.jsx(Te,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Ce.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ce.collabSection,children:[l.jsxs("h3",{className:Ce.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Ce.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Ce.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ce.collabList,children:f.map(N=>{var M,V,A,U;return l.jsxs("li",{className:Ce.collabItem,children:[l.jsx("div",{className:Ce.userAvatar,"aria-hidden":"true",children:k(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ce.userInfo,children:[l.jsx("span",{className:Ce.userName,children:k(N)}),N.email&&l.jsx("span",{className:Ce.userEmail,children:N.email}),(((V=(M=N.organisations)==null?void 0:M[0])==null?void 0:V.orgName)??N.rootOrgName)&&l.jsx("span",{className:Ce.userOrg,children:((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName})]}),l.jsx(Te,{variant:"danger",size:"sm",onClick:()=>O(N.identifier),children:"Remove"})]},N.identifier)})})]}),p&&l.jsx("p",{className:Ce.error,role:"alert",children:p}),m&&l.jsx("p",{className:Ce.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ce.footer,children:[l.jsx(Te,{variant:"ghost",onClick:t,disabled:g,children:"Cancel"}),l.jsx(Te,{variant:"primary",isLoading:g,onClick:I,children:"Save"})]})]})};async function qb(e){return(await Me.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function Hb(e,t){var s;const n=((s=(await Me.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 Wb(e){var n;const r=((n=(await Me.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 ae={topbar:"_topbar_zj8wk_1",left:"_left_zj8wk_15",right:"_right_zj8wk_23",backBtn:"_backBtn_zj8wk_30",title:"_title_zj8wk_49",statusChip:"_statusChip_zj8wk_61",savedIndicator:"_savedIndicator_zj8wk_73",unsaved:"_unsaved_zj8wk_83",iconBtn:"_iconBtn_zj8wk_88",iconBtnLabel:"_iconBtnLabel_zj8wk_115",qrDropdown:"_qrDropdown_zj8wk_119",qrMenu:"_qrMenu_zj8wk_123",reviewBtns:"_reviewBtns_zj8wk_158",sourcingBtns:"_sourcingBtns_zj8wk_167",modalOverlay:"_modalOverlay_zj8wk_176",sbOverlay:"_sbOverlay_zj8wk_186",sbModal:"_sbModal_zj8wk_196",sbModalHeader:"_sbModalHeader_zj8wk_207",sbModalTitle:"_sbModalTitle_zj8wk_215",sbModalClose:"_sbModalClose_zj8wk_222",sbModalBody:"_sbModalBody_zj8wk_235",sbLabel:"_sbLabel_zj8wk_242",sbTextarea:"_sbTextarea_zj8wk_249",sbError:"_sbError_zj8wk_266",sbModalFooter:"_sbModalFooter_zj8wk_273"};function Kb(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Gb(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Wu=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ae.sbModalTitle,children:e}),l.jsx("button",{className:ae.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.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:ae.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ae.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Te,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Qb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ae.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ae.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Yb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ae.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",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:ae.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ae.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Rb=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Ae,re;const a=xe(se=>se.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=Gb(((Ae=a==null?void 0:a.metadata)==null?void 0:Ae.status)??(a==null?void 0:a.status)),u=ce(se=>{var de,je,Ke,Pe;return((je=(de=se.editorConfig)==null?void 0:de.context)==null?void 0:je.contentId)??((Pe=(Ke=se.editorConfig)==null?void 0:Ke.context)==null?void 0:Pe.identifier)??""}),{activeModal:f,modalData:y,closeModal:g,openModal:_}=$v(),p=ce(se=>se.buttonLoaders),v=ce(se=>se.categoryMeta),m=!v||v.schemaDefaults.generateDIALCodes!=="No",[b,S]=h.useState(!1),[w,O]=h.useState(!1),[I,k]=h.useState(!1),[P,B]=h.useState(!1),N=h.useRef(null),[M,V]=h.useState(!1);h.useEffect(()=>{if(!P)return;const se=de=>{var je;(je=N.current)!=null&&je.contains(de.target)||B(!1)};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[P]);const[A,U]=h.useState(!1),[j,J]=h.useState(!1),{updateNode:ie}=xe(),ye=(re=a==null?void 0:a.metadata)==null?void 0:re.qrCodeProcessId,we=h.useCallback(async se=>{if(u){V(!1),U(!0);try{const{processId:de,reservedDialcodes:je}=await Hb(u,se);de&&a&&ie(a.id,{qrCodeProcessId:de,reservedDialcodes:je}),Ee.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ee.error("Failed to generate QR Codes. Please try again.")}finally{U(!1)}}},[u,a,ie]),Se=h.useCallback(async()=>{if(!ye){Ee.error("No QR codes generated yet. Generate QR Codes first.");return}J(!0);try{const se=await Wb(ye);if(se.status==="in-process"){Ee("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const de=se.url;if(!de){Ee.error("QR Codes not ready yet. Please wait and try again.");return}const je=await fetch(de).then(rt=>rt.blob()),Ke=await new Promise(rt=>{const mt=new FileReader;mt.onloadend=()=>rt(mt.result),mt.readAsDataURL(je)}),Pe=(a==null?void 0:a.metadata)??{},te=rt=>Array.isArray(rt)?rt.join("_"):typeof rt=="string"?rt:"",Ye=[u,te(Pe.medium),te(Pe.gradeLevel),te(Pe.subject)].filter(Boolean),vt=new Date().toISOString().replace(/[:.]/g,"-"),St=`${Ye.join("_")}_${vt}.zip`,Ge=document.createElement("a");Ge.href=Ke,Ge.download=St,Ge.style.display="none",document.body.appendChild(Ge),Ge.click(),document.body.removeChild(Ge),Ee.success("QR codes downloaded.")}catch{Ee.error("Failed to download QR Codes.")}finally{J(!1)}},[ye,a,u]),G=e==="edit",F=e==="review",Y=e==="sourcingreview",L=e==="read",R=h.useCallback((se,de)=>{i({action:se,data:de})},[i]),K=h.useCallback(()=>{g(),R("publish")},[g,R]),oe=h.useCallback((se,de)=>{const je=y==null?void 0:y.action;g(),je==="approve"?R("sourcingApprove",{comment:se,score:de}):R("reject",{comment:se})},[g,R,y]),ge=h.useCallback(se=>{S(!1),R("sendBackForCorrections",{comment:se})},[R]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ae.topbar,role:"banner",children:[l.jsxs("div",{className:ae.left,children:[l.jsx("button",{className:ae.backBtn,onClick:()=>R("back"),"aria-label":"Go back",type:"button",children:l.jsx(tv,{size:18})}),l.jsx("h1",{className:ae.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ae.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ae.right,children:[t?l.jsx("span",{className:ae.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ae.savedIndicator} ${ae.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ae.savedIndicator,"aria-live":"polite",children:[l.jsx(hn,{size:14,"aria-hidden":"true"}),"Saved ",Kb(n)]}):null,!L&&!F&&!Y&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Te,{variant:"ghost",size:"sm",onClick:()=>R("saveCollection"),disabled:!s,children:"Save as Draft"})}),G&&l.jsxs(l.Fragment,{children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>k(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(vv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ae.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(_v,{size:16,"aria-hidden":"true"})}),m&&l.jsxs("div",{className:ae.qrDropdown,ref:N,children:[l.jsxs("button",{className:ae.iconBtn,onClick:()=>B(se=>!se),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":P,children:[l.jsx(Bc,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ae.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),P&&l.jsxs("div",{className:ae.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{B(!1),V(!0)},disabled:A,children:[l.jsx(Bc,{size:14}),A?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{B(!1),Se()},disabled:j||!ye,children:[l.jsx(ov,{size:14}),j?"Downloading…":"Download QR Codes"]})]})]})]}),F&&l.jsxs("div",{className:ae.reviewBtns,children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:p.publishCollection,isLoading:p.publishCollection,children:[l.jsx(Mc,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Te,{variant:"danger",size:"sm",onClick:()=>O(!0),disabled:p.rejectCollection,isLoading:p.rejectCollection,children:[l.jsx($o,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Te,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[l.jsx(gv,{size:14,"aria-hidden":"true"})," Send Back"]})]}),Y&&l.jsxs("div",{className:ae.sourcingBtns,children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(mv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Te,{variant:"danger",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx($o,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(Uv,{contentId:u,onConfirm:K,onCancel:g}),f==="qualityParams"&&l.jsx(Vv,{contentId:u,action:(y==null?void 0:y.action)??"reject",onConfirm:oe,onCancel:g}),f==="manageCollaborators"&&l.jsx("div",{className:ae.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(zb,{contentId:u,onClose:g})}),I&&l.jsx(Qb,{onConfirm:()=>{k(!1),R("sendForReview")},onCancel:()=>k(!1)}),w&&l.jsx(Wu,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:se=>{O(!1),R("reject",{comment:se})},onCancel:()=>O(!1)}),b&&l.jsx(Wu,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:ge,onCancel:()=>S(!1)}),M&&l.jsx(Yb,{onConfirm:we,onCancel:()=>V(!1)})]})},Xb=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Be.createPortal(l.jsx("div",{className:Ne.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ne.modal,children:[l.jsxs("div",{className:Ne.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Ne.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Ne.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Ne.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Te,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Te,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var Zb=Yo();const Ku=h.createContext(null);function Dt(){const e=h.useContext(Ku);if(e===null)throw new Error("No Tree Api Provided");return e}const Gu=h.createContext(null);function Jb(){const e=h.useContext(Gu);if(e===null)throw new Error("Provide a NodesContext");return e}const Qu=h.createContext(null);function e_(){const e=h.useContext(Qu);if(e===null)throw new Error("Provide a DnDContext");return e}const Yu=h.createContext(0);function Ru(){h.useContext(Yu)}function Ci(e,t,r){return Math.max(Math.min(e,r),t)}function Xu(e){return e&&e.isLeaf}function Zu(e){return e&&e.isInternal&&!e.isOpen}function Ju(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const ed=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},td=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function pa(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=pa(r,t);if(n)return n}return null}function Oi(e,t){if(t(e),e.children)for(let r of e.children)Oi(r,t)}function rd(e){const t=sd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=t_(t,n);break}r==null||r.focus()}function nd(e){const t=sd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=r_(t,n);break}r==null||r.focus()}function t_(e,t){return t+1<e.length?e[t+1]:e[0]}function r_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function sd(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 gs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function _n(e){return typeof e=="string"?e:e.id}function n_(e,...t){if(e)return e(...t)}function id(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function od(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 ad(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const s_=Object.freeze(Object.defineProperty({__proto__:null,access:gs,bound:Ci,dfs:pa,focusNextElement:rd,focusPrevElement:nd,getInsertIndex:od,getInsertParentId:ad,identify:_n,indexOf:td,isClosed:Zu,isDescendant:ed,isItem:Xu,isOpenWithEmptyChildren:Ju,safeRun:n_,waitFor:id,walk:Oi},Symbol.toStringTag,{value:"Module"})),i_={display:"flex",alignItems:"center",zIndex:1},o_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},a_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},l_=h.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({},i_),s),children:[l.jsx("div",{style:Object.assign({},a_)}),l.jsx("div",{style:Object.assign({},o_)})]})});function c_({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 u_(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(f_,Object.assign({},e)):l.jsx(d_,Object.assign({},e))]})}function d_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function f_({node:e}){const t=h.useRef();return h.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 ys="__REACT_ARBORIST_INTERNAL_ROOT__";function ld(e){var t;function r(i,o,a){const c=e.accessId(i),d=new vs({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new vs({tree:e,id:ys,data:{id:ys},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 vs{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===ys}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 vs(Object.assign({},this))}edit(){return this.tree.edit(this)}}function ga(e){return{type:"EDIT",id:e}}function h_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function wn(e){return{type:"FOCUS",id:e}}function p_(){return{type:"TREE_BLUR"}}function g_(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 cd(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 y_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:cd(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:cd(e.unfiltered,t)}):e}const Sn=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}}},Cr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:_n(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(_n)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(_n)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:_n(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:_n(e)})};function v_(e=Sn().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 Cn={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 m_(e=Sn().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 Sn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const b_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},__=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},w_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function ud({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(S_,{isDragging:s,children:[l.jsx(C_,{offset:e,children:l.jsx(E_,{id:r,dragIds:n})}),l.jsx(O_,{mouse:t,count:n.length})]})}const S_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:b_,children:t.children}):null});function C_(e){return l.jsx("div",{className:"row preview",style:__(e.offset),children:e.children})}function O_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:w_(r),children:t}):null}const E_=h.memo(function(t){const r=Dt(),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 va(){return va=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},va.apply(null,arguments)}function dd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ma(e,t){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ma(e,t)}function D_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ma(e,t)}var fd=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function I_(e,t){return!!(e===t||fd(e)&&fd(t))}function T_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!I_(e[r],t[r]))return!1;return!0}function ba(e,t){t===void 0&&(t=T_);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 N_=typeof performance=="object"&&typeof performance.now=="function",hd=N_?function(){return performance.now()}:function(){return Date.now()};function pd(e){cancelAnimationFrame(e.id)}function x_(e,t){var r=hd();function n(){hd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var _a=-1;function gd(e){if(e===void 0&&(e=!1),_a===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),_a=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return _a}var On=null;function yd(e){if(e===void 0&&(e=!1),On===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?On="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?On="negative":On="positive-ascending"),document.body.removeChild(t),On}return On}process.env.NODE_ENV;var k_=150,A_=function(t,r){return t},Ei=null,Di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ei=new WeakSet,Di=new WeakSet);function vd(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){D_(y,f);function y(_){var p;return p=f.call(this,_)||this,p._instanceProps=c(p.props,dd(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:dd(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=ba(function(v,m,b,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:b,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=ba(function(v,m,b){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,b=m.direction,S=m.itemSize,w=m.layout,O=p._getItemStyleCache(d&&S,d&&w,d&&b),I;if(O.hasOwnProperty(v))I=O[v];else{var k=r(p.props,v,p._instanceProps),P=s(p.props,v,p._instanceProps),B=b==="horizontal"||w==="horizontal",N=b==="rtl",M=B?k:0;O[v]=I={position:"absolute",left:N?void 0:M,right:N?M:void 0,top:B?0:k,height:B?"100%":P,width:B?P:"100%"}}return I},p._getItemStyleCache=void 0,p._getItemStyleCache=ba(function(v,m,b){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,b=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(O){if(O.scrollOffset===S)return null;var I=p.props.direction,k=S;if(I==="rtl")switch(yd()){case"negative":k=-S;break;case"positive-descending":k=w-b-S;break}return k=Math.max(0,Math.min(k,w-b)),{isScrolling:!0,scrollDirection:O.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,b=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(O){if(O.scrollOffset===w)return null;var I=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:O.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var m=p.props.outerRef;p._outerRef=v,typeof m=="function"?m(v):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=v)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&pd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=x_(p._resetIsScrolling,k_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}y.getDerivedStateFromProps=function(p,v){return P_(p,v),u(p),null};var g=y.prototype;return g.scrollTo=function(p){p=Math.max(0,p),this.setState(function(v){return v.scrollOffset===p?null:{scrollDirection:v.scrollOffset<p?"forward":"backward",scrollOffset:p,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,b=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,b-1));var O=0;if(this._outerRef){var I=this._outerRef;S==="vertical"?O=I.scrollWidth>I.clientWidth?gd():0:O=I.scrollHeight>I.clientHeight?gd():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,O))},g.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,b=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||b==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},g.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var O=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(yd()){case"negative":O.scrollLeft=-S;break;case"positive-ascending":O.scrollLeft=S;break;default:var I=O.clientWidth,k=O.scrollWidth;O.scrollLeft=k-I-S;break}else O.scrollLeft=S;else O.scrollTop=S}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&pd(this._resetIsScrollingTimeoutId)},g.render=function(){var p=this.props,v=p.children,m=p.className,b=p.direction,S=p.height,w=p.innerRef,O=p.innerElementType,I=p.innerTagName,k=p.itemCount,P=p.itemData,B=p.itemKey,N=B===void 0?A_:B,M=p.layout,V=p.outerElementType,A=p.outerTagName,U=p.style,j=p.useIsScrolling,J=p.width,ie=this.state.isScrolling,ye=b==="horizontal"||M==="horizontal",we=ye?this._onScrollHorizontal:this._onScrollVertical,Se=this._getRangeToRender(),G=Se[0],F=Se[1],Y=[];if(k>0)for(var L=G;L<=F;L++)Y.push(h.createElement(v,{data:P,key:N(L,P),index:L,isScrolling:j?ie:void 0,style:this._getItemStyle(L)}));var R=n(this.props,this._instanceProps);return h.createElement(V||A||"div",{className:m,onScroll:we,ref:this._outerRefSetter,style:va({position:"relative",height:S,width:J,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},U)},h.createElement(O||I||"div",{children:Y,ref:w,style:{height:ye?"100%":R,pointerEvents:ie?"none":void 0,width:ye?R:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],b=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,b,S,w)}}if(typeof this.props.onScroll=="function"){var O=this.state,I=O.scrollDirection,k=O.scrollOffset,P=O.scrollUpdateWasRequested;this._callOnScroll(I,k,P)}},g._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,b=this.state,S=b.isScrolling,w=b.scrollDirection,O=b.scrollOffset;if(v===0)return[0,0,0,0];var I=o(this.props,O,this._instanceProps),k=a(this.props,I,O,this._instanceProps),P=!S||w==="backward"?Math.max(1,m):1,B=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,I-P),Math.max(0,Math.min(v-1,k+B)),I,k]},y}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var P_=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Di&&!Di.has(u)&&(Di.add(u),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":Ei&&!Ei.has(u)&&(Ei.add(u),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 d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" 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.'))}},M_=50,En=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 d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},L_=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?md(t,r,i,0,n):F_(t,r,Math.max(0,i),n)},md=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=En(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},F_=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&En(t,n,r).offset<s;)n+=o,o*=2;return md(t,r,Math.min(n,i-1),Math.floor(n/2),s)},bd=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 d=n-o-1,u=d*i;return a+u},$_=vd({getItemOffset:function(t,r,n){return En(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:bd,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",y=f?u:c,g=En(t,r,i),_=bd(t,i),p=Math.max(0,Math.min(_-y,g.offset)),v=Math.max(0,g.offset-y+g.size+o);switch(n==="smart"&&(s>=v-y&&s<=p+y?n="auto":n="center"),n){case"start":return p;case"end":return v;case"center":return Math.round(v+(p-v)/2);case"auto":default:return s>=v&&s<=p?s:s<v?v:p}},getStartIndexForOffset:function(t,r,n){return L_(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,y=En(t,r,s),g=n+f,_=y.offset+y.size,p=r;p<a-1&&_<g;)p++,_+=En(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||M_,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.'))}}),j_=vd({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,d=t.itemCount,u=t.itemSize,f=t.layout,y=t.width,g=a==="horizontal"||f==="horizontal",_=g?y:c,p=Math.max(0,d*u-_),v=Math.min(p,r*u),m=Math.max(0,r*u-_+u+o);switch(n==="smart"&&(s>=m-_&&s<=v+_?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var b=Math.round(m+(v-m)/2);return b<Math.ceil(_/2)?0:b>p+Math.floor(_/2)?p:b}case"auto":default:return s>=m&&s<=v?s:s<m?m: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,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,y=u?d:i,g=Math.ceil((y+n-f)/a);return Math.max(0,Math.min(o-1,r+g-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 B_(){var e,t;const r=Dt(),s=e_().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 U_=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 V_=h.forwardRef(function(t,r){const{children:n}=t,s=U_(t,["children"]),i=Dt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(z_,{}),n]}))}),z_=()=>{const e=Dt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(B_,{})})};var q_=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 H_=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=q_(t,["style"]);const d=Dt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.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)+u+f}px`})},c))});var _d=h.createContext({dragDropManager:void 0}),jt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(jt||(jt={}));function ue(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 wa="dnd-core/INIT_COORDS",Ii="dnd-core/BEGIN_DRAG",Sa="dnd-core/PUBLISH_DRAG_SOURCE",Ti="dnd-core/HOVER",Ni="dnd-core/DROP",xi="dnd-core/END_DRAG";function wd(e,t){return{type:wa,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function ki(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ki=function(r){return typeof r}:ki=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ki(e)}function W_(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function K_(e,t){return e.filter(function(r){return r!==t})}function Sd(e){return ki(e)==="object"}function G_(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 Q_(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var Y_={type:wa,payload:{clientOffset:null,sourceClientOffset:null}};function R_(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(),d=e.getRegistry();e.dispatch(wd(o)),X_(r,c,d);var u=ew(r,c);if(u===null){e.dispatch(Y_);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");Z_(a),f=a(u)}e.dispatch(wd(o,f));var y=d.getSource(u),g=y.beginDrag(c,u);if(g!=null){J_(g),d.pinSource(u);var _=d.getSourceType(u);return{type:Ii,payload:{itemType:_,item:g,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function X_(e,t,r){ue(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ue(r.getSource(n),"Expected sourceIds to be registered.")})}function Z_(e){ue(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function J_(e){ue(Sd(e),"Item must be an object.")}function ew(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 tw(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Sa}}}function Ca(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function rw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;nw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();sw(i,o,a);var c=o.getItemType();return iw(i,a,c),ow(i,o,a),{type:Ti,payload:{targetIds:i,clientOffset:s||null}}}}function nw(e){ue(Array.isArray(e),"Expected targetIds to be an array.")}function sw(e,t,r){ue(t.isDragging(),"Cannot call hover while not dragging."),ue(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ue(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ue(i,"Expected targetIds to be registered.")}}function iw(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ca(i,r)||e.splice(n,1)}}function ow(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Cd(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 Od(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Cd(Object(r),!0).forEach(function(n){aw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lw(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();cw(n);var i=fw(n);i.forEach(function(o,a){var c=uw(o,a,s,n),d={type:Ni,payload:{dropResult:Od(Od({},r),c)}};e.dispatch(d)})}}function cw(e){ue(e.isDragging(),"Cannot call drop while not dragging."),ue(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function uw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return dw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function dw(e){ue(typeof e>"u"||Sd(e),"Drop result must either be an object or undefined.")}function fw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function hw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();pw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:xi}}}function pw(e){ue(e.isDragging(),"Cannot call endDrag while not dragging.")}function gw(e){return{beginDrag:R_(e),publishDragSource:tw(e),hover:rw(e),drop:lw(e),endDrag:hw(e)}}function yw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vw(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 mw(e,t,r){return t&&vw(e.prototype,t),e}function ms(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bw=function(){function e(t,r){var n=this;yw(this,e),ms(this,"store",void 0),ms(this,"monitor",void 0),ms(this,"backend",void 0),ms(this,"isSetUp",!1),ms(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 mw(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),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=gw(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 Bt(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 Ed=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Dd=function(){return Math.random().toString(36).substring(7).split("").join(".")},Id={INIT:"@@redux/INIT"+Dd(),REPLACE:"@@redux/REPLACE"+Dd()};function _w(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 ww(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(Ow(e))return"date";if(Cw(e))return"error";var r=Sw(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 Sw(e){return typeof e.constructor=="function"?e.constructor.name:null}function Cw(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Ow(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Dn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=ww(e)),t}function Td(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"?Bt(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"?Bt(1):"Expected the enhancer to be a function. Instead, received: '"+Dn(r)+"'");return r(Td)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(2):"Expected the root reducer to be a function. Instead, received: '"+Dn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(4):"Expected the listener to be a function. Instead, received: '"+Dn(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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 d(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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,d();var b=a.indexOf(p);a.splice(b,1),o=null}}}function y(p){if(!_w(p))throw new Error(process.env.NODE_ENV==="production"?Bt(7):"Actions must be plain objects. Instead, the actual type was: '"+Dn(p)+"'. 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 p.type>"u")throw new Error(process.env.NODE_ENV==="production"?Bt(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"?Bt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,p)}finally{c=!1}for(var v=o=a,m=0;m<v.length;m++){var b=v[m];b()}return p}function g(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(10):"Expected the nextReducer to be a function. Instead, received: '"+Dn(p));s=p,y({type:Id.REPLACE})}function _(){var p,v=f;return p={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Bt(11):"Expected the observer to be an object. Instead, received: '"+Dn(b)+"'");function S(){b.next&&b.next(u())}S();var w=v(S);return{unsubscribe:w}}},p[Ed]=function(){return this},p}return y({type:Id.INIT}),n={dispatch:y,subscribe:f,getState:u,replaceReducer:g},n[Ed]=_,n}var Ew=function(t,r){return t===r};function Dw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Iw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ew;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 Nd(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 xd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nd(Object(r),!0).forEach(function(n){Tw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var kd={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Nw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kd,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case wa:case Ii:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Ti:return Dw(e.clientOffset,r.clientOffset)?e:xd(xd({},e),{},{clientOffset:r.clientOffset});case xi:case Ni:return kd;default:return e}}var Oa="dnd-core/ADD_SOURCE",Ea="dnd-core/ADD_TARGET",Da="dnd-core/REMOVE_SOURCE",Ai="dnd-core/REMOVE_TARGET";function xw(e){return{type:Oa,payload:{sourceId:e}}}function kw(e){return{type:Ea,payload:{targetId:e}}}function Aw(e){return{type:Da,payload:{sourceId:e}}}function Pw(e){return{type:Ai,payload:{targetId:e}}}function Ad(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 Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ad(Object(r),!0).forEach(function(n){Mw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ad(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Lw={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Fw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lw,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ii:return Ut(Ut({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Sa:return Ut(Ut({},e),{},{isSourcePublic:!0});case Ti:return Ut(Ut({},e),{},{targetIds:r.targetIds});case Ai:return e.targetIds.indexOf(r.targetId)===-1?e:Ut(Ut({},e),{},{targetIds:K_(e.targetIds,r.targetId)});case Ni:return Ut(Ut({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case xi:return Ut(Ut({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function $w(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Oa:case Ea:return e+1;case Da:case Ai:return e-1;default:return e}}var Pi=[],Ia=[];Pi.__IS_NONE__=!0,Ia.__IS_ALL__=!0;function jw(e,t){if(e===Pi)return!1;if(e===Ia||typeof t>"u")return!0;var r=Q_(t,e);return r.length>0}function Bw(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Ti:break;case Oa:case Ea:case Ai:case Da:return Pi;case Ii:case Sa:case xi:case Ni:default:return Ia}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=G_(n,i),a=o.length>0||!Iw(n,i);if(!a)return Pi;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function Uw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Pd(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 Md(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pd(Object(r),!0).forEach(function(n){Vw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Bw(e.dirtyHandlerIds,{type:t.type,payload:Md(Md({},t.payload),{},{prevTargetIds:W_(e,"dragOperation.targetIds",[])})}),dragOffset:Nw(e.dragOffset,t),refCount:$w(e.refCount,t),dragOperation:Fw(e.dragOperation,t),stateId:Uw(e.stateId)}}function qw(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Ld(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hw(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Ld(qw(t,n),r)}function Ww(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Ld(t,r)}function Kw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gw(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 Qw(e,t,r){return t&&Gw(e.prototype,t),e}function Fd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Yw=function(){function e(t,r){Kw(this,e),Fd(this,"store",void 0),Fd(this,"registry",void 0),this.store=t,this.registry=r}return Qw(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;ue(typeof r=="function","listener must be a function."),ue(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!jw(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ue(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 ue(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(ue(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 Ca(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(ue(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&&!Ca(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 Hw(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return Ww(this.store.getState().dragOffset)}}]),e}(),Rw=0;function Xw(){return Rw++}function Mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mi=function(r){return typeof r}:Mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Mi(e)}function Zw(e){ue(typeof e.canDrag=="function","Expected canDrag to be a function."),ue(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ue(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Jw(e){ue(typeof e.canDrop=="function","Expected canDrop to be a function."),ue(typeof e.hover=="function","Expected hover to be a function."),ue(typeof e.drop=="function","Expected beginDrag to be a function.")}function Ta(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Ta(r,!1)});return}ue(typeof e=="string"||Mi(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 $d=typeof global<"u"?global:self,jd=$d.MutationObserver||$d.WebKitMutationObserver;function Bd(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function eS(e){let t=1;const r=new jd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const tS=typeof jd=="function"?eS:Bd;class rS{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=tS(this.flush),this.requestErrorThrow=Bd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class nS{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 sS{create(t){const r=this.freeTasks,n=r.length?r.pop():new nS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Ud=new rS,iS=new sS(Ud.registerPendingError);function oS(e){Ud.enqueueTask(iS.create(e))}function aS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lS(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 cS(e,t,r){return t&&lS(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 uS(e,t){return pS(e)||hS(e,t)||fS(e,t)||dS()}function dS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fS(e,t){if(e){if(typeof e=="string")return Vd(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 Vd(e,t)}}function Vd(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 hS(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 pS(e){if(Array.isArray(e))return e}function gS(e){var t=Xw().toString();switch(e){case jt.SOURCE:return"S".concat(t);case jt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function zd(e){switch(e[0]){case"S":return jt.SOURCE;case"T":return jt.TARGET;default:ue(!1,"Cannot parse handler ID: ".concat(e))}}function qd(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=uS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var yS=function(){function e(t){aS(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 cS(e,[{key:"addSource",value:function(r,n){Ta(r),Zw(n);var s=this.addHandler(jt.SOURCE,r,n);return this.store.dispatch(xw(s)),s}},{key:"addTarget",value:function(r,n){Ta(r,!0),Jw(n);var s=this.addHandler(jt.TARGET,r,n);return this.store.dispatch(kw(s)),s}},{key:"containsHandler",value:function(r){return qd(this.dragSources,r)||qd(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;ue(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 ue(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return ue(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return ue(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=zd(r);return n===jt.SOURCE}},{key:"isTargetId",value:function(r){var n=zd(r);return n===jt.TARGET}},{key:"removeSource",value:function(r){var n=this;ue(this.getSource(r),"Expected an existing source."),this.store.dispatch(Aw(r)),oS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){ue(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Pw(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);ue(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){ue(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=gS(r);return this.types.set(i,n),r===jt.SOURCE?this.dragSources.set(i,s):r===jt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function vS(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=mS(n),i=new Yw(s,new yS(s)),o=new bw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function mS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Td(zw,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var bS=["children"];function _S(e,t){return OS(e)||CS(e,t)||SS(e,t)||wS()}function wS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
458
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SS(e,t){if(e){if(typeof e=="string")return Hd(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 Hd(e,t)}}function Hd(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 CS(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 OS(e){if(Array.isArray(e))return e}function ES(e,t){if(e==null)return{};var r=DS(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 DS(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 Wd=0,Li=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),IS=h.memo(function(t){var r=t.children,n=ES(t,bS),s=TS(n),i=_S(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=Kd();return++Wd,function(){--Wd===0&&(c[Li]=null)}}},[]),l.jsx(_d.Provider,Object.assign({value:o},{children:r}),void 0)});function TS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=NS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function NS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Kd(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Li]||(s[Li]={dragDropManager:vS(e,t,r,n)}),s[Li]}function Kd(){return typeof global<"u"?global:window}function xS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kS(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 AS(e,t,r){return t&&kS(e.prototype,t),e}function Gd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Na=!1,xa=!1,PS=function(){function e(t){xS(this,e),Gd(this,"internalMonitor",void 0),Gd(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return AS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ue(!Na,"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 Na=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Na=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ue(!xa,"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 xa=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{xa=!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 MS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LS(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 FS(e,t,r){return t&&LS(e.prototype,t),e}function Qd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ka=!1,$S=function(){function e(t){MS(this,e),Qd(this,"internalMonitor",void 0),Qd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return FS(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;ue(!ka,"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 ka=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ka=!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 jS(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 BS(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(!h.isValidElement(t)){var n=t;return e(n,r),n}var s=t;jS(s);var i=r?function(o){return e(o,r)}:e;return US(s,i)}}function Yd(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=BS(n);t[r]=function(){return s}}}),t}function Rd(e,t){typeof e=="function"?e(t):e.current=t}function US(e,t){var r=e.ref;return ue(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?h.cloneElement(e,{ref:function(s){Rd(r,s),Rd(t,s)}}):h.cloneElement(e,{ref:t})}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 Aa(e){return e!==null&&Fi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Pa(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 d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function VS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zS(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 qS(e,t,r){return t&&zS(e.prototype,t),e}function dt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var HS=function(){function e(t){var r=this;VS(this,e),dt(this,"hooks",Yd({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Aa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Aa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),dt(this,"handlerId",null),dt(this,"dragSourceRef",null),dt(this,"dragSourceNode",void 0),dt(this,"dragSourceOptionsInternal",null),dt(this,"dragSourceUnsubscribe",void 0),dt(this,"dragPreviewRef",null),dt(this,"dragPreviewNode",void 0),dt(this,"dragPreviewOptionsInternal",null),dt(this,"dragPreviewUnsubscribe",void 0),dt(this,"lastConnectedHandlerId",null),dt(this,"lastConnectedDragSource",null),dt(this,"lastConnectedDragSourceOptions",null),dt(this,"lastConnectedDragPreview",null),dt(this,"lastConnectedDragPreviewOptions",null),dt(this,"backend",void 0),this.backend=t}return qS(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!Pa(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Pa(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 WS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KS(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 GS(e,t,r){return t&&KS(e.prototype,t),e}function er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var QS=function(){function e(t){var r=this;WS(this,e),er(this,"hooks",Yd({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Aa(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),er(this,"handlerId",null),er(this,"dropTargetRef",null),er(this,"dropTargetNode",void 0),er(this,"dropTargetOptionsInternal",null),er(this,"unsubscribeDropTarget",void 0),er(this,"lastConnectedHandlerId",null),er(this,"lastConnectedDropTarget",null),er(this,"lastConnectedDropTargetOptions",null),er(this,"backend",void 0),this.backend=t}return GS(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!Pa(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 YS(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function RS(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Hr=typeof window<"u"?h.useLayoutEffect:h.useEffect;function $i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$i=function(r){return typeof r}:$i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$i(e)}function XS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZS(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 JS(e,t,r){return t&&ZS(e.prototype,t),e}function Ma(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var eC=function(){function e(t,r,n){XS(this,e),Ma(this,"spec",void 0),Ma(this,"monitor",void 0),Ma(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return JS(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return $i(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 tC(e,t,r){var n=h.useMemo(function(){return new eC(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Wr(){var e=h.useContext(_d),t=e.dragDropManager;return ue(t!=null,"Expected drag drop context"),t}function rC(e){return h.useMemo(function(){var t=e.type;return ue(t!=null,"spec.type must be defined"),t},[e])}function nC(e,t){return aC(e)||oC(e,t)||iC(e,t)||sC()}function sC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iC(e,t){if(e){if(typeof e=="string")return Xd(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 Xd(e,t)}}function Xd(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 oC(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 aC(e){if(Array.isArray(e))return e}function lC(e,t,r){var n=Wr(),s=tC(e,t,r),i=rC(e);Hr(function(){if(i!=null){var a=RS(i,s,n),c=nC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function cC(e){return hC(e)||fC(e)||dC(e)||uC()}function uC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dC(e,t){if(e){if(typeof e=="string")return La(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 La(e,t)}}function fC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hC(e){if(Array.isArray(e))return La(e)}function La(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 Zd(e,t){var r=cC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function pC(){var e=Wr();return h.useMemo(function(){return new PS(e)},[e])}function gC(e,t){var r=Wr(),n=h.useMemo(function(){return new HS(r.getBackend())},[r]);return Hr(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),Hr(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var yC=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r};const vC=zc(yC);function mC(e,t){return SC(e)||wC(e,t)||_C(e,t)||bC()}function bC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
461
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _C(e,t){if(e){if(typeof e=="string")return Jd(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 Jd(e,t)}}function Jd(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 wC(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 SC(e){if(Array.isArray(e))return e}function ef(e,t,r){var n=h.useState(function(){return t(e)}),s=mC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);vC(i,c)||(o(c),r&&r())},[i,e,r]);return Hr(a),[i,a]}function CC(e,t){return IC(e)||DC(e,t)||EC(e,t)||OC()}function OC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
462
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EC(e,t){if(e){if(typeof e=="string")return tf(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 tf(e,t)}}function tf(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 DC(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 IC(e){if(Array.isArray(e))return e}function TC(e,t,r){var n=ef(e,t,r),s=CC(n,2),i=s[0],o=s[1];return Hr(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function rf(e,t,r){return TC(t,e||function(){return{}},function(){return r.reconnect()})}function NC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function xC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function kC(e,t){var r=Zd(e,t);ue(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var n=pC(),s=gC(r.options,r.previewOptions);return lC(r,n,s),[rf(r.collect,n,s),NC(s),xC(s)]}function AC(e){var t=e.accept;return h.useMemo(function(){return ue(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function PC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MC(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 LC(e,t,r){return t&&MC(e.prototype,t),e}function nf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var FC=function(){function e(t,r){PC(this,e),nf(this,"spec",void 0),nf(this,"monitor",void 0),this.spec=t,this.monitor=r}return LC(e,[{key:"canDrop",value:function(){var r=this.spec,n=this.monitor;return r.canDrop?r.canDrop(n.getItem(),n):!0}},{key:"hover",value:function(){var r=this.spec,n=this.monitor;r.hover&&r.hover(n.getItem(),n)}},{key:"drop",value:function(){var r=this.spec,n=this.monitor;if(r.drop)return r.drop(n.getItem(),n)}}]),e}();function $C(e,t){var r=h.useMemo(function(){return new FC(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function jC(e,t){return zC(e)||VC(e,t)||UC(e,t)||BC()}function BC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UC(e,t){if(e){if(typeof e=="string")return sf(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 sf(e,t)}}function sf(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 VC(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 zC(e){if(Array.isArray(e))return e}function qC(e,t,r){var n=Wr(),s=$C(e,t),i=AC(e);Hr(function(){var a=YS(i,s,n),c=jC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function HC(){var e=Wr();return h.useMemo(function(){return new $S(e)},[e])}function WC(e){var t=Wr(),r=h.useMemo(function(){return new QS(t.getBackend())},[t]);return Hr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function KC(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function of(e,t){var r=Zd(e,t),n=HC(),s=WC(r.options);return qC(r,n,s),[rf(r.collect,n,s),KC(s)]}function GC(e,t){return XC(e)||RC(e,t)||YC(e,t)||QC()}function QC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YC(e,t){if(e){if(typeof e=="string")return af(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 af(e,t)}}function af(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 RC(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 XC(e){if(Array.isArray(e))return e}function ZC(e){var t=Wr(),r=t.getMonitor(),n=ef(r,e),s=GC(n,2),i=s[0],o=s[1];return h.useEffect(function(){return r.subscribeToOffsetChange(o)}),h.useEffect(function(){return r.subscribeToStateChange(o)}),i}function lf(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function JC(e,t){return e.filter(function(r){return r!==t})}function e0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function t0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r0(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 n0(e,t,r){return t&&r0(e.prototype,t),e}function cf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s0=function(){function e(t){t0(this,e),cf(this,"entered",[]),cf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return n0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=e0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=JC(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),i0=lf(function(){return/firefox/i.test(navigator.userAgent)}),uf=lf(function(){return!!window.safari});function o0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a0(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 l0(e,t,r){return t&&a0(e.prototype,t),e}function bs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var df=function(){function e(t,r){o0(this,e),bs(this,"xs",void 0),bs(this,"ys",void 0),bs(this,"c1s",void 0),bs(this,"c2s",void 0),bs(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(P,B){return t[P]<t[B]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],y=0;y<o.length-1;y++){var g=a[y],_=a[y+1];if(g*_<=0)f.push(0);else{c=o[y];var p=o[y+1],v=c+p;f.push(3*v/((v+p)/g+(v+c)/_))}}f.push(a[a.length-1]);for(var m=[],b=[],S,w=0;w<f.length-1;w++){S=a[w];var O=f[w],I=1/o[w],k=O+f[w+1]-S-S;m.push((S-O-k)*I),b.push(k*I*I)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=b}return l0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var y=n[f];if(y<r)d=f+1;else if(y>r)u=f-1;else return s[f]}c=Math.max(0,u);var g=r-n[c],_=g*g;return s[c]+i[c]*g+o[c]*_+a[c]*g*_}}]),e}(),c0=1;function ff(e){var t=e.nodeType===c0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function ji(e){return{x:e.clientX,y:e.clientY}}function u0(e){var t;return e.nodeName==="IMG"&&(i0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function d0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return uf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function f0(e,t,r,n,s){var i=u0(t),o=i?e:t,a=ff(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,y=n.anchorY,g=d0(i,t,d,u),_=g.dragPreviewWidth,p=g.dragPreviewHeight,v=function(){var k=new df([0,.5,1],[c.y,c.y/u*p,c.y+p-u]),P=k.interpolate(y);return uf()&&i&&(P+=(window.devicePixelRatio-1)*p),P},m=function(){var k=new df([0,.5,1],[c.x,c.x/d*_,c.x+_-d]);return k.interpolate(f)},b=s.offsetX,S=s.offsetY,w=b===0||b,O=S===0||S;return{x:w?b:m(),y:O?S:v()}}var hf="__NATIVE_FILE__",pf="__NATIVE_URL__",gf="__NATIVE_TEXT__",yf="__NATIVE_HTML__";const vf=Object.freeze(Object.defineProperty({__proto__:null,FILE:hf,HTML:yf,TEXT:gf,URL:pf},Symbol.toStringTag,{value:"Module"}));function Fa(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var Tn;function Bi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $a=(Tn={},Bi(Tn,hf,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Bi(Tn,yf,{exposeProperties:{html:function(t,r){return Fa(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Bi(Tn,pf,{exposeProperties:{urls:function(t,r){return Fa(t,r,"").split(`
465
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Bi(Tn,gf,{exposeProperties:{text:function(t,r){return Fa(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Tn);function h0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p0(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 g0(e,t,r){return t&&p0(e.prototype,t),e}function mf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var y0=function(){function e(t){h0(this,e),mf(this,"item",void 0),mf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return g0(e,[{key:"initializeExposedProperties",value:function(){var r=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(r.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(r){var n=this;if(r){var s={};Object.keys(this.config.exposeProperties).forEach(function(i){s[i]={value:n.config.exposeProperties[i](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,s)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(r,n){return n===r.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function v0(e,t){var r=new y0($a[e]);return r.loadDataTransfer(t),r}function ja(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys($a).filter(function(r){var n=$a[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function m0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b0(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 _0(e,t,r){return t&&b0(e.prototype,t),e}function Ba(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var w0=function(){function e(t,r){m0(this,e),Ba(this,"ownerDocument",null),Ba(this,"globalContext",void 0),Ba(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return _0(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function bf(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 _f(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bf(Object(r),!0).forEach(function(n){pe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function S0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C0(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 O0(e,t,r){return t&&C0(e.prototype,t),e}function pe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E0=function(){function e(t,r,n){var s=this;S0(this,e),pe(this,"options",void 0),pe(this,"actions",void 0),pe(this,"monitor",void 0),pe(this,"registry",void 0),pe(this,"enterLeaveCounter",void 0),pe(this,"sourcePreviewNodes",new Map),pe(this,"sourcePreviewNodeOptions",new Map),pe(this,"sourceNodes",new Map),pe(this,"sourceNodeOptions",new Map),pe(this,"dragStartSourceIds",null),pe(this,"dropTargetIds",[]),pe(this,"dragEnterTargetIds",[]),pe(this,"currentNativeSource",null),pe(this,"currentNativeHandle",null),pe(this,"currentDragSourceNode",null),pe(this,"altKeyPressed",!1),pe(this,"mouseMoveTimeoutTimer",null),pe(this,"asyncEndDragFrameId",null),pe(this,"dragOverTargetIds",null),pe(this,"lastClientOffset",null),pe(this,"hoverRafId",null),pe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&ff(o)||null}),pe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),pe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),pe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),pe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=ji(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=ja(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),y=s.sourcePreviewNodes.get(u)||f;if(y){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,p=g.anchorY,v=g.offsetX,m=g.offsetY,b={anchorX:_,anchorY:p},S={offsetX:v,offsetY:m},w=f0(f,y,a,b,S);c.setDragImage(y,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var O=s.getCurrentSourcePreviewNodeOptions(),I=O.captureDraggingState;I?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),pe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=ja(a);c&&s.beginDragNativeItem(c,a)}}),pe(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:ji(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),pe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),pe(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=ji(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),pe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),pe(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else ja(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),pe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:ji(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new w0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new s0(this.isNodeInDocument)}return O0(e,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return _f({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return _f({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(vf).some(function(n){return vf[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=v0(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),e}(),Ui;function D0(){return Ui||(Ui=new Image,Ui.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ui}var I0=function(t,r,n){return new E0(t,r,n)};function T0(e,t){return typeof e=="function"?e(t):e??"NODE"}function N0(e){return e.isDraggable&&!e.isEditing}function x0(e){const t=Dt(),r=t.selectedIds,[n,s,i]=kC(()=>({canDrag:()=>N0(e),type:T0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Cn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Cn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(D0())},[i]),s}function k0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function A0(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function Vi(e,t){return{parentId:e||null,index:t}}function Nn(e,t){return{type:"line",index:e,level:t}}function P0(e){return{type:"highlight",id:e}}function Ua(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=td(n)+1;return{parentId:s,index:i}}function wf(e){var t;const r=k0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=A0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Vi(i.id,null),cursor:P0(i.id)};if(!c)return{drop:Vi((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:Nn(0,0)};if(Xu(c)){const u=Ci(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ua(c,u),cursor:Nn(c.rowIndex+1,u)}}if(Zu(c)){const u=Ci(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ua(c,u),cursor:Nn(c.rowIndex+1,u)}}if(Ju(c)){const u=Ci(s,0,c.level+1);return u>c.level?{drop:Vi(c.id,0),cursor:Nn(c.rowIndex+1,u)}:{drop:Ua(c,u),cursor:Nn(c.rowIndex+1,u)}}return{drop:Vi(c==null?void 0:c.id,0),cursor:Nn(c.rowIndex+1,c.level+1)}}function M0(e,t){const r=Dt(),[n,s]=of(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=wf({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Cn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function L0(e){const t=Dt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return h.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const Sf=h.memo(function({index:t,style:r}){Ru(),Jb();const n=Dt(),s=L0(t),i=h.useRef(null),o=x0(s),a=M0(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),d=n.indent*s.level,u=h.useMemo(()=>({paddingLeft:d}),[d]),f=h.useMemo(()=>{var p,v;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((v=(p=n.props.padding)!==null&&p!==void 0?p:n.props.paddingTop)!==null&&v!==void 0?v:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),y={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};h.useEffect(()=>{var p;!s.isEditing&&s.isFocused&&((p=i.current)===null||p===void 0||p.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:y,children:l.jsx(g,{node:s,tree:n,style:u,dragHandle:o})})});let Va="",Cf=null;function Of(){Ru();const e=Dt();return l.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),rd(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),nd(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(Cf),Va+=t.key,Cf=setTimeout(()=>{Va=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Va):!1});n&&e.focus(n.id)},children:l.jsx(F0,{})})}function F0(){var e,t;const r=Dt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:V_,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:H_,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx($_,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:Sf})):l.jsx(j_,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:Sf}))}function Ef(e){return e.isFiltered?j0(e.root,e.isMatch.bind(e)):$0(e.root)}function $0(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(Df),t}function j0(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(Df),n}function Df(e,t){e.rowIndex=t}const If=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var za=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:ft}=s_;class _s{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=ld(this),this.visibleNodes=Ef(this),this.idToIndex=If(this.visibleNodes)}update(t){this.props=t,this.root=ld(this),this.visibleNodes=Ef(this),this.idToIndex=If(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=gs(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=gs(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof vs)return t.id;const r=this.props.idAccessor||"id";return gs(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return za(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?ad(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:od(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ft(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return za(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield ft(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(ga(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{_s.editPromise=i})}submit(t,r){return za(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ft(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(ga(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(ga(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ft(this.props.onActivate,r)}resolveEdit(t){const r=_s.editPromise;r&&r(t),_s.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(wn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ft(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(wn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&&ft(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Cr.remove(r)),ft(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(wn(n.id)),n.isSelectable&&(this.dispatch(Cr.add(n.id)),this.dispatch(Cr.anchor(n.id)),this.dispatch(Cr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ft(this.props.onFocus,this.focusedNode),ft(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(wn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(Cr.remove(this.nodesBetween(s,i))),this.dispatch(Cr.add(o)),this.dispatch(Cr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ft(this.props.onFocus,this.focusedNode),ft(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(wn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ft(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(r=>this.get(this.identify(r))).filter(r=>!!r&&r.isSelectable)}setSelection(t){var r;const n=new Set((r=t.ids)===null||r===void 0?void 0:r.map(o=>this.identify(o))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(Cr.set({ids:n,anchor:s,mostRecent:i})),ft(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&ed(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;ft(this.props.onMove,{dragIds:n,parentId:t===ys?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Cn.cursor({type:"none"}))}showCursor(t){this.dispatch(Cn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(ya.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),ft(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(ya.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),ft(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=pa(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Oi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Oi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),id(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===ys)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!gs(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(wn(t.id))}onBlur(){this.dispatch(p_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Of}get renderRow(){return this.props.renderRow||c_}get renderNode(){return this.props.children||u_}get renderDragPreview(){return this.props.renderDragPreview||ud}get renderCursor(){return this.props.renderCursor||l_}}function ht(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 B0=typeof Symbol=="function"&&Symbol.observable||"@@observable",Tf=B0,qa=()=>Math.random().toString(36).substring(7).split("").join("."),U0={INIT:`@@redux/INIT${qa()}`,REPLACE:`@@redux/REPLACE${qa()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qa()}`},Kr=U0;function Nf(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function V0(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(H0(e))return"date";if(q0(e))return"error";const r=z0(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function z0(e){return typeof e.constructor=="function"?e.constructor.name:null}function q0(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function H0(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=V0(e)),t}function xf(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ht(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ht(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"?ht(1):`Expected the enhancer to be a function. Instead, received: '${Or(r)}'`);return r(xf)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((v,m)=>{o.set(m,v)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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 s}function f(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ht(4):`Expected the listener to be a function. Instead, received: '${Or(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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.");let m=!0;d();const b=a++;return o.set(b,v),function(){if(m){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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.");m=!1,d(),o.delete(b),i=null}}}function y(v){if(!Nf(v))throw new Error(process.env.NODE_ENV==="production"?ht(7):`Actions must be plain objects. Instead, the actual type was: '${Or(v)}'. 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 v.type>"u")throw new Error(process.env.NODE_ENV==="production"?ht(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof v.type!="string")throw new Error(process.env.NODE_ENV==="production"?ht(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(v.type)}'. Value was: '${v.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function g(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ht(10):`Expected the nextReducer to be a function. Instead, received: '${Or(v)}`);n=v,y({type:Kr.REPLACE})}function _(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?ht(11):`Expected the observer to be an object. Instead, received: '${Or(m)}'`);function b(){const w=m;w.next&&w.next(u())}return b(),{unsubscribe:v(b)}},[Tf](){return this}}}return y({type:Kr.INIT}),{dispatch:y,subscribe:f,getState:u,replaceReducer:g,[Tf]:_}}function kf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function W0(e,t,r,n){const s=Object.keys(t),i=r&&r.type===Kr.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Nf(e))return`The ${i} has unexpected type of "${Or(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===Kr.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function K0(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Kr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Kr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Kr.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function Af(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&kf(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{K0(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=W0(a,r,c,s);f&&kf(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const y=n[f],g=r[y],_=a[y],p=g(_,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ht(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${y}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}u[y]=p,d=d||p!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function G0(e=Sn().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const Q0=Af({nodes:Af({focus:g_,edit:h_,open:y_,selection:v_,drag:G0}),dnd:m_}),Y0=Sn();function R0({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(xf(Q0,Sn(e))),o=Zb.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>Y0),a=h.useMemo(()=>new _s(i.current,e,n,s),[]),c=h.useRef(0);return h.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),h.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),h.useImperativeHandle(t,()=>a),h.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),h.useEffect(()=>{a.props.searchTerm||i.current.dispatch(ya.clear(!0))},[a.props.searchTerm]),l.jsx(Ku.Provider,{value:a,children:l.jsx(Yu.Provider,{value:c.current,children:l.jsx(Gu.Provider,{value:o.nodes,children:l.jsx(Qu.Provider,{value:o.dnd,children:l.jsx(IS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||I0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function X0(){const e=Dt(),[,t]=of(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const s=n.getClientOffset();if(!e.listEl.current||!s)return;const{cursor:i,drop:o}=wf({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Cn.hovering(o.parentId,o.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function Z0(e){return X0(),e.children}function J0(){const t=Dt().props.renderContainer||Of;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function e1(){const e=Dt(),{offset:t,mouse:r,item:n,isDragging:s}=ZC(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||ud;return l.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function t1(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class r1{constructor(t,r={}){this.accessors=t1(r),this.root=n1(t,this.accessors)}get data(){var t,r;return(r=(t=this.root.children)===null||t===void 0?void 0:t.map(n=>n.data))!==null&&r!==void 0?r:[]}create(t){const r=t.parentId?this.find(t.parentId):this.root;if(!r)return null;r.addChild(t.data,t.index)}move(t){const r=this.find(t.id),n=t.parentId?this.find(t.parentId):this.root;!r||!n||(n.addChild(r.data,t.index),r.drop())}update(t){const r=this.find(t.id);r&&r.update(t.changes)}drop(t){const r=this.find(t.id);r&&r.drop()}find(t,r=this.root){if(!r)return null;if(r.id===t)return r;if(r.children){for(let n of r.children){const s=this.find(t,n);if(s)return s}return null}return null}}function n1(e,t){const r=new Pf({},null,t,"ROOT");return r.children=e.map(n=>Ha(n,r,t)),r}function Ha(e,t,r){const n=new Pf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Ha(i,n,r))),n}class Pf{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=Ha(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let s1=0;function i1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new r1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const p of _.dragIds)o.move({id:p,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:p})=>{o.update({id:p,changes:{name:_}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,index:p,type:v})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(v==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const m={[d]:`simple-tree-id-${s1++}`,name:""};return v==="internal"&&(m[u]=[]),o.create({parentId:_,index:p,data:m}),n(o.data),m},onDelete:_=>{_.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function o1(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
466
+ Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=i1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function a1(e,t){const r=o1(e);return l.jsxs(R0,{treeProps:r,imperativeHandle:t,children:[l.jsx(Z0,{children:l.jsx(J0,{})}),l.jsx(e1,{})]})}const l1=h.forwardRef(a1);function Wa(){return xe(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function c1(){return xe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const Mf={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Lf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Ff=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],u1=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function d1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function zi(e){const t=d1(e);return{key:t,color:Mf[t]??Mf.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Lf[t]??Lf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const It={row:"_row_i3qt2_1",grip:"_grip_i3qt2_16",menuBtn:"_menuBtn_i3qt2_19",selected:"_selected_i3qt2_23",title:"_title_i3qt2_28",dropTarget:"_dropTarget_i3qt2_33",toggle:"_toggle_i3qt2_50",ctIcon:"_ctIcon_i3qt2_65",folderIcon:"_folderIcon_i3qt2_77",renameInput:"_renameInput_i3qt2_92",dropHere:"_dropHere_i3qt2_101",menuWrap:"_menuWrap_i3qt2_111",menu:"_menu_i3qt2_19",dangerItem:"_dangerItem_i3qt2_163"},f1={video:Ho,pdf:jo,h5p:Bo,scorm:Vo,audio:Uo,quiz:Fo,default:pn},h1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,d]=h.useState(e.data.name),u=h.useRef(null),f=n==="edit",y=Wa(),g=zi(e.data),_=f1[g.key]??pn,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?nv:m?lv:_;h.useEffect(()=>{if(!s)return;const O=I=>{var k;(k=u.current)!=null&&k.contains(I.target)||i(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(O=>{O.key==="Enter"&&S(),O.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[It.row,p?It.selected:"",e.state.isOver&&m?It.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":m?"true":void 0,role:"treeitem","aria-selected":p,"aria-expanded":m?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:It.grip,"aria-hidden":"true",children:l.jsx($c,{size:14})}),l.jsx("button",{className:It.toggle,onClick:O=>{O.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(Pc,{size:14}):l.jsx(as,{size:14})}),l.jsx("span",{className:`${It.ctIcon} ${v||m?It.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:It.renameInput,value:c,autoFocus:!0,onChange:O=>d(O.target.value),onBlur:S,onKeyDown:w,onClick:O=>O.stopPropagation()}):l.jsx("span",{className:It.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&m&&l.jsx("span",{className:It.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:It.menuWrap,ref:u,children:[l.jsx("button",{className:It.menuBtn,onClick:O=>{O.stopPropagation(),i(I=>!I)},"aria-label":"Node options",children:l.jsx(Lc,{size:14})}),s&&l.jsxs("div",{className:It.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(pv,{size:13})," Rename"]}),m&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Fc,{size:13})," Add sub-unit"]}),e.data.parent&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(ls,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:It.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(qo,{size:13})," Delete"]})]})]})]})};async function p1(e,t){var i,o;const n=((i=(await Me.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((o=n.content)==null?void 0:o.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function g1(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function y1(e,t){var a;const r=await p1(e,t.name),n=await g1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Me.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function v1(e){var r;return((r=(await Me.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function $f(e){var n,s,i;const r=(i=(s=(n=(await Me.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:s.collection)==null?void 0:i.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function m1(e){return $f(e)}const Ie={container:"_container_jr3ij_1",header:"_header_jr3ij_13",title:"_title_jr3ij_22",closeBtn:"_closeBtn_jr3ij_29",body:"_body_jr3ij_45",dropZone:"_dropZone_jr3ij_54",dragOver:"_dragOver_jr3ij_67",hasFile:"_hasFile_jr3ij_72",hiddenInput:"_hiddenInput_jr3ij_78",fileInfo:"_fileInfo_jr3ij_82",fileIcon:"_fileIcon_jr3ij_89",fileName:"_fileName_jr3ij_93",fileSize:"_fileSize_jr3ij_100",dropHint:"_dropHint_jr3ij_105",dropIcon:"_dropIcon_jr3ij_112",dropText:"_dropText_jr3ij_117",dropSubtext:"_dropSubtext_jr3ij_124",sampleLink:"_sampleLink_jr3ij_130",statusBar:"_statusBar_jr3ij_145",status_uploading:"_status_uploading_jr3ij_154",status_processing:"_status_processing_jr3ij_154",status_done:"_status_done_jr3ij_159",status_error:"_status_error_jr3ij_164",successDetail:"_successDetail_jr3ij_170",spinner:"_spinner_jr3ij_175",spin:"_spin_jr3ij_175",errorMsg:"_errorMsg_jr3ij_191",failedSection:"_failedSection_jr3ij_197",failedTitle:"_failedTitle_jr3ij_203",tableWrap:"_tableWrap_jr3ij_213",failedTable:"_failedTable_jr3ij_219",reasonCell:"_reasonCell_jr3ij_244",footer:"_footer_jr3ij_248"},b1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState("idle"),[u,f]=h.useState(""),[y,g]=h.useState([]),[_,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),b=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>b(),[b]);const S=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=h.useCallback(N=>{f(""),g([]),p(null),d("idle"),S(N)&&i(N)},[]),O=h.useCallback(N=>{N.preventDefault(),a(!1);const M=N.dataTransfer.files[0];M&&w(M)},[w]),I=h.useCallback(N=>{var V;const M=(V=N.target.files)==null?void 0:V[0];M&&w(M),N.target.value=""},[w]),k=h.useCallback(async()=>{try{const N=await m1(e),M=document.createElement("a");M.href=N,M.download="sample_hierarchy.csv",M.target="_blank",M.click()}catch{f("Failed to download sample CSV.")}},[e]),P=h.useCallback(async()=>{if(s){d("uploading"),f(""),g([]);try{const{processId:N}=await y1(e,s);if(!N){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const M=await v1(N);M.status==="COMPLETED"?(b(),d("done"),p(M.successCount??null),M.failedRecords&&M.failedRecords.length>0?g(M.failedRecords):setTimeout(t,1500)):M.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),M.failedRecords&&g(M.failedRecords))}catch{b(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),B={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ie.container,children:[l.jsxs("div",{className:Ie.header,children:[l.jsx("h2",{className:Ie.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ie.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ie.body,children:[l.jsxs("div",{className:`${Ie.dropZone} ${o?Ie.dragOver:""} ${s?Ie.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:O,onClick:()=>{var N;return(N=v.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var M;return N.key==="Enter"&&((M=v.current)==null?void 0:M.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Ie.hiddenInput,onChange:I,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ie.fileInfo,children:[l.jsx("span",{className:Ie.fileIcon,children:"📄"}),l.jsx("span",{className:Ie.fileName,children:s.name}),l.jsxs("span",{className:Ie.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ie.dropHint,children:[l.jsx("span",{className:Ie.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ie.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ie.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ie.sampleLink,onClick:k,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ie.statusBar} ${Ie[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ie.spinner,"aria-hidden":"true"}),B[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ie.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:Ie.errorMsg,role:"alert",children:u}),y.length>0&&l.jsxs("div",{className:Ie.failedSection,children:[l.jsxs("h4",{className:Ie.failedTitle,children:["Failed Rows (",y.length,")"]}),l.jsx("div",{className:Ie.tableWrap,children:l.jsxs("table",{className:Ie.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:y.map((N,M)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??M+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ie.reasonCell,children:N.reason??"Unknown error"})]},M))})]})})]})]}),l.jsxs("div",{className:Ie.footer,children:[l.jsx(Te,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Te,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:P,children:c==="done"?"Uploaded":"Upload"})]})]})},tr={container:"_container_1y30m_1",header:"_header_1y30m_8",headerActions:"_headerActions_1y30m_19",iconBtn:"_iconBtn_1y30m_25",menuWrap:"_menuWrap_1y30m_43",dropdownMenu:"_dropdownMenu_1y30m_47",treeWrapper:"_treeWrapper_1y30m_79",csvModal:"_csvModal_1y30m_95",footer:"_footer_1y30m_105"},_1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var Se;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[y,g]=h.useState("create"),{treeData:_,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:b,reorderChildren:S,moveNode:w,setTreeData:O}=xe(),I=e==="edit",k=Wa(),P=I&&k,B=(((Se=_[0])==null?void 0:Se.children)??[]).some(G=>G.isFolder),N=ce(G=>{var F,Y,L,R;return((Y=(F=G.editorConfig)==null?void 0:F.context)==null?void 0:Y.contentId)??((R=(L=G.editorConfig)==null?void 0:L.context)==null?void 0:R.identifier)??""}),M=ce(G=>{var Y,L;const F=(L=(Y=G.categoryMeta)==null?void 0:Y.sourcingSettings)==null?void 0:L.collection;return(F==null?void 0:F.enableBulkUpload)!==!1});h.useEffect(()=>{const G=s.current;if(!G)return;const F=new ResizeObserver(()=>{a(G.clientHeight||400)});return F.observe(G),a(G.clientHeight||400),()=>F.disconnect()},[]),h.useEffect(()=>{if(!c)return;const G=F=>{var Y;(Y=i.current)!=null&&Y.contains(F.target)||d(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[c]);const V=h.useCallback(G=>{G.length>0&&v(G[0].data.id)},[v]),A=h.useCallback(({parentId:G,index:F,dragIds:Y})=>{if(!G)return;const L=Y[0],R=Ka(_,L);if(!R)return;const K=R.parent;if(K===G){const oe=Ka(_,G);if(!(oe!=null&&oe.children))return;const ge=oe.children.findIndex(Ae=>Ae.id===L);if(ge<0)return;S(G,ge,F>ge?F-1:F)}else w(L,K??"",G)},[_,S,w]),U=h.useCallback(({ids:G})=>{G.forEach(F=>b(F))},[b]),j=h.useCallback(({parentId:G})=>{var L;const F=G??((L=_[0])==null?void 0:L.id)??"";if(!F)return{id:crypto.randomUUID()};const Y=m(F,"unit");return Y?{id:Y}:(Ee.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,_]),J=h.useCallback(()=>{var F;const G=(F=_[0])==null?void 0:F.id;G&&(m(G,"unit")||Ee.error("Maximum depth reached"))},[_,m]),ie=h.useCallback(()=>{p&&(m(p,"subunit")||Ee.error("Maximum depth reached"))},[p,m]),ye=h.useCallback(async()=>{if(d(!1),!!N)try{const G=await $f(N),F=await fetch(G).then(R=>R.blob()),Y=URL.createObjectURL(F),L=document.createElement("a");L.href=Y,L.download=`${N}-folders.csv`,L.style.display="none",document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(Y)}catch{Ee.error("Failed to download CSV")}},[N]),we=h.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:G}=await Hu(N);O([G]),Ee.success("Course outline refreshed.")}catch{Ee.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,O]);return l.jsxs("div",{className:tr.container,children:[l.jsx("div",{className:tr.header,children:l.jsxs("div",{className:tr.headerActions,children:[I&&l.jsxs("div",{className:tr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:tr.iconBtn,onClick:()=>d(G=>!G),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Lc,{size:15})}),c&&l.jsx("div",{className:tr.dropdownMenu,role:"menu",children:M&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:B,title:B?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!B,title:B?void 0:'No folders yet — use "Create" first',onClick:ye,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!B,title:B?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),g("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:tr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(fv,{size:15}):l.jsx(dv,{size:15})})]})}),l.jsx("div",{className:tr.treeWrapper,ref:s,children:l.jsx(l1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:V,onMove:I?A:void 0,onDelete:I?U:void 0,onCreate:I?j:void 0,disableEdit:!I,disableDrop:!I,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:G=>l.jsx(h1,{...G,editorMode:e})})}),I&&l.jsxs("div",{className:tr.footer,children:[l.jsxs(Te,{variant:"ghost",size:"sm",onClick:J,disabled:!P,children:[l.jsx(ls,{size:14})," Add Unit"]}),l.jsxs(Te,{variant:"ghost",size:"sm",onClick:ie,disabled:!P||!p,children:[l.jsx(Fc,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:tr.csvModal,children:l.jsx(b1,{contentId:N,mode:y,onComplete:we,onClose:()=>f(!1)})})]})};function Ka(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Ka(r.children,t);if(n)return n}}}const ws={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},w1=({crumbs:e})=>{const t=xe(r=>r.selectNode);return e.length?l.jsxs("nav",{className:ws.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:ws.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(cv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(Pc,{size:13,className:ws.sep}),n<e.length-1?l.jsx("button",{className:ws.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:ws.current,children:r.name})]},r.id))]}):null},Ss={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},jf=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],S1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?jf.filter(i=>n.includes(i.id)):jf;return l.jsx("div",{className:Ss.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[Ss.tab,e===i.id?Ss.active:"",r.includes(i.id)?Ss.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Ss.errorDot,"aria-label":"Has errors"})]},i.id))})};var Cs=e=>e.type==="checkbox",Gr=e=>e instanceof Date,ot=e=>e==null;const Bf=e=>typeof e=="object";var Ue=e=>!ot(e)&&!Array.isArray(e)&&Bf(e)&&!Gr(e),Ga=e=>Ue(e)&&e.target?Cs(e.target)?e.target.checked:e.target.value:e,Uf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Vf=e=>{const t=e.constructor&&e.constructor.prototype;return Ue(t)&&t.hasOwnProperty("isPrototypeOf")},qi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function qe(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(qi&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Ue(e)&&Vf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=qe(e[s]));return n}const Er={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Qa="form",zf="root",qf=["__proto__","constructor","prototype"];var Os=e=>/^\w*$/.test(e),Le=e=>e===void 0,Hi=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!Ue(e))return r;const n=Os(t)?[t]:Hi(t);if(n.some(i=>qf.includes(i)))return r;const s=n.reduce((i,o)=>ot(i)?void 0:i[o],e);return Le(s)||s===e?Le(e[t])?r:e[t]:s},At=e=>typeof e=="boolean",pt=e=>typeof e=="function",ke=(e,t,r)=>{let n=-1;const s=Os(t)?[t]:Hi(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=Ue(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(qf.includes(a))return;e[a]=c,e=e[a]}};const Ya=h.createContext(null);Ya.displayName="HookFormControlContext";const Ra=()=>h.useContext(Ya);var Hf=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Gt.all&&(t._proxyFormState[o]=!n||Gt.all),r&&(r[o]=!0),e[o]}});return s};const Xa=qi?h.useLayoutEffect:h.useEffect;function C1(e){const t=Ra(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=h.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Xa(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),h.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),h.useMemo(()=>Hf(o,r,c.current,!1),[o,r])}var gt=e=>typeof e=="string",Za=(e,t,r,n,s)=>gt(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),W(r,i))):(n&&(t.watchAll=!0),r),Ja=e=>ot(e)||!Bf(e);const Wf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Vf(e);function Pt(e,t,r=new WeakMap){if(e===t)return!0;if(Ja(e)||Ja(t))return Object.is(e,t);if(Gr(e)&&Gr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Wf(e,n)||Wf(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Gr(a)&&Gr(c)||(Ue(a)||Array.isArray(a))&&(Ue(c)||Array.isArray(c))?!Pt(a,c,r):!Object.is(a,c))return!1}}return!0}function O1(e){const t=Ra(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),d=h.useRef(a),u=h.useRef(void 0),f=h.useRef(r),y=h.useRef(n);d.current=a;const[g,_]=h.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),p=h.useCallback(w=>{const O=Za(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(O):O},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const O=Za(n,r._names,w||r._formValues,!1,c.current);if(d.current){const I=d.current(O);Pt(I,u.current)||(_(I),u.current=I)}else _(O)}},[r._formValues,r._names,i,n]);Xa(()=>((f.current!==r||!Pt(y.current,n))&&(f.current=r,y.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{v(w.values)}})),[r,o,n,v]),h.useEffect(()=>r._removeUnmounted());const m=f.current!==r,b=y.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!Pt(b,n);return m||w?p():null},[i,m,n,b,p]);return S!==null?S:g}function Wi(e){const t=Ra(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Uf(s._names.array,r),d=h.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,o)),[s,r,o]),u=O1({control:s,name:r,defaultValue:d,exact:a}),f=C1({control:s,name:r,exact:a}),y=h.useRef(e),g=h.useRef(null),_=h.useRef(s.register(r,{...e.rules,value:u,...At(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const p=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(f.validatingFields,r)},error:{enumerable:!0,get:()=>W(f.errors,r)}}),[f,r]),v=h.useCallback(w=>{const O=Ga(w);return W(s._fields,r)||(_.current=s.register(r,{...y.current.rules,value:O})),_.current.onChange({target:{value:Ga(w),name:r},type:Er.CHANGE})},[r,s]),m=h.useCallback(()=>_.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Er.BLUR}),[r,s._formValues]),b=h.useCallback(w=>{w&&(g.current={focus:()=>pt(w.focus)&&w.focus(),select:()=>pt(w.select)&&w.select(),setCustomValidity:I=>pt(w.setCustomValidity)&&w.setCustomValidity(I),reportValidity:()=>pt(w.reportValidity)&&w.reportValidity()});const O=W(s._fields,r);O&&O._f&&w&&(O._f.ref=g.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:u,...At(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:b}),[r,n,f.disabled,v,m,b,u]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...y.current.rules,...At(y.current.disabled)?{disabled:y.current.disabled}:{}});const O=(I,k)=>{const P=W(s._fields,I);P&&P._f&&(P._f.mount=k)};if(O(r,!0),w){const I=qe(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,y.current.defaultValue)));ke(s._defaultValues,r,I),Le(W(s._formValues,r))&&ke(s._formValues,r,I)}if(!c&&s.register(r),g.current){const I=W(s._fields,r);I&&I._f&&(I._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):O(r,!1)}},[r,s,c,i]),h.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),h.useMemo(()=>({field:S,formState:f,fieldState:p}),[S,f,p])}const el=h.createContext(null);el.displayName="HookFormContext";const Yt=()=>h.useContext(el),E1=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m})=>{const b=h.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m}),[i,_,d,n,r,y,p,f,u,s,v,o,a,m,c,g,t]);return h.createElement(el.Provider,{value:b},h.createElement(Ya.Provider,{value:b.control},e))};var D1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ki=e=>Array.isArray(e)?e:[e],Gf=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Qf(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&Ue(s)&&i){const o=Qf(s,i);Ue(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Je=e=>Ue(e)&&!Object.keys(e).length,tl=e=>e.type==="file",Gi=e=>{if(!qi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yf=e=>e.type==="select-multiple",rl=e=>e.type==="radio",I1=e=>rl(e)||Cs(e),nl=e=>Gi(e)&&e.isConnected;function T1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ot(e)){e=void 0;break}e=e[t[n]],n++}return e}function N1(e){for(const t in e)if(e.hasOwnProperty(t)&&!Le(e[t]))return!1;return!0}function Qe(e,t){if(gt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Os(t)?[t]:Hi(t),n=r.length===1?e:T1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(Ue(n)&&Je(n)||Array.isArray(n)&&N1(n))&&Qe(e,r.slice(0,-1)),e}var x1=e=>{for(const t in e)if(pt(e[t]))return!0;return!1};function Rf(e){return Array.isArray(e)||Ue(e)&&!x1(e)}function sl(e,t={}){for(const r in e){const n=e[r];Rf(n)?(t[r]=Array.isArray(n)?[]:{},sl(n,t[r])):Le(n)||(t[r]=!0)}return t}function il(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>il(r));return t.some(r=>r!==void 0)?t:void 0}if(Ue(e)){const t={};for(const r in e){const n=il(e[r]);Le(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Qr(e,t,r){r||(r=sl(t));for(const n in e){const s=e[n];if(Rf(s))Le(t)||Ja(r[n])?r[n]=sl(s,Array.isArray(s)?[]:{}):Qr(s,ot(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Pt(s,i)}}return il(r)||{}}const Xf={value:!1,isValid:!1},Zf={value:!0,isValid:!0};var Jf=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Le(e[0].attributes.value)?Le(e[0].value)||e[0].value===""?Zf:{value:e[0].value,isValid:!0}:Zf:Xf}return Xf},eh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Le(e)?e:t?e===""?NaN:e&&+e:r&&gt(e)?new Date(e):n?n(e):e;const th={isValid:!1,value:null};var rh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,th):th;function nh(e){const t=e.ref;return tl(t)?t.files:rl(t)?rh(e.refs).value:Yf(t)?[...t.selectedOptions].map(({value:r})=>r):Cs(t)?Jf(e.refs).value:eh(Le(t.value)?e.ref.value:t.value,e)}var k1=(e,t,r,n)=>{const s={};for(const i of e){const o=W(t,i);o&&ke(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Qi=e=>e instanceof RegExp,Es=e=>Le(e)?e:Qi(e)?e.source:Ue(e)?Qi(e.value)?e.value.source:e.value:e,sh=e=>({isOnSubmit:!e||e===Gt.onSubmit,isOnBlur:e===Gt.onBlur,isOnChange:e===Gt.onChange,isOnAll:e===Gt.all,isOnTouch:e===Gt.onTouched});const ih="AsyncFunction";var A1=e=>!!e&&!!e.validate&&!!(pt(e.validate)&&e.validate.constructor.name===ih||Ue(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ih)),P1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ol=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Ds=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=W(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(Ds(a,t))break}else if(Ue(a)&&Ds(a,t))break}}};function oh(e,t,r){const n=W(e,r);if(n||Os(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=W(t,i),a=W(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var M1=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Je(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Gt.all))},L1=(e,t,r)=>!e||!t||e===t||Ki(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),F1=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,$1=(e,t)=>!Kf(W(e,t)).length&&Qe(e,t),ah=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return ke(s,zf,t[r]),ke(e,r,s),e};function lh(e,t,r="validate"){if(gt(e)||Array.isArray(e)&&e.every(gt)||At(e)&&!e)return{type:r,message:gt(e)?e:"",ref:t}}var xn=e=>Ue(e)&&!Qi(e)?e:{value:e,message:""},ch=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:y,pattern:g,validate:_,name:p,valueAsNumber:v,mount:m}=e._f,b=W(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=V=>{if(s&&S.reportValidity){const A=At(V)?"":V||"";a?a.forEach(U=>U.setCustomValidity(A)):S.setCustomValidity(A),S.reportValidity()}},O={},I=rl(o),k=Cs(o),P=I||k,B=(v||tl(o))&&Le(o.value)&&Le(b)||Gi(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,N=D1.bind(null,p,n,O),M=(V,A,U,j=Qt.maxLength,J=Qt.minLength)=>{const ie=V?A:U;O[p]={type:V?j:J,message:ie,ref:o,...N(V?j:J,ie)}};if(i?!Array.isArray(b)||!b.length:c&&(!P&&(B||ot(b))||At(b)&&!b||k&&!Jf(a).isValid||I&&!rh(a).isValid)){const{value:V,message:A}=gt(c)?{value:!!c,message:c}:xn(c);if(V&&(O[p]={type:Qt.required,message:A,ref:S,...N(Qt.required,A)},!n))return w(A),O}if(!B&&(!ot(f)||!ot(y))){let V,A;const U=xn(y),j=xn(f);if(!ot(b)&&!isNaN(b)){const J=o.valueAsNumber||b&&+b;ot(U.value)||(V=J>U.value),ot(j.value)||(A=J<j.value)}else{const J=o.valueAsDate||new Date(b),ie=Se=>new Date(new Date().toDateString()+" "+Se),ye=o.type=="time",we=o.type=="week";gt(U.value)&&b&&(V=ye?ie(b)>ie(U.value):we?b>U.value:J>new Date(U.value)),gt(j.value)&&b&&(A=ye?ie(b)<ie(j.value):we?b<j.value:J<new Date(j.value))}if((V||A)&&(M(!!V,U.message,j.message,Qt.max,Qt.min),!n))return w(O[p].message),O}if((d||u)&&!B&&(gt(b)||i&&Array.isArray(b))){const V=xn(d),A=xn(u),U=!ot(V.value)&&b.length>+V.value,j=!ot(A.value)&&b.length<+A.value;if((U||j)&&(M(U,V.message,A.message),!n))return w(O[p].message),O}if(g&&!B&&gt(b)){const{value:V,message:A}=xn(g);if(Qi(V)&&!b.match(V)&&(O[p]={type:Qt.pattern,message:A,ref:o,...N(Qt.pattern,A)},!n))return w(A),O}if(_){if(pt(_)){const V=await _(b,r),A=lh(V,S);if(A&&(O[p]={...A,...N(Qt.validate,A.message)},!n))return w(A.message),O}else if(Ue(_)){let V={};for(const A in _){if(!Je(V)&&!n)break;const U=lh(await _[A](b,r),S,A);U&&(V={...U,...N(A,U.message)},w(U.message),n&&(O[p]=V))}if(!Je(V)&&(O[p]={ref:S,...V},!n))return O}}return w(!0),O};const j1={mode:Gt.onSubmit,reValidateMode:Gt.onChange,shouldFocusError:!0},uh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function B1(e={}){let t={...j1,...e},r={...qe(uh),isLoading:pt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=Ue(t.defaultValues)||Ue(t.values)?qe(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:qe(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let y={...f};const g={array:Gf(),state:Gf()},_=t.criteriaMode===Gt.all,p=C=>T=>{clearTimeout(d),d=setTimeout(C,T)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||y.isValid||C)){let T;t.resolver?(T=Je((await N()).errors),m()):T=await A({fields:n,onlyCheckValid:!0,eventType:Er.VALID}),T!==r.isValid&&g.state.next({isValid:T})}},m=(C,T)=>{!t.disabled&&(f.isValidating||f.validatingFields||y.isValidating||y.validatingFields)&&((C||Array.from(a.mount)).forEach(x=>{x&&(T?ke(r.validatingFields,x,T):Qe(r.validatingFields,x))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},b=()=>{r.dirtyFields=Qr(s,i)},S=(C,T=[],x,z,q=!0,Q=!0)=>{if(z&&x&&!t.disabled){if(o.action=!0,Q&&Array.isArray(W(n,C))){const H=x(W(n,C),z.argA,z.argB);q&&ke(n,C,H)}if(Q&&Array.isArray(W(r.errors,C))){const H=x(W(r.errors,C),z.argA,z.argB);q&&ke(r.errors,C,H),$1(r.errors,C)}if((f.touchedFields||y.touchedFields)&&Q&&Array.isArray(W(r.touchedFields,C))){const H=x(W(r.touchedFields,C),z.argA,z.argB);q&&ke(r.touchedFields,C,H)}(f.dirtyFields||y.dirtyFields)&&b(),g.state.next({name:C,isDirty:j(C,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ke(i,C,T)},w=(C,T)=>{ke(r.errors,C,T),r.errors={...r.errors},g.state.next({errors:r.errors})},O=C=>{r.errors=C,g.state.next({errors:r.errors,isValid:!1})},I=C=>{const T=Os(C)?[C]:Hi(C);let x=i,z=s;for(let q=0;q<T.length-1;q++){const Q=T[q];if(x=ot(x)?x:x[Q],z=ot(z)?z:z[Q],x===null&&z!==null)return!0}return!1},k=(C,T,x,z)=>{const q=W(n,C);if(q){if(I(C))return;const Q=Le(W(i,C)),H=W(i,C,Le(x)?W(s,C):x);Le(H)||z&&z.defaultChecked||T?ke(i,C,T?H:nh(q._f)):ye(C,H),o.mount&&!o.action&&(v(),Q&&r.isDirty&&(f.isDirty||y.isDirty)&&(j()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!Le(W(i,C))&&ol(C,a)&&(o.watch=!0))}},P=(C,T,x,z,q)=>{let Q=!1,H=!1;const ee={name:C};if(!t.disabled){if(!x||z){(f.isDirty||y.isDirty)&&(H=r.isDirty,r.isDirty=ee.isDirty=j(),Q=H!==ee.isDirty);const he=Pt(W(s,C),T);H=!!W(r.dirtyFields,C),he!==r.isDirty?r.dirtyFields=Qr(s,i):he?Qe(r.dirtyFields,C):ke(r.dirtyFields,C,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||y.dirtyFields)&&H!==!he}if(x){const he=W(r.touchedFields,C);he||(ke(r.touchedFields,C,x),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||y.touchedFields)&&he!==x)}Q&&q&&g.state.next(ee)}return Q?ee:{}},B=(C,T,x,z)=>{const q=W(r.errors,C),Q=(f.isValid||y.isValid)&&At(T)&&r.isValid!==T;if(t.delayError&&x?(c=p(()=>w(C,x)),c(t.delayError)):(clearTimeout(d),c=null,x?ke(r.errors,C,x):Qe(r.errors,C),r.errors={...r.errors}),(x?!Pt(q,x):q)||!Je(z)||Q){const H={...z,...Q&&At(T)?{isValid:T}:{},errors:r.errors,name:C};r={...r,...H},g.state.next(H)}},N=async C=>(m(C,!0),await t.resolver(i,t.context,k1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),M=async C=>{const{errors:T}=await N(C);if(m(C),C){for(const x of C){const z=W(T,x);z?a.array.has(x)&&Ue(z)&&!Object.keys(z).some(q=>!Number.isNaN(Number(q)))?ah(r.errors,{[x]:z},x):ke(r.errors,x,z):Qe(r.errors,x)}r.errors={...r.errors}}else r.errors=T;return T},V=async({name:C,eventType:T})=>{if(e.validate){const x=await e.validate({formValues:i,formState:r,name:C,eventType:T});if(Ue(x))for(const z in x){const q=x[z];q&&Ae(`${Qa}.${z}`,{message:gt(q.message)?q.message:"",type:q.type||Qt.validate})}else gt(x)||!x?Ae(Qa,{message:x||"",type:Qt.validate}):ge(Qa);return x}return!0},A=async({fields:C,onlyCheckValid:T,name:x,eventType:z,context:q={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(q.runRootValidation=!0,!await V({name:x,eventType:z})&&(q.valid=!1,T)))return q.valid;for(const Q in C){const H=C[Q];if(H){const{_f:ee,...he}=H;if(ee){const ze=a.array.has(ee.name),Nt=H._f&&A1(H._f),xt=f.validatingFields||f.isValidating||y.validatingFields||y.isValidating;Nt&&xt&&m([ee.name],!0);const pr=await ch(H,a.disabled,i,_,t.shouldUseNativeValidation&&!T,ze);if(Nt&&xt&&m([ee.name]),pr[ee.name]&&(q.valid=!1,T)||(!T&&(W(pr,ee.name)?ze?ah(r.errors,pr,ee.name):ke(r.errors,ee.name,pr[ee.name]):Qe(r.errors,ee.name)),e.shouldUseNativeValidation&&pr[ee.name]))break}!Je(he)&&await A({context:q,onlyCheckValid:T,fields:he,name:Q,eventType:z})}}return q.valid},U=()=>{for(const C of a.unMount){const T=W(n,C);T&&(T._f.refs?T._f.refs.every(x=>!nl(x)):!nl(T._f.ref))&&je(C)}a.unMount=new Set},j=(C,T)=>!t.disabled&&(C&&T&&ke(i,C,T),!Pt(K(),s)),J=(C,T,x)=>Za(C,a,{...o.mount?i:Le(T)?s:gt(C)?{[C]:T}:T},x,T),ie=C=>Kf(W(o.mount?i:s,C,t.shouldUnregister?W(s,C,[]):[])),ye=(C,T,x={},z=!1)=>{const q=W(n,C);let Q=T;if(q){const H=q._f;H&&(!H.disabled&&ke(i,C,eh(T,H)),Q=Gi(H.ref)&&ot(T)?"":T,Yf(H.ref)?[...H.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):H.refs?Cs(H.ref)?H.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(he=>he===ee.value):ee.checked=Q===ee.value||!!Q)}):H.refs.forEach(ee=>ee.checked=ee.value===Q):tl(H.ref)?H.ref.value="":(H.ref.value=Q,H.ref.type||g.state.next({name:C,values:z?i:qe(i)})))}(x.shouldDirty||x.shouldTouch)&&P(C,Q,x.shouldTouch,x.shouldDirty,!0),x.shouldValidate&&R(C)},we=(C,T,x,z=!1)=>{for(const q in T){if(!T.hasOwnProperty(q))return;const Q=T[q],H=C+"."+q,ee=W(n,H);(a.array.has(C)||Ue(Q)||ee&&!ee._f)&&!Gr(Q)?we(H,Q,x,z):ye(H,Q,x,z)}},Se=(C,T,x,z)=>{const q=W(n,C),Q=a.array.has(C),H=z?T:qe(T),ee=W(i,C),he=Pt(ee,H);if(he||ke(i,C,H),Q)g.array.next({name:C,values:z?i:qe(i)}),(f.isDirty||f.dirtyFields||y.isDirty||y.dirtyFields)&&x.shouldDirty&&(b(),g.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:j(C,H)}));else{const ze=Array.isArray(H)&&!H.length||Je(H);!q||q._f||ot(H)||ze?ye(C,H,x,z):we(C,H,x,z)}if(!he){const ze=ol(C,a),Nt=z?i:qe(i);g.state.next({...ze&&r,name:o.mount||ze?C:void 0,values:Nt})}},G=(C,T,x={})=>Se(C,T,x,!1),F=(C,T={})=>{const x=pt(C)?C(i):C;if(!Pt(i,x)){i={...i,...x};for(const z of a.mount)Se(z,W(x,z),T,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),T.shouldValidate&&v()}},Y=async C=>{o.mount=!0;const T=C.target;let x=T.name,z=!0;const q=W(n,x),Q=he=>{z=Number.isNaN(he)||Gr(he)&&isNaN(he.getTime())||Pt(he,W(i,x,he))},H=sh(t.mode),ee=sh(t.reValidateMode);if(q){let he,ze;const Nt=T.type?nh(q._f):Ga(C),xt=C.type===Er.BLUR||C.type===Er.FOCUS_OUT,pr=!P1(q._f)&&!e.validate&&!t.resolver&&!W(r.errors,x)&&!q._f.deps||F1(xt,W(r.touchedFields,x),r.isSubmitted,ee,H),$s=ol(x,a,xt);ke(i,x,Nt),xt?(!T||!T.readOnly)&&(q._f.onBlur&&q._f.onBlur(C),c&&c(0)):q._f.onChange&&q._f.onChange(C);const ln=P(x,Nt,xt),nt=!Je(ln)||$s;if(!xt&&g.state.next({name:x,type:C.type,values:qe(i)}),pr)return(f.isValid||y.isValid)&&(t.mode==="onBlur"?xt&&v():xt||v()),nt&&g.state.next({name:x,...$s?{}:ln});if(!t.resolver&&e.validate&&await V({name:x,eventType:C.type}),!xt&&$s&&g.state.next({...r}),t.resolver){const{errors:bt}=await N([x]);if(m([x]),Q(Nt),!z){!Je(ln)&&g.state.next(ln);return}const Ct=oh(r.errors,n,x),Zt=oh(bt,n,Ct.name||x);he=Zt.error,x=Zt.name,ze=Je(bt)}else m([x],!0),he=(await ch(q,a.disabled,i,_,t.shouldUseNativeValidation))[x],m([x]),Q(Nt),z&&(he?ze=!1:(f.isValid||y.isValid)&&(ze=await A({fields:n,onlyCheckValid:!0,name:x,eventType:C.type})));z&&(q._f.deps&&(!Array.isArray(q._f.deps)||q._f.deps.length>0)&&R(q._f.deps),B(x,ze,he,ln))}},L=(C,T)=>{if(W(r.errors,T)&&C.focus)return C.focus(),1},R=async(C,T={})=>{let x,z;const q=Ki(C);if(t.resolver){const Q=await M(Le(C)?C:q);x=Je(Q),z=C?!q.some(H=>W(Q,H)):x}else C?(z=(await Promise.all(q.map(async Q=>{const H=W(n,Q);return await A({fields:H&&H._f?{[Q]:H}:H,eventType:Er.TRIGGER})}))).every(Boolean),!(!z&&!r.isValid)&&v()):z=x=await A({fields:n,name:C,eventType:Er.TRIGGER});return g.state.next({...!gt(C)||(f.isValid||y.isValid)&&x!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:x}:{},errors:r.errors}),T.shouldFocus&&!z&&Ds(n,L,C?q:a.mount),z},K=(C,T)=>{let x={...o.mount?i:s};return T&&(x=Qf(T.dirtyFields?r.dirtyFields:r.touchedFields,x)),Le(C)?x:gt(C)?W(x,C):C.map(z=>W(x,z))},oe=(C,T)=>({invalid:!!W((T||r).errors,C),isDirty:!!W((T||r).dirtyFields,C),error:W((T||r).errors,C),isValidating:!!W(r.validatingFields,C),isTouched:!!W((T||r).touchedFields,C)}),ge=C=>{const T=C?Ki(C):void 0;T==null||T.forEach(x=>Qe(r.errors,x)),T?T.forEach(x=>{g.state.next({name:x,errors:r.errors})}):g.state.next({errors:{}})},Ae=(C,T,x)=>{const z=(W(n,C,{_f:{}})._f||{}).ref,q=W(r.errors,C)||{},{ref:Q,message:H,type:ee,...he}=q;ke(r.errors,C,{...he,...T,ref:z}),g.state.next({name:C,errors:r.errors,isValid:!1}),x&&x.shouldFocus&&z&&z.focus&&z.focus()},re=(C,T)=>pt(C)?g.state.subscribe({next:x=>"values"in x&&C(x.values||J(void 0,T),x)}):J(C,T,!0),se=C=>g.state.subscribe({next:T=>{if(L1(C.name,T.name,C.exact)&&M1(T,C.formState||f,ro,C.reRenderRoot)){const x={...i};C.callback({values:x,...r,...T,defaultValues:s})}}}).unsubscribe,de=C=>(o.mount=!0,y={...y,...C.formState},se({...C,formState:{...u,...C.formState}})),je=(C,T={})=>{for(const x of C?Ki(C):a.mount)a.mount.delete(x),a.array.delete(x),T.keepValue||(Qe(n,x),Qe(i,x)),!T.keepError&&Qe(r.errors,x),!T.keepDirty&&Qe(r.dirtyFields,x),!T.keepTouched&&Qe(r.touchedFields,x),!T.keepIsValidating&&Qe(r.validatingFields,x),!t.shouldUnregister&&!T.keepDefaultValue&&Qe(s,x);g.state.next({values:qe(i)}),g.state.next({...r,...T.keepDirty?{isDirty:j()}:{}}),!T.keepIsValid&&v()},Ke=({disabled:C,name:T})=>{if(At(C)&&o.mount||C||a.disabled.has(T)){const q=a.disabled.has(T)!==!!C;C?a.disabled.add(T):a.disabled.delete(T),q&&o.mount&&!o.action&&v()}},Pe=(C,T={})=>{let x=W(n,C);const z=At(T.disabled)||At(t.disabled),q=!a.registerName.has(C)&&x&&x._f&&!x._f.mount;return ke(n,C,{...x||{},_f:{...x&&x._f?x._f:{ref:{name:C}},name:C,mount:!0,...T}}),a.mount.add(C),x&&!q?Ke({disabled:At(T.disabled)?T.disabled:t.disabled,name:C}):k(C,!0,T.value),{...z?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:Es(T.min),max:Es(T.max),minLength:Es(T.minLength),maxLength:Es(T.maxLength),pattern:Es(T.pattern)}:{},name:C,onChange:Y,onBlur:Y,ref:Q=>{if(Q){a.registerName.add(C),Pe(C,T),a.registerName.delete(C),x=W(n,C);const H=Le(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=I1(H),he=x._f.refs||[];if(ee?he.find(ze=>ze===H):H===x._f.ref)return;ke(n,C,{_f:{...x._f,...ee?{refs:[...he.filter(nl),H,...Array.isArray(W(s,C))?[{}]:[]],ref:{type:H.type,name:C}}:{ref:H}}}),k(C,!1,void 0,H)}else x=W(n,C,{}),x._f&&(x._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(Uf(a.array,C)&&o.action)&&a.unMount.add(C)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Ds(n,L,a.mount),Ye=C=>{At(C)&&(g.state.next({disabled:C}),Ds(n,(T,x)=>{const z=W(n,x);z&&(T.disabled=z._f.disabled||C,Array.isArray(z._f.refs)&&z._f.refs.forEach(q=>{q.disabled=z._f.disabled||C}))},0,!1))},vt=(C,T)=>async x=>{let z;x&&(x.preventDefault&&x.preventDefault(),x.persist&&x.persist());let q=qe(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:H}=await N();m(),r.errors=Q,q=qe(H)}else await A({fields:n,eventType:Er.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Qe(q,Q);if(Qe(r.errors,zf),Je(r.errors)){g.state.next({errors:{}});try{await C(q,x)}catch(Q){z=Q}}else T&&await T({...r.errors},x),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!z,submitCount:r.submitCount+1,errors:r.errors}),z)throw z},St=(C,T={})=>{W(n,C)&&(Le(T.defaultValue)?G(C,qe(W(s,C))):(G(C,T.defaultValue),ke(s,C,qe(T.defaultValue))),T.keepTouched||Qe(r.touchedFields,C),T.keepDirty||(Qe(r.dirtyFields,C),r.isDirty=T.defaultValue?j(C,qe(W(s,C))):j()),T.keepError||(Qe(r.errors,C),f.isValid&&v()),g.state.next({...r}))},Ge=(C,T={})=>{const x=C?qe(C):s,z=qe(x),q=Je(C),Q=z;if(T.keepDefaultValues||(s=x),!T.keepValues){if(T.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(Qr(s,i))]);for(const ee of Array.from(H)){const he=W(r.dirtyFields,ee),ze=W(i,ee),Nt=W(Q,ee);he&&!Le(ze)?ke(Q,ee,ze):!he&&!Le(Nt)&&G(ee,Nt)}}else{if(qi&&Le(C))for(const H of a.mount){const ee=W(n,H);if(ee&&ee._f){const he=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Gi(he)){const ze=he.closest("form");if(ze){ze.reset();break}}}}if(T.keepFieldsRef)for(const H of a.mount)G(H,W(Q,H));else n={}}if(t.shouldUnregister){if(i=T.keepDefaultValues?qe(s):{},T.keepFieldsRef)for(const H of a.mount)ke(i,H,W(Q,H))}else i=qe(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!T.keepIsValid||!!T.keepDirtyValues||!t.shouldUnregister&&!Je(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!T.keepIsValid,o.action=!1,T.keepErrors||(r.errors={}),g.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:q?!1:T.keepDirty?r.isDirty:T.keepValues?j():!!(T.keepDefaultValues&&!Pt(C,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q?{}:T.keepDirtyValues?T.keepDefaultValues&&i?Qr(s,i):r.dirtyFields:T.keepDefaultValues&&C?Qr(s,C):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},rt=(C,T)=>Ge(pt(C)?C(i):C,{...t.resetOptions,...T}),mt=(C,T={})=>{const x=W(n,C),z=x&&x._f;if(z){const q=z.refs?z.refs[0]:z.ref;q.focus&&setTimeout(()=>{q.focus(),T.shouldSelect&&pt(q.select)&&q.select()})}},ro=C=>{r={...r,...C}},no={control:{register:Pe,unregister:je,getFieldState:oe,handleSubmit:vt,setError:Ae,_subscribe:se,_runSchema:N,_updateIsValidating:m,_focusError:te,_getWatch:J,_getDirty:j,_setValid:v,_setFieldArray:S,_setDisabledField:Ke,_setErrors:O,_getFieldArray:ie,_reset:Ge,_resetDefaultValues:()=>pt(t.defaultValues)&&t.defaultValues().then(C=>{rt(C,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:U,_disableForm:Ye,_subjects:g,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return a},set _names(C){a=C},get _formState(){return r},get _options(){return t},set _options(C){t={...t,...C}}},subscribe:de,trigger:R,register:Pe,handleSubmit:vt,watch:re,setValue:G,setValues:F,getValues:K,reset:rt,resetField:St,resetDefaultValues:(C,T={})=>{if(s=qe(C),!T.keepDirty){const x=Qr(s,i);r.dirtyFields=x,r.isDirty=!Je(x)}T.keepIsValid||v(),g.state.next({...r,defaultValues:s})},clearErrors:ge,unregister:je,setError:Ae,setFocus:mt,getFieldState:oe};return{...no,formControl:no}}function U1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...qe(uh),isLoading:pt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!pt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=B1(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,Xa(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),h.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),h.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),h.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),h.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),h.useEffect(()=>{var a;e.values&&!Pt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),h.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=h.useMemo(()=>Hf(s,o),[o,s]),t.current}async function dh(e){var r,n;return(n=(r=(await Me.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function fh(e,t){const r=mo({queryKey:["framework",e],queryFn:()=>dh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=mo({queryKey:["framework",n],queryFn:()=>dh(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}async function V1(e){var r,n;return(n=(r=(await Me.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function z1(e){var r,n,s,i,o,a;const t=mo({queryKey:["channel",e],queryFn:()=>V1(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}const q1={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},Yi={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},H1={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},W1={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},hh={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},ph=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function K1(e,t,r,n){if(!(e!=null&&e.length))return Z1(t,n,r);const s=new Set;return e.filter(i=>{if(n&&(i.code==="dialCode"||i.code==="dialcode")||i.visible===!1)return!1;const o=i.code;return s.has(o)?!1:(s.add(o),!0)}).map(i=>{const o=i.code??"",a=R1(i),c=X1(i,r,t),d=t[o],u=gh(d,a),f={code:o,label:i.label??o,inputType:a,required:!!(i.required===!0||Array.isArray(i.validations)&&i.validations.some(y=>y.type==="required")),editable:i.editable!==!1,placeholder:i.placeholder,maxLength:i.maxLength,options:Q1(c,u,a,r),depends:i.depends,tab:Y1(i),section:i.section,defaultValue:i.defaultValue??i.default,currentValue:u};if(o==="dialcodes"){const y=t.dialcodeRequired==="Yes";return{...f,required:y,visible:y}}return f})}function G1(e){var n,s,i;const t=new Map,r=o=>o==null?void 0:o.forEach(a=>{a.identifier&&t.set(a.identifier,a.name),a.name&&t.set(a.name,a.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(o=>r(o.terms)),(i=e.targetFrameworks)==null||i.forEach(o=>{var a;return(a=o.categories)==null?void 0:a.forEach(c=>r(c.terms))}),t}function Q1(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const s=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!s.length)return e;const i=e?[...e]:[],o=new Set(i.map(c=>c.value)),a=G1(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function Y1(e){const t=e.section;if(t){if(Yi[t])return Yi[t];const n=H1[t];if(n&&Yi[n])return Yi[n]}const r=e.code??"";return W1[r]??"details"}function gh(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function R1(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function X1(e,t,r){var a;const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(c=>({label:c,value:c})):n.map(c=>({label:c.name,value:c.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(c=>({label:c,value:c}));const i=e.code??"";if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories")return(a=t.channelAdditionalCategories)==null?void 0:a.map(c=>({label:c,value:c}));const o=e.sourceCategory??hh[i];if(o)return yh(i,o,e,t,r)}function yh(e,t,r,n,s){var f,y,g,_,p;const i=ph.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=v=>({label:v.name,value:i?v.identifier:v.name}),a=(y=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:y.find(v=>v.code===t),c=(p=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:p.find(v=>v.code===t);let d=(ph.has(e)?c==null?void 0:c.terms:a==null?void 0:a.terms)??(c==null?void 0:c.terms)??(a==null?void 0:a.terms)??[];const u=r.depends;if(u!=null&&u.length){const v=u.flatMap(m=>{const b=s[m];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(v.length){const m=d.filter(b=>{const S=b.associations;return!S||!S.length?!0:S.some(w=>v.includes(w.identifier)||v.includes(w.code)||v.includes(w.name))});m.length&&(d=m)}}return d.map(o)}function Is(e,t){const r=hh[e];if(r)return yh(e,r,{},t,{})}function at(e,t,r){return gh(e[t],r)}function Z1(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:at(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:at(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:at(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:at(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:at(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:at(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:Is("subjectIds",r),currentValue:at(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:at(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:Is("targetBoardIds",r),currentValue:at(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:Is("targetMediumIds",r),currentValue:at(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:Is("targetGradeLevelIds",r),currentValue:at(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:Is("targetSubjectIds",r),currentValue:at(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"license","select")})),n}function J1(e,t){const{watch:r,setValue:n}=e;h.useEffect(()=>{const s=r((i,{name:o})=>{o&&t.forEach(a=>{var c;(c=a.depends)!=null&&c.includes(o)&&n(a.code,a.inputType==="multiselect"||a.inputType==="chips"?[]:"",{shouldDirty:!0})})});return()=>s.unsubscribe()},[r,n,t])}const kn={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},eO=({title:e,description:t,children:r})=>l.jsxs("div",{className:kn.section,children:[l.jsxs("div",{className:kn.header,children:[l.jsx("h3",{className:kn.title,children:e}),t&&l.jsx("p",{className:kn.description,children:t})]}),l.jsx("hr",{className:kn.divider}),l.jsx("div",{className:kn.fields,children:r})]}),$={field:"_field_1s288_1",fullWidth:"_fullWidth_1s288_7",label:"_label_1s288_11",required:"_required_1s288_19",input:"_input_1s288_24",textarea:"_textarea_1s288_45",inputError:"_inputError_1s288_50",error:"_error_1s288_54",selectBtn:"_selectBtn_1s288_59",selectOpen:"_selectOpen_1s288_83",placeholder:"_placeholder_1s288_87",selectedVal:"_selectedVal_1s288_91",chevronUp:"_chevronUp_1s288_95",dropdown:"_dropdown_1s288_100",option:"_option_1s288_116",optionSelected:"_optionSelected_1s288_134",noOpts:"_noOpts_1s288_139",chipGroup:"_chipGroup_1s288_146",chipInput:"_chipInput_1s288_158",addChipBtn:"_addChipBtn_1s288_167",radioGroup:"_radioGroup_1s288_184",radioLabel:"_radioLabel_1s288_191",iconWrap:"_iconWrap_1s288_199",iconPreview:"_iconPreview_1s288_214",iconPlaceholder:"_iconPlaceholder_1s288_220",removeIconBtn:"_removeIconBtn_1s288_233",tagChip:"_tagChip_1s288_252",tagChipRemove:"_tagChipRemove_1s288_264",nestedSelectRow:"_nestedSelectRow_1s288_278",dialcodeRow:"_dialcodeRow_1s288_287",validateBtn:"_validateBtn_1s288_293",dialcodeValid:"_dialcodeValid_1s288_315",dialcodeSpinner:"_dialcodeSpinner_1s288_325"},vh=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[$.field,s?$.fullWidth:""].join(" "),children:[l.jsxs("label",{className:$.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[$.input,$.textarea,d?$.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[$.input,d?$.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:$.error,children:String(d.message)})]})},tO=({name:e,label:t,options:r,required:n,disabled:s})=>{var p;const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),y=d(e),g=((p=r.find(v=>v.value===y))==null?void 0:p.label)??"Select…",_=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),l.jsxs("div",{className:$.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[$.selectBtn,_?$.inputError:"",i?$.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y?$.selectedVal:$.placeholder,children:g}),l.jsx(as,{size:14,className:i?$.chevronUp:""})]}),i&&l.jsxs("div",{className:$.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[$.option,y===v.value?$.optionSelected:""].join(" "),onClick:()=>{u(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),y===v.value&&l.jsx(hn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:$.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:$.error,children:String(_.message)})]})},rO=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),y=d(e)??[],g=f[e],_=y.length?`${y.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=y.includes(v)?y.filter(b=>b!==v):[...y,v];u(e,m,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:$.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[$.selectBtn,g?$.inputError:"",i?$.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y.length?$.selectedVal:$.placeholder,children:_}),l.jsx(as,{size:14,className:i?$.chevronUp:""})]}),i&&l.jsxs("div",{className:$.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[$.option,y.includes(v.value)?$.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(hn,{size:13,style:{opacity:y.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:$.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:$.error,children:String(g.message)})]})},nO=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),d=h.useRef(null),{watch:u,setValue:f,formState:{errors:y}}=Yt(),g=u(e)??[],_=y[e],p=()=>{const m=i.trim();m&&!g.includes(m)&&f(e,[...g,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,g.filter(b=>b!==m),{shouldDirty:!0});return l.jsxs("div",{className:[$.field,$.fullWidth].join(" "),children:[l.jsxs("label",{className:$.label,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsxs("div",{className:$.chipGroup,children:[g.map(m=>l.jsxs("span",{className:"sbx-chip filled",children:[m,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>v(m),"aria-label":`Remove ${m}`,children:"×"})]},m)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:$.chipInput,value:i,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),p()),m.key==="Escape"&&(o(""),c(!1))},onBlur:p,placeholder:s}):l.jsxs("button",{type:"button",className:$.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var m;return(m=d.current)==null?void 0:m.focus()},50)},children:[l.jsx(ls,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:$.error,children:String(_.message)})]})},sO=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Yt(),a=o[e];return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("div",{className:$.radioGroup,children:r.map(c=>l.jsxs("label",{className:$.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:$.error,children:String(a.message)})]})};async function iO(e,t,r,n){var o,a;const i=(a=(o=(await Me.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function oO(e,t){var s,i;const n=(i=(s=(await Me.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function aO(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function lO(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Me.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const fe={overlay:"_overlay_ga6eh_1",modal:"_modal_ga6eh_12",header:"_header_ga6eh_24",title:"_title_ga6eh_33",closeBtn:"_closeBtn_ga6eh_39",tabs:"_tabs_ga6eh_57",tab:"_tab_ga6eh_57",activeTab:"_activeTab_ga6eh_83",body:"_body_ga6eh_88",searchWrap:"_searchWrap_ga6eh_99",searchIcon:"_searchIcon_ga6eh_104",searchInput:"_searchInput_ga6eh_113",grid:"_grid_ga6eh_132",imgCell:"_imgCell_ga6eh_148",imgCellSelected:"_imgCellSelected_ga6eh_166",thumb:"_thumb_ga6eh_171",noThumb:"_noThumb_ga6eh_177",checkBadge:"_checkBadge_ga6eh_183",loadMoreBtn:"_loadMoreBtn_ga6eh_198",loadingRow:"_loadingRow_ga6eh_220",empty:"_empty_ga6eh_230",spinner:"_spinner_ga6eh_237",uploadArea:"_uploadArea_ga6eh_247",dropZone:"_dropZone_ga6eh_256",uploadIcon:"_uploadIcon_ga6eh_277",dropText:"_dropText_ga6eh_281",dropSubtext:"_dropSubtext_ga6eh_288",uploadPreview:"_uploadPreview_ga6eh_294",hiddenInput:"_hiddenInput_ga6eh_301",fileName:"_fileName_ga6eh_305",errorText:"_errorText_ga6eh_311",footer:"_footer_ga6eh_318",cancelBtn:"_cancelBtn_ga6eh_328",confirmBtn:"_confirmBtn_ga6eh_345"},mh=18,bh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,d]=h.useState([]),[u,f]=h.useState(0),[y,g]=h.useState(!1),[_,p]=h.useState(null),[v,m]=h.useState(0),[b,S]=h.useState(null),[w,O]=h.useState(""),[I,k]=h.useState(!1),[P,B]=h.useState(""),N=h.useRef(null),M=ce(L=>{var R,K;return((K=(R=L.editorConfig)==null?void 0:R.context)==null?void 0:K.channel)??""}),V=ce(L=>{var R,K;return((K=(R=L.editorConfig)==null?void 0:R.context)==null?void 0:K.uid)??""}),A=ce(L=>{var R,K,oe;return((oe=(K=(R=L.editorConfig)==null?void 0:R.context)==null?void 0:K.cloudStorage)==null?void 0:oe.presigned_headers)??{}}),U=ce(L=>{var R,K,oe;return((oe=(K=(R=L.editorConfig)==null?void 0:R.config)==null?void 0:K.assetConfig)==null?void 0:oe.size)??1*1024*1024}),j=ce(L=>{var R,K,oe;return((oe=(K=(R=L.editorConfig)==null?void 0:R.config)==null?void 0:K.assetConfig)==null?void 0:oe.accepted)??"image/png,image/jpeg"}),J=h.useCallback(async(L,R,K=!1)=>{var oe;g(!0);try{const ge={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&V&&(ge.createdBy=V),M&&(ge.channel=M);const re=((oe=(await Me.post("/action/composite/v3/search",{request:{filters:ge,query:L,limit:mh,offset:R,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:oe.result)??{},se=re.content??[];f(re.count??0),d(de=>K?[...de,...se]:se)}catch{}finally{g(!1)}},[s,V,M]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),J(o,0))},[s]);const ie=h.useRef(),ye=L=>{a(L),clearTimeout(ie.current),ie.current=setTimeout(()=>{d([]),m(0),J(L,0)},400)},we=()=>{const L=v+mh;m(L),J(o,L,!0)},Se=()=>{const L=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";L&&r(L)};h.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const G=L=>{var oe;const R=(oe=L.target.files)==null?void 0:oe[0];if(L.target.value="",!R)return;const K=j.split(",").map(ge=>ge.trim());if(!K.includes(R.type)){const ge=K.map(Ae=>Ae.replace("image/","").toUpperCase()).join(", ");B(`Only ${ge} files are accepted.`);return}if(R.size>U){const ge=(U/1048576).toFixed(0);B(`Image must be under ${ge} MB.`);return}w&&URL.revokeObjectURL(w),S(R),O(URL.createObjectURL(R)),B("")},F=async()=>{if(b){k(!0),B("");try{const L=await iO(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,V,M),R=await oO(L,b.name);await aO(R,b,A);const K=R.split("?")[0],oe=await lO(L,K,b.type);r(oe)}catch(L){B(L instanceof Error?L.message:"Upload failed.")}finally{k(!1)}}},Y=c.length<u;return l.jsx("div",{className:fe.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:fe.modal,children:[l.jsxs("div",{className:fe.header,children:[l.jsx("span",{className:fe.title,children:"Select App Icon"}),l.jsx("button",{className:fe.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:18})})]}),l.jsxs("div",{className:fe.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${fe.tab} ${s==="my"?fe.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${fe.tab} ${s==="all"?fe.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${fe.tab} ${s==="upload"?fe.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Uc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:fe.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:fe.searchWrap,children:[l.jsx(zo,{size:14,className:fe.searchIcon}),l.jsx("input",{type:"search",className:fe.searchInput,placeholder:"Search images…",value:o,onChange:L=>ye(L.target.value)})]}),y&&c.length===0?l.jsxs("div",{className:fe.loadingRow,children:[l.jsx(ci,{size:20,className:fe.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:fe.empty,children:"No images found"}):l.jsx("div",{className:fe.grid,children:c.map(L=>{const R=L.appIcon??L.artifactUrl??L.downloadUrl??"",K=(_==null?void 0:_.identifier)===L.identifier;return l.jsxs("button",{type:"button",className:`${fe.imgCell} ${K?fe.imgCellSelected:""}`,onClick:()=>p(L),title:L.name,children:[R?l.jsx("img",{src:R,alt:L.name,className:fe.thumb}):l.jsx("div",{className:fe.noThumb,children:"IMG"}),K&&l.jsx("div",{className:fe.checkBadge,children:l.jsx(hn,{size:12})})]},L.identifier)})}),Y&&!y&&l.jsx("button",{className:fe.loadMoreBtn,onClick:we,children:"Load More"}),y&&c.length>0&&l.jsx("div",{className:fe.loadingRow,children:l.jsx(ci,{size:16,className:fe.spinner})})]}):l.jsxs("div",{className:fe.uploadArea,children:[l.jsx("div",{className:fe.dropZone,onClick:()=>{var L;return(L=N.current)==null?void 0:L.click()},onDragOver:L=>L.preventDefault(),onDrop:L=>{L.preventDefault();const R=L.dataTransfer.files[0];R&&G({target:{files:[R],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:fe.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Uc,{size:32,className:fe.uploadIcon}),l.jsx("p",{className:fe.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:fe.dropSubtext,children:[j.split(",").map(L=>L.replace("image/","").toUpperCase()).join(", ")," · max ",(U/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:j,className:fe.hiddenInput,onChange:G}),b&&l.jsx("p",{className:fe.fileName,children:b.name}),P&&l.jsx("p",{className:fe.errorText,children:P})]})}),l.jsxs("div",{className:fe.footer,children:[l.jsx("button",{className:fe.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:fe.confirmBtn,disabled:!b||I,onClick:F,children:I?l.jsxs(l.Fragment,{children:[l.jsx(ci,{size:14,className:fe.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:fe.confirmBtn,disabled:!_,onClick:Se,children:"Use Selected"})]})]})})},cO=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Yt(),f=a(e),y=u[e],g=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:$.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:$.iconPreview}):l.jsxs("div",{className:$.iconPlaceholder,children:[l.jsx(jc,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:$.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(qo,{size:13}),l.jsx("span",{children:"Remove"})]}),y&&l.jsx("span",{className:$.error,children:String(y.message)}),i&&l.jsx(bh,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},uO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[$.input,o?$.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:$.error,children:String(o.message)})]})},dO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),d=h.useRef(null),u=i.value??[],f=p=>{const v=p.trim();!v||u.includes(v)||i.onChange([...u,v])},y=p=>{i.onChange(u.filter(v=>v!==p))},g=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&u.length>0&&y(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[$.field,$.fullWidth].join(" "),children:[l.jsxs("label",{className:$.label,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsxs("div",{className:[$.chipGroup,o?$.inputError:""].join(" "),onClick:()=>{var p;return!n&&((p=d.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(p=>l.jsxs("span",{className:$.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:$.tagChipRemove,onClick:v=>{v.stopPropagation(),y(p)},"aria-label":`Remove ${p}`,children:l.jsx(jr,{size:11})})]},p)),!n&&l.jsx("input",{ref:d,className:$.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:g,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:$.error,children:String(o.message)})]})},fO=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=Wi({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,y)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[u]=y;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};return l.jsxs("div",{className:[$.field,$.fullWidth].join(" "),children:[l.jsxs("label",{className:$.label,children:[t,n&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("div",{className:$.nestedSelectRow,children:r.map((u,f)=>{const y=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:$.field,style:{flex:1},children:[l.jsx("label",{className:$.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[$.input,a?$.inputError:""].join(" "),disabled:s||y,value:c[u.code]??"",onChange:g=>d(u.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},u.code)})}),a&&l.jsx("span",{className:$.error,children:String(a.message)})]})},_h=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],hO=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Yt(),f=c(e),y=_h.find(p=>p.value===f),g=(y==null?void 0:y.label)??"Select license…",_=u[e];return h.useEffect(()=>{if(!s)return;const p=v=>{var m;(m=o.current)!=null&&m.contains(v.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),l.jsxs("div",{className:$.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:$.label,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[$.selectBtn,_?$.inputError:"",s?$.selectOpen:""].join(" "),onClick:()=>i(p=>!p),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?$.selectedVal:$.placeholder,children:g}),l.jsx(as,{size:14,className:s?$.chevronUp:""})]}),s&&l.jsx("div",{className:$.dropdown,role:"listbox",children:_h.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[$.option,f===p.value?$.optionSelected:""].join(" "),onClick:()=>{d(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(hn,{size:13})]},p.value))}),_&&l.jsx("span",{className:$.error,children:String(_.message)})]})},pO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[d,u]=h.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await qb(g),p=_==null?void 0:_.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},y=()=>a==="loading"?l.jsx(ci,{size:16,className:$.dialcodeSpinner}):a==="valid"?l.jsx(Mc,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx($o,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:$.field,children:[l.jsxs("label",{className:$.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:$.required,children:"*"})]}),l.jsxs("div",{className:$.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[$.input,o?$.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:g=>{i.onChange(g),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:$.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),y()]}),o&&l.jsx("span",{className:$.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?$.dialcodeValid:$.error,children:d})]})},al={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},gO=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var ye,we,Se,G;const a=ce(F=>F.editorConfig),c=ce(F=>F.rootFormConfig),d=ce(F=>F.unitFormConfig),{organisationFramework:u,targetFrameworks:f,isLoading:y}=fh((ye=a==null?void 0:a.context)==null?void 0:ye.framework,(we=a==null?void 0:a.context)==null?void 0:we.targetFWIds),{frameworks:g,collectionAdditionalCategories:_}=z1((Se=a==null?void 0:a.context)==null?void 0:Se.channel),p=g==null?void 0:g.map(F=>({label:F.name,value:F.identifier})),v={organisationFramework:u,targetFrameworks:f,orgFrameworks:p,channelAdditionalCategories:_},m=xe(F=>F.selectedNodeId),b=xe(F=>F.treeCache),S=m?b[m]??{}:{},w={...e,...S},O=r?c:d,I=O||(((G=a==null?void 0:a.config.hierarchy)==null?void 0:G.formConfig)??[]),k=K1(I,w,v,r),P=k.filter(F=>F.tab===t&&F.inputType!=="appIcon"&&F.visible!==!1),B=U1({mode:"onChange",defaultValues:Object.fromEntries(k.map(F=>{const Y=["multiselect","chips","keywords","tagsinput"],L=["nestedselect"];return Y.includes(F.inputType)?[F.code,F.currentValue??F.defaultValue??[]]:L.includes(F.inputType)?[F.code,F.currentValue??F.defaultValue??{}]:[F.code,F.currentValue??F.defaultValue??""]}))});J1(B,k);const{updateNode:N}=xe(),M=h.useRef(k);M.current=k;const V=h.useRef(m);V.current=m;const A=h.useRef(i);A.current=i;const U=h.useRef(o);U.current=o,h.useEffect(()=>{const F=V.current;if(F){const Y=Object.fromEntries(M.current.filter(L=>L.currentValue!==void 0&&L.currentValue!==null).map(L=>[L.code,L.currentValue]));Object.keys(Y).length>0&&N(F,Y)}B.trigger().then(()=>{const Y=B.formState.errors,L=M.current,R=Array.from(new Set(Object.keys(Y).map(K=>{var oe;return(oe=L.find(ge=>ge.code===K))==null?void 0:oe.tab}).filter(Boolean)));U.current(Object.keys(Y).length===0,R)})},[]),h.useEffect(()=>{const F=B.watch((Y,{name:L})=>{const R=V.current;if(!R)return;const K=M.current,oe=new Set(K.map(re=>re.code));if(L&&oe.has(L)){let re=B.getValues(L);L==="dialcodes"&&(re=Array.isArray(re)?re:re?[re]:[]),N(R,{[L]:re}),A.current({[L]:re})}else if(!L){const re=B.getValues(),se=Object.fromEntries(Object.entries(re).filter(([de])=>oe.has(de)));Object.keys(se).length>0&&(N(R,se),A.current(se))}const ge=B.formState.errors,Ae=Array.from(new Set(Object.keys(ge).map(re=>{var se;return(se=K.find(de=>de.code===re))==null?void 0:se.tab}).filter(Boolean)));U.current(Object.keys(ge).length===0,Ae)});return()=>F.unsubscribe()},[B]);const j=s!=="edit",J=P.reduce((F,Y)=>{const L=F[F.length-1];return L&&L.section===Y.section?L.fields.push(Y):F.push({section:Y.section,fields:[Y]}),F},[]),ie=F=>{const Y={key:F.code,name:F.code,label:F.label,required:F.required,disabled:j||F.editable===!1};switch(F.inputType){case"textarea":return l.jsx(vh,{...Y,multiline:!0,maxLength:F.maxLength});case"select":return l.jsx(tO,{...Y,options:F.options??[]});case"multiselect":return l.jsx(rO,{...Y,options:F.options??[]});case"chips":return l.jsx(nO,{...Y});case"radio":return l.jsx(sO,{...Y,options:F.options??[]});case"appIcon":return l.jsx(cO,{...Y,nodeId:m??""});case"datepicker":case"datetime":return l.jsx(uO,{...Y});case"keywords":case"tagsinput":return l.jsx(dO,{...Y});case"nestedselect":return l.jsx(fO,{...Y,levels:F.levels??[]});case"license":return l.jsx(hO,{...Y});case"dialcode":return l.jsx(pO,{...Y});default:return l.jsx(vh,{...Y,maxLength:F.maxLength})}};return l.jsx(E1,{...B,children:l.jsxs("div",{className:al.form,children:[J.map((F,Y)=>{const L=F.section?q1[F.section]:void 0;return L?l.jsx(eO,{title:L.title,description:L.description,children:F.fields.map(ie)},F.section??Y):l.jsx("div",{className:al.ungrouped,children:F.fields.map(ie)},Y)}),P.length===0&&!y&&l.jsx("p",{className:al.noFields,children:"No fields configured for this tab."})]})})};function wh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function yO(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Ri(e){return e!==null&&e>=0}function vO(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function mO(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Sh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=wh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Xi={scaleX:1,scaleY:1},bO=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...Xi}:null}const c=_O(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Xi}:s<r&&s>=o?{x:0,y:a.height+c,...Xi}:{x:0,y:0,...Xi}};function _O(e,t,r){const n=e[t],s=e[t-1],i=e[t+1];return n?r<t?s?n.top-(s.top+s.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const Ch="Sortable",Oh=h.createContext({activeIndex:-1,containerId:Ch,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sh,disabled:{draggable:!1,droppable:!1}});function wO(e){let{children:t,id:r,items:n,strategy:s=Sh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=xc(),f=es(Ch,r),y=a.rect!==null,g=h.useMemo(()=>n.map(I=>typeof I=="object"&&"id"in I?I.id:I),[n]),_=o!=null,p=o?g.indexOf(o.id):-1,v=d?g.indexOf(d.id):-1,m=h.useRef(g),b=!vO(g,m.current),S=v!==-1&&p===-1||b,w=mO(i);Ht(()=>{b&&_&&u(g)},[b,g,_,u]),h.useEffect(()=>{m.current=g},[g]);const O=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:g,overIndex:v,useDragOverlay:y,sortedRects:yO(g,c),strategy:s}),[p,f,w.draggable,w.droppable,S,g,v,c,y,s]);return h.createElement(Oh.Provider,{value:O},t)}const SO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return wh(r,n,s).indexOf(t)},CO=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},OO={duration:200,easing:"ease"},Eh="transform",EO=wr.Transition.toString({property:Eh,duration:0,easing:"linear"}),DO={roleDescription:"sortable"};function IO(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=h.useState(null),a=h.useRef(r);return Ht(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=fn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),h.useEffect(()=>{i&&o(null)},[i]),i}function TO(e){let{animateLayoutChanges:t=CO,attributes:r,disabled:n,data:s,getNewIndex:i=SO,id:o,strategy:a,resizeObserverConfig:c,transition:d=OO}=e;const{items:u,containerId:f,activeIndex:y,disabled:g,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Oh),S=NO(n,g),w=u.indexOf(o),O=h.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),I=h.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:k,node:P,isOver:B,setNodeRef:N}=Uy({id:o,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...c}}),{active:M,activatorEvent:V,activeNodeRect:A,attributes:U,setNodeRef:j,listeners:J,isDragging:ie,over:ye,setActivatorNodeRef:we,transform:Se}=Nc({id:o,data:O,attributes:{...DO,...r},disabled:S.draggable}),G=Eg(N,j),F=!!M,Y=F&&!_&&Ri(y)&&Ri(v),L=!m&&ie,R=L&&Y?Se:null,oe=Y?R??(a??b)({rects:p,activeNodeRect:A,activeIndex:y,overIndex:v,index:w}):null,ge=Ri(y)&&Ri(v)?i({id:o,items:u,activeIndex:y,overIndex:v}):w,Ae=M==null?void 0:M.id,re=h.useRef({activeId:Ae,items:u,newIndex:ge,containerId:f}),se=u!==re.current.items,de=t({active:M,containerId:f,isDragging:ie,isSorting:F,id:o,index:w,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:d,wasDragging:re.current.activeId!=null}),je=IO({disabled:!de,index:w,node:P,rect:k});return h.useEffect(()=>{F&&re.current.newIndex!==ge&&(re.current.newIndex=ge),f!==re.current.containerId&&(re.current.containerId=f),u!==re.current.items&&(re.current.items=u)},[F,ge,f,u]),h.useEffect(()=>{if(Ae===re.current.activeId)return;if(Ae&&!re.current.activeId){re.current.activeId=Ae;return}const Pe=setTimeout(()=>{re.current.activeId=Ae},50);return()=>clearTimeout(Pe)},[Ae]),{active:M,activeIndex:y,attributes:U,data:O,rect:k,index:w,newIndex:ge,items:u,isOver:B,isSorting:F,isDragging:ie,listeners:J,node:P,overIndex:v,over:ye,setNodeRef:G,setActivatorNodeRef:we,setDroppableNodeRef:N,setDraggableNodeRef:j,transform:je??oe,transition:Ke()};function Ke(){if(je||se&&re.current.newIndex===w)return EO;if(!(L&&!ei(V)||!d)&&(F||de))return wr.Transition.toString({...d,property:Eh})}}function NO(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Zi(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const xO=[be.Down,be.Right,be.Up,be.Left],kO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(xO.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const y=s.get(f.id);if(y)switch(e.code){case be.Down:n.top<y.top&&c.push(f);break;case be.Up:n.top>y.top&&c.push(f);break;case be.Left:n.left>y.left&&c.push(f);break;case be.Right:n.left<y.left&&c.push(f);break}});const d=zg({collisionRect:n,droppableRects:s,droppableContainers:c});let u=tc(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),y=i.get(u),g=y?s.get(y.id):null,_=y==null?void 0:y.node.current;if(_&&g&&f&&y){const v=ni(_).some((I,k)=>a[k]!==I),m=Dh(f,y),b=AO(f,y),S=v||!m?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},w={x:g.left,y:g.top};return S.x&&S.y?w:ts(w,S)}}}};function Dh(e,t){return!Zi(e)||!Zi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function AO(e,t){return!Zi(e)||!Zi(t)||!Dh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Yr={row:"_row_11nth_1",removeBtn:"_removeBtn_11nth_14",grip:"_grip_11nth_17",ctIcon:"_ctIcon_11nth_34",info:"_info_11nth_38",name:"_name_11nth_46",meta:"_meta_11nth_55"},PO={video:Ho,pdf:jo,h5p:Bo,scorm:Vo,audio:Uo,quiz:Fo,default:pn},MO=({item:e,onRemove:t,isEditable:r})=>{const n=zi(e),s=PO[n.key]??pn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=TO({id:e.id,disabled:!r}),f={transform:wr.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Yr.row,role:"listitem",children:[r&&l.jsx("span",{className:Yr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx($c,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Yr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Yr.info,children:[l.jsx("span",{className:Yr.name,title:e.name,children:e.name}),l.jsx("span",{className:Yr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Yr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(jr,{size:14})})]})},Rr={container:"_container_lzvke_1",header:"_header_lzvke_7",heading:"_heading_lzvke_13",count:"_count_lzvke_21",list:"_list_lzvke_30",emptyState:"_emptyState_lzvke_36",addRow:"_addRow_lzvke_52"},LO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=xe(),i=t?r(t):[],o=e==="edit",a=Xl(Eo(si,{activationConstraint:{distance:5}}),Eo(xo,{coordinateGetter:kO})),c=h.useCallback(u=>{const{active:f,over:y}=u;if(!y||f.id===y.id||!t)return;const g=xe.getState().getChildrenOf(t),_=g.findIndex(v=>v.id===f.id),p=g.findIndex(v=>v.id===y.id);_<0||p<0||n(t,_,p)},[t,n]),d=h.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:Rr.container,children:[l.jsxs("div",{className:Rr.header,children:[l.jsx("span",{className:Rr.heading,children:"Content in this unit"}),l.jsx("span",{className:Rr.count,children:i.length})]}),i.length>0?l.jsx(Ic,{sensors:a,collisionDetection:Vg,onDragEnd:c,children:l.jsx(wO,{items:i.map(u=>u.id),strategy:bO,children:l.jsx("div",{className:Rr.list,role:"list",children:i.map(u=>l.jsx(MO,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:Rr.emptyState,children:[l.jsx("p",{children:"No content yet"}),l.jsx("span",{children:"Drag from the library or click Add content"})]}),o&&l.jsxs("button",{className:Rr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(ls,{size:14})," Add content"]})]}):null},Ih={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},FO=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Ih.dropZone} ${e?Ih.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function $O(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Me.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function jO(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Fe={contentPlayerRoot:"_contentPlayerRoot_ryh6z_1",stage:"_stage_ryh6z_9",playerHeader:"_playerHeader_ryh6z_19",playerHeaderThumb:"_playerHeaderThumb_ryh6z_33",playerHeaderTitle:"_playerHeaderTitle_ryh6z_43",typeBadge:"_typeBadge_ryh6z_53",typeDot:"_typeDot_ryh6z_92",aspectRatio:"_aspectRatio_ryh6z_99",playerFrame:"_playerFrame_ryh6z_112",coverOverlay:"_coverOverlay_ryh6z_120",coverHidden:"_coverHidden_ryh6z_132",coverThumb:"_coverThumb_ryh6z_137",coverPlayRing:"_coverPlayRing_ryh6z_146",coverPlayIcon:"_coverPlayIcon_ryh6z_159",coverLabel:"_coverLabel_ryh6z_168",coverSkeleton:"_coverSkeleton_ryh6z_174",playerWrapper:"_playerWrapper_ryh6z_200",infoStrip:"_infoStrip_ryh6z_210",infoChip:"_infoChip_ryh6z_226",infoChipLabel:"_infoChipLabel_ryh6z_245",infoChipIcon:"_infoChipIcon_ryh6z_254",playerError:"_playerError_ryh6z_260",playerErrorIcon:"_playerErrorIcon_ryh6z_274",playerErrorMsg:"_playerErrorMsg_ryh6z_279",qumlRoot:"_qumlRoot_ryh6z_286"},BO=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"],label:"Video",icon:"🎬"},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"],label:"Audio",icon:"🎵"},{key:"pdf",mimes:["application/pdf"],label:"PDF",icon:"📄"},{key:"epub",mimes:["application/epub"],label:"ePub",icon:"📖"},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"],label:"ECML",icon:"✏️"},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"],label:"H5P",icon:"🎮"},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"],label:"SCORM",icon:"📦"}];function UO(e){return BO.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const VO={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},zO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},qO={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},HO="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function ll(e){for(const[t,r]of Object.entries(VO))if(r.includes(e))return t;return"default-player"}function WO(e,t,r){var i;const n=r==null?void 0:r.context,s=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((i=n==null?void 0:n.pdata)==null?void 0:i.id)??"sunbird.portal",ver:1,pid:"sunbird-portal"},contentId:e.identifier,sid:(n==null?void 0:n.sid)??"",uid:(n==null?void 0:n.uid)??"",channel:(n==null?void 0:n.channel)??"",did:(n==null?void 0:n.did)??"",timeDiff:0,contextRollup:{},tags:[],app:[(n==null?void 0:n.channel)??""],dims:""},config:{showEndPage:!1,showStartPage:!0,host:"",overlay:{showUser:!1},splash:{text:"",icon:"",bgImage:"",webLink:""},sideMenu:{showDownload:!0,showExit:!1,showShare:!0},apislug:"/action",repos:["/sunbird-plugins/renderer"],plugins:[{id:"org.sunbird.iframeEvent",ver:1,type:"plugin"},{id:"org.sunbird.player.endpage",ver:1.1,type:"plugin"}],enableTelemetryValidation:!1},metadata:t,data:s==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function KO(e){return document.querySelector(`script[src="${e}"]`)?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${e}`)),document.head.appendChild(n)})}async function GO(e,t,r=100){await KO(zO[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const o=setInterval(()=>{i++,customElements.get(e)?(clearInterval(o),n()):i>=r&&(clearInterval(o),s(new Error(`Custom element <${e}> did not register`)))},100)})}const QO=[{key:"author",label:"Author",icon:"👤"},{key:"license",label:"License",icon:"⚖️"},{key:"language",label:"Language",icon:"🌐"},{key:"gradeLevel",label:"Class",icon:"🏫"},{key:"subject",label:"Subject",icon:"📚"},{key:"contentType",label:"Type",icon:"🏷️"}];function YO({node:e}){const t=e.metadata??{},r=QO.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:Fe.infoStrip,children:r.map(n=>l.jsxs("div",{className:Fe.infoChip,children:[n.icon&&l.jsx("span",{className:Fe.infoChipIcon,children:n.icon}),l.jsx("span",{className:Fe.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function RO({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Fe.coverOverlay} ${t?Fe.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Fe.coverThumb}),l.jsx("div",{className:Fe.coverPlayRing,children:l.jsx("div",{className:Fe.coverPlayIcon})}),l.jsx("span",{className:Fe.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Fe.coverSkeleton})})}function XO({message:e}){return l.jsxs("div",{className:Fe.playerError,children:[l.jsx("span",{className:Fe.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Fe.playerErrorMsg,children:e})]})}function ZO({mimeType:e}){const t=UO(e);return l.jsxs("span",{className:Fe.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Fe.typeDot}),t.label]})}const cl=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(eE,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Fe.contentPlayerRoot,children:[l.jsxs("div",{className:Fe.stage,children:[l.jsxs("div",{className:Fe.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Fe.playerHeaderThumb}),l.jsx("span",{className:Fe.playerHeaderTitle,children:e.name}),l.jsx(ZO,{mimeType:e.mimeType??""})]}),l.jsx(JO,{node:e})]}),l.jsx(YO,{node:e})]})};function JO({node:e}){var v;const t=ce(m=>m.editorConfig),[r,n]=h.useState(()=>ll(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,d]=h.useState(e.metadata??{}),[u,f]=h.useState(!1),y=h.useRef(null),g=h.useRef(null),_=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??HO;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(ll(e.mimeType??"")),jO(e.identifier).then(b=>{if(m)return;const S={...e.metadata??{},...b};d(S);const w=b.mimeType??e.mimeType??"";n(ll(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=WO(e,c,t);return h.useEffect(()=>{if(!u||r!=="default-player")return;const m=y.current;if(!m)return;m.src=_;const b=()=>{try{const w=m.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(p),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},S=()=>a("Preview player could not be loaded.");return m.addEventListener("load",b),m.addEventListener("error",S),()=>{m.removeEventListener("load",b),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,_,u]),h.useEffect(()=>{if(!u||r==="default-player")return;const m=g.current;if(!m)return;const b=qO[r];if(!b)return;const S=p;GO(b,r).then(()=>{if(!g.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(S)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),m.innerHTML="",m.appendChild(w),setTimeout(()=>{try{w.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Fe.aspectRatio,children:[o?l.jsx(XO,{message:o}):l.jsx(RO,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:y,id:"contentPlayer",title:e.name,className:Fe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:Fe.playerFrame})]})}function eE({node:e,editorMode:t}){const r=ce(s=>s.editorConfig),n=h.useRef(null);return h.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:Fe.qumlRoot,children:l.jsx("div",{ref:n,className:Fe.playerWrapper})})}const Vt={overlay:"_overlay_ifddx_1",modal:"_modal_ifddx_11",header:"_header_ifddx_21",body:"_body_ifddx_37",hint:"_hint_ifddx_43",list:"_list_ifddx_49",item:"_item_ifddx_55",selected:"_selected_ifddx_68",empty:"_empty_ifddx_73",footer:"_footer_ifddx_79",cancelBtn:"_cancelBtn_ifddx_87",moveBtn:"_moveBtn_ifddx_95"};function tE(e,t,r){const n=[],s=i=>{var o;for(const a of i)a.isFolder&&a.id!==r&&a.id!==t&&n.push(a),(o=a.children)!=null&&o.length&&s(a.children)};return s(e),n}const rE=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=xe(),o=tE(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=h.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Vt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Vt.modal,children:[l.jsxs("div",{className:Vt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:Vt.body,children:[l.jsx("p",{className:Vt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Vt.list,children:[o.map(f=>l.jsxs("li",{className:`${Vt.item} ${a===f.id?Vt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(av,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Vt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Vt.footer,children:[l.jsx("button",{className:Vt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Vt.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},rr={overlay:"_overlay_16at9_1",modal:"_modal_16at9_11",header:"_header_16at9_21",body:"_body_16at9_37",table:"_table_16at9_43",pageInput:"_pageInput_16at9_61",empty:"_empty_16at9_68",footer:"_footer_16at9_74",cancelBtn:"_cancelBtn_16at9_82",saveBtn:"_saveBtn_16at9_90"};function nE(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const sE=({onClose:e})=>{const{treeData:t,updateNode:r}=xe(),n=nE(t),[s,i]=h.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=h.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:rr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:rr.modal,children:[l.jsxs("div",{className:rr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(jr,{size:16})})]}),l.jsx("div",{className:rr.body,children:n.length===0?l.jsx("p",{className:rr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:rr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:rr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:rr.footer,children:[l.jsx("button",{className:rr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:rr.saveBtn,onClick:o,children:[l.jsx(yv,{size:14})," Save"]})]})]})})},Ve={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},iE=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var M,V;const{updateNode:s,markDirty:i}=xe(),o=t==="edit",a=zi(e),c=ce(A=>A.relationalFormConfig),d=A=>c==null?void 0:c.find(U=>U.code===A),u=A=>!c||!!d(A),f=(A,U)=>{var j;return((j=d(A))==null?void 0:j.label)||U},[y,g]=h.useState(!0),_=((M=e.metadata)==null?void 0:M.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((V=e.metadata)==null?void 0:V.keywords)?e.metadata.keywords:[]),[O,I]=h.useState(!!_.optional);h.useEffect(()=>{var U,j;const A=((U=e.metadata)==null?void 0:U.relationalMetadata)??{};v(A.name??e.name??""),w(Array.isArray(A.keywords)?A.keywords:Array.isArray((j=e.metadata)==null?void 0:j.keywords)?e.metadata.keywords:[]),I(!!A.optional)},[e.id]);const k=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},P=()=>{const A=m.trim();if(A&&!S.includes(A)){const U=[...S,A];w(U),s(e.id,{keywords:U}),i()}b("")},B=A=>{const U=S.filter(j=>j!==A);w(U),s(e.id,{keywords:U}),i()},N=A=>{I(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:Ve.container,children:[l.jsxs("div",{className:Ve.panelHeader,children:[l.jsxs("div",{className:Ve.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Ve.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Ve.panelCollapseBtn,onClick:()=>g(A=>!A),"aria-expanded":y,"aria-label":y?"Collapse metadata panel":"Expand metadata panel",title:y?"Collapse":"Expand",children:y?l.jsx(as,{size:15}):l.jsx(sv,{size:15})})]}),y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ve.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Ve.icon}),l.jsx("input",{type:"text",className:Ve.nameInput,value:p,disabled:!o,onChange:A=>v(A.target.value),onBlur:k,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("div",{className:Ve.fieldHeader,children:l.jsxs("label",{className:Ve.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:Ve.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:Ve.chips,children:S.map(A=>l.jsxs("span",{className:Ve.chip,children:[A,o&&l.jsx("button",{type:"button",className:Ve.chipRemove,onClick:()=>B(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:Ve.keywordInput,children:[l.jsx("input",{type:"text",className:Ve.input,value:m,placeholder:"Add keyword and press Enter",onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),P())}}),l.jsx("button",{type:"button",className:Ve.addBtn,onClick:P,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("label",{className:Ve.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Ve.radioGroup,children:[l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},Ts={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},oE=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=xe(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[Ts.iconBtn,r?Ts.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:Ts.iconImg}):l.jsx("div",{className:Ts.placeholder,children:l.jsx(jc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ts.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(qo,{size:11})})]}),n&&l.jsx(bh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Rt={leafContentLayout:"_leafContentLayout_1osey_1",container:"_container_1osey_17",emptyState:"_emptyState_1osey_26",titleRow:"_titleRow_1osey_36",nodeTitle:"_nodeTitle_1osey_52",formArea:"_formArea_1osey_74",contentListArea:"_contentListArea_1osey_78",dropZone:"_dropZone_1osey_83",reviewComment:"_reviewComment_1osey_90",reviewCommentLabel:"_reviewCommentLabel_1osey_103",reviewCommentText:"_reviewCommentText_1osey_109"},aE=["application/vnd.sunbird.questionset"],lE=({editorMode:e,onToolbarEvent:t})=>{var M,V,A,U;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:y,breadcrumb:g,activeNodeMeta:_,updateNode:p,treeData:v}=xe(),m=ce(j=>{var J,ie,ye,we;return((ie=(J=j.editorConfig)==null?void 0:J.context)==null?void 0:ie.contentId)??((we=(ye=j.editorConfig)==null?void 0:ye.context)==null?void 0:we.identifier)??""}),b=y?Th(v,y):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),O=b&&aE.includes(b.mimeType??""),I=b&&!b.isFolder&&!O&&!S,k=((M=b==null?void 0:b.metadata)==null?void 0:M.rejectComment)??(S?(A=(V=v[0])==null?void 0:V.metadata)==null?void 0:A.rejectComment:void 0),P=h.useCallback(()=>{const j=u.current;if(!j||!y)return;const J=j.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(y,{name:J})},600)},[y,p]),B=h.useCallback(j=>{t({action:"onFormValueChange",data:j})},[t]),N=h.useCallback((j,J)=>{i(J),t({action:"onFormStatusChange",data:{isValid:j,nodeId:y}})},[t,y]);return b?O?l.jsx(cl,{node:b,editorMode:e,type:"quml"}):I?l.jsxs("div",{className:Rt.leafContentLayout,children:[l.jsx(cl,{node:b,editorMode:e,type:"content"}),l.jsx(iE,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(rE,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Rt.container,children:[l.jsx(w1,{crumbs:g}),k&&l.jsxs("div",{className:Rt.reviewComment,role:"alert",children:[l.jsx("span",{className:Rt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Rt.reviewCommentText,children:k})]}),l.jsxs("div",{className:Rt.titleRow,children:[S&&y&&l.jsx(oE,{nodeId:y,value:String(b.appIcon??((U=b.metadata)==null?void 0:U.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Rt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:P,onBlur:P,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(S1,{activeTab:r,onChange:j=>n(j),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Rt.formArea,children:l.jsx(gO,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:B,onFormStatusChange:N},`${y??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Rt.contentListArea,children:l.jsx(LO,{editorMode:e})}),l.jsx(FO,{isActive:!1,label:"Drop to add content to this unit",nodeId:y??void 0,className:Rt.dropZone}),c&&l.jsx(sE,{contentId:m,onClose:()=>d(!1)})]}):l.jsx("div",{className:Rt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Th(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Th(r.children,t);if(n)return n}}}const Nh=di((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),cE=20;function xh(){var d;const e=ce(u=>u.editorConfig),t=xe(u=>u.selectedNodeId),r=xe(u=>u.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function u(f,y,g=0){var _;for(const p of f){if(p.id===y)return g;if((_=p.children)!=null&&_.length){const v=u(p.children,y,g+1);if(v>=0)return v}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...Ff];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...Ff]}function uE(){const e=Nh(),t=ce(f=>{var y,g;return((g=(y=f.editorConfig)==null?void 0:y.context)==null?void 0:g.channel)??""}),r=xh(),n=h.useRef(),s=h.useCallback(async(f="",y="all",g={},_=!0,p=!1)=>{var v,m,b,S,w;e.setLoading(!0);try{const O={status:["Live"],primaryCategory:y&&y!=="all"?[y]:r};(v=g==null?void 0:g.board)!=null&&v.length&&(O.board=g.board),(m=g==null?void 0:g.medium)!=null&&m.length&&(O.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(O.gradeLevel=g.gradeLevel),(S=g==null?void 0:g.subject)!=null&&S.length&&(O.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(O.primaryCategory=g.primaryCategory);const I=_?0:e.offset,{content:k,count:P}=await $O({filters:O,query:f,limit:f?50:cE,offset:I,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(k,P):e.appendContent(k,P)}catch(O){console.error("[useLibrary] load error:",O)}finally{e.setLoading(!1)}},[r,t]);h.useEffect(()=>{s()},[t]);const i=h.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=h.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=h.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=h.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=h.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const nr={card:"_card_jzciw_1",addBtn:"_addBtn_jzciw_17",dragging:"_dragging_jzciw_24",ctIcon:"_ctIcon_jzciw_29",info:"_info_jzciw_33",name:"_name_jzciw_41",meta:"_meta_jzciw_50",addBtnMuted:"_addBtnMuted_jzciw_78",added:"_added_jzciw_87",addedBadge:"_addedBadge_jzciw_96"},dE={video:Ho,pdf:jo,h5p:Bo,scorm:Vo,audio:Uo,quiz:Fo,default:pn},fE=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=zi(e),o=dE[i.key]??pn,a=Wa(),c=c1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:y,isDragging:g}=Nc({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:y,className:[nr.card,g?nr.dragging:"",s?nr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,nr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:nr.info,children:[l.jsx("span",{className:nr.name,title:e.name,children:e.name}),l.jsxs("span",{className:nr.meta,children:[((p=e.organisation)==null?void 0:p[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:nr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(hn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[nr.addBtn,!d&&a?nr.addBtnMuted:""].join(" "),onClick:m=>{m.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(ls,{size:14})})]})},kh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},hE=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:kh.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",kh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),et={panel:"_panel_1cl11_1",header:"_header_1cl11_10",headerTitle:"_headerTitle_1cl11_19",closeBtn:"_closeBtn_1cl11_25",body:"_body_1cl11_43",section:"_section_1cl11_59",sectionLabel:"_sectionLabel_1cl11_65",chips:"_chips_1cl11_73",chip:"_chip_1cl11_73",active:"_active_1cl11_96",footer:"_footer_1cl11_102",resetBtn:"_resetBtn_1cl11_112",applyBtn:"_applyBtn_1cl11_129"},pE=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],gE=new Set(["board","medium","gradeLevel","subject","topic"]),yE=({local:e,toggle:t})=>{const r=xh();return r.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:et.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[et.chip,(e.primaryCategory??[]).includes(n)?et.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},vE=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=ce(p=>p.editorConfig),i=ce(p=>p.searchFormConfig),{organisationFramework:o}=fh((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=h.useState(t),d=i!=null&&i.length?i.filter(p=>gE.has(p.code)).map(p=>({key:p.code,label:p.label||p.code})):pE;h.useEffect(()=>{c(t)},[t]);const u=(p,v)=>{c(m=>{const b=m[p]??[],S=b.includes(v)?b.filter(w=>w!==v):[...b,v];return{...m,[p]:S}})},f=(o==null?void 0:o.categories)??[],y=p=>{var v;return((v=f.find(m=>m.code===p))==null?void 0:v.terms)??[]};return e?l.jsxs("div",{className:et.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:et.header,children:[l.jsx("span",{className:et.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:et.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:et.body,children:[d.map(({key:p,label:v})=>{const m=y(p);return m.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:v}),l.jsx("div",{className:et.chips,children:m.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[et.chip,(a[p]??[]).includes(b.name)?et.active:""].join(" "),onClick:()=>u(p,b.name),children:b.name},b.identifier))})]},p):null}),l.jsx(yE,{local:a,toggle:u})]}),l.jsxs("div",{className:et.footer,children:[l.jsx("button",{type:"button",className:et.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:et.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},dr={header:"_header_6qdpu_10",title:"_title_6qdpu_20",headerActions:"_headerActions_6qdpu_31",iconBtn:"_iconBtn_6qdpu_38",playerArea:"_playerArea_6qdpu_56",footer:"_footer_6qdpu_64",addBtn:"_addBtn_6qdpu_73",modalOverlay:"_modalOverlay_6qdpu_92",modalPanel:"_modalPanel_6qdpu_103"},mE=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Be.createPortal(l.jsx("div",{className:dr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:dr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:dr.header,children:[l.jsx("span",{className:dr.title,title:e.name,children:e.name}),l.jsx("div",{className:dr.headerActions,children:l.jsx("button",{type:"button",className:dr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(jr,{size:16})})})]}),l.jsx("div",{className:dr.playerArea,children:l.jsx(cl,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:dr.footer,children:l.jsx("button",{type:"button",className:dr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},$e={dock:"_dock_1lpg0_1",header:"_header_1lpg0_8",headerLeft:"_headerLeft_1lpg0_17",headerTitle:"_headerTitle_1lpg0_24",count:"_count_1lpg0_30",searchRow:"_searchRow_1lpg0_39",searchWrap:"_searchWrap_1lpg0_47",searchIcon:"_searchIcon_1lpg0_53",searchInput:"_searchInput_1lpg0_62",filterToggleBtn:"_filterToggleBtn_1lpg0_80",filterToggleBtnActive:"_filterToggleBtnActive_1lpg0_99",filterBadge:"_filterBadge_1lpg0_105",filters:"_filters_1lpg0_124",mainArea:"_mainArea_1lpg0_134",sidePanelOverlay:"_sidePanelOverlay_1lpg0_143",cardList:"_cardList_1lpg0_152",skeleton:"_skeleton_1lpg0_168",skeletonIcon:"_skeletonIcon_1lpg0_178",skeletonText:"_skeletonText_1lpg0_186",skeletonLine:"_skeletonLine_1lpg0_193",skeletonLineSm:"_skeletonLineSm_1lpg0_200",loadMoreBtn:"_loadMoreBtn_1lpg0_215",emptyState:"_emptyState_1lpg0_240",collapseBtn:"_collapseBtn_1lpg0_260"};function bE(e){const t=new Set,r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t.add(n.identifier),n.children&&r.push(...n.children)}return t}const _E=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:y,toggleSort:g,loadMore:_}=uE(),{addResource:p,selectedNodeId:v,treeData:m}=xe(),b=e==="edit",[S,w]=h.useState(!1),[O,I]=h.useState({}),[k,P]=h.useState(null),B=h.useMemo(()=>bE(m),[m]),N=h.useCallback(j=>{var ye;if(!v){Ee.error("Select a unit first");return}const J=(ye=m[0])==null?void 0:ye.id;if(v===J){Ee("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(p(j,v)===!1){Ee.error(`"${j.name}" is already in this collection`);return}Ee.success(`Added "${j.name}"`)},[v,p,m]),M=h.useCallback(j=>{I(j),y(j)},[y]),V=h.useCallback(j=>{P(j)},[]),A=h.useCallback(j=>{N(j),P(null)},[N]),U=h.useMemo(()=>Object.values(O).reduce((j,J)=>j+((J==null?void 0:J.length)??0),0),[O]);return l.jsxs("div",{className:$e.dock,children:[l.jsx("div",{className:$e.header,children:l.jsxs("div",{className:$e.headerLeft,children:[l.jsx("button",{type:"button",className:$e.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(hv,{size:15})}),l.jsx(uv,{size:16}),l.jsx("span",{className:$e.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:$e.count,children:i})]})}),l.jsxs("div",{className:$e.searchRow,children:[l.jsxs("div",{className:$e.searchWrap,children:[l.jsx(zo,{size:14,className:$e.searchIcon}),l.jsx("input",{type:"search",className:$e.searchInput,placeholder:"Search content…",value:a,onChange:j=>u(j.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[$e.filterToggleBtn,c?$e.filterToggleBtnActive:""].join(" "),onClick:g,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(rv,{size:15}):l.jsx(iv,{size:15})}),l.jsxs("button",{type:"button",className:[$e.filterToggleBtn,S?$e.filterToggleBtnActive:""].join(" "),onClick:()=>w(j=>!j),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(bv,{size:15}),U>0&&l.jsx("span",{className:$e.filterBadge,children:U})]})]}),l.jsx("div",{className:$e.filters,children:l.jsx(hE,{filters:u1,active:o,onChange:f})}),l.jsxs("div",{className:$e.mainArea,children:[l.jsx("div",{className:$e.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((j,J)=>l.jsxs("div",{className:$e.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:$e.skeletonIcon}),l.jsxs("div",{className:$e.skeletonText,children:[l.jsx("div",{className:$e.skeletonLine}),l.jsx("div",{className:$e.skeletonLineSm})]})]},J)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(j=>l.jsx(fE,{item:j,onAdd:N,onPreview:V,isDraggable:b,isAdded:B.has(j.identifier)},j.identifier)),d&&l.jsx("button",{type:"button",className:$e.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:$e.emptyState,children:[l.jsx(zo,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:$e.sidePanelOverlay,children:l.jsx(vE,{isOpen:S,filters:O,onApply:M,onClose:()=>w(!1)})}),k&&l.jsx(mE,{content:k,onAdd:A,onClose:()=>P(null)})]})]})};function wE(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","medium","gradeLevel","subject","additionalCategories","keywords","language"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(y,g=!1){const _={};for(const[p,v]of Object.entries(y))if(!i.has(p)&&!(g&&o.has(p)))if(a.has(p))Array.isArray(v)?_[p]=v:v!=null&&v!==""?_[p]=[v]:_[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(_[p]=m)}else _[p]=v;return _}function u(y){var _;const g={};for(const p of y.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,...b}=v;if(Object.keys(b).length===0)continue;const S=((_=p.metadata)==null?void 0:_.relationalMetadata)??{};g[p.identifier]={name:p.name,...S,...b}}return g}function f(y,g){var S,w;const _=y.identifier,p=t[_],v=_.startsWith("temp-")||!!(p!=null&&p.isNew),m=!y.isFolder&&!g;if(g||v||p&&!m){let O;if(v)O={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=y.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=y.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:y.name,visibility:"Parent",channel:r,...d(y.metadata??{})};else if(g){const{isNew:I,...k}=p??{};O={...d(y.metadata??{},!0),...d(k,!1),name:y.name}}else{const{isNew:I,...k}=p??{};O={name:y.name,visibility:"Parent",...d(k,!0)}}n[_]={metadata:O,objectType:y.objectType||(y.isFolder?"Collection":"Content"),root:g,isNew:v}}const b=y.isFolder?u(y):{};s[_]={name:y.name,children:(y.children??[]).map(O=>O.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(y.children??[]).forEach(O=>f(O,!1))}return e.forEach((y,g)=>f(y,g===0)),{nodesModified:n,hierarchy:s}}function SE(){const[e,t]=h.useState(!1),r=xe(u=>u.treeCache),n=xe(u=>u.treeData),s=ce(u=>u.isDirty),i=ce(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ce(),c=ce(u=>u.editorConfig);return{save:h.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",y=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:g,hierarchy:_}=wE(n,r,f),{identifiers:p}=await Fb(u,g,_,y);p&&Object.keys(p).length>0&&xe.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(g){console.error("[useSaveHierarchy] save failed:",g),Ee.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function CE(e){const t=ce(o=>o.editorConfig),r=ce(o=>o.setButtonLoader),n=ce(o=>o.validateAllForms),s=xe(o=>o.treeData);return{runAction:h.useCallback(async(o,a)=>{var u,f,y,g;const c=((u=t==null?void 0:t.context)==null?void 0:u.contentId)??((f=t==null?void 0:t.context)==null?void 0:f.identifier)??"";if(!c)return Ee.error("No content identifier found."),!1;const d=((y=t==null?void 0:t.context)==null?void 0:y.userId)??((g=t==null?void 0:t.context)==null?void 0:g.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await Bb(c),Ee.success("Content sent for review"),!0):(Ee.error("Some units have missing required fields. Please fill them before sending for review."),!1);case"reject":{r("rejectCollection",!0);const _=(a==null?void 0:a.comment)??"";return await Ub(c,_),Ee.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await $b(c,d),Ee.success("Content published successfully"),!0):(Ee.error("Some units have missing required fields. Please fill them before publishing."),!1);default:return!1}}catch(_){console.error(`[useToolbarActions] ${o} failed`,_);const p=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return Ee.error(`Failed to ${p}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const Mt={shell:"_shell_90fon_1",workspace:"_workspace_90fon_8",sidebarCollapsed:"_sidebarCollapsed_90fon_16",dockCollapsed:"_dockCollapsed_90fon_19",dock:"_dock_90fon_19",outline:"_outline_90fon_40",reopenTab:"_reopenTab_90fon_45",outlineHidden:"_outlineHidden_90fon_79",editor:"_editor_90fon_86",dockHidden:"_dockHidden_90fon_101",dockReopenTab:"_dockReopenTab_90fon_108",dragChip:"_dragChip_90fon_133",dragChipLabel:"_dragChipLabel_90fon_148"},OE=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState(!1),{addResource:y,treeData:g}=xe(),_=ce(A=>A.setFormStatus),[p,v]=h.useState(!0),m=xe(A=>A.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:O}=SE(),{runAction:I}=CE(b);h.useEffect(()=>{if(!w)return;const A=U=>{U.preventDefault(),U.returnValue=""};return window.addEventListener("beforeunload",A),()=>window.removeEventListener("beforeunload",A)},[w]);const k=Xl(Eo(si,{activationConstraint:{distance:8}})),P=h.useCallback(A=>{var j;const U=(j=A.active.data.current)==null?void 0:j.item;U&&i(U)},[]),B=h.useCallback(A=>{var we,Se;i(null);const U=(we=A.active.data.current)==null?void 0:we.item;if(!U)return;const j=A.over,J=(j==null?void 0:j.id)??m??void 0;if(!J){Ee.error("Drop onto a unit to add content");return}const ie=(Se=g[0])==null?void 0:Se.id;if(J===ie){Ee.error("Drop content onto a unit, not directly on the course.");return}if(!y(U,J)){Ee.error(`"${U.name}" is already in this collection`);return}r==null||r(U,J),Ee.success(`Added "${U.name}" to unit`)},[m,y,r]),N=h.useCallback(async A=>{if(A.action==="onFormStatusChange"){const{isValid:U,nodeId:j}=A.data??{},J=U!==!1;v(J),j&&_(j,J);return}if(A.action==="back"&&w){f(!0);return}if(A.action==="saveCollection"){if(!p){Ee.error("Please fill the required metadata");return}await b(),n==null||n(g),t==null||t(A);return}if(A.action==="sendForReview"||A.action==="reject"||A.action==="publish"){await I(A.action,A.data)&&(t==null||t(A));return}t==null||t(A)},[b,I,t,n,g,w,p]),M=h.useCallback(async()=>{await b(),f(!1),n==null||n(g),t==null||t({action:"back"})},[b,n,t,g]),V=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Ic,{sensors:k,onDragStart:P,onDragEnd:B,children:[l.jsxs("div",{className:Mt.shell,children:[l.jsx(Rb,{editorMode:e,isSaving:S,isDirty:w,lastSaved:O,isFormValid:p,onToolbarEvent:N}),l.jsxs("div",{className:[Mt.workspace,o?Mt.sidebarCollapsed:"",c?Mt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Mt.outline,o?Mt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(_1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(A=>!A)})}),o&&l.jsx("button",{className:Mt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Mt.editor,role:"main","aria-label":"Content editor",children:l.jsx(lE,{editorMode:e,onToolbarEvent:N})}),l.jsx("aside",{className:[Mt.dock,c?Mt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(_E,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(A=>!A)})}),c&&l.jsx("button",{className:Mt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Xy,{dropAnimation:null,children:s?l.jsx("div",{className:Mt.dragChip,children:l.jsx("span",{className:Mt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(Xb,{onSave:M,onDiscard:V,onCancel:()=>f(!1),isSaving:S})]})},EE="v1";function DE(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function Ah(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:DE(e),depends:e.depends,sourceCategory:e.sourceCategory,range:e.range,enum:e.enum,default:e.default,defaultValue:e.defaultValue,index:e.index,section:t,output:e.output}}function Dr(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(o=>!!o.code).sort((o,a)=>(o.index??0)-(a.index??0));for(const o of i)r.push(Ah(o,s))}else n.code&&r.push(Ah(n));return r}function IE(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,s]of Object.entries(t))s&&"default"in s&&(r[n]=s.default);return r}async function TE(e,t,r="Collection",n=EE){var d,u;const i=(u=(d=(await Me.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:Dr(o.create),unitForm:Dr(o.unitMetadata),childForm:Dr(o.childMetadata),searchForm:Dr(o.search??o.searchConfig),relationalForm:Dr(o.relationalMetadata),publishChecklist:Dr(o.publishchecklist),reviewChecklist:Dr(o.review),rfcChecklist:Dr(o.requestforchangeschecklist),schemaDefaults:IE(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function NE({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u}=ce(),{setTreeData:f,selectNode:y}=xe();return h.useEffect(()=>{let g=!1;async function _(){var p,v;try{n(!0),i(null),e.apiBaseUrl&&Vu(e.apiBaseUrl),c(e),d(e.config.mode);const m=e.context.contentId??e.context.identifier??"";if(m){const{rootNode:b}=await Hu(m);g||(f(b?[b]:[]),b&&y(b.id));const S=e.config.primaryCategory??"Course",w=e.context.channel??"",O=e.config.categoryDefinitionApiVersion??"v1";try{const I=await TE(S,w,e.config.objectType??"Collection",O);if(!g){u(I);const k=((p=I.sourcingSettings)==null?void 0:p.collection)??{},P={};k.maxDepth&&!e.config.maxDepth&&(P.maxDepth=k.maxDepth),k.children&&!e.config.children&&(P.children=k.children),k.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(P.hierarchy={...e.config.hierarchy??{},...k.hierarchy}),Object.keys(P).length>0&&c({...e,config:{...e.config,...P}})}}catch{}}g||a(!0)}catch(m){if(!g){const b=m instanceof Error?m:new Error(String(m));i(b),t==null||t(b)}}finally{g||n(!1)}}return _(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ns={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},xE=new Cp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class kE extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:Ns.errorState,children:[l.jsx("h3",{children:"Something went wrong"}),l.jsx("p",{children:this.state.error.message}),l.jsx("button",{onClick:()=>this.setState({error:null}),children:"Retry"})]}):this.props.children}}function AE(e){const{isLoading:t,error:r}=NE({config:e,onError:e.onError}),n=ce(s=>s.editorMode);return t?l.jsxs("div",{className:Ns.loadingState,children:[l.jsx("div",{className:Ns.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ns.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ns.root}`,children:l.jsx(OE,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Ph=e=>l.jsx(kE,{onError:e.onError,children:l.jsxs(Ep,{client:xE,children:[l.jsx(AE,{...e}),l.jsx(Og,{position:"top-right",toastOptions:{duration:3e3}})]})}),Ji=Symbol.for("r2wc.reactRender"),Mh=Symbol.for("r2wc.shouldRender"),eo=Symbol.for("r2wc.root");function PE(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ME(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Lh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Ji]()}}),e[Ji]()}};function LE(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,y){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Lh.expando(y,u,f),Reflect.set(d,u,f,y)):(Lh.expando(y,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Mh]=!0,this[Ji]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[eo].unmount():r.unmountComponentAtNode(this)},a[Ji]=function(){if(this[Mh]===!0){var d={};Object.keys(this).forEach(function(y){s[y]!==!1&&(d[y]=this[y])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[eo]||(this[eo]=r.createRoot(u)),this[eo].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return PE(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var y=n.dashStyleAttributes?ME(d):d;this[y]=f}),o}var xs={},ks=Be;if(process.env.NODE_ENV==="production")xs.createRoot=ks.createRoot,xs.hydrateRoot=ks.hydrateRoot;else{var to=ks.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;xs.createRoot=function(e,t){to.usingClientEntryPoint=!0;try{return ks.createRoot(e,t)}finally{to.usingClientEntryPoint=!1}},xs.hydrateRoot=function(e,t,r){to.usingClientEntryPoint=!0;try{return ks.hydrateRoot(e,t,r)}finally{to.usingClientEntryPoint=!1}}}function FE(){if(document.getElementById("sb-ce-react-styles"))return;const e=document.createElement("style");e.id="sb-ce-react-styles",e.textContent="@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');",document.head.insertBefore(e,document.head.firstChild)}function $E(e="sb-collection-editor"){if(FE(),typeof customElements>"u"||customElements.get(e))return;const t=LE(Ph,h,xs,{});customElements.define(e,t)}me.CollectionEditor=Ph,me.registerCollectionEditor=$E,me.setApiBaseUrl=Vu,me.useEditorStore=ce,me.useLibraryStore=Nh,me.useTreeStore=xe,Object.defineProperty(me,Symbol.toStringTag,{value:"Module"})});