@project-sunbird/collection-editor-react 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/hierarchy.d.ts +1 -1
- package/dist/collection-editor.umd.js +68 -68
- package/dist/hooks/useToolbarActions.d.ts +15 -0
- package/dist/index.cjs +26 -26
- package/dist/index.js +4649 -4560
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var gl=e=>{throw TypeError(e)};var io=(e,t,r)=>t.has(e)||gl("Cannot "+r);var E=(e,t,r)=>(io(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?gl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),K=(e,t,r,n)=>(io(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),he=(e,t,r)=>(io(e,t,"access private method"),r);var zs=(e,t,r,n)=>({set _(s){K(e,t,s,r)},get _(){return E(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),$r=require("react-dom"),l=require("react/jsx-runtime");function Kh(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 be=Kh(p);var Ds=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(){}},zr,Er,xn,Fu,Qh=(Fu=class extends Ds{constructor(){super();ne(this,zr);ne(this,Er);ne(this,xn);K(this,xn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Er)||this.setEventListener(E(this,xn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Er))==null||t.call(this),K(this,Er,void 0))}setEventListener(t){var r;K(this,xn,t),(r=E(this,Er))==null||r.call(this),K(this,Er,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,zr)!==t&&(K(this,zr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,zr)=="boolean"?E(this,zr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zr=new WeakMap,Er=new WeakMap,xn=new WeakMap,Fu),Ia=new Qh,Gh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rr,qr,$u,Yh=($u=class{constructor(){ne(this,rr,Gh);ne(this,qr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,qr)&&e!==E(this,rr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,rr),provider:e}),K(this,rr,e),process.env.NODE_ENV!=="production"&&K(this,qr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&K(this,qr,!0),E(this,rr).setTimeout(e,t)}clearTimeout(e){E(this,rr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,qr,!0),E(this,rr).setInterval(e,t)}clearInterval(e){E(this,rr).clearInterval(e)}},rr=new WeakMap,qr=new WeakMap,$u),Br=new Yh;function Xh(e){setTimeout(e,0)}var Zh=typeof window>"u"||"Deno"in globalThis;function _t(){}function Jh(e,t){return typeof e=="function"?e(t):e}function Fo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jr(e,t){return typeof e=="function"?e(t):e}function It(e,t){return typeof e=="function"?e(t):e}function ml(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Na(o,t.options))return!1}else if(!ps(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 yl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(hs(t.options.mutationKey)!==hs(i))return!1}else if(!ps(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Na(e,t){return((t==null?void 0:t.queryKeyHashFn)||hs)(e)}function hs(e){return JSON.stringify(e,(t,r)=>Vo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ps(e[r],t[r])):!1}var ep=Object.prototype.hasOwnProperty;function $o(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=vl(e)&&vl(t);if(!n&&!(Vo(e)&&Vo(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 u=0;for(let d=0;d<a;d++){const f=n?d:o[d],m=e[f],g=t[f];if(m===g){c[f]=m,(n?d<i:ep.call(e,f))&&u++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){c[f]=g;continue}const b=$o(m,g,r+1);c[f]=b,b===m&&u++}return i===a&&u===i?e:c}function Bo(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 vl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vo(e){if(!bl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!bl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bl(e){return Object.prototype.toString.call(e)==="[object Object]"}function tp(e){return new Promise(t=>{Br.setTimeout(t,e)})}function Uo(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 $o(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 $o(e,t)}return t}function rp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function np(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var vi=Symbol();function Gu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===vi&&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===vi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Yu(e,t){return typeof e=="function"?e(...t):!!e}function sp(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 gs=(()=>{let e=()=>Zh;return{isServer(){return e()},setIsServer(t){e=t}}})();function zo(){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 ip=Xh;function op(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=ip;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 Je=op(),Sn,Or,Cn,Bu,ap=(Bu=class extends Ds{constructor(){super();ne(this,Sn,!0);ne(this,Or);ne(this,Cn);K(this,Cn,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,Or)||this.setEventListener(E(this,Cn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Or))==null||t.call(this),K(this,Or,void 0))}setEventListener(t){var r;K(this,Cn,t),(r=E(this,Or))==null||r.call(this),K(this,Or,t(this.setOnline.bind(this)))}setOnline(t){E(this,Sn)!==t&&(K(this,Sn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Sn)}},Sn=new WeakMap,Or=new WeakMap,Cn=new WeakMap,Bu),bi=new ap;function lp(e){return Math.min(1e3*2**e,3e4)}function Xu(e){return(e??"online")==="online"?bi.isOnline():!0}var qo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Zu(e){let t=!1,r=0,n;const s=zo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new qo(h);m(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ia.isFocused()&&(e.networkMode==="always"||bi.isOnline())&&e.canRun(),d=()=>Xu(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},m=h=>{i()||(n==null||n(),s.reject(h))},g=()=>new Promise(h=>{var y;n=v=>{(i()||u())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(f).catch(v=>{var O;if(i())return;const _=e.retry??(gs.isServer()?0:3),x=e.retryDelay??lp,w=typeof x=="function"?x(r,v):x,S=_===!0||typeof _=="number"&&r<_||typeof _=="function"&&_(r,v);if(t||!S){m(v);return}r++,(O=e.onFail)==null||O.call(e,r,v),tp(w).then(()=>u()?void 0:g()).then(()=>{t?m(v):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?b():g().then(b),s)}}var Hr,Vu,Ju=(Vu=class{constructor(){ne(this,Hr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fo(this.gcTime)&&K(this,Hr,Br.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Hr)!==void 0&&(Br.clearTimeout(E(this,Hr)),K(this,Hr,void 0))}},Hr=new WeakMap,Vu);function cp(e){return{onFetch:(t,r)=>{var d,f,m,g,b;const n=t.options,s=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let h=!1;const y=x=>{sp(x,()=>t.signal,()=>h=!0)},v=Gu(t.options,t.fetchOptions),_=async(x,w,S)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const N=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:w,direction:S?"backward":"forward",meta:t.options.meta};return y(M),M})(),j=await v(N),{maxPages:F}=t.options,k=S?np:rp;return{pages:k(x.pages,j,F),pageParams:k(x.pageParams,w,F)}};if(s&&i.length){const x=s==="backward",w=x?up:_l,S={pages:i,pageParams:o},O=w(n,S);a=await _(S,O,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:_l(n,a);if(c>0&&w==null)break;a=await _(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function _l(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 up(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 En,Wr,On,Lt,Kr,We,xs,Qr,Tt,ed,dr,Uu,dp=(Uu=class extends Ju{constructor(t){super();ne(this,Tt);ne(this,En);ne(this,Wr);ne(this,On);ne(this,Lt);ne(this,Kr);ne(this,We);ne(this,xs);ne(this,Qr);K(this,Qr,!1),K(this,xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,Kr,t.client),K(this,Lt,E(this,Kr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,Wr,xl(this.options)),this.state=t.state??E(this,Wr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,En)}get promise(){var t;return(t=E(this,We))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,xs),...t},t!=null&&t._type&&K(this,En,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=xl(this.options);r.data!==void 0&&(this.setState(wl(r.data,r.dataUpdatedAt)),K(this,Wr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Lt).remove(this)}setData(t,r){const n=Uo(this.state.data,t,this.options);return he(this,Tt,dr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){he(this,Tt,dr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,We))==null?void 0:n.promise;return(s=E(this,We))==null||s.cancel(t),r?r.then(_t).catch(_t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Wr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>It(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>jr(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:!Qu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,We))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,We))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,Lt).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,We)&&(E(this,Qr)||he(this,Tt,ed).call(this)?E(this,We).cancel({revert:!0}):E(this,We).cancelRetry()),this.scheduleGc()),E(this,Lt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Tt,dr).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,m,g,b,h,y,v,_,x;if(this.state.fetchStatus!=="idle"&&((u=E(this,We))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,We))return E(this,We).continueRetry(),E(this,We).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(S=>S.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:()=>(K(this,Qr,!0),n.signal)})},i=()=>{const w=Gu(this.options,r),O=(()=>{const N={client:E(this,Kr),queryKey:this.queryKey,meta:this.meta};return s(N),N})();return K(this,Qr,!1),this.options.persister?this.options.persister(w,O,this):w(O)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,Kr),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,En)==="infinite"?cp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),K(this,On,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&he(this,Tt,dr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),K(this,We,Zu({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof qo&&w.revert&&this.setState({...E(this,On),fetchStatus:"idle"}),n.abort()},onFail:(w,S)=>{he(this,Tt,dr).call(this,{type:"failed",failureCount:w,error:S})},onPause:()=>{he(this,Tt,dr).call(this,{type:"pause"})},onContinue:()=>{he(this,Tt,dr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,We).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=(m=E(this,Lt).config).onSuccess)==null||g.call(m,w,this),(h=(b=E(this,Lt).config).onSettled)==null||h.call(b,w,this.state.error,this),w}catch(w){if(w instanceof qo){if(w.silent)return E(this,We).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,Tt,dr).call(this,{type:"error",error:w}),(v=(y=E(this,Lt).config).onError)==null||v.call(y,w,this),(x=(_=E(this,Lt).config).onSettled)==null||x.call(_,this.state.data,w,this),w}finally{this.scheduleGc()}}},En=new WeakMap,Wr=new WeakMap,On=new WeakMap,Lt=new WeakMap,Kr=new WeakMap,We=new WeakMap,xs=new WeakMap,Qr=new WeakMap,Tt=new WeakSet,ed=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},dr=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,...td(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...wl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return K(this,On,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),Je.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Lt).notify({query:this,type:"updated",action:t})})},Uu);function td(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function xl(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 bt,pe,Ss,ft,Gr,Dn,fr,Dr,Cs,Tn,In,Yr,Xr,Tr,Nn,_e,ss,Ho,Wo,Ko,Qo,Go,Yo,Xo,rd,zu,fp=(zu=class extends Ds{constructor(t,r){super();ne(this,_e);ne(this,bt);ne(this,pe);ne(this,Ss);ne(this,ft);ne(this,Gr);ne(this,Dn);ne(this,fr);ne(this,Dr);ne(this,Cs);ne(this,Tn);ne(this,In);ne(this,Yr);ne(this,Xr);ne(this,Tr);ne(this,Nn,new Set);this.options=r,K(this,bt,t),K(this,Dr,null),K(this,fr,zo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,pe).addObserver(this),Sl(E(this,pe),this.options)?he(this,_e,ss).call(this):this.updateResult(),he(this,_e,Qo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zo(E(this,pe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zo(E(this,pe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,_e,Go).call(this),he(this,_e,Yo).call(this),E(this,pe).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,pe);if(this.options=E(this,bt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof It(this.options.enabled,E(this,pe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,_e,Xo).call(this),E(this,pe).setOptions(this.options),r._defaulted&&!Bo(this.options,r)&&E(this,bt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,pe),observer:this});const s=this.hasListeners();s&&Cl(E(this,pe),n,this.options,r)&&he(this,_e,ss).call(this),this.updateResult(),s&&(E(this,pe)!==n||It(this.options.enabled,E(this,pe))!==It(r.enabled,E(this,pe))||jr(this.options.staleTime,E(this,pe))!==jr(r.staleTime,E(this,pe)))&&he(this,_e,Ho).call(this);const i=he(this,_e,Wo).call(this);s&&(E(this,pe)!==n||It(this.options.enabled,E(this,pe))!==It(r.enabled,E(this,pe))||i!==E(this,Tr))&&he(this,_e,Ko).call(this,i)}getOptimisticResult(t){const r=E(this,bt).getQueryCache().build(E(this,bt),t),n=this.createResult(r,t);return pp(this,n)&&(K(this,ft,n),K(this,Dn,this.options),K(this,Gr,E(this,pe).state)),n}getCurrentResult(){return E(this,ft)}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,Nn).add(t)}getCurrentQuery(){return E(this,pe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,bt).defaultQueryOptions(t),n=E(this,bt).getQueryCache().build(E(this,bt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,_e,ss).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,ft)))}createResult(t,r){var F;const n=E(this,pe),s=this.options,i=E(this,ft),o=E(this,Gr),a=E(this,Dn),u=t!==n?t.state:E(this,Ss),{state:d}=t;let f={...d},m=!1,g;if(r._optimisticResults){const k=this.hasListeners(),M=!k&&Sl(t,r),q=k&&Cl(t,n,r,s);(M||q)&&(f={...f,...td(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:y}=f;g=f.data;let v=!1;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let k;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(k=i.data,v=!0):k=typeof r.placeholderData=="function"?r.placeholderData((F=E(this,In))==null?void 0:F.state.data,E(this,In)):r.placeholderData,k!==void 0&&(y="success",g=Uo(i==null?void 0:i.data,k,r),m=!0)}if(r.select&&g!==void 0&&!v)if(i&&g===(o==null?void 0:o.data)&&r.select===E(this,Cs))g=E(this,Tn);else try{K(this,Cs,r.select),g=r.select(g),g=Uo(i==null?void 0:i.data,g,r),K(this,Tn,g),K(this,Dr,null)}catch(k){K(this,Dr,k)}E(this,Dr)&&(b=E(this,Dr),g=E(this,Tn),h=Date.now(),y="error");const _=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",S=x&&_,O=g!==void 0,j={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:S,isLoading:S,data:g,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!x,isLoadingError:w&&!O,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:w&&O,isStale:Ra(t,r),refetch:this.refetch,promise:E(this,fr),isEnabled:It(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=j.data!==void 0,M=j.status==="error"&&!k,q=L=>{M?L.reject(j.error):k&&L.resolve(j.data)},R=()=>{const L=K(this,fr,j.promise=zo());q(L)},P=E(this,fr);switch(P.status){case"pending":t.queryHash===n.queryHash&&q(P);break;case"fulfilled":(M||j.data!==P.value)&&R();break;case"rejected":(!M||j.error!==P.reason)&&R();break}}return j}updateResult(){const t=E(this,ft),r=this.createResult(E(this,pe),this.options);if(K(this,Gr,E(this,pe).state),K(this,Dn,this.options),E(this,Gr).data!==void 0&&K(this,In,E(this,pe)),Bo(r,t))return;K(this,ft,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,Nn).size)return!0;const o=new Set(i??E(this,Nn));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,ft)).some(a=>{const c=a;return E(this,ft)[c]!==t[c]&&o.has(c)})};he(this,_e,rd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,_e,Qo).call(this)}},bt=new WeakMap,pe=new WeakMap,Ss=new WeakMap,ft=new WeakMap,Gr=new WeakMap,Dn=new WeakMap,fr=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,Tn=new WeakMap,In=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Tr=new WeakMap,Nn=new WeakMap,_e=new WeakSet,ss=function(t){he(this,_e,Xo).call(this);let r=E(this,pe).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(_t)),r},Ho=function(){he(this,_e,Go).call(this);const t=jr(this.options.staleTime,E(this,pe));if(gs.isServer()||E(this,ft).isStale||!Fo(t))return;const n=Qu(E(this,ft).dataUpdatedAt,t)+1;K(this,Yr,Br.setTimeout(()=>{E(this,ft).isStale||this.updateResult()},n))},Wo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,pe)):this.options.refetchInterval)??!1},Ko=function(t){he(this,_e,Yo).call(this),K(this,Tr,t),!(gs.isServer()||It(this.options.enabled,E(this,pe))===!1||!Fo(E(this,Tr))||E(this,Tr)===0)&&K(this,Xr,Br.setInterval(()=>{(this.options.refetchIntervalInBackground||Ia.isFocused())&&he(this,_e,ss).call(this)},E(this,Tr)))},Qo=function(){he(this,_e,Ho).call(this),he(this,_e,Ko).call(this,he(this,_e,Wo).call(this))},Go=function(){E(this,Yr)!==void 0&&(Br.clearTimeout(E(this,Yr)),K(this,Yr,void 0))},Yo=function(){E(this,Xr)!==void 0&&(Br.clearInterval(E(this,Xr)),K(this,Xr,void 0))},Xo=function(){const t=E(this,bt).getQueryCache().build(E(this,bt),this.options);if(t===E(this,pe))return;const r=E(this,pe);K(this,pe,t),K(this,Ss,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},rd=function(t){Je.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,ft))}),E(this,bt).getQueryCache().notify({query:E(this,pe),type:"observerResultsUpdated"})})},zu);function hp(e,t){return It(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&It(t.retryOnMount,e)===!1)}function Sl(e,t){return hp(e,t)||e.state.data!==void 0&&Zo(e,t,t.refetchOnMount)}function Zo(e,t,r){if(It(t.enabled,e)!==!1&&jr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ra(e,t)}return!1}function Cl(e,t,r,n){return(e!==t||It(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ra(e,r)}function Ra(e,t){return It(t.enabled,e)!==!1&&e.isStaleByTime(jr(t.staleTime,e))}function pp(e,t){return!Bo(e.getCurrentResult(),t)}var Es,nr,at,Zr,sr,_r,qu,gp=(qu=class extends Ju{constructor(t){super();ne(this,sr);ne(this,Es);ne(this,nr);ne(this,at);ne(this,Zr);K(this,Es,t.client),this.mutationId=t.mutationId,K(this,at,t.mutationCache),K(this,nr,[]),this.state=t.state||mp(),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,nr).includes(t)||(E(this,nr).push(t),this.clearGcTimeout(),E(this,at).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,nr,E(this,nr).filter(r=>r!==t)),this.scheduleGc(),E(this,at).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,nr).length||(this.state.status==="pending"?this.scheduleGc():E(this,at).remove(this))}continue(){var t;return((t=E(this,Zr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,f,m,g,b,h,y,v,_,x,w,S,O,N;const r=()=>{he(this,sr,_r).call(this,{type:"continue"})},n={client:E(this,Es),meta:this.options.meta,mutationKey:this.options.mutationKey};K(this,Zr,Zu({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(j,F)=>{he(this,sr,_r).call(this,{type:"failed",failureCount:j,error:F})},onPause:()=>{he(this,sr,_r).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,at).canRun(this)}));const s=this.state.status==="pending",i=!E(this,Zr).canStart();try{if(s)r();else{he(this,sr,_r).call(this,{type:"pending",variables:t,isPaused:i}),E(this,at).config.onMutate&&await E(this,at).config.onMutate(t,this,n);const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));F!==this.state.context&&he(this,sr,_r).call(this,{type:"pending",context:F,variables:t,isPaused:i})}const j=await E(this,Zr).start();return await((u=(c=E(this,at).config).onSuccess)==null?void 0:u.call(c,j,t,this.state.context,this,n)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,t,this.state.context,n)),await((g=(m=E(this,at).config).onSettled)==null?void 0:g.call(m,j,null,this.state.variables,this.state.context,this,n)),await((h=(b=this.options).onSettled)==null?void 0:h.call(b,j,null,t,this.state.context,n)),he(this,sr,_r).call(this,{type:"success",data:j}),j}catch(j){try{await((v=(y=E(this,at).config).onError)==null?void 0:v.call(y,j,t,this.state.context,this,n))}catch(F){Promise.reject(F)}try{await((x=(_=this.options).onError)==null?void 0:x.call(_,j,t,this.state.context,n))}catch(F){Promise.reject(F)}try{await((S=(w=E(this,at).config).onSettled)==null?void 0:S.call(w,void 0,j,this.state.variables,this.state.context,this,n))}catch(F){Promise.reject(F)}try{await((N=(O=this.options).onSettled)==null?void 0:N.call(O,void 0,j,t,this.state.context,n))}catch(F){Promise.reject(F)}throw he(this,sr,_r).call(this,{type:"error",error:j}),j}finally{E(this,at).runNext(this)}}},Es=new WeakMap,nr=new WeakMap,at=new WeakMap,Zr=new WeakMap,sr=new WeakSet,_r=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),Je.batch(()=>{E(this,nr).forEach(n=>{n.onMutationUpdate(t)}),E(this,at).notify({mutation:this,type:"updated",action:t})})},qu);function mp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hr,Ht,Os,Hu,yp=(Hu=class extends Ds{constructor(t={}){super();ne(this,hr);ne(this,Ht);ne(this,Os);this.config=t,K(this,hr,new Set),K(this,Ht,new Map),K(this,Os,0)}build(t,r,n){const s=new gp({client:t,mutationCache:this,mutationId:++zs(this,Os)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,hr).add(t);const r=qs(t);if(typeof r=="string"){const n=E(this,Ht).get(r);n?n.push(t):E(this,Ht).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hr).delete(t)){const r=qs(t);if(typeof r=="string"){const n=E(this,Ht).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,Ht).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=qs(t);if(typeof r=="string"){const n=E(this,Ht).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=qs(t);if(typeof r=="string"){const s=(n=E(this,Ht).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(){Je.batch(()=>{E(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hr).clear(),E(this,Ht).clear()})}getAll(){return Array.from(E(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>yl(r,n))}findAll(t={}){return this.getAll().filter(r=>yl(t,r))}notify(t){Je.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Je.batch(()=>Promise.all(t.map(r=>r.continue().catch(_t))))}},hr=new WeakMap,Ht=new WeakMap,Os=new WeakMap,Hu);function qs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ir,Wu,vp=(Wu=class extends Ds{constructor(t={}){super();ne(this,ir);this.config=t,K(this,ir,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Na(s,r);let o=this.get(i);return o||(o=new dp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ir).has(t.queryHash)||(E(this,ir).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ir).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ir).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ir).get(t)}getAll(){return[...E(this,ir).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>ml(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>ml(t,n)):r}notify(t){Je.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Je.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Je.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ir=new WeakMap,Wu),Me,Ir,Nr,Rn,jn,Rr,kn,An,Ku,bp=(Ku=class{constructor(e={}){ne(this,Me);ne(this,Ir);ne(this,Nr);ne(this,Rn);ne(this,jn);ne(this,Rr);ne(this,kn);ne(this,An);K(this,Me,e.queryCache||new vp),K(this,Ir,e.mutationCache||new yp),K(this,Nr,e.defaultOptions||{}),K(this,Rn,new Map),K(this,jn,new Map),K(this,Rr,0)}mount(){zs(this,Rr)._++,E(this,Rr)===1&&(K(this,kn,Ia.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Me).onFocus())})),K(this,An,bi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Me).onOnline())})))}unmount(){var e,t;zs(this,Rr)._--,E(this,Rr)===0&&((e=E(this,kn))==null||e.call(this),K(this,kn,void 0),(t=E(this,An))==null||t.call(this),K(this,An,void 0))}isFetching(e){return E(this,Me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Ir).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,Me).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,Me).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(jr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,Me).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,Me).get(n.queryHash),i=s==null?void 0:s.state.data,o=Jh(t,i);if(o!==void 0)return E(this,Me).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return Je.batch(()=>E(this,Me).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,Me).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,Me);Je.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,Me);return Je.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Je.batch(()=>E(this,Me).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(_t).catch(_t)}invalidateQueries(e,t={}){return Je.batch(()=>(E(this,Me).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=Je.batch(()=>E(this,Me).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(_t)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(_t)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,Me).build(this,t);return r.isStaleByTime(jr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return bi.isOnline()?E(this,Ir).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Me)}getMutationCache(){return E(this,Ir)}getDefaultOptions(){return E(this,Nr)}setDefaultOptions(e){K(this,Nr,e)}setQueryDefaults(e,t){E(this,Rn).set(hs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Rn).values()],r={};return t.forEach(n=>{ps(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,jn).set(hs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,jn).values()],r={};return t.forEach(n=>{ps(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Nr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Na(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===vi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Nr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Me).clear(),E(this,Ir).clear()}},Me=new WeakMap,Ir=new WeakMap,Nr=new WeakMap,Rn=new WeakMap,jn=new WeakMap,Rr=new WeakMap,kn=new WeakMap,An=new WeakMap,Ku),nd=be.createContext(void 0),_p=e=>{const t=be.useContext(nd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},wp=({client:e,children:t})=>(be.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(nd.Provider,{value:e,children:t})),sd=be.createContext(!1),xp=()=>be.useContext(sd);sd.Provider;function Sp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cp=be.createContext(Sp()),Ep=()=>be.useContext(Cp),Op=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Yu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Dp=e=>{be.useEffect(()=>{e.clearReset()},[e])},Tp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Yu(r,[e.error,n])),Ip=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))}},Np=(e,t)=>e.isLoading&&e.isFetching&&!t,Rp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,El=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function jp(e,t,r){var g,b,h,y;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=xp(),s=Ep(),i=_p(),o=i.defaultQueryOptions(e);(b=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||b.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,Ip(o),Op(o,s,a),Dp(s);const u=!i.getQueryCache().get(o.queryHash),[d]=be.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),m=!n&&c;if(be.useSyncExternalStore(be.useCallback(v=>{const _=m?d.subscribe(Je.batchCalls(v)):_t;return d.updateResult(),_},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),be.useEffect(()=>{d.setOptions(o)},[o,d]),Rp(o,f))throw El(o,d,s);if(Tp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!gs.isServer()&&Np(f,n)){const v=u?El(o,d,s):a==null?void 0:a.promise;v==null||v.catch(_t).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Ol(e,t){return jp(e,fp)}let kp={data:""},Ap=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||kp},Pp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Mp=/\/\*[^]*?\*\/| +/g,Dl=/\n+/g,Cr=(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"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(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+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},yr={},id=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+id(e[r]);return t}return e},Lp=(e,t,r,n,s)=>{let i=id(e),o=yr[i]||(yr[i]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(i));if(!yr[o]){let c=i!==e?e:(u=>{let d,f,m=[{}];for(;d=Pp.exec(u.replace(Mp,""));)d[4]?m.shift():d[3]?(f=d[3].replace(Dl," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][d[1]]=d[2].replace(Dl," ").trim();return m[0]})(e);yr[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&yr.g;return r&&(yr.g=yr[o]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(yr[o],t,n,a),o},Fp=(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?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Pi(e){let t=this||{},r=e.call?e(t.p):e;return Lp(r.unshift?r.raw?Fp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Ap(t.target),t.g,t.o,t.k)}let od,Jo,ea;Pi.bind({g:1});let pr=Pi.bind({k:1});function $p(e,t,r,n){Cr.p=t,od=e,Jo=r,ea=n}function Ar(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:Jo&&Jo()},a),r.o=/go\d/.test(c),a.className=Pi.apply(r,n)+(c?" "+c:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),ea&&u[0]&&ea(a),od(u,a)}return s}}var Bp=e=>typeof e=="function",_i=(e,t)=>Bp(e)?e(t):e,Vp=(()=>{let e=0;return()=>(++e).toString()})(),ad=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Up=20,ja="default",ld=(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 ld(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}))}}},ri=[],cd={toasts:[],pausedAt:void 0,settings:{toastLimit:Up}},or={},ud=(e,t=ja)=>{or[t]=ld(or[t]||cd,e),ri.forEach(([r,n])=>{r===t&&n(or[t])})},dd=e=>Object.keys(or).forEach(t=>ud(e,t)),zp=e=>Object.keys(or).find(t=>or[t].toasts.some(r=>r.id===e)),Mi=(e=ja)=>t=>{ud(t,e)},qp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Hp=(e={},t=ja)=>{let[r,n]=p.useState(or[t]||cd),s=p.useRef(or[t]);p.useEffect(()=>(s.current!==or[t]&&n(or[t]),ri.push([t,n]),()=>{let o=ri.findIndex(([a])=>a===t);o>-1&&ri.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,u;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,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...r,toasts:i}},Wp=(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)||Vp()}),Ts=e=>(t,r)=>{let n=Wp(t,e,r);return Mi(n.toasterId||zp(n.id))({type:2,toast:n}),n.id},Le=(e,t)=>Ts("blank")(e,t);Le.error=Ts("error");Le.success=Ts("success");Le.loading=Ts("loading");Le.custom=Ts("custom");Le.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Mi(t)(r):dd(r)};Le.dismissAll=e=>Le.dismiss(void 0,e);Le.remove=(e,t)=>{let r={type:4,toastId:e};t?Mi(t)(r):dd(r)};Le.removeAll=e=>Le.remove(void 0,e);Le.promise=(e,t,r)=>{let n=Le.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?_i(t.success,s):void 0;return i?Le.success(i,{id:n,...r,...r==null?void 0:r.success}):Le.dismiss(n),s}).catch(s=>{let i=t.error?_i(t.error,s):void 0;i?Le.error(i,{id:n,...r,...r==null?void 0:r.error}):Le.dismiss(n)}),e};var Kp=1e3,Qp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Hp(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,m=Kp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},m);s.set(f,g)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),m=r.map(g=>{if(g.duration===1/0)return;let b=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(b<0){g.visible&&Le.dismiss(g.id);return}return setTimeout(()=>Le.dismiss(g.id,t),b)});return()=>{m.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=p.useCallback(Mi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,m)=>{o({type:1,toast:{id:f,height:m}})},[o]),u=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=p.useCallback((f,m)=>{let{reverseOrder:g=!1,gutter:b=8,defaultPosition:h}=m||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),_=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...g?[_+1]:[0,_]).reduce((x,w)=>x+(w.height||0)+b,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:u,calculateOffset:d}}},Gp=pr`
|
|
1
|
+
"use strict";var gl=e=>{throw TypeError(e)};var io=(e,t,r)=>t.has(e)||gl("Cannot "+r);var O=(e,t,r)=>(io(e,t,"read from private field"),r?r.call(e):t.get(e)),re=(e,t,r)=>t.has(e)?gl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Q=(e,t,r,n)=>(io(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),he=(e,t,r)=>(io(e,t,"access private method"),r);var zs=(e,t,r,n)=>({set _(s){Q(e,t,s,r)},get _(){return O(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),$r=require("react-dom"),l=require("react/jsx-runtime");function Kh(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 _e=Kh(g);var Ds=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(){}},zr,Er,xn,Fu,Qh=(Fu=class extends Ds{constructor(){super();re(this,zr);re(this,Er);re(this,xn);Q(this,xn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Er)||this.setEventListener(O(this,xn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Er))==null||t.call(this),Q(this,Er,void 0))}setEventListener(t){var r;Q(this,xn,t),(r=O(this,Er))==null||r.call(this),Q(this,Er,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,zr)!==t&&(Q(this,zr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,zr)=="boolean"?O(this,zr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zr=new WeakMap,Er=new WeakMap,xn=new WeakMap,Fu),Ta=new Qh,Gh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rr,qr,$u,Yh=($u=class{constructor(){re(this,rr,Gh);re(this,qr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,qr)&&e!==O(this,rr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,rr),provider:e}),Q(this,rr,e),process.env.NODE_ENV!=="production"&&Q(this,qr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Q(this,qr,!0),O(this,rr).setTimeout(e,t)}clearTimeout(e){O(this,rr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Q(this,qr,!0),O(this,rr).setInterval(e,t)}clearInterval(e){O(this,rr).clearInterval(e)}},rr=new WeakMap,qr=new WeakMap,$u),Br=new Yh;function Xh(e){setTimeout(e,0)}var Zh=typeof window>"u"||"Deno"in globalThis;function _t(){}function Jh(e,t){return typeof e=="function"?e(t):e}function Fo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jr(e,t){return typeof e=="function"?e(t):e}function Tt(e,t){return typeof e=="function"?e(t):e}function ml(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Na(o,t.options))return!1}else if(!ps(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 yl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(hs(t.options.mutationKey)!==hs(i))return!1}else if(!ps(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Na(e,t){return((t==null?void 0:t.queryKeyHashFn)||hs)(e)}function hs(e){return JSON.stringify(e,(t,r)=>Vo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ps(e[r],t[r])):!1}var ep=Object.prototype.hasOwnProperty;function $o(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=vl(e)&&vl(t);if(!n&&!(Vo(e)&&Vo(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 u=0;for(let d=0;d<a;d++){const f=n?d:o[d],p=e[f],m=t[f];if(p===m){c[f]=p,(n?d<i:ep.call(e,f))&&u++;continue}if(p===null||m===null||typeof p!="object"||typeof m!="object"){c[f]=m;continue}const _=$o(p,m,r+1);c[f]=_,_===p&&u++}return i===a&&u===i?e:c}function Bo(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 vl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vo(e){if(!bl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!bl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bl(e){return Object.prototype.toString.call(e)==="[object Object]"}function tp(e){return new Promise(t=>{Br.setTimeout(t,e)})}function Uo(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 $o(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 $o(e,t)}return t}function rp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function np(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var vi=Symbol();function Gu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===vi&&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===vi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Yu(e,t){return typeof e=="function"?e(...t):!!e}function sp(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 gs=(()=>{let e=()=>Zh;return{isServer(){return e()},setIsServer(t){e=t}}})();function zo(){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 ip=Xh;function op(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=ip;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 et=op(),Sn,Or,Cn,Bu,ap=(Bu=class extends Ds{constructor(){super();re(this,Sn,!0);re(this,Or);re(this,Cn);Q(this,Cn,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(){O(this,Or)||this.setEventListener(O(this,Cn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Or))==null||t.call(this),Q(this,Or,void 0))}setEventListener(t){var r;Q(this,Cn,t),(r=O(this,Or))==null||r.call(this),Q(this,Or,t(this.setOnline.bind(this)))}setOnline(t){O(this,Sn)!==t&&(Q(this,Sn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Sn)}},Sn=new WeakMap,Or=new WeakMap,Cn=new WeakMap,Bu),bi=new ap;function lp(e){return Math.min(1e3*2**e,3e4)}function Xu(e){return(e??"online")==="online"?bi.isOnline():!0}var qo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Zu(e){let t=!1,r=0,n;const s=zo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new qo(h);p(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ta.isFocused()&&(e.networkMode==="always"||bi.isOnline())&&e.canRun(),d=()=>Xu(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},p=h=>{i()||(n==null||n(),s.reject(h))},m=()=>new Promise(h=>{var y;n=v=>{(i()||u())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(f).catch(v=>{var E;if(i())return;const b=e.retry??(gs.isServer()?0:3),x=e.retryDelay??lp,w=typeof x=="function"?x(r,v):x,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!C){p(v);return}r++,(E=e.onFail)==null||E.call(e,r,v),tp(w).then(()=>u()?void 0:m()).then(()=>{t?p(v):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?_():m().then(_),s)}}var Hr,Vu,Ju=(Vu=class{constructor(){re(this,Hr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fo(this.gcTime)&&Q(this,Hr,Br.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,Hr)!==void 0&&(Br.clearTimeout(O(this,Hr)),Q(this,Hr,void 0))}},Hr=new WeakMap,Vu);function cp(e){return{onFetch:(t,r)=>{var d,f,p,m,_;const n=t.options,s=(p=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let h=!1;const y=x=>{sp(x,()=>t.signal,()=>h=!0)},v=Gu(t.options,t.fetchOptions),b=async(x,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const N=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(P),P})(),j=await v(N),{maxPages:F}=t.options,k=C?np:rp;return{pages:k(x.pages,j,F),pageParams:k(x.pageParams,w,F)}};if(s&&i.length){const x=s==="backward",w=x?up:_l,C={pages:i,pageParams:o},E=w(n,C);a=await b(C,E,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:_l(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function _l(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 up(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 En,Wr,On,Lt,Kr,Ke,xs,Qr,It,ed,dr,Uu,dp=(Uu=class extends Ju{constructor(t){super();re(this,It);re(this,En);re(this,Wr);re(this,On);re(this,Lt);re(this,Kr);re(this,Ke);re(this,xs);re(this,Qr);Q(this,Qr,!1),Q(this,xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,Kr,t.client),Q(this,Lt,O(this,Kr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,Wr,xl(this.options)),this.state=t.state??O(this,Wr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,En)}get promise(){var t;return(t=O(this,Ke))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,xs),...t},t!=null&&t._type&&Q(this,En,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=xl(this.options);r.data!==void 0&&(this.setState(wl(r.data,r.dataUpdatedAt)),Q(this,Wr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Lt).remove(this)}setData(t,r){const n=Uo(this.state.data,t,this.options);return he(this,It,dr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){he(this,It,dr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,Ke))==null?void 0:n.promise;return(s=O(this,Ke))==null||s.cancel(t),r?r.then(_t).catch(_t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,Wr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Tt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>jr(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:!Qu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ke))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ke))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Lt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(O(this,Ke)&&(O(this,Qr)||he(this,It,ed).call(this)?O(this,Ke).cancel({revert:!0}):O(this,Ke).cancelRetry()),this.scheduleGc()),O(this,Lt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,It,dr).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,p,m,_,h,y,v,b,x;if(this.state.fetchStatus!=="idle"&&((u=O(this,Ke))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ke))return O(this,Ke).continueRetry(),O(this,Ke).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.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:()=>(Q(this,Qr,!0),n.signal)})},i=()=>{const w=Gu(this.options,r),E=(()=>{const N={client:O(this,Kr),queryKey:this.queryKey,meta:this.meta};return s(N),N})();return Q(this,Qr,!1),this.options.persister?this.options.persister(w,E,this):w(E)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,Kr),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,En)==="infinite"?cp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Q(this,On,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&he(this,It,dr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Q(this,Ke,Zu({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof qo&&w.revert&&this.setState({...O(this,On),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{he(this,It,dr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{he(this,It,dr).call(this,{type:"pause"})},onContinue:()=>{he(this,It,dr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,Ke).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),(m=(p=O(this,Lt).config).onSuccess)==null||m.call(p,w,this),(h=(_=O(this,Lt).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof qo){if(w.silent)return O(this,Ke).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,It,dr).call(this,{type:"error",error:w}),(v=(y=O(this,Lt).config).onError)==null||v.call(y,w,this),(x=(b=O(this,Lt).config).onSettled)==null||x.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},En=new WeakMap,Wr=new WeakMap,On=new WeakMap,Lt=new WeakMap,Kr=new WeakMap,Ke=new WeakMap,xs=new WeakMap,Qr=new WeakMap,It=new WeakSet,ed=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},dr=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,...td(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...wl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,On,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),et.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,Lt).notify({query:this,type:"updated",action:t})})},Uu);function td(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function xl(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 bt,ge,Ss,ht,Gr,Dn,fr,Dr,Cs,In,Tn,Yr,Xr,Ir,Nn,we,ss,Ho,Wo,Ko,Qo,Go,Yo,Xo,rd,zu,fp=(zu=class extends Ds{constructor(t,r){super();re(this,we);re(this,bt);re(this,ge);re(this,Ss);re(this,ht);re(this,Gr);re(this,Dn);re(this,fr);re(this,Dr);re(this,Cs);re(this,In);re(this,Tn);re(this,Yr);re(this,Xr);re(this,Ir);re(this,Nn,new Set);this.options=r,Q(this,bt,t),Q(this,Dr,null),Q(this,fr,zo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ge).addObserver(this),Sl(O(this,ge),this.options)?he(this,we,ss).call(this):this.updateResult(),he(this,we,Qo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zo(O(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zo(O(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,we,Go).call(this),he(this,we,Yo).call(this),O(this,ge).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,ge);if(this.options=O(this,bt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tt(this.options.enabled,O(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,we,Xo).call(this),O(this,ge).setOptions(this.options),r._defaulted&&!Bo(this.options,r)&&O(this,bt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ge),observer:this});const s=this.hasListeners();s&&Cl(O(this,ge),n,this.options,r)&&he(this,we,ss).call(this),this.updateResult(),s&&(O(this,ge)!==n||Tt(this.options.enabled,O(this,ge))!==Tt(r.enabled,O(this,ge))||jr(this.options.staleTime,O(this,ge))!==jr(r.staleTime,O(this,ge)))&&he(this,we,Ho).call(this);const i=he(this,we,Wo).call(this);s&&(O(this,ge)!==n||Tt(this.options.enabled,O(this,ge))!==Tt(r.enabled,O(this,ge))||i!==O(this,Ir))&&he(this,we,Ko).call(this,i)}getOptimisticResult(t){const r=O(this,bt).getQueryCache().build(O(this,bt),t),n=this.createResult(r,t);return pp(this,n)&&(Q(this,ht,n),Q(this,Dn,this.options),Q(this,Gr,O(this,ge).state)),n}getCurrentResult(){return O(this,ht)}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&&O(this,fr).status==="pending"&&O(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,Nn).add(t)}getCurrentQuery(){return O(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,bt).defaultQueryOptions(t),n=O(this,bt).getQueryCache().build(O(this,bt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,we,ss).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,ht)))}createResult(t,r){var F;const n=O(this,ge),s=this.options,i=O(this,ht),o=O(this,Gr),a=O(this,Dn),u=t!==n?t.state:O(this,Ss),{state:d}=t;let f={...d},p=!1,m;if(r._optimisticResults){const k=this.hasListeners(),P=!k&&Sl(t,r),V=k&&Cl(t,n,r,s);(P||V)&&(f={...f,...td(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;m=f.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&y==="pending"){let k;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(k=i.data,v=!0):k=typeof r.placeholderData=="function"?r.placeholderData((F=O(this,Tn))==null?void 0:F.state.data,O(this,Tn)):r.placeholderData,k!==void 0&&(y="success",m=Uo(i==null?void 0:i.data,k,r),p=!0)}if(r.select&&m!==void 0&&!v)if(i&&m===(o==null?void 0:o.data)&&r.select===O(this,Cs))m=O(this,In);else try{Q(this,Cs,r.select),m=r.select(m),m=Uo(i==null?void 0:i.data,m,r),Q(this,In,m),Q(this,Dr,null)}catch(k){Q(this,Dr,k)}O(this,Dr)&&(_=O(this,Dr),m=O(this,In),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",C=x&&b,E=m!==void 0,j={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:w&&!E,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:w&&E,isStale:Ra(t,r),refetch:this.refetch,promise:O(this,fr),isEnabled:Tt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=j.data!==void 0,P=j.status==="error"&&!k,V=L=>{P?L.reject(j.error):k&&L.resolve(j.data)},R=()=>{const L=Q(this,fr,j.promise=zo());V(L)},M=O(this,fr);switch(M.status){case"pending":t.queryHash===n.queryHash&&V(M);break;case"fulfilled":(P||j.data!==M.value)&&R();break;case"rejected":(!P||j.error!==M.reason)&&R();break}}return j}updateResult(){const t=O(this,ht),r=this.createResult(O(this,ge),this.options);if(Q(this,Gr,O(this,ge).state),Q(this,Dn,this.options),O(this,Gr).data!==void 0&&Q(this,Tn,O(this,ge)),Bo(r,t))return;Q(this,ht,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,Nn).size)return!0;const o=new Set(i??O(this,Nn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,ht)).some(a=>{const c=a;return O(this,ht)[c]!==t[c]&&o.has(c)})};he(this,we,rd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,we,Qo).call(this)}},bt=new WeakMap,ge=new WeakMap,Ss=new WeakMap,ht=new WeakMap,Gr=new WeakMap,Dn=new WeakMap,fr=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,In=new WeakMap,Tn=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Ir=new WeakMap,Nn=new WeakMap,we=new WeakSet,ss=function(t){he(this,we,Xo).call(this);let r=O(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(_t)),r},Ho=function(){he(this,we,Go).call(this);const t=jr(this.options.staleTime,O(this,ge));if(gs.isServer()||O(this,ht).isStale||!Fo(t))return;const n=Qu(O(this,ht).dataUpdatedAt,t)+1;Q(this,Yr,Br.setTimeout(()=>{O(this,ht).isStale||this.updateResult()},n))},Wo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ge)):this.options.refetchInterval)??!1},Ko=function(t){he(this,we,Yo).call(this),Q(this,Ir,t),!(gs.isServer()||Tt(this.options.enabled,O(this,ge))===!1||!Fo(O(this,Ir))||O(this,Ir)===0)&&Q(this,Xr,Br.setInterval(()=>{(this.options.refetchIntervalInBackground||Ta.isFocused())&&he(this,we,ss).call(this)},O(this,Ir)))},Qo=function(){he(this,we,Ho).call(this),he(this,we,Ko).call(this,he(this,we,Wo).call(this))},Go=function(){O(this,Yr)!==void 0&&(Br.clearTimeout(O(this,Yr)),Q(this,Yr,void 0))},Yo=function(){O(this,Xr)!==void 0&&(Br.clearInterval(O(this,Xr)),Q(this,Xr,void 0))},Xo=function(){const t=O(this,bt).getQueryCache().build(O(this,bt),this.options);if(t===O(this,ge))return;const r=O(this,ge);Q(this,ge,t),Q(this,Ss,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},rd=function(t){et.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,ht))}),O(this,bt).getQueryCache().notify({query:O(this,ge),type:"observerResultsUpdated"})})},zu);function hp(e,t){return Tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Tt(t.retryOnMount,e)===!1)}function Sl(e,t){return hp(e,t)||e.state.data!==void 0&&Zo(e,t,t.refetchOnMount)}function Zo(e,t,r){if(Tt(t.enabled,e)!==!1&&jr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ra(e,t)}return!1}function Cl(e,t,r,n){return(e!==t||Tt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ra(e,r)}function Ra(e,t){return Tt(t.enabled,e)!==!1&&e.isStaleByTime(jr(t.staleTime,e))}function pp(e,t){return!Bo(e.getCurrentResult(),t)}var Es,nr,lt,Zr,sr,_r,qu,gp=(qu=class extends Ju{constructor(t){super();re(this,sr);re(this,Es);re(this,nr);re(this,lt);re(this,Zr);Q(this,Es,t.client),this.mutationId=t.mutationId,Q(this,lt,t.mutationCache),Q(this,nr,[]),this.state=t.state||mp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,nr).includes(t)||(O(this,nr).push(t),this.clearGcTimeout(),O(this,lt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,nr,O(this,nr).filter(r=>r!==t)),this.scheduleGc(),O(this,lt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,nr).length||(this.state.status==="pending"?this.scheduleGc():O(this,lt).remove(this))}continue(){var t;return((t=O(this,Zr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,f,p,m,_,h,y,v,b,x,w,C,E,N;const r=()=>{he(this,sr,_r).call(this,{type:"continue"})},n={client:O(this,Es),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,Zr,Zu({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(j,F)=>{he(this,sr,_r).call(this,{type:"failed",failureCount:j,error:F})},onPause:()=>{he(this,sr,_r).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,lt).canRun(this)}));const s=this.state.status==="pending",i=!O(this,Zr).canStart();try{if(s)r();else{he(this,sr,_r).call(this,{type:"pending",variables:t,isPaused:i}),O(this,lt).config.onMutate&&await O(this,lt).config.onMutate(t,this,n);const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));F!==this.state.context&&he(this,sr,_r).call(this,{type:"pending",context:F,variables:t,isPaused:i})}const j=await O(this,Zr).start();return await((u=(c=O(this,lt).config).onSuccess)==null?void 0:u.call(c,j,t,this.state.context,this,n)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,t,this.state.context,n)),await((m=(p=O(this,lt).config).onSettled)==null?void 0:m.call(p,j,null,this.state.variables,this.state.context,this,n)),await((h=(_=this.options).onSettled)==null?void 0:h.call(_,j,null,t,this.state.context,n)),he(this,sr,_r).call(this,{type:"success",data:j}),j}catch(j){try{await((v=(y=O(this,lt).config).onError)==null?void 0:v.call(y,j,t,this.state.context,this,n))}catch(F){Promise.reject(F)}try{await((x=(b=this.options).onError)==null?void 0:x.call(b,j,t,this.state.context,n))}catch(F){Promise.reject(F)}try{await((C=(w=O(this,lt).config).onSettled)==null?void 0:C.call(w,void 0,j,this.state.variables,this.state.context,this,n))}catch(F){Promise.reject(F)}try{await((N=(E=this.options).onSettled)==null?void 0:N.call(E,void 0,j,t,this.state.context,n))}catch(F){Promise.reject(F)}throw he(this,sr,_r).call(this,{type:"error",error:j}),j}finally{O(this,lt).runNext(this)}}},Es=new WeakMap,nr=new WeakMap,lt=new WeakMap,Zr=new WeakMap,sr=new WeakSet,_r=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),et.batch(()=>{O(this,nr).forEach(n=>{n.onMutationUpdate(t)}),O(this,lt).notify({mutation:this,type:"updated",action:t})})},qu);function mp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hr,Ht,Os,Hu,yp=(Hu=class extends Ds{constructor(t={}){super();re(this,hr);re(this,Ht);re(this,Os);this.config=t,Q(this,hr,new Set),Q(this,Ht,new Map),Q(this,Os,0)}build(t,r,n){const s=new gp({client:t,mutationCache:this,mutationId:++zs(this,Os)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,hr).add(t);const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).get(r);n?n.push(t):O(this,Ht).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,hr).delete(t)){const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&O(this,Ht).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).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=qs(t);if(typeof r=="string"){const s=(n=O(this,Ht).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(){et.batch(()=>{O(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,hr).clear(),O(this,Ht).clear()})}getAll(){return Array.from(O(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>yl(r,n))}findAll(t={}){return this.getAll().filter(r=>yl(t,r))}notify(t){et.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return et.batch(()=>Promise.all(t.map(r=>r.continue().catch(_t))))}},hr=new WeakMap,Ht=new WeakMap,Os=new WeakMap,Hu);function qs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ir,Wu,vp=(Wu=class extends Ds{constructor(t={}){super();re(this,ir);this.config=t,Q(this,ir,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Na(s,r);let o=this.get(i);return o||(o=new dp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,ir).has(t.queryHash)||(O(this,ir).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,ir).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,ir).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,ir).get(t)}getAll(){return[...O(this,ir).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>ml(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>ml(t,n)):r}notify(t){et.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ir=new WeakMap,Wu),Fe,Tr,Nr,Rn,jn,Rr,kn,An,Ku,bp=(Ku=class{constructor(e={}){re(this,Fe);re(this,Tr);re(this,Nr);re(this,Rn);re(this,jn);re(this,Rr);re(this,kn);re(this,An);Q(this,Fe,e.queryCache||new vp),Q(this,Tr,e.mutationCache||new yp),Q(this,Nr,e.defaultOptions||{}),Q(this,Rn,new Map),Q(this,jn,new Map),Q(this,Rr,0)}mount(){zs(this,Rr)._++,O(this,Rr)===1&&(Q(this,kn,Ta.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Fe).onFocus())})),Q(this,An,bi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Fe).onOnline())})))}unmount(){var e,t;zs(this,Rr)._--,O(this,Rr)===0&&((e=O(this,kn))==null||e.call(this),Q(this,kn,void 0),(t=O(this,An))==null||t.call(this),Q(this,An,void 0))}isFetching(e){return O(this,Fe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Tr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Fe).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Fe).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(jr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Fe).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=O(this,Fe).get(n.queryHash),i=s==null?void 0:s.state.data,o=Jh(t,i);if(o!==void 0)return O(this,Fe).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return et.batch(()=>O(this,Fe).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Fe).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Fe);et.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Fe);return et.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=et.batch(()=>O(this,Fe).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(_t).catch(_t)}invalidateQueries(e,t={}){return et.batch(()=>(O(this,Fe).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=et.batch(()=>O(this,Fe).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(_t)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(_t)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Fe).build(this,t);return r.isStaleByTime(jr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return bi.isOnline()?O(this,Tr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Fe)}getMutationCache(){return O(this,Tr)}getDefaultOptions(){return O(this,Nr)}setDefaultOptions(e){Q(this,Nr,e)}setQueryDefaults(e,t){O(this,Rn).set(hs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Rn).values()],r={};return t.forEach(n=>{ps(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,jn).set(hs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,jn).values()],r={};return t.forEach(n=>{ps(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Nr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Na(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===vi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Nr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Fe).clear(),O(this,Tr).clear()}},Fe=new WeakMap,Tr=new WeakMap,Nr=new WeakMap,Rn=new WeakMap,jn=new WeakMap,Rr=new WeakMap,kn=new WeakMap,An=new WeakMap,Ku),nd=_e.createContext(void 0),_p=e=>{const t=_e.useContext(nd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},wp=({client:e,children:t})=>(_e.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(nd.Provider,{value:e,children:t})),sd=_e.createContext(!1),xp=()=>_e.useContext(sd);sd.Provider;function Sp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cp=_e.createContext(Sp()),Ep=()=>_e.useContext(Cp),Op=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Yu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Dp=e=>{_e.useEffect(()=>{e.clearReset()},[e])},Ip=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Yu(r,[e.error,n])),Tp=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))}},Np=(e,t)=>e.isLoading&&e.isFetching&&!t,Rp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,El=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function jp(e,t,r){var m,_,h,y;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=xp(),s=Ep(),i=_p(),o=i.defaultQueryOptions(e);(_=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||_.call(m,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,Tp(o),Op(o,s,a),Dp(s);const u=!i.getQueryCache().get(o.queryHash),[d]=_e.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),p=!n&&c;if(_e.useSyncExternalStore(_e.useCallback(v=>{const b=p?d.subscribe(et.batchCalls(v)):_t;return d.updateResult(),b},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),_e.useEffect(()=>{d.setOptions(o)},[o,d]),Rp(o,f))throw El(o,d,s);if(Ip({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!gs.isServer()&&Np(f,n)){const v=u?El(o,d,s):a==null?void 0:a.promise;v==null||v.catch(_t).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Ol(e,t){return jp(e,fp)}let kp={data:""},Ap=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||kp},Pp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Mp=/\/\*[^]*?\*\/| +/g,Dl=/\n+/g,Cr=(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"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(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+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},yr={},id=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+id(e[r]);return t}return e},Lp=(e,t,r,n,s)=>{let i=id(e),o=yr[i]||(yr[i]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(i));if(!yr[o]){let c=i!==e?e:(u=>{let d,f,p=[{}];for(;d=Pp.exec(u.replace(Mp,""));)d[4]?p.shift():d[3]?(f=d[3].replace(Dl," ").trim(),p.unshift(p[0][f]=p[0][f]||{})):p[0][d[1]]=d[2].replace(Dl," ").trim();return p[0]})(e);yr[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&yr.g;return r&&(yr.g=yr[o]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(yr[o],t,n,a),o},Fp=(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?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Pi(e){let t=this||{},r=e.call?e(t.p):e;return Lp(r.unshift?r.raw?Fp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Ap(t.target),t.g,t.o,t.k)}let od,Jo,ea;Pi.bind({g:1});let pr=Pi.bind({k:1});function $p(e,t,r,n){Cr.p=t,od=e,Jo=r,ea=n}function Ar(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:Jo&&Jo()},a),r.o=/go\d/.test(c),a.className=Pi.apply(r,n)+(c?" "+c:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),ea&&u[0]&&ea(a),od(u,a)}return s}}var Bp=e=>typeof e=="function",_i=(e,t)=>Bp(e)?e(t):e,Vp=(()=>{let e=0;return()=>(++e).toString()})(),ad=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Up=20,ja="default",ld=(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 ld(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}))}}},ri=[],cd={toasts:[],pausedAt:void 0,settings:{toastLimit:Up}},or={},ud=(e,t=ja)=>{or[t]=ld(or[t]||cd,e),ri.forEach(([r,n])=>{r===t&&n(or[t])})},dd=e=>Object.keys(or).forEach(t=>ud(e,t)),zp=e=>Object.keys(or).find(t=>or[t].toasts.some(r=>r.id===e)),Mi=(e=ja)=>t=>{ud(t,e)},qp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Hp=(e={},t=ja)=>{let[r,n]=g.useState(or[t]||cd),s=g.useRef(or[t]);g.useEffect(()=>(s.current!==or[t]&&n(or[t]),ri.push([t,n]),()=>{let o=ri.findIndex(([a])=>a===t);o>-1&&ri.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,u;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,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...r,toasts:i}},Wp=(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)||Vp()}),Is=e=>(t,r)=>{let n=Wp(t,e,r);return Mi(n.toasterId||zp(n.id))({type:2,toast:n}),n.id},qe=(e,t)=>Is("blank")(e,t);qe.error=Is("error");qe.success=Is("success");qe.loading=Is("loading");qe.custom=Is("custom");qe.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Mi(t)(r):dd(r)};qe.dismissAll=e=>qe.dismiss(void 0,e);qe.remove=(e,t)=>{let r={type:4,toastId:e};t?Mi(t)(r):dd(r)};qe.removeAll=e=>qe.remove(void 0,e);qe.promise=(e,t,r)=>{let n=qe.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?_i(t.success,s):void 0;return i?qe.success(i,{id:n,...r,...r==null?void 0:r.success}):qe.dismiss(n),s}).catch(s=>{let i=t.error?_i(t.error,s):void 0;i?qe.error(i,{id:n,...r,...r==null?void 0:r.error}):qe.dismiss(n)}),e};var Kp=1e3,Qp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Hp(e,t),s=g.useRef(new Map).current,i=g.useCallback((f,p=Kp)=>{if(s.has(f))return;let m=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},p);s.set(f,m)},[]);g.useEffect(()=>{if(n)return;let f=Date.now(),p=r.map(m=>{if(m.duration===1/0)return;let _=(m.duration||0)+m.pauseDuration-(f-m.createdAt);if(_<0){m.visible&&qe.dismiss(m.id);return}return setTimeout(()=>qe.dismiss(m.id,t),_)});return()=>{p.forEach(m=>m&&clearTimeout(m))}},[r,n,t]);let o=g.useCallback(Mi(t),[t]),a=g.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=g.useCallback((f,p)=>{o({type:1,toast:{id:f,height:p}})},[o]),u=g.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=g.useCallback((f,p)=>{let{reverseOrder:m=!1,gutter:_=8,defaultPosition:h}=p||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),b=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...m?[b+1]:[0,b]).reduce((x,w)=>x+(w.height||0)+_,0)},[r]);return g.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let p=s.get(f.id);p&&(clearTimeout(p),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:u,calculateOffset:d}}},Gp=pr`
|
|
2
2
|
from {
|
|
3
3
|
transform: scale(0) rotate(45deg);
|
|
4
4
|
opacity: 0;
|
|
@@ -144,7 +144,7 @@ to {
|
|
|
144
144
|
min-width: 20px;
|
|
145
145
|
animation: ${og} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
146
146
|
forwards;
|
|
147
|
-
`,lg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?
|
|
147
|
+
`,lg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?_e.createElement(ag,null,t):t:r==="blank"?null:_e.createElement(ig,null,_e.createElement(eg,{...n}),r!=="loading"&&_e.createElement(sg,null,r==="error"?_e.createElement(Zp,{...n}):_e.createElement(ng,{...n})))},cg=e=>`
|
|
148
148
|
0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
|
|
149
149
|
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
150
150
|
`,ug=e=>`
|
|
@@ -169,16 +169,16 @@ to {
|
|
|
169
169
|
color: inherit;
|
|
170
170
|
flex: 1 1 auto;
|
|
171
171
|
white-space: pre-line;
|
|
172
|
-
`,gg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=ad()?[dg,fg]:[cg(r),ug(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},mg=
|
|
172
|
+
`,gg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=ad()?[dg,fg]:[cg(r),ug(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},mg=_e.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?gg(e.position||t||"top-center",e.visible):{opacity:0},i=_e.createElement(lg,{toast:e}),o=_e.createElement(pg,{...e.ariaProps},_i(e.message,e));return _e.createElement(hg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):_e.createElement(_e.Fragment,null,i,o))});$p(_e.createElement);var yg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=_e.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 _e.createElement("div",{ref:i,className:t,style:r},s)},vg=(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:ad()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},bg=Pi`
|
|
173
173
|
z-index: 9999;
|
|
174
174
|
> * {
|
|
175
175
|
pointer-events: auto;
|
|
176
176
|
}
|
|
177
|
-
`,Hs=16,_g=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:u}=Qp(r,i);return
|
|
177
|
+
`,Hs=16,_g=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:u}=Qp(r,i);return _e.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Hs,left:Hs,right:Hs,bottom:Hs,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},c.map(d=>{let f=d.position||t,p=u.calculateOffset(d,{reverseOrder:e,gutter:n,defaultPosition:t}),m=vg(f,p);return _e.createElement(yg,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?bg:"",style:m},d.type==="custom"?_i(d.message,d):s?s(d):_e.createElement(mg,{toast:d,position:f}))}))},Ue=qe;function wg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Li=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $n(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ka(e){return"nodeType"in e}function pt(e){var t,r;return e?$n(e)?e:ka(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Aa(e){const{Document:t}=pt(e);return e instanceof t}function Ts(e){return $n(e)?!1:e instanceof pt(e).HTMLElement}function fd(e){return e instanceof pt(e).SVGElement}function Bn(e){return e?$n(e)?e.document:ka(e)?Aa(e)?e:Ts(e)||fd(e)?e.ownerDocument:document:document:document}const Kt=Li?g.useLayoutEffect:g.useEffect;function Fi(e){const t=g.useRef(e);return Kt(()=>{t.current=e}),g.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 xg(){const e=g.useRef(null),t=g.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ms(e,t){t===void 0&&(t=[e]);const r=g.useRef(e);return Kt(()=>{r.current!==e&&(r.current=e)},t),r}function Ns(e,t){const r=g.useRef();return g.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function wi(e){const t=Fi(e),r=g.useRef(null),n=g.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function xi(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let oo={};function Rs(e,t){return g.useMemo(()=>{if(t)return t;const r=oo[e]==null?0:oo[e]+1;return oo[e]=r,e+"-"+r},[e,t])}function hd(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,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const wn=hd(1),ys=hd(-1);function Sg(e){return"clientX"in e&&"clientY"in e}function $i(e){if(!e)return!1;const{KeyboardEvent:t}=pt(e.target);return t&&e instanceof t}function Cg(e){if(!e)return!1;const{TouchEvent:t}=pt(e.target);return t&&e instanceof t}function Si(e){if(Cg(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 Sg(e)?{x:e.clientX,y:e.clientY}:null}const kr=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[kr.Translate.toString(e),kr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Il="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eg(e){return e.matches(Il)?e:e.querySelector(Il)}const Og={display:"none"};function Dg(e){let{id:t,value:r}=e;return g.createElement("div",{id:t,style:Og},r)}function Ig(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 g.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Tg(){const[e,t]=g.useState("");return{announce:g.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const pd=g.createContext(null);function Ng(e){const t=g.useContext(pd);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Rg(){const[e]=g.useState(()=>new Set),t=g.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[g.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 jg={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
|
-
`},kg={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 Ag(e){let{announcements:t=kg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=jg}=e;const{announce:i,announcement:o}=Ig(),a=Rs("DndLiveRegion"),[c,u]=p.useState(!1);if(p.useEffect(()=>{u(!0)},[]),Ng(p.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;t.onDragMove&&i(t.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(t.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(t.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(t.onDragCancel({active:m,over:g}))}}),[i,t])),!c)return null;const d=p.createElement(p.Fragment,null,p.createElement(Dg,{id:n,value:s.draggable}),p.createElement(Tg,{id:a,announcement:o}));return r?$r.createPortal(d,r):d}var ze;(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"})(ze||(ze={}));function Ci(){}function ta(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function gd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Qt=Object.freeze({x:0,y:0});function md(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pg(e,t){const r=Si(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 yd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Mg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Il(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 vd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Nl(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 Lg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Nl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=md(Nl(c),s);i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(yd)},Fg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Il(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Il(c),d=s.reduce((m,g,b)=>m+md(u[b],g),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(yd)};function $g(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,u=e.width*e.height,d=o*a,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const Bg=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=$g(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Mg)};function Vg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function bd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qt}function Ug(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 zg=Ug(1);function _d(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=_d(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),u=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Hg={ignoreTransform:!1};function Vn(e,t){t===void 0&&(t=Hg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=pt(e).getComputedStyle(e);u&&(r=qg(r,u,d))}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 Rl(e){return Vn(e,{ignoreTransform:!0})}function Wg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Kg(e,t){return t===void 0&&(t=pt(e).getComputedStyle(e)),t.position==="fixed"}function Qg(e,t){t===void 0&&(t=pt(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 Bi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Aa(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Is(s)||fd(s)||r.includes(s))return r;const i=pt(e).getComputedStyle(s);return s!==e&&Qg(s,i)&&r.push(s),Kg(s,i)?r:n(s.parentNode)}return e?n(e):r}function wd(e){const[t]=Bi(e,1);return t??null}function ao(e){return!Li||!e?null:$n(e)?e:ka(e)?Aa(e)||e===Bn(e).scrollingElement?window:Is(e)?e:null:null}function xd(e){return $n(e)?e.scrollX:e.scrollLeft}function Sd(e){return $n(e)?e.scrollY:e.scrollTop}function ra(e){return{x:xd(e),y:Sd(e)}}var Ge;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ge||(Ge={}));function Cd(e){return!Li||!e?!1:e===document.scrollingElement}function Ed(e){const t={x:0,y:0},r=Cd(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 Gg={x:.2,y:.2};function Yg(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Gg);const{isTop:u,isBottom:d,isLeft:f,isRight:m}=Ed(e),g={x:0,y:0},b={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+h.height?(g.y=Ge.Backward,b.y=n*Math.abs((t.top+h.height-i)/h.height)):!d&&c>=t.bottom-h.height&&(g.y=Ge.Forward,b.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!m&&a>=t.right-h.width?(g.x=Ge.Forward,b.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(g.x=Ge.Backward,b.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:g,speed:b}}function Xg(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 Od(e){return e.reduce((t,r)=>wn(t,ra(r)),Qt)}function Zg(e){return e.reduce((t,r)=>t+xd(r),0)}function Jg(e){return e.reduce((t,r)=>t+Sd(r),0)}function Dd(e,t){if(t===void 0&&(t=Vn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);wd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const em=[["x",["left","right"],Zg],["y",["top","bottom"],Jg]];class Pa{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=Bi(r),s=Od(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of em)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(n),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ls{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 tm(e){const{EventTarget:t}=pt(e);return e instanceof t?e:Bn(e)}function lo(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 Ft;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ft||(Ft={}));function jl(e){e.preventDefault()}function rm(e){e.stopPropagation()}var ge;(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"})(ge||(ge={}));const Td={start:[ge.Space,ge.Enter],cancel:[ge.Esc],end:[ge.Space,ge.Enter,ge.Tab]},nm=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ge.Right:return{...r,x:r.x+25};case ge.Left:return{...r,x:r.x-25};case ge.Down:return{...r,y:r.y+25};case ge.Up:return{...r,y:r.y-25}}};class Ma{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 ls(Bn(r)),this.windowListeners=new ls(pt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ft.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Dd(n),r(Qt)}handleKeyDown(t){if($i(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Td,coordinateGetter:o=nm,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:u}=n.current,d=u?{x:u.left,y:u.top}:Qt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const m=ys(f,d),g={x:0,y:0},{scrollableAncestors:b}=n.current;for(const h of b){const y=t.code,{isTop:v,isRight:_,isLeft:x,isBottom:w,maxScroll:S,minScroll:O}=Ed(h),N=Xg(h),j={x:Math.min(y===ge.Right?N.right-N.width/2:N.right,Math.max(y===ge.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(y===ge.Down?N.bottom-N.height/2:N.bottom,Math.max(y===ge.Down?N.top:N.top+N.height/2,f.y))},F=y===ge.Right&&!_||y===ge.Left&&!x,k=y===ge.Down&&!w||y===ge.Up&&!v;if(F&&j.x!==f.x){const M=h.scrollLeft+m.x,q=y===ge.Right&&M<=S.x||y===ge.Left&&M>=O.x;if(q&&!m.y){h.scrollTo({left:M,behavior:a});return}q?g.x=h.scrollLeft-M:g.x=y===ge.Right?h.scrollLeft-S.x:h.scrollLeft-O.x,g.x&&h.scrollBy({left:-g.x,behavior:a});break}else if(k&&j.y!==f.y){const M=h.scrollTop+m.y,q=y===ge.Down&&M<=S.y||y===ge.Up&&M>=O.y;if(q&&!m.x){h.scrollTo({top:M,behavior:a});return}q?g.y=h.scrollTop-M:g.y=y===ge.Down?h.scrollTop-S.y:h.scrollTop-O.y,g.y&&h.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,wn(ys(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()}}Ma.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Td,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 kl(e){return!!(e&&"distance"in e)}function Al(e){return!!(e&&"delay"in e)}class La{constructor(t,r,n){var s;n===void 0&&(n=tm(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=Bn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(pt(o)),this.initialCoordinates=(s=Si(i))!=null?s:Qt,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(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.DragStart,jl),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),this.windowListeners.add(Ft.ContextMenu,jl),this.documentListeners.add(Ft.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Al(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(kl(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(Ft.Click,rm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ft.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=Si(t))!=null?r:Qt,u=ys(s,c);if(!n&&a){if(kl(a)){if(a.tolerance!=null&&lo(u,a.tolerance))return this.handleCancel();if(lo(u,a.distance))return this.handleStart()}if(Al(a)&&lo(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);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===ge.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const sm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vi extends La{constructor(t){const{event:r}=t,n=Bn(r.target);super(t,sm,n)}}Vi.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 im={move:{name:"mousemove"},end:{name:"mouseup"}};var na;(function(e){e[e.RightClick=2]="RightClick"})(na||(na={}));class om extends La{constructor(t){super(t,im,Bn(t.event.target))}}om.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===na.RightClick?!1:(n==null||n({event:r}),!0)}}];const co={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class am extends La{constructor(t){super(t,co)}static setup(){return window.addEventListener(co.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(co.move.name,t)};function t(){}}}am.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 cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var Ei;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ei||(Ei={}));function lm(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Ei.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:m}=e;const g=um({delta:f,disabled:!i}),[b,h]=xg(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),_=p.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),x=p.useRef(null),w=p.useCallback(()=>{const O=x.current;if(!O)return;const N=y.current.x*v.current.x,j=y.current.y*v.current.y;O.scrollBy(N,j)},[]),S=p.useMemo(()=>a===Ei.TreeOrder?[...u].reverse():u,[a,u]);p.useEffect(()=>{if(!i||!u.length||!_){h();return}for(const O of S){if((n==null?void 0:n(O))===!1)continue;const N=u.indexOf(O),j=d[N];if(!j)continue;const{direction:F,speed:k}=Yg(O,j,_,t,m);for(const M of["x","y"])g[M][F[M]]||(k[M]=0,F[M]=0);if(k.x>0||k.y>0){h(),x.current=O,b(w,o),y.current=k,v.current=F;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(_),JSON.stringify(g),b,u,S,d,JSON.stringify(m)])}const cm={x:{[Ge.Backward]:!1,[Ge.Forward]:!1},y:{[Ge.Backward]:!1,[Ge.Forward]:!1}};function um(e){let{delta:t,disabled:r}=e;const n=xi(t);return Ns(s=>{if(r||!n||!s)return cm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ge.Backward]:s.x[Ge.Backward]||i.x===-1,[Ge.Forward]:s.x[Ge.Forward]||i.x===1},y:{[Ge.Backward]:s.y[Ge.Backward]||i.y===-1,[Ge.Forward]:s.y[Ge.Forward]||i.y===1}}},[r,t,n])}function dm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ns(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function fm(e,t){return p.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 vs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vs||(vs={}));var sa;(function(e){e.Optimized="optimized"})(sa||(sa={}));const Pl=new Map;function hm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:u}=s,d=p.useRef(e),f=y(),m=ms(f),g=p.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(_=>_===null?v:_.concat(v.filter(x=>!_.includes(x))))},[m]),b=p.useRef(null),h=Ns(v=>{if(f&&!r)return Pl;if(!v||v===Pl||d.current!==e||i!=null){const _=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){_.set(x.id,x.rect.current);continue}const w=x.node.current,S=w?new Pa(c(w),w):null;x.rect.current=S,S&&_.set(x.id,S)}return _}return v},[e,i,r,f,c]);return p.useEffect(()=>{d.current=e},[e]),p.useEffect(()=>{f||g()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{g(),b.current=null},a))},[a,f,g,...n]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(u){case vs.Always:return!1;case vs.BeforeDragging:return r;default:return!r}}}function Fa(e,t){return Ns(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function pm(e,t){return Fa(e,t)}function gm(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Ui(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function mm(e){return new Pa(Vn(e),e)}function Ml(e,t,r){t===void 0&&(t=mm);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??r)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=gm({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Ui({callback:i});return Kt(()=>{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 ym(e){const t=Fa(e);return bd(e,t)}const Ll=[];function vm(e){const t=p.useRef(e),r=Ns(n=>e?n&&n!==Ll&&e&&t.current&&e.parentNode===t.current.parentNode?n:Bi(e):Ll,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function bm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=ao(i.target);o&&r(a=>a?(a.set(o,ra(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const u=ao(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,ra(u)]):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 u=ao(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>wn(i,o),Qt):Od(e):Qt,[e,t])}function Fl(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ys(e,r.current):Qt}function _m(e){p.useEffect(()=>{if(!Li)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 wm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Id(e){return p.useMemo(()=>e?Wg(e):null,[e])}const $l=[];function xm(e,t){t===void 0&&(t=Vn);const[r]=e,n=Id(r?pt(r):null),[s,i]=p.useState($l);function o(){i(()=>e.length?e.map(c=>Cd(c)?n:new Pa(t(c),c)):$l)}const a=Ui({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Nd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Is(t)?t:e}function Sm(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(u=>{for(const{target:d}of u)if(Is(d)){n(f=>{const m=t(d);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=Ui({callback:s}),o=p.useCallback(u=>{const d=Nd(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[a,c]=wi(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Cm=[{sensor:Vi,options:{}},{sensor:Ma,options:{}}],Em={current:{}},ni={draggable:{measure:Rl},droppable:{measure:Rl,strategy:vs.WhileDragging,frequency:sa.Optimized},dragOverlay:{measure:Vn}};class us 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 Om={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ni,measureDroppableContainers:Ci,windowRect:null,measuringScheduled:!1},Rd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ci,draggableNodes:new Map,over:null,measureDroppableContainers:Ci},js=p.createContext(Rd),jd=p.createContext(Om);function Dm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function Tm(e,t){switch(t.type){case ze.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ze.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 ze.DragEnd:case ze.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ze.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new us(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case ze.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 us(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case ze.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new us(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Im(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(js),i=xi(n),o=xi(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!$i(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Eg(d);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function kd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Nm(e){return p.useMemo(()=>({draggable:{...ni.draggable,...e==null?void 0:e.draggable},droppable:{...ni.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ni.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 Rm(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=r(u),f=bd(d,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=wd(u);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const zi=p.createContext({...Qt,scaleX:1,scaleY:1});var xr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xr||(xr={}));const Ad=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Cm,collisionDetection:f=Bg,measuring:m,modifiers:g,...b}=t;const h=p.useReducer(Tm,void 0,Dm),[y,v]=h,[_,x]=Rg(),[w,S]=p.useState(xr.Uninitialized),O=w===xr.Initialized,{draggable:{active:N,nodes:j,translate:F},droppable:{containers:k}}=y,M=N!=null?j.get(N):null,q=p.useRef({initial:null,translated:null}),R=p.useMemo(()=>{var He;return N!=null?{id:N,data:(He=M==null?void 0:M.data)!=null?He:Em,rect:q}:null},[N,M]),P=p.useRef(null),[L,ee]=p.useState(null),[Y,z]=p.useState(null),te=ms(b,Object.values(b)),ie=Rs("DndDescribedBy",o),H=p.useMemo(()=>k.getEnabled(),[k]),J=Nm(m),{droppableRects:G,measureDroppableContainers:se,measuringScheduled:ue}=hm(H,{dragging:O,dependencies:[F.x,F.y],config:J.droppable}),X=dm(j,N),ve=p.useMemo(()=>Y?Si(Y):null,[Y]),Ie=Pr(),Ue=pm(X,J.draggable.measure);Rm({activeNode:N!=null?j.get(N):null,config:Ie.layoutShiftCompensation,initialRect:Ue,measure:J.draggable.measure});const me=Ml(X,J.draggable.measure,Ue),Bt=Ml(X?X.parentElement:null),Ae=p.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),St=k.getNodeFor((r=Ae.current.over)==null?void 0:r.id),tt=Sm({measure:J.dragOverlay.measure}),Be=(n=tt.nodeRef.current)!=null?n:X,re=O?(s=tt.rect)!=null?s:me:null,qe=!!(tt.nodeRef.current&&tt.rect),gt=ym(qe?null:me),Ct=Id(Be?pt(Be):null),mt=vm(O?St??X:null),ar=xm(mt),jt=kd(g,{transform:{x:F.x-gt.x,y:F.y-gt.y,scaleX:1,scaleY:1},activatorEvent:Y,active:R,activeNodeRect:me,containerNodeRect:Bt,draggingNodeRect:re,over:Ae.current.over,overlayNodeRect:tt.rect,scrollableAncestors:mt,scrollableAncestorRects:ar,windowRect:Ct}),Vs=ve?wn(ve,F):null,no=bm(mt),pl=Fl(no),Us=Fl(no,[me]),C=wn(jt,pl),T=re?zg(re,jt):null,I=R&&T?f({active:R,collisionRect:T,droppableRects:G,droppableContainers:H,pointerCoordinates:Vs}):null,$=vd(I,"id"),[B,W]=p.useState(null),V=qe?jt:wn(jt,Us),Z=Vg(V,(i=B==null?void 0:B.rect)!=null?i:null,me),ce=p.useRef(null),Ne=p.useCallback((He,rt)=>{let{sensor:dt,options:Vt}=rt;if(P.current==null)return;const kt=j.get(P.current);if(!kt)return;const Et=He.nativeEvent,Xt=new dt({active:P.current,activeNode:kt,event:Et,options:Vt,context:Ae,onAbort(Ye){if(!j.get(Ye))return;const{onDragAbort:Zt}=te.current,cr={id:Ye};Zt==null||Zt(cr),_({type:"onDragAbort",event:cr})},onPending(Ye,gr,Zt,cr){if(!j.get(Ye))return;const{onDragPending:Qn}=te.current,mr={id:Ye,constraint:gr,initialCoordinates:Zt,offset:cr};Qn==null||Qn(mr),_({type:"onDragPending",event:mr})},onStart(Ye){const gr=P.current;if(gr==null)return;const Zt=j.get(gr);if(!Zt)return;const{onDragStart:cr}=te.current,Kn={activatorEvent:Et,active:{id:gr,data:Zt.data,rect:q}};$r.unstable_batchedUpdates(()=>{cr==null||cr(Kn),S(xr.Initializing),v({type:ze.DragStart,initialCoordinates:Ye,active:gr}),_({type:"onDragStart",event:Kn}),ee(ce.current),z(Et)})},onMove(Ye){v({type:ze.DragMove,coordinates:Ye})},onEnd:an(ze.DragEnd),onCancel:an(ze.DragCancel)});ce.current=Xt;function an(Ye){return async function(){const{active:Zt,collisions:cr,over:Kn,scrollAdjustedTranslate:Qn}=Ae.current;let mr=null;if(Zt&&Qn){const{cancelDrop:Gn}=te.current;mr={activatorEvent:Et,active:Zt,collisions:cr,delta:Qn,over:Kn},Ye===ze.DragEnd&&typeof Gn=="function"&&await Promise.resolve(Gn(mr))&&(Ye=ze.DragCancel)}P.current=null,$r.unstable_batchedUpdates(()=>{v({type:Ye}),S(xr.Uninitialized),W(null),ee(null),z(null),ce.current=null;const Gn=Ye===ze.DragEnd?"onDragEnd":"onDragCancel";if(mr){const so=te.current[Gn];so==null||so(mr),_({type:Gn,event:mr})}})}}},[j]),yt=p.useCallback((He,rt)=>(dt,Vt)=>{const kt=dt.nativeEvent,Et=j.get(Vt);if(P.current!==null||!Et||kt.dndKit||kt.defaultPrevented)return;const Xt={active:Et};He(dt,rt.options,Xt)===!0&&(kt.dndKit={capturedBy:rt.sensor},P.current=Vt,Ne(dt,rt))},[j,Ne]),vt=fm(d,yt);_m(d),Kt(()=>{me&&w===xr.Initializing&&S(xr.Initialized)},[me,w]),p.useEffect(()=>{const{onDragMove:He}=te.current,{active:rt,activatorEvent:dt,collisions:Vt,over:kt}=Ae.current;if(!rt||!dt)return;const Et={active:rt,activatorEvent:dt,collisions:Vt,delta:{x:C.x,y:C.y},over:kt};$r.unstable_batchedUpdates(()=>{He==null||He(Et),_({type:"onDragMove",event:Et})})},[C.x,C.y]),p.useEffect(()=>{const{active:He,activatorEvent:rt,collisions:dt,droppableContainers:Vt,scrollAdjustedTranslate:kt}=Ae.current;if(!He||P.current==null||!rt||!kt)return;const{onDragOver:Et}=te.current,Xt=Vt.get($),an=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,Ye={active:He,activatorEvent:rt,collisions:dt,delta:{x:kt.x,y:kt.y},over:an};$r.unstable_batchedUpdates(()=>{W(an),Et==null||Et(Ye),_({type:"onDragOver",event:Ye})})},[$]),Kt(()=>{Ae.current={activatorEvent:Y,active:R,activeNode:X,collisionRect:T,collisions:I,droppableRects:G,draggableNodes:j,draggingNode:Be,draggingNodeRect:re,droppableContainers:k,over:B,scrollableAncestors:mt,scrollAdjustedTranslate:C},q.current={initial:re,translated:T}},[R,X,I,T,j,Be,re,G,k,B,mt,C]),lm({...Ie,delta:F,draggingRect:T,pointerCoordinates:Vs,scrollableAncestors:mt,scrollableAncestorRects:ar});const lr=p.useMemo(()=>({active:R,activeNode:X,activeNodeRect:me,activatorEvent:Y,collisions:I,containerNodeRect:Bt,dragOverlay:tt,draggableNodes:j,droppableContainers:k,droppableRects:G,over:B,measureDroppableContainers:se,scrollableAncestors:mt,scrollableAncestorRects:ar,measuringConfiguration:J,measuringScheduled:ue,windowRect:Ct}),[R,X,me,Y,I,Bt,tt,j,k,G,B,se,mt,ar,J,ue,Ct]),Wn=p.useMemo(()=>({activatorEvent:Y,activators:vt,active:R,activeNodeRect:me,ariaDescribedById:{draggable:ie},dispatch:v,draggableNodes:j,over:B,measureDroppableContainers:se}),[Y,vt,R,me,v,ie,j,B,se]);return p.createElement(pd.Provider,{value:x},p.createElement(js.Provider,{value:Wn},p.createElement(jd.Provider,{value:lr},p.createElement(zi.Provider,{value:Z},u)),p.createElement(Im,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(Ag,{...a,hiddenTextDescribedById:ie}));function Pr(){const He=(L==null?void 0:L.autoScrollEnabled)===!1,rt=typeof c=="object"?c.enabled===!1:c===!1,dt=O&&!He&&!rt;return typeof c=="object"?{...c,enabled:dt}:{enabled:dt}}}),jm=p.createContext(null),Bl="button",km="Draggable";function Pd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=Rs(km),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:m}=p.useContext(js),{role:g=Bl,roleDescription:b="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?zi:jm),[_,x]=wi(),[w,S]=wi(),O=wm(o,t),N=ms(r);Kt(()=>(f.set(t,{id:t,key:i,node:_,activatorNode:w,data:N}),()=>{const F=f.get(t);F&&F.key===i&&f.delete(t)}),[f,t]);const j=p.useMemo(()=>({role:g,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&g===Bl?!0:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[n,g,h,y,b,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:j,isDragging:y,listeners:n?void 0:O,node:_,over:m,setNodeRef:x,setActivatorNodeRef:S,transform:v}}function Md(){return p.useContext(jd)}const Am="Droppable",Pm={timeout:25};function Mm(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=Rs(Am),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=p.useContext(js),d=p.useRef({disabled:r}),f=p.useRef(!1),m=p.useRef(null),g=p.useRef(null),{disabled:b,updateMeasurementsFor:h,timeout:y}={...Pm,...s},v=ms(h??n),_=p.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),g.current=null},y)},[y]),x=Ui({callback:_,disabled:b||!o}),w=p.useCallback((j,F)=>{x&&(F&&(x.unobserve(F),f.current=!1),j&&x.observe(j))},[x]),[S,O]=wi(w),N=ms(t);return p.useEffect(()=>{!x||!S.current||(x.disconnect(),f.current=!1,x.observe(S.current))},[S,x]),p.useEffect(()=>(a({type:ze.RegisterDroppable,element:{id:n,key:i,disabled:r,node:S,rect:m,data:N}}),()=>a({type:ze.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==d.current.disabled&&(a({type:ze.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,a]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===n,node:S,over:c,setNodeRef:O}}function Lm(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=xi(r);return!r&&!n&&a&&s(a),Kt(()=>{if(!i)return;const c=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const Fm={x:0,y:0,scaleX:1,scaleY:1};function $m(e){let{children:t}=e;return p.createElement(js.Provider,{value:Rd},p.createElement(zi.Provider,{value:Fm},t))}const Bm={position:"fixed",touchAction:"none"},Vm=e=>$i(e)?"transform 250ms ease":void 0,Um=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=Vm}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},m={...Bm,width:a.width,height:a.height,top:a.top,left:a.left,transform:kr.Transform.toString(f),transformOrigin:s&&n?Pg(n,a):void 0,transition:typeof d=="function"?d(n):d,...c};return p.createElement(r,{className:o,style:m,ref:t},i)}),zm=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,u]of Object.entries(s))r.node.style.setProperty(c,u);o!=null&&o.active&&r.node.classList.remove(o.active)}},qm=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:kr.Transform.toString(t)},{transform:kr.Transform.toString(r)}]},Hm={duration:250,easing:"ease",keyframes:qm,sideEffects:zm({styles:{active:{opacity:"0"}}})};function Wm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Fi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=Nd(o);if(!u)return;const{transform:d}=pt(o).getComputedStyle(o),f=_d(d);if(!f)return;const m=typeof t=="function"?t:Km(t);return Dd(c,s.draggable.measure),m({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Km(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Hm,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={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},m={x:c.x-d.x,y:c.y-d.y,...f},g=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:m}}),[b]=g,h=g[g.length-1];if(JSON.stringify(b)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...u}),v=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(_=>{v.onfinish=()=>{y==null||y(),_()}})}}let Vl=0;function Qm(e){return p.useMemo(()=>{if(e!=null)return Vl++,Vl},[e])}const Gm=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:g,draggableNodes:b,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:_,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:S}=Md(),O=p.useContext(zi),N=Qm(f==null?void 0:f.id),j=kd(o,{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:g,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:O,windowRect:S}),F=Fa(m),k=Wm({config:n,draggableNodes:b,droppableContainers:h,measuringConfiguration:_}),M=F?y.setRef:void 0;return p.createElement($m,null,p.createElement(Lm,{animation:k},f&&N?p.createElement(Um,{key:N,id:f.id,ref:M,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:F,style:{zIndex:u,...s},transform:j},r):null))});/**
|
|
181
|
+
`},kg={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 Ag(e){let{announcements:t=kg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=jg}=e;const{announce:i,announcement:o}=Tg(),a=Rs("DndLiveRegion"),[c,u]=g.useState(!1);if(g.useEffect(()=>{u(!0)},[]),Ng(g.useMemo(()=>({onDragStart(f){let{active:p}=f;i(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&i(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;i(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;i(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;i(t.onDragCancel({active:p,over:m}))}}),[i,t])),!c)return null;const d=g.createElement(g.Fragment,null,g.createElement(Dg,{id:n,value:s.draggable}),g.createElement(Ig,{id:a,announcement:o}));return r?$r.createPortal(d,r):d}var ze;(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"})(ze||(ze={}));function Ci(){}function ta(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function gd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Qt=Object.freeze({x:0,y:0});function md(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pg(e,t){const r=Si(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 yd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Mg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Tl(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 vd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Nl(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 Lg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Nl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=md(Nl(c),s);i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(yd)},Fg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Tl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Tl(c),d=s.reduce((p,m,_)=>p+md(u[_],m),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(yd)};function $g(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,u=e.width*e.height,d=o*a,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const Bg=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=$g(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Mg)};function Vg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function bd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qt}function Ug(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 zg=Ug(1);function _d(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=_d(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),u=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Hg={ignoreTransform:!1};function Vn(e,t){t===void 0&&(t=Hg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=pt(e).getComputedStyle(e);u&&(r=qg(r,u,d))}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 Rl(e){return Vn(e,{ignoreTransform:!0})}function Wg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Kg(e,t){return t===void 0&&(t=pt(e).getComputedStyle(e)),t.position==="fixed"}function Qg(e,t){t===void 0&&(t=pt(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 Bi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Aa(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ts(s)||fd(s)||r.includes(s))return r;const i=pt(e).getComputedStyle(s);return s!==e&&Qg(s,i)&&r.push(s),Kg(s,i)?r:n(s.parentNode)}return e?n(e):r}function wd(e){const[t]=Bi(e,1);return t??null}function ao(e){return!Li||!e?null:$n(e)?e:ka(e)?Aa(e)||e===Bn(e).scrollingElement?window:Ts(e)?e:null:null}function xd(e){return $n(e)?e.scrollX:e.scrollLeft}function Sd(e){return $n(e)?e.scrollY:e.scrollTop}function ra(e){return{x:xd(e),y:Sd(e)}}var Ye;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ye||(Ye={}));function Cd(e){return!Li||!e?!1:e===document.scrollingElement}function Ed(e){const t={x:0,y:0},r=Cd(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 Gg={x:.2,y:.2};function Yg(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Gg);const{isTop:u,isBottom:d,isLeft:f,isRight:p}=Ed(e),m={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+h.height?(m.y=Ye.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!d&&c>=t.bottom-h.height&&(m.y=Ye.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!p&&a>=t.right-h.width?(m.x=Ye.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(m.x=Ye.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:m,speed:_}}function Xg(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 Od(e){return e.reduce((t,r)=>wn(t,ra(r)),Qt)}function Zg(e){return e.reduce((t,r)=>t+xd(r),0)}function Jg(e){return e.reduce((t,r)=>t+Sd(r),0)}function Dd(e,t){if(t===void 0&&(t=Vn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);wd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const em=[["x",["left","right"],Zg],["y",["top","bottom"],Jg]];class Pa{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=Bi(r),s=Od(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of em)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(n),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ls{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 tm(e){const{EventTarget:t}=pt(e);return e instanceof t?e:Bn(e)}function lo(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 Ft;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ft||(Ft={}));function jl(e){e.preventDefault()}function rm(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 Id={start:[me.Space,me.Enter],cancel:[me.Esc],end:[me.Space,me.Enter,me.Tab]},nm=(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 Ma{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 ls(Bn(r)),this.windowListeners=new ls(pt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ft.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Dd(n),r(Qt)}handleKeyDown(t){if($i(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Id,coordinateGetter:o=nm,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:u}=n.current,d=u?{x:u.left,y:u.top}:Qt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const p=ys(f,d),m={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:x,isBottom:w,maxScroll:C,minScroll:E}=Ed(h),N=Xg(h),j={x:Math.min(y===me.Right?N.right-N.width/2:N.right,Math.max(y===me.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(y===me.Down?N.bottom-N.height/2:N.bottom,Math.max(y===me.Down?N.top:N.top+N.height/2,f.y))},F=y===me.Right&&!b||y===me.Left&&!x,k=y===me.Down&&!w||y===me.Up&&!v;if(F&&j.x!==f.x){const P=h.scrollLeft+p.x,V=y===me.Right&&P<=C.x||y===me.Left&&P>=E.x;if(V&&!p.y){h.scrollTo({left:P,behavior:a});return}V?m.x=h.scrollLeft-P:m.x=y===me.Right?h.scrollLeft-C.x:h.scrollLeft-E.x,m.x&&h.scrollBy({left:-m.x,behavior:a});break}else if(k&&j.y!==f.y){const P=h.scrollTop+p.y,V=y===me.Down&&P<=C.y||y===me.Up&&P>=E.y;if(V&&!p.x){h.scrollTo({top:P,behavior:a});return}V?m.y=h.scrollTop-P:m.y=y===me.Down?h.scrollTop-C.y:h.scrollTop-E.y,m.y&&h.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,wn(ys(f,this.referenceCoordinates),m))}}}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()}}Ma.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Id,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 kl(e){return!!(e&&"distance"in e)}function Al(e){return!!(e&&"delay"in e)}class La{constructor(t,r,n){var s;n===void 0&&(n=tm(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=Bn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(pt(o)),this.initialCoordinates=(s=Si(i))!=null?s:Qt,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(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.DragStart,jl),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),this.windowListeners.add(Ft.ContextMenu,jl),this.documentListeners.add(Ft.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Al(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(kl(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(Ft.Click,rm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ft.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=Si(t))!=null?r:Qt,u=ys(s,c);if(!n&&a){if(kl(a)){if(a.tolerance!=null&&lo(u,a.tolerance))return this.handleCancel();if(lo(u,a.distance))return this.handleStart()}if(Al(a)&&lo(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);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 sm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vi extends La{constructor(t){const{event:r}=t,n=Bn(r.target);super(t,sm,n)}}Vi.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 im={move:{name:"mousemove"},end:{name:"mouseup"}};var na;(function(e){e[e.RightClick=2]="RightClick"})(na||(na={}));class om extends La{constructor(t){super(t,im,Bn(t.event.target))}}om.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===na.RightClick?!1:(n==null||n({event:r}),!0)}}];const co={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class am extends La{constructor(t){super(t,co)}static setup(){return window.addEventListener(co.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(co.move.name,t)};function t(){}}}am.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 cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var Ei;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ei||(Ei={}));function lm(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Ei.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e;const m=um({delta:f,disabled:!i}),[_,h]=xg(),y=g.useRef({x:0,y:0}),v=g.useRef({x:0,y:0}),b=g.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),x=g.useRef(null),w=g.useCallback(()=>{const E=x.current;if(!E)return;const N=y.current.x*v.current.x,j=y.current.y*v.current.y;E.scrollBy(N,j)},[]),C=g.useMemo(()=>a===Ei.TreeOrder?[...u].reverse():u,[a,u]);g.useEffect(()=>{if(!i||!u.length||!b){h();return}for(const E of C){if((n==null?void 0:n(E))===!1)continue;const N=u.indexOf(E),j=d[N];if(!j)continue;const{direction:F,speed:k}=Yg(E,j,b,t,p);for(const P of["x","y"])m[P][F[P]]||(k[P]=0,F[P]=0);if(k.x>0||k.y>0){h(),x.current=E,_(w,o),y.current=k,v.current=F;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(b),JSON.stringify(m),_,u,C,d,JSON.stringify(p)])}const cm={x:{[Ye.Backward]:!1,[Ye.Forward]:!1},y:{[Ye.Backward]:!1,[Ye.Forward]:!1}};function um(e){let{delta:t,disabled:r}=e;const n=xi(t);return Ns(s=>{if(r||!n||!s)return cm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ye.Backward]:s.x[Ye.Backward]||i.x===-1,[Ye.Forward]:s.x[Ye.Forward]||i.x===1},y:{[Ye.Backward]:s.y[Ye.Backward]||i.y===-1,[Ye.Forward]:s.y[Ye.Forward]||i.y===1}}},[r,t,n])}function dm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ns(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function fm(e,t){return g.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 vs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vs||(vs={}));var sa;(function(e){e.Optimized="optimized"})(sa||(sa={}));const Pl=new Map;function hm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=g.useState(null),{frequency:a,measure:c,strategy:u}=s,d=g.useRef(e),f=y(),p=ms(f),m=g.useCallback(function(v){v===void 0&&(v=[]),!p.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[p]),_=g.useRef(null),h=Ns(v=>{if(f&&!r)return Pl;if(!v||v===Pl||d.current!==e||i!=null){const b=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const w=x.node.current,C=w?new Pa(c(w),w):null;x.rect.current=C,C&&b.set(x.id,C)}return b}return v},[e,i,r,f,c]);return g.useEffect(()=>{d.current=e},[e]),g.useEffect(()=>{f||m()},[r,f]),g.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),g.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{m(),_.current=null},a))},[a,f,m,...n]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(u){case vs.Always:return!1;case vs.BeforeDragging:return r;default:return!r}}}function Fa(e,t){return Ns(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function pm(e,t){return Fa(e,t)}function gm(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=g.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return g.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Ui(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=g.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return g.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function mm(e){return new Pa(Vn(e),e)}function Ml(e,t,r){t===void 0&&(t=mm);const[n,s]=g.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??r)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=gm({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Ui({callback:i});return Kt(()=>{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 ym(e){const t=Fa(e);return bd(e,t)}const Ll=[];function vm(e){const t=g.useRef(e),r=Ns(n=>e?n&&n!==Ll&&e&&t.current&&e.parentNode===t.current.parentNode?n:Bi(e):Ll,[e]);return g.useEffect(()=>{t.current=e},[e]),r}function bm(e){const[t,r]=g.useState(null),n=g.useRef(e),s=g.useCallback(i=>{const o=ao(i.target);o&&r(a=>a?(a.set(o,ra(o)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const u=ao(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,ra(u)]):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 u=ao(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>wn(i,o),Qt):Od(e):Qt,[e,t])}function Fl(e,t){t===void 0&&(t=[]);const r=g.useRef(null);return g.useEffect(()=>{r.current=null},t),g.useEffect(()=>{const n=e!==Qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ys(e,r.current):Qt}function _m(e){g.useEffect(()=>{if(!Li)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 wm(e,t){return g.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Td(e){return g.useMemo(()=>e?Wg(e):null,[e])}const $l=[];function xm(e,t){t===void 0&&(t=Vn);const[r]=e,n=Td(r?pt(r):null),[s,i]=g.useState($l);function o(){i(()=>e.length?e.map(c=>Cd(c)?n:new Pa(t(c),c)):$l)}const a=Ui({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Nd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ts(t)?t:e}function Sm(e){let{measure:t}=e;const[r,n]=g.useState(null),s=g.useCallback(u=>{for(const{target:d}of u)if(Ts(d)){n(f=>{const p=t(d);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),i=Ui({callback:s}),o=g.useCallback(u=>{const d=Nd(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[a,c]=wi(o);return g.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Cm=[{sensor:Vi,options:{}},{sensor:Ma,options:{}}],Em={current:{}},ni={draggable:{measure:Rl},droppable:{measure:Rl,strategy:vs.WhileDragging,frequency:sa.Optimized},dragOverlay:{measure:Vn}};class us 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 Om={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ni,measureDroppableContainers:Ci,windowRect:null,measuringScheduled:!1},Rd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ci,draggableNodes:new Map,over:null,measureDroppableContainers:Ci},js=g.createContext(Rd),jd=g.createContext(Om);function Dm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function Im(e,t){switch(t.type){case ze.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ze.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 ze.DragEnd:case ze.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ze.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new us(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case ze.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 us(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case ze.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new us(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Tm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=g.useContext(js),i=xi(n),o=xi(r==null?void 0:r.id);return g.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!$i(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Eg(d);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function kd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Nm(e){return g.useMemo(()=>({draggable:{...ni.draggable,...e==null?void 0:e.draggable},droppable:{...ni.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ni.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 Rm(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=g.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=r(u),f=bd(d,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=wd(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const zi=g.createContext({...Qt,scaleX:1,scaleY:1});var xr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xr||(xr={}));const Ad=g.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Cm,collisionDetection:f=Bg,measuring:p,modifiers:m,..._}=t;const h=g.useReducer(Im,void 0,Dm),[y,v]=h,[b,x]=Rg(),[w,C]=g.useState(xr.Uninitialized),E=w===xr.Initialized,{draggable:{active:N,nodes:j,translate:F},droppable:{containers:k}}=y,P=N!=null?j.get(N):null,V=g.useRef({initial:null,translated:null}),R=g.useMemo(()=>{var We;return N!=null?{id:N,data:(We=P==null?void 0:P.data)!=null?We:Em,rect:V}:null},[N,P]),M=g.useRef(null),[L,Z]=g.useState(null),[ne,z]=g.useState(null),J=ms(_,Object.values(_)),ee=Rs("DndDescribedBy",o),W=g.useMemo(()=>k.getEnabled(),[k]),X=Nm(p),{droppableRects:se,measureDroppableContainers:ye,measuringScheduled:Ce}=hm(W,{dragging:E,dependencies:[F.x,F.y],config:X.droppable}),K=dm(j,N),le=g.useMemo(()=>ne?Si(ne):null,[ne]),de=Pr(),Pe=pm(K,X.draggable.measure);Rm({activeNode:N!=null?j.get(N):null,config:de.layoutShiftCompensation,initialRect:Pe,measure:X.draggable.measure});const pe=Ml(K,X.draggable.measure,Pe),Bt=Ml(K?K.parentElement:null),Me=g.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),St=k.getNodeFor((r=Me.current.over)==null?void 0:r.id),rt=Sm({measure:X.dragOverlay.measure}),Be=(n=rt.nodeRef.current)!=null?n:K,te=E?(s=rt.rect)!=null?s:pe:null,He=!!(rt.nodeRef.current&&rt.rect),gt=ym(He?null:pe),Ct=Td(Be?pt(Be):null),mt=vm(E?St??K:null),ar=xm(mt),jt=kd(m,{transform:{x:F.x-gt.x,y:F.y-gt.y,scaleX:1,scaleY:1},activatorEvent:ne,active:R,activeNodeRect:pe,containerNodeRect:Bt,draggingNodeRect:te,over:Me.current.over,overlayNodeRect:rt.rect,scrollableAncestors:mt,scrollableAncestorRects:ar,windowRect:Ct}),Vs=le?wn(le,F):null,no=bm(mt),pl=Fl(no),Us=Fl(no,[pe]),S=wn(jt,pl),I=te?zg(te,jt):null,T=R&&I?f({active:R,collisionRect:I,droppableRects:se,droppableContainers:W,pointerCoordinates:Vs}):null,$=vd(T,"id"),[B,H]=g.useState(null),U=He?jt:wn(jt,Us),Y=Vg(U,(i=B==null?void 0:B.rect)!=null?i:null,pe),ue=g.useRef(null),Re=g.useCallback((We,nt)=>{let{sensor:ft,options:Vt}=nt;if(M.current==null)return;const kt=j.get(M.current);if(!kt)return;const Et=We.nativeEvent,Xt=new ft({active:M.current,activeNode:kt,event:Et,options:Vt,context:Me,onAbort(Xe){if(!j.get(Xe))return;const{onDragAbort:Zt}=J.current,cr={id:Xe};Zt==null||Zt(cr),b({type:"onDragAbort",event:cr})},onPending(Xe,gr,Zt,cr){if(!j.get(Xe))return;const{onDragPending:Qn}=J.current,mr={id:Xe,constraint:gr,initialCoordinates:Zt,offset:cr};Qn==null||Qn(mr),b({type:"onDragPending",event:mr})},onStart(Xe){const gr=M.current;if(gr==null)return;const Zt=j.get(gr);if(!Zt)return;const{onDragStart:cr}=J.current,Kn={activatorEvent:Et,active:{id:gr,data:Zt.data,rect:V}};$r.unstable_batchedUpdates(()=>{cr==null||cr(Kn),C(xr.Initializing),v({type:ze.DragStart,initialCoordinates:Xe,active:gr}),b({type:"onDragStart",event:Kn}),Z(ue.current),z(Et)})},onMove(Xe){v({type:ze.DragMove,coordinates:Xe})},onEnd:an(ze.DragEnd),onCancel:an(ze.DragCancel)});ue.current=Xt;function an(Xe){return async function(){const{active:Zt,collisions:cr,over:Kn,scrollAdjustedTranslate:Qn}=Me.current;let mr=null;if(Zt&&Qn){const{cancelDrop:Gn}=J.current;mr={activatorEvent:Et,active:Zt,collisions:cr,delta:Qn,over:Kn},Xe===ze.DragEnd&&typeof Gn=="function"&&await Promise.resolve(Gn(mr))&&(Xe=ze.DragCancel)}M.current=null,$r.unstable_batchedUpdates(()=>{v({type:Xe}),C(xr.Uninitialized),H(null),Z(null),z(null),ue.current=null;const Gn=Xe===ze.DragEnd?"onDragEnd":"onDragCancel";if(mr){const so=J.current[Gn];so==null||so(mr),b({type:Gn,event:mr})}})}}},[j]),yt=g.useCallback((We,nt)=>(ft,Vt)=>{const kt=ft.nativeEvent,Et=j.get(Vt);if(M.current!==null||!Et||kt.dndKit||kt.defaultPrevented)return;const Xt={active:Et};We(ft,nt.options,Xt)===!0&&(kt.dndKit={capturedBy:nt.sensor},M.current=Vt,Re(ft,nt))},[j,Re]),vt=fm(d,yt);_m(d),Kt(()=>{pe&&w===xr.Initializing&&C(xr.Initialized)},[pe,w]),g.useEffect(()=>{const{onDragMove:We}=J.current,{active:nt,activatorEvent:ft,collisions:Vt,over:kt}=Me.current;if(!nt||!ft)return;const Et={active:nt,activatorEvent:ft,collisions:Vt,delta:{x:S.x,y:S.y},over:kt};$r.unstable_batchedUpdates(()=>{We==null||We(Et),b({type:"onDragMove",event:Et})})},[S.x,S.y]),g.useEffect(()=>{const{active:We,activatorEvent:nt,collisions:ft,droppableContainers:Vt,scrollAdjustedTranslate:kt}=Me.current;if(!We||M.current==null||!nt||!kt)return;const{onDragOver:Et}=J.current,Xt=Vt.get($),an=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,Xe={active:We,activatorEvent:nt,collisions:ft,delta:{x:kt.x,y:kt.y},over:an};$r.unstable_batchedUpdates(()=>{H(an),Et==null||Et(Xe),b({type:"onDragOver",event:Xe})})},[$]),Kt(()=>{Me.current={activatorEvent:ne,active:R,activeNode:K,collisionRect:I,collisions:T,droppableRects:se,draggableNodes:j,draggingNode:Be,draggingNodeRect:te,droppableContainers:k,over:B,scrollableAncestors:mt,scrollAdjustedTranslate:S},V.current={initial:te,translated:I}},[R,K,T,I,j,Be,te,se,k,B,mt,S]),lm({...de,delta:F,draggingRect:I,pointerCoordinates:Vs,scrollableAncestors:mt,scrollableAncestorRects:ar});const lr=g.useMemo(()=>({active:R,activeNode:K,activeNodeRect:pe,activatorEvent:ne,collisions:T,containerNodeRect:Bt,dragOverlay:rt,draggableNodes:j,droppableContainers:k,droppableRects:se,over:B,measureDroppableContainers:ye,scrollableAncestors:mt,scrollableAncestorRects:ar,measuringConfiguration:X,measuringScheduled:Ce,windowRect:Ct}),[R,K,pe,ne,T,Bt,rt,j,k,se,B,ye,mt,ar,X,Ce,Ct]),Wn=g.useMemo(()=>({activatorEvent:ne,activators:vt,active:R,activeNodeRect:pe,ariaDescribedById:{draggable:ee},dispatch:v,draggableNodes:j,over:B,measureDroppableContainers:ye}),[ne,vt,R,pe,v,ee,j,B,ye]);return g.createElement(pd.Provider,{value:x},g.createElement(js.Provider,{value:Wn},g.createElement(jd.Provider,{value:lr},g.createElement(zi.Provider,{value:Y},u)),g.createElement(Tm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),g.createElement(Ag,{...a,hiddenTextDescribedById:ee}));function Pr(){const We=(L==null?void 0:L.autoScrollEnabled)===!1,nt=typeof c=="object"?c.enabled===!1:c===!1,ft=E&&!We&&!nt;return typeof c=="object"?{...c,enabled:ft}:{enabled:ft}}}),jm=g.createContext(null),Bl="button",km="Draggable";function Pd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=Rs(km),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=g.useContext(js),{role:m=Bl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=g.useContext(y?zi:jm),[b,x]=wi(),[w,C]=wi(),E=wm(o,t),N=ms(r);Kt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:N}),()=>{const F=f.get(t);F&&F.key===i&&f.delete(t)}),[f,t]);const j=g.useMemo(()=>({role:m,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&m===Bl?!0:void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[n,m,h,y,_,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:j,isDragging:y,listeners:n?void 0:E,node:b,over:p,setNodeRef:x,setActivatorNodeRef:C,transform:v}}function Md(){return g.useContext(jd)}const Am="Droppable",Pm={timeout:25};function Mm(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=Rs(Am),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=g.useContext(js),d=g.useRef({disabled:r}),f=g.useRef(!1),p=g.useRef(null),m=g.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...Pm,...s},v=ms(h??n),b=g.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},y)},[y]),x=Ui({callback:b,disabled:_||!o}),w=g.useCallback((j,F)=>{x&&(F&&(x.unobserve(F),f.current=!1),j&&x.observe(j))},[x]),[C,E]=wi(w),N=ms(t);return g.useEffect(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),g.useEffect(()=>(a({type:ze.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:p,data:N}}),()=>a({type:ze.UnregisterDroppable,key:i,id:n})),[n]),g.useEffect(()=>{r!==d.current.disabled&&(a({type:ze.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,a]),{active:o,rect:p,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:E}}function Lm(e){let{animation:t,children:r}=e;const[n,s]=g.useState(null),[i,o]=g.useState(null),a=xi(r);return!r&&!n&&a&&s(a),Kt(()=>{if(!i)return;const c=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,n,i]),g.createElement(g.Fragment,null,r,n?g.cloneElement(n,{ref:o}):null)}const Fm={x:0,y:0,scaleX:1,scaleY:1};function $m(e){let{children:t}=e;return g.createElement(js.Provider,{value:Rd},g.createElement(zi.Provider,{value:Fm},t))}const Bm={position:"fixed",touchAction:"none"},Vm=e=>$i(e)?"transform 250ms ease":void 0,Um=g.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=Vm}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},p={...Bm,width:a.width,height:a.height,top:a.top,left:a.left,transform:kr.Transform.toString(f),transformOrigin:s&&n?Pg(n,a):void 0,transition:typeof d=="function"?d(n):d,...c};return g.createElement(r,{className:o,style:p,ref:t},i)}),zm=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,u]of Object.entries(s))r.node.style.setProperty(c,u);o!=null&&o.active&&r.node.classList.remove(o.active)}},qm=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:kr.Transform.toString(t)},{transform:kr.Transform.toString(r)}]},Hm={duration:250,easing:"ease",keyframes:qm,sideEffects:zm({styles:{active:{opacity:"0"}}})};function Wm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Fi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=Nd(o);if(!u)return;const{transform:d}=pt(o).getComputedStyle(o),f=_d(d);if(!f)return;const p=typeof t=="function"?t:Km(t);return Dd(c,s.draggable.measure),p({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Km(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Hm,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={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},p={x:c.x-d.x,y:c.y-d.y,...f},m=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:p}}),[_]=m,h=m[m.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...u}),v=a.node.animate(m,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let Vl=0;function Qm(e){return g.useMemo(()=>{if(e!=null)return Vl++,Vl},[e])}const Gm=g.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:C}=Md(),E=g.useContext(zi),N=Qm(f==null?void 0:f.id),j=kd(o,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:E,windowRect:C}),F=Fa(p),k=Wm({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),P=F?y.setRef:void 0;return g.createElement($m,null,g.createElement(Lm,{animation:k},f&&N?g.createElement(Um,{key:N,id:f.id,ref:P,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:F,style:{zIndex:u,...s},transform:j},r):null))});/**
|
|
182
182
|
* @license lucide-react v0.400.0 - ISC
|
|
183
183
|
*
|
|
184
184
|
* 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 Zm=
|
|
196
|
+
*/const Zm=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>g.createElement("svg",{ref:c,...Xm,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ld("lucide",s),...a},[...o.map(([u,d])=>g.createElement(u,d)),...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 ae=(e,t)=>{const r=
|
|
201
|
+
*/const ae=(e,t)=>{const r=g.forwardRef(({className:n,...s},i)=>g.createElement(Zm,{ref:i,iconNode:t,className:Ld(`lucide-${Ym(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.
|
|
@@ -413,7 +413,7 @@ to {
|
|
|
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 sn=ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),by={},ql=e=>{let t;const r=new Set,n=(d,f)=>{const
|
|
416
|
+
*/const sn=ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),by={},ql=e=>{let t;const r=new Set,n=(d,f)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const m=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),r.forEach(_=>_(t,m))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(by?"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()}},u=t=e(n,s,c);return c},_y=e=>e?ql(e):ql;function qd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var aa={exports:{}},uo={},Ws={exports:{}},fo={};/**
|
|
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 Hl;function wy(){if(Hl)return fo;Hl=1;var e=
|
|
424
|
+
*/var Hl;function wy(){if(Hl)return fo;Hl=1;var e=g;function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,p){var m=p(),_=n({inst:{value:m,getSnapshot:p}}),h=_[0].inst,y=_[1];return i(function(){h.value=m,h.getSnapshot=p,c(h)&&y({inst:h})},[f,m,p]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(m),m}function c(f){var p=f.getSnapshot;f=f.value;try{var m=p();return!r(f,m)}catch{return!0}}function u(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return fo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,fo}var ho={};/**
|
|
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 Wl;function xy(){return Wl||(Wl=1,process.env.NODE_ENV!=="production"&&function(){function e(
|
|
432
|
+
*/var Wl;function xy(){return Wl||(Wl=1,process.env.NODE_ENV!=="production"&&function(){function e(m,_){return m===_&&(m!==0||1/m===1/_)||m!==m&&_!==_}function t(m,_){d||s.startTransition===void 0||(d=!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 h=_();if(!f){var y=_();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:_}});var v=y[0].inst,b=y[1];return c(function(){v.value=h,v.getSnapshot=_,r(v)&&b({inst:v})},[m,h,_]),a(function(){return r(v)&&b({inst:v}),m(function(){r(v)&&b({inst:v})})},[m]),u(h),h}function r(m){var _=m.getSnapshot;m=m.value;try{var h=_();return!i(m,h)}catch{return!0}}function n(m,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=g,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,u=s.useDebugValue,d=!1,f=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ho.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ho}var Kl;function Wa(){return Kl||(Kl=1,process.env.NODE_ENV==="production"?Ws.exports=wy():Ws.exports=xy()),Ws.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 Ql;function Sy(){if(Ql)return uo;Ql=1;var e=
|
|
440
|
+
*/var Ql;function Sy(){if(Ql)return uo;Ql=1;var e=g,t=Wa();function r(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}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 uo.useSyncExternalStoreWithSelector=function(u,d,f,p,m){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(E){if(!b){if(b=!0,x=E,E=p(E),m!==void 0&&h.hasValue){var N=h.value;if(m(N,E))return w=N}return w=E}if(N=w,n(x,E))return N;var j=p(E);return m!==void 0&&m(N,j)?(x=E,N):(x=E,w=j)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,f,p,m]);var y=s(u,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},uo}var po={};/**
|
|
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 Gl;function Cy(){return Gl||(Gl=1,process.env.NODE_ENV!=="production"&&function(){function e(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=Wa(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(u,d,f,m,g){var b=i(null);if(b.current===null){var h={hasValue:!1,value:null};b.current=h}else h=b.current;b=a(function(){function v(O){if(!_){if(_=!0,x=O,O=m(O),g!==void 0&&h.hasValue){var N=h.value;if(g(N,O))return w=N}return w=O}if(N=w,n(x,O))return N;var j=m(O);return g!==void 0&&g(N,j)?(x=O,N):(x=O,w=j)}var _=!1,x,w,S=f===void 0?null:f;return[function(){return v(d())},S===null?void 0:function(){return v(S())}]},[d,f,m,g]);var y=s(u,b[0],b[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),po}process.env.NODE_ENV==="production"?aa.exports=Sy():aa.exports=Cy();var Ey=aa.exports;const Oy=qd(Ey),Hd={},{useDebugValue:Dy}=p,{useSyncExternalStoreWithSelector:Ty}=Oy;let Yl=!1;const Iy=e=>e;function Ny(e,t=Iy,r){(Hd?"production":void 0)!=="production"&&r&&!Yl&&(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"),Yl=!0);const n=Ty(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Dy(n),n}const Xl=e=>{(Hd?"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"?_y(e):e,r=(n,s)=>Ny(t,n,s);return Object.assign(r,t),r},qi=e=>e?Xl(e):Xl,Se=qi(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,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}),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}})})),Wd=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:Se},Symbol.toStringTag,{value:"Module"}));function bn(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 Kd(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=Kd(s.children,t,r+1);if(i>=0)return i}}return-1}const Ry=new Set(["name","appIcon","description","keywords","trackable"]);function Qd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Ry)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Qd(n.children,t,r)}:n})}function ii(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:ii(n.children,t,r)}:n)}function la(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?la(r.children,t):[]}))}function Gd(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:Gd(s.children,t,r,n)}:s})}function jy(e,t){const r=bn(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?bn(e,s.parent):void 0;return n}const Te=qi((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=bn(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};Se.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:Qd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),Se.getState().setIsDirty(!0)},addNode:(r,n)=>{var u,d;const s=t(),i=((d=(u=Se.getState().editorConfig)==null?void 0:u.config)==null?void 0:d.maxDepth)??4,o=Kd(s.treeData,r);if(o>=i-1)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:ii(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),t().selectNode(a),a},deleteNode:r=>{e(n=>({treeData:la(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Gd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=bn(i.treeData,r);if(!o)return i;let a=la(i.treeData,r);return a=ii(a,s,{...o,parent:s}),{treeData:a,isDirty:!0}})},addResource:(r,n)=>{var c,u;const s=Se.getState().editorConfig,i=((c=s==null?void 0:s.config)==null?void 0:c.allowContentUnderRoot)??!1,o=(u=t().treeData[0])==null?void 0:u.id;if(!i&&n===o)return;const a={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};e(d=>({treeData:ii(d.treeData,n,a)})),t().markDirty()},markDirty:()=>{Promise.resolve().then(()=>Wd).then(({useEditorStore:r})=>{r.getState().setIsDirty(!0)})},getNodeById:r=>bn(t().treeData,r),getChildrenOf:r=>{const n=bn(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>jy(t().treeData,r)})),ky=qi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Ay="_spin_1ah4d_9",Py={spin:Ay},My=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Py.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"})}),je=({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(My,{size:14}):null,i]});function Yd(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ly}=Object.prototype,{getPrototypeOf:Pn}=Object,{iterator:Ps,toStringTag:Xd}=Symbol,Oi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bs=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Oi(r,t))return!0;r=Pn(r)}return!1},Fy=(e,t)=>e!=null&&bs(e,t)?e[t]:void 0,Ka=(e=>t=>{const r=Ly.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>Ka(t)===e),Hi=e=>t=>typeof t===e,{isArray:tn}=Array,Mn=Hi("undefined");function qn(e){return e!==null&&!Mn(e)&&e.constructor!==null&&!Mn(e.constructor)&&wt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Zd=Gt("ArrayBuffer");function $y(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Zd(e.buffer),t}const By=Hi("string"),wt=Hi("function"),Jd=Hi("number"),Hn=e=>e!==null&&typeof e=="object",Vy=e=>e===!0||e===!1,oi=e=>{if(!Hn(e))return!1;const t=Pn(e);return(t===null||t===Object.prototype||Pn(t)===null)&&!bs(e,Xd)&&!bs(e,Ps)},Uy=e=>{if(!Hn(e)||qn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},zy=Gt("Date"),qy=Gt("File"),Hy=e=>!!(e&&typeof e.uri<"u"),Wy=e=>e&&typeof e.getParts<"u",Ky=Gt("Blob"),Qy=Gt("FileList"),Gy=e=>Hn(e)&&wt(e.pipe);function Yy(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Zl=Yy(),Jl=typeof Zl.FormData<"u"?Zl.FormData:void 0,Xy=e=>{if(!e)return!1;if(Jl&&e instanceof Jl)return!0;const t=Pn(e);if(!t||t===Object.prototype||!wt(e.append))return!1;const r=Ka(e);return r==="formdata"||r==="object"&&wt(e.toString)&&e.toString()==="[object FormData]"},Zy=Gt("URLSearchParams"),[Jy,ev,tv,rv]=["ReadableStream","Request","Response","Headers"].map(Gt),nv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ms(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),tn(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(qn(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 ef(e,t){if(qn(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,tf=e=>!Mn(e)&&e!==Vr;function ca(...e){const{caseless:t,skipUndefined:r}=tf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&ef(n,o)||o,c=Oi(n,a)?n[a]:void 0;oi(c)&&oi(i)?n[a]=ca(c,i):oi(i)?n[a]=ca({},i):tn(i)?n[a]=i.slice():(!r||!Mn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||qn(a)||(Ms(a,s),typeof a!="object"||tn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];gv.call(a,d)&&s(a[d],d)}}return n}const sv=(e,t,r,{allOwnKeys:n}={})=>(Ms(t,(s,i)=>{r&&wt(s)?Object.defineProperty(e,i,{__proto__:null,value:Yd(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),iv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ov=(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)},av=(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&&Pn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},lv=(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},cv=e=>{if(!e)return null;if(tn(e))return e;let t=e.length;if(!Jd(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},uv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Pn(Uint8Array)),dv=(e,t)=>{const n=(e&&e[Ps]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},fv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},hv=Gt("HTMLFormElement"),pv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:gv}=Object.prototype,mv=Gt("RegExp"),rf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ms(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},yv=e=>{rf(e,(t,r)=>{if(wt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(wt(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+"'")})}})},vv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return tn(e)?n(e):n(String(e).split(t)),r},bv=()=>{},_v=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function wv(e){return!!(e&&wt(e.append)&&e[Xd]==="FormData"&&e[Ps])}const xv=e=>{const t=new WeakSet,r=n=>{if(Hn(n)){if(t.has(n))return;if(qn(n))return n;if(!("toJSON"in n)){t.add(n);const s=tn(n)?[]:{};return Ms(n,(i,o)=>{const a=r(i);!Mn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Sv=Gt("AsyncFunction"),Cv=e=>e&&(Hn(e)||wt(e))&&wt(e.then)&&wt(e.catch),nf=((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",wt(Vr.postMessage)),Ev=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||nf,sf=e=>e!=null&&wt(e[Ps]),Ov=e=>e!=null&&bs(e,Ps)&&sf(e),D={isArray:tn,isArrayBuffer:Zd,isBuffer:qn,isFormData:Xy,isArrayBufferView:$y,isString:By,isNumber:Jd,isBoolean:Vy,isObject:Hn,isPlainObject:oi,isEmptyObject:Uy,isReadableStream:Jy,isRequest:ev,isResponse:tv,isHeaders:rv,isUndefined:Mn,isDate:zy,isFile:qy,isReactNativeBlob:Hy,isReactNative:Wy,isBlob:Ky,isRegExp:mv,isFunction:wt,isStream:Gy,isURLSearchParams:Zy,isTypedArray:uv,isFileList:Qy,forEach:Ms,merge:ca,extend:sv,trim:nv,stripBOM:iv,inherits:ov,toFlatObject:av,kindOf:Ka,kindOfTest:Gt,endsWith:lv,toArray:cv,forEachEntry:dv,matchAll:fv,isHTMLForm:hv,hasOwnProperty:Oi,hasOwnProp:Oi,hasOwnInPrototypeChain:bs,getSafeProp:Fy,reduceDescriptors:rf,freezeMethods:yv,toObjectSet:vv,toCamelCase:pv,noop:bv,toFiniteNumber:_v,findKey:ef,global:Vr,isContextDefined:tf,isSpecCompliantForm:wv,toJSONObject:xv,isAsyncFn:Sv,isThenable:Cv,setImmediate:nf,asap:Ev,isIterable:sf,isSafeIterable:Ov},Dv=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"]),Tv=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]&&
|
|
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[ec]=this[ec]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Yn(o);n[a]||(Lv(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};ut.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);D.reduceDescriptors(ut.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});D.freezeMethods(ut);const Fv="[REDACTED ****]";function $v(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 Bv(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 ut&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const u=s(a);D.isUndefined(u)||(o[c]=u)});else{if(!D.isPlainObject(i)&&$v(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const u=r.has(a.toLowerCase())?Fv:s(c);D.isUndefined(u)||(o[a]=u)}}return n.pop(),o};return s(e)}let Q=class af extends Error{static from(t,r,n,s,i,o){const a=new af(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?Bv(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}}};Q.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Q.ERR_BAD_OPTION="ERR_BAD_OPTION";Q.ECONNABORTED="ECONNABORTED";Q.ETIMEDOUT="ETIMEDOUT";Q.ECONNREFUSED="ECONNREFUSED";Q.ERR_NETWORK="ERR_NETWORK";Q.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Q.ERR_DEPRECATED="ERR_DEPRECATED";Q.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Q.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Q.ERR_CANCELED="ERR_CANCELED";Q.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Q.ERR_INVALID_URL="ERR_INVALID_URL";Q.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Vv=null,lf=100;function ua(e){return D.isPlainObject(e)||D.isArray(e)}function cf(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function mo(e,t,r){return e?e.concat(t).map(function(s,i){return s=cf(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Uv(e){return D.isArray(e)&&!e.some(ua)}const zv=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function Wi(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(_,x){return!D.isUndefined(x[_])});const n=r.metaTokens,s=r.visitor||b,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?lf:r.maxDepth,u=a&&D.isSpecCompliantForm(t),d=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(D.isDate(v))return v.toISOString();if(D.isBoolean(v))return v.toString();if(!u&&D.isBlob(v))throw new Q("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(v)||D.isTypedArray(v)?u&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function m(v){if(v>c)throw new Q("Object is too deeply nested ("+v+" levels). Max depth: "+c,Q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(v,_){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(S,O){if(!D.isObject(O))return O;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(O),m(_+x.length-1),O})}function b(v,_,x){let w=v;if(D.isReactNative(t)&&D.isReactNativeBlob(v))return t.append(mo(x,_,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(D.endsWith(_,"{}"))_=n?_:_.slice(0,-2),v=g(v,1);else if(D.isArray(v)&&Uv(v)||(D.isFileList(v)||D.endsWith(_,"[]"))&&(w=D.toArray(v)))return _=cf(_),w.forEach(function(O,N){!(D.isUndefined(O)||O===null)&&t.append(o===!0?mo([_],N,i):o===null?_:_+"[]",f(O))}),!1}return ua(v)?!0:(t.append(mo(x,_,i),f(v)),!1)}const h=Object.assign(zv,{defaultVisitor:b,convertValue:f,isVisitable:ua});function y(v,_,x=0){if(!D.isUndefined(v)){if(m(x),d.indexOf(v)!==-1)throw new Error("Circular reference detected in "+_.join("."));d.push(v),D.forEach(v,function(S,O){(!(D.isUndefined(S)||S===null)&&s.call(t,S,D.isString(O)?O.trim():O,_,h))===!0&&y(S,_?_.concat(O):[O],x+1)}),d.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return y(e),t}function tc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Ga(e,t){this._pairs=[],e&&Wi(e,this,t)}const uf=Ga.prototype;uf.append=function(t,r){this._pairs.push([t,r])};uf.toString=function(t){const r=t?function(n){return t.call(this,n,tc)}:tc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function qv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function df(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||qv,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new Ga(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class rc{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 Ya={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Hv=typeof URLSearchParams<"u"?URLSearchParams:Ga,Wv=typeof FormData<"u"?FormData:null,Kv=typeof Blob<"u"?Blob:null,Qv={isBrowser:!0,classes:{URLSearchParams:Hv,FormData:Wv,Blob:Kv},protocols:["http","https","file","blob","url","data"]},Xa=typeof window<"u"&&typeof document<"u",da=typeof navigator=="object"&&navigator||void 0,Gv=Xa&&(!da||["ReactNative","NativeScript","NS"].indexOf(da.product)<0),Yv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Xv=Xa&&window.location.href||"http://localhost",Zv=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xa,hasStandardBrowserEnv:Gv,hasStandardBrowserWebWorkerEnv:Yv,navigator:da,origin:Xv},Symbol.toStringTag,{value:"Module"})),et={...Zv,...Qv};function Jv(e,t){return Wi(e,new et.classes.URLSearchParams,{visitor:function(r,n,s,i){return et.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const nc=lf;function ff(e){if(e>nc)throw new Q("FormData field is too deeply nested ("+e+" levels). Max depth: "+nc,Q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function eb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)ff(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 hf(e){function t(r,n,s,i){ff(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 ln=(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 Ls={transitional:Ya,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(hf(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=ln(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jv(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=ln(this,"env"),d=u&&u.FormData;return Wi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(r.setContentType("application/json",!1),rb(t)):t}],transformResponse:[function(t){const r=ln(this,"transitional")||Ls.transitional,n=r&&r.forcedJSONParsing,s=ln(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,ln(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Q.from(c,Q.ERR_BAD_RESPONSE,this,null,ln(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:et.classes.FormData,Blob:et.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=>{Ls.headers[e]={}});function yo(e,t){const r=this||Ls,n=t||r,s=ut.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 pf(e){return!!(e&&e.__CANCEL__)}let Fs=class extends Q{constructor(t,r,n){super(t??"canceled",Q.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function gf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Q("Request failed with status code "+r.status,r.status>=400&&r.status<500?Q.ERR_BAD_REQUEST:Q.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 u=Date.now(),d=n[i];o||(o=u),r[s]=c,n[s]=u;let f=i,m=0;for(;f!==s;)m+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const g=d&&u-d;return g?Math.round(m*1e3/g):void 0}}function ib(e,t){let r=0,n=1e3/t,s,i;const o=(u,d=Date.now())=>{r=d,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-r;f>=n?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Di=(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,u=Math.max(0,c-n),d=s(u);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a?(a-c)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},sc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ic=e=>(...t)=>D.asap(()=>e(...t)),ob=et.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,et.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(et.origin),et.navigator&&/(msie|trident)/i.test(et.navigator.userAgent)):()=>!0,ab=et.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 oc(e,t){if(typeof e=="string"&&ub.test(hb(e)))throw new Q('Invalid URL: missing "//" after protocol',Q.ERR_INVALID_URL,t)}function mf(e,t,r,n){oc(t,n);let s=!lb(t);return e&&(s||r===!1)?(oc(e,n),cb(e,t)):t}const ac=e=>e instanceof ut?{...e}:e;function rn(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(d,f,m,g){return D.isPlainObject(d)&&D.isPlainObject(f)?D.merge.call({caseless:g},d,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(d,f,m,g){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d,m,g)}else return n(d,f,m,g)}function i(d,f){if(!D.isUndefined(f))return n(void 0,f)}function o(d,f){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d)}else return n(void 0,f)}function a(d){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,d))return f[d]}else return;const m=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(m)&&D.hasOwnProp(m,d))return m[d]}function c(d,f,m){if(D.hasOwnProp(t,m))return n(d,f);if(D.hasOwnProp(e,m))return n(void 0,d)}const u={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:(d,f,m)=>s(ac(d),ac(f),m,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=D.hasOwnProp(u,f)?u[f]:s,g=D.hasOwnProp(e,f)?e[f]:void 0,b=D.hasOwnProp(t,f)?t[f]:void 0,h=m(g,b,f);D.isUndefined(h)&&m!==c||(r[f]=h)}),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 mb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function yf(e){const t=rn({},e),r=m=>D.hasOwnProp(t,m)?t[m]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=ut.from(a),t.url=df(mf(u,f,d,t),r("params"),r("paramsSerializer")),c){const m=D.getSafeProp(c,"username")||"",g=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(g?mb(g):"")))}if(D.isFormData(n)&&(et.hasStandardBrowserEnv||et.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&gb(a,n.getHeaders(),r("formDataHeaderPolicy"))),et.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 yb=typeof XMLHttpRequest<"u",vb=yb&&function(e){return new Promise(function(r,n){const s=yf(e);let i=s.data;const o=ut.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,d,f,m,g,b;function h(){g&&g(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=ut.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};gf(function(N){r(N),h()},function(N){n(N),h()},S),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new Q("Request aborted",Q.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const S=w&&w.message?w.message:"Network Error",O=new Q(S,Q.ERR_NETWORK,e,y);O.event=w||null,n(O),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||Ya;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Q(w,S.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&D.forEach(of(o),function(w,S){y.setRequestHeader(S,w)}),D.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),u&&([m,b]=Di(u,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,g]=Di(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=x=>{y&&(n(!x||x.type?new Fs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const _=nb(s.url);if(_&&!et.protocols.includes(_)){n(new Q("Unsupported protocol "+_+":",Q.ERR_BAD_REQUEST,e));return}y.send(i||null)})},bb=(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 u=c instanceof Error?c:this.reason;r.abort(u instanceof Q?u:new Fs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new Q(`timeout of ${t}ms exceeded`,Q.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},_b=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},wb=async function*(e,t){for await(const r of xb(e))yield*_b(r,t)},xb=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()}},lc=(e,t,r,n)=>{const s=wb(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){a(),c.close();return}let f=d.byteLength;if(r){let m=i+=f;r(m)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ti=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Sb=(e,t,r)=>t+2<r&&Ti(e.charCodeAt(t+1))&&Ti(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 b=n.charCodeAt(g+1),h=n.charCodeAt(g+2);Ti(b)&&Ti(h)&&(o-=2,g+=2)}let c=0,u=a-1;const d=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);u>=0&&(n.charCodeAt(u)===61?(c++,u--):d(u)&&(c++,u-=3)),c===1&&u>=0&&(n.charCodeAt(u)===61||d(u))&&c++;const m=Math.floor(o/4)*3-(c||0);return m>0?m: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 u=n.charCodeAt(o+1);u>=56320&&u<=57343?(i+=4,o++):i+=3}else i+=3}return i}const Za="1.18.0",cc=64*1024,{isFunction:Ks}=D,Eb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),uc=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},dc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ob=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?Ks(s):typeof fetch=="function",c=Ks(i),u=Ks(o);if(!a)return!1;const d=a&&Ks(r),f=a&&(typeof n=="function"?(v=>_=>v.encode(_))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),m=c&&d&&dc(()=>{let v=!1;const _=new i(et.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),v&&!x}),g=u&&d&&dc(()=>D.isReadableStream(new o("").body)),b={stream:g&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!b[v]&&(b[v]=(_,x)=>{let w=_&&_[v];if(w)return w.call(_);throw new Q(`Response type '${v}' is not supported`,Q.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(D.isBlob(v))return v.size;if(D.isSpecCompliantForm(v))return(await new i(et.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(D.isArrayBufferView(v)||D.isArrayBuffer(v))return v.byteLength;if(D.isURLSearchParams(v)&&(v=v+""),D.isString(v))return(await f(v)).byteLength},y=async(v,_)=>{const x=D.toFiniteNumber(v.getContentLength());return x??h(_)};return async v=>{let{url:_,method:x,data:w,signal:S,cancelToken:O,timeout:N,onDownloadProgress:j,onUploadProgress:F,responseType:k,headers:M,withCredentials:q="same-origin",fetchOptions:R,maxContentLength:P,maxBodyLength:L}=yf(v);const ee=D.isNumber(P)&&P>-1,Y=D.isNumber(L)&&L>-1,z=X=>D.hasOwnProp(v,X)?v[X]:void 0;let te=s||fetch;k=k?(k+"").toLowerCase():"text";let ie=bb([S,O&&O.toAbortSignal()],N),H=null;const J=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let G,se=null;const ue=()=>new Q("Request body larger than maxBodyLength limit",Q.ERR_BAD_REQUEST,v,H);try{let X;const ve=z("auth");if(ve){const re=D.getSafeProp(ve,"username")||"",qe=D.getSafeProp(ve,"password")||"";X={username:re,password:qe}}if(Ob(_)){const re=new URL(_,et.origin);if(!X&&(re.username||re.password)){const qe=uc(re.username),gt=uc(re.password);X={username:qe,password:gt}}(re.username||re.password)&&(re.username="",re.password="",_=re.href)}if(X&&(M.delete("authorization"),M.set("Authorization","Basic "+btoa(Eb((X.username||"")+":"+(X.password||""))))),ee&&typeof _=="string"&&_.startsWith("data:")&&Cb(_)>P)throw new Q("maxContentLength size of "+P+" exceeded",Q.ERR_BAD_RESPONSE,v,H);if(Y&&x!=="get"&&x!=="head"){const re=await h(w);if(typeof re=="number"&&isFinite(re)&&(G=re,re>L))throw ue()}const Ie=Y&&(D.isReadableStream(w)||D.isStream(w)),Ue=(re,qe,gt)=>lc(re,cc,Ct=>{if(Y&&Ct>L)throw se=ue();qe&&qe(Ct)},gt);if(m&&x!=="get"&&x!=="head"&&(F||Ie)){if(G=G??await y(M,w),G!==0||Ie){let re=new i(_,{method:"POST",body:w,duplex:"half"}),qe;if(D.isFormData(w)&&(qe=re.headers.get("content-type"))&&M.setContentType(qe),re.body){const[gt,Ct]=F&&sc(G,Di(ic(F)))||[];w=Ue(re.body,gt,Ct)}}}else if(Ie&&!c&&d&&x!=="get"&&x!=="head")w=Ue(w);else if(Ie&&c&&!m&&x!=="get"&&x!=="head")throw new Q("Stream request bodies are not supported by the current fetch implementation",Q.ERR_NOT_SUPPORT,v,H);D.isString(q)||(q=q?"include":"omit");const me=c&&"credentials"in i.prototype;if(D.isFormData(w)){const re=M.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&M.delete("content-type")}M.set("User-Agent","axios/"+Za,!1);const Bt={...R,signal:ie,method:x.toUpperCase(),headers:of(M.normalize()),body:w,duplex:"half",credentials:me?q:void 0};H=c&&new i(_,Bt);let Ae=await(c?te(H,R):te(_,Bt));const St=ut.from(Ae.headers);if(ee){const re=D.toFiniteNumber(St.getContentLength());if(re!=null&&re>P)throw new Q("maxContentLength size of "+P+" exceeded",Q.ERR_BAD_RESPONSE,v,H)}const tt=g&&(k==="stream"||k==="response");if(g&&Ae.body&&(j||ee||tt&&J)){const re={};["status","statusText","headers"].forEach(jt=>{re[jt]=Ae[jt]});const qe=D.toFiniteNumber(St.getContentLength()),[gt,Ct]=j&&sc(qe,Di(ic(j),!0))||[];let mt=0;const ar=jt=>{if(ee&&(mt=jt,mt>P))throw new Q("maxContentLength size of "+P+" exceeded",Q.ERR_BAD_RESPONSE,v,H);gt&>(jt)};Ae=new o(lc(Ae.body,cc,ar,()=>{Ct&&Ct(),J&&J()}),re)}k=k||"text";let Be=await b[D.findKey(b,k)||"text"](Ae,v);if(ee&&!g&&!tt){let re;if(Be!=null&&(typeof Be.byteLength=="number"?re=Be.byteLength:typeof Be.size=="number"?re=Be.size:typeof Be=="string"&&(re=typeof n=="function"?new n().encode(Be).byteLength:Be.length)),typeof re=="number"&&re>P)throw new Q("maxContentLength size of "+P+" exceeded",Q.ERR_BAD_RESPONSE,v,H)}return!tt&&J&&J(),await new Promise((re,qe)=>{gf(re,qe,{data:Be,headers:ut.from(Ae.headers),status:Ae.status,statusText:Ae.statusText,config:v,request:H})})}catch(X){if(J&&J(),ie&&ie.aborted&&ie.reason instanceof Q){const ve=ie.reason;throw ve.config=v,H&&(ve.request=H),X!==ve&&(ve.cause=X),ve}throw se?(H&&!se.request&&(se.request=H),se):X instanceof Q?(H&&!X.request&&(X.request=H),X):X&&X.name==="TypeError"&&/Load failed|fetch/i.test(X.message)?Object.assign(new Q("Network Error",Q.ERR_NETWORK,v,H,X&&X.response),{cause:X.cause||X}):Q.from(X,X&&X.code,v,H,X&&X.response)}}},Tb=new Map,vf=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,u,d=Tb;for(;a--;)c=i[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:Db(t)),d=u;return u};vf();const Ja={http:Vv,xhr:vb,fetch:{get:vf}};D.forEach(Ja,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const fc=e=>`- ${e}`,Ib=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,!Ib(n)&&(s=Ja[(a=String(n)).toLowerCase()],s===void 0))throw new Q(`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,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
|
|
448
|
+
*/var Gl;function Cy(){return Gl||(Gl=1,process.env.NODE_ENV!=="production"&&function(){function e(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,r=Wa(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(u,d,f,p,m){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(E){if(!b){if(b=!0,x=E,E=p(E),m!==void 0&&h.hasValue){var N=h.value;if(m(N,E))return w=N}return w=E}if(N=w,n(x,E))return N;var j=p(E);return m!==void 0&&m(N,j)?(x=E,N):(x=E,w=j)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,f,p,m]);var y=s(u,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),po}process.env.NODE_ENV==="production"?aa.exports=Sy():aa.exports=Cy();var Ey=aa.exports;const Oy=qd(Ey),Hd={},{useDebugValue:Dy}=g,{useSyncExternalStoreWithSelector:Iy}=Oy;let Yl=!1;const Ty=e=>e;function Ny(e,t=Ty,r){(Hd?"production":void 0)!=="production"&&r&&!Yl&&(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"),Yl=!0);const n=Iy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Dy(n),n}const Xl=e=>{(Hd?"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"?_y(e):e,r=(n,s)=>Ny(t,n,s);return Object.assign(r,t),r},qi=e=>e?Xl(e):Xl,be=qi(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,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}),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}})})),Wd=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:be},Symbol.toStringTag,{value:"Module"}));function bn(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 Kd(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=Kd(s.children,t,r+1);if(i>=0)return i}}return-1}const Ry=new Set(["name","appIcon","description","keywords","trackable"]);function Qd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Ry)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Qd(n.children,t,r)}:n})}function ii(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:ii(n.children,t,r)}:n)}function la(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?la(r.children,t):[]}))}function Gd(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:Gd(s.children,t,r,n)}:s})}function jy(e,t){const r=bn(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?bn(e,s.parent):void 0;return n}const Ne=qi((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=bn(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};be.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:Qd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),be.getState().setIsDirty(!0)},addNode:(r,n)=>{var u,d;const s=t(),i=((d=(u=be.getState().editorConfig)==null?void 0:u.config)==null?void 0:d.maxDepth)??4,o=Kd(s.treeData,r);if(o>=i-1)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:ii(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),t().selectNode(a),a},deleteNode:r=>{e(n=>({treeData:la(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Gd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=bn(i.treeData,r);if(!o)return i;let a=la(i.treeData,r);return a=ii(a,s,{...o,parent:s}),{treeData:a,isDirty:!0}})},addResource:(r,n)=>{var c,u;const s=be.getState().editorConfig,i=((c=s==null?void 0:s.config)==null?void 0:c.allowContentUnderRoot)??!1,o=(u=t().treeData[0])==null?void 0:u.id;if(!i&&n===o)return;const a={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};e(d=>({treeData:ii(d.treeData,n,a)})),t().markDirty()},markDirty:()=>{Promise.resolve().then(()=>Wd).then(({useEditorStore:r})=>{r.getState().setIsDirty(!0)})},getNodeById:r=>bn(t().treeData,r),getChildrenOf:r=>{const n=bn(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>jy(t().treeData,r)})),ky=qi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Ay="_spin_1ah4d_9",Py={spin:Ay},My=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Py.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(My,{size:14}):null,i]}),Ly="_overlay_109ur_1",Fy="_modal_109ur_11",$y="_modalHeader_109ur_23",By="_modalHeaderClose_109ur_33",Vy="_modalBody_109ur_51",Uy="_modalFooter_109ur_58",zy="_checkRow_109ur_65",qy="_checkIcon_109ur_74",Hy="_pass_109ur_84",Wy="_fail_109ur_88",Ky="_divider_109ur_92",Qy="_errorBanner_109ur_98",Gy="_formGroup_109ur_108",Yy="_textarea_109ur_119",Xy="_sliderGroup_109ur_140",Zy="_sliderValue_109ur_152",Jy="_sliderLabels_109ur_160",ev="_sectionTitle_109ur_168",ve={overlay:Ly,modal:Fy,modalHeader:$y,modalHeaderClose:By,modalBody:Vy,modalFooter:Uy,checkRow:zy,checkIcon:qy,pass:Hy,fail:Wy,divider:Ky,errorBanner:Qy,formGroup:Gy,textarea:Yy,sliderGroup:Xy,sliderValue:Zy,sliderLabels:Jy,sectionTitle:ev};function tv(){return l.jsx("span",{className:`${ve.checkIcon} ${ve.pass}`,"aria-label":"passed",children:"✓"})}function rv(){return l.jsx("span",{className:`${ve.checkIcon} ${ve.fail}`,"aria-label":"failed",children:"✗"})}const nv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=Ne(p=>p.treeData),s=be(p=>p.publishChecklist)??[],[i,o]=g.useState({}),a=s.every(p=>i[p.code]),c=g.useMemo(()=>{var C,E,N,j,F,k;const p=n[0],m=!!(p!=null&&p.name&&p.name.trim().length>0),_=!!((C=p==null?void 0:p.description)!=null&&C.trim()||(N=(E=p==null?void 0:p.metadata)==null?void 0:E.description)!=null&&N.trim()),h=!!(p!=null&&p.appIcon||(j=p==null?void 0:p.metadata)!=null&&j.appIcon),y=(p==null?void 0:p.children)??[],v=y.some(P=>P.isFolder);function b(P){for(const V of P)if(!V.isFolder||V.children&&b(V.children))return!0;return!1}const x=b(y),w=!!((k=(F=p==null?void 0:p.metadata)==null?void 0:F.license)!=null&&k.trim());return[{label:"Root node has a title and description",passed:m&&_,critical:!0},{label:"Root node has an app icon",passed:h,critical:!0},{label:"At least one unit exists",passed:v,critical:!0},{label:"At least one content item added",passed:x,critical:!0},{label:"License field is set",passed:w,critical:!0}]},[n]),u=c.every(p=>!p.critical||p.passed)&&a,d=c.filter(p=>!p.passed).length,f=()=>{t()};return l.jsx("div",{className:ve.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:ve.modal,children:[l.jsxs("div",{className:ve.modalHeader,children:[l.jsx("span",{id:"publish-modal-title",children:"Publish Checklist"}),l.jsx("button",{className:ve.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsxs("div",{className:ve.modalBody,children:[l.jsx("p",{className:ve.sectionTitle,children:"Pre-publish validation"}),c.map(p=>l.jsxs("div",{className:ve.checkRow,children:[p.passed?l.jsx(tv,{}):l.jsx(rv,{}),l.jsx("span",{children:p.label})]},p.label)),s.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:ve.divider}),l.jsx("p",{className:ve.sectionTitle,children:"Reviewer confirmation"}),s.map(p=>l.jsxs("label",{className:ve.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[p.code],onChange:m=>o(_=>({..._,[p.code]:m.target.checked}))}),l.jsx("span",{children:p.label})]},p.code))]}),d>0&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:ve.divider}),l.jsx("div",{className:ve.errorBanner,children:d===1?"1 check failed. Please resolve it before publishing.":`${d} checks failed. Please resolve them before publishing.`})]})]}),l.jsxs("div",{className:ve.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:r,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:f,disabled:!u,children:"Publish"})]})]})})},sv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=g.useState(""),[o,a]=g.useState(7),c=t==="approve",u=c?"Review Quality":"Reject Content",d=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:ve.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:ve.modal,children:[l.jsxs("div",{className:ve.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:u}),l.jsx("button",{className:ve.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:ve.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ve.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:ve.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:p=>a(Number(p.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:ve.sliderValue,children:o})]}),l.jsxs("div",{className:ve.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:ve.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:ve.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:p=>i(p.target.value),rows:4})]})]}):l.jsxs("div",{className:ve.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:ve.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:p=>i(p.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:ve.modalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Te,{variant:c?"primary":"danger",onClick:f,disabled:d,children:c?"Approve":"Reject"})]})]})})};function Yd(e,t){return function(){return e.apply(t,arguments)}}const{toString:iv}=Object.prototype,{getPrototypeOf:Pn}=Object,{iterator:Ps,toStringTag:Xd}=Symbol,Oi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bs=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Oi(r,t))return!0;r=Pn(r)}return!1},ov=(e,t)=>e!=null&&bs(e,t)?e[t]:void 0,Ka=(e=>t=>{const r=iv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>Ka(t)===e),Hi=e=>t=>typeof t===e,{isArray:tn}=Array,Mn=Hi("undefined");function qn(e){return e!==null&&!Mn(e)&&e.constructor!==null&&!Mn(e.constructor)&&wt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Zd=Gt("ArrayBuffer");function av(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Zd(e.buffer),t}const lv=Hi("string"),wt=Hi("function"),Jd=Hi("number"),Hn=e=>e!==null&&typeof e=="object",cv=e=>e===!0||e===!1,oi=e=>{if(!Hn(e))return!1;const t=Pn(e);return(t===null||t===Object.prototype||Pn(t)===null)&&!bs(e,Xd)&&!bs(e,Ps)},uv=e=>{if(!Hn(e)||qn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},dv=Gt("Date"),fv=Gt("File"),hv=e=>!!(e&&typeof e.uri<"u"),pv=e=>e&&typeof e.getParts<"u",gv=Gt("Blob"),mv=Gt("FileList"),yv=e=>Hn(e)&&wt(e.pipe);function vv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Zl=vv(),Jl=typeof Zl.FormData<"u"?Zl.FormData:void 0,bv=e=>{if(!e)return!1;if(Jl&&e instanceof Jl)return!0;const t=Pn(e);if(!t||t===Object.prototype||!wt(e.append))return!1;const r=Ka(e);return r==="formdata"||r==="object"&&wt(e.toString)&&e.toString()==="[object FormData]"},_v=Gt("URLSearchParams"),[wv,xv,Sv,Cv]=["ReadableStream","Request","Response","Headers"].map(Gt),Ev=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ms(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),tn(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(qn(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 ef(e,t){if(qn(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,tf=e=>!Mn(e)&&e!==Vr;function ca(...e){const{caseless:t,skipUndefined:r}=tf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&ef(n,o)||o,c=Oi(n,a)?n[a]:void 0;oi(c)&&oi(i)?n[a]=ca(c,i):oi(i)?n[a]=ca({},i):tn(i)?n[a]=i.slice():(!r||!Mn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||qn(a)||(Ms(a,s),typeof a!="object"||tn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];Lv.call(a,d)&&s(a[d],d)}}return n}const Ov=(e,t,r,{allOwnKeys:n}={})=>(Ms(t,(s,i)=>{r&&wt(s)?Object.defineProperty(e,i,{__proto__:null,value:Yd(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),Dv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Iv=(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)},Tv=(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&&Pn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Nv=(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},Rv=e=>{if(!e)return null;if(tn(e))return e;let t=e.length;if(!Jd(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},jv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Pn(Uint8Array)),kv=(e,t)=>{const n=(e&&e[Ps]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Av=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Pv=Gt("HTMLFormElement"),Mv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Lv}=Object.prototype,Fv=Gt("RegExp"),rf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ms(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},$v=e=>{rf(e,(t,r)=>{if(wt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(wt(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+"'")})}})},Bv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return tn(e)?n(e):n(String(e).split(t)),r},Vv=()=>{},Uv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function zv(e){return!!(e&&wt(e.append)&&e[Xd]==="FormData"&&e[Ps])}const qv=e=>{const t=new WeakSet,r=n=>{if(Hn(n)){if(t.has(n))return;if(qn(n))return n;if(!("toJSON"in n)){t.add(n);const s=tn(n)?[]:{};return Ms(n,(i,o)=>{const a=r(i);!Mn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Hv=Gt("AsyncFunction"),Wv=e=>e&&(Hn(e)||wt(e))&&wt(e.then)&&wt(e.catch),nf=((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",wt(Vr.postMessage)),Kv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||nf,sf=e=>e!=null&&wt(e[Ps]),Qv=e=>e!=null&&bs(e,Ps)&&sf(e),D={isArray:tn,isArrayBuffer:Zd,isBuffer:qn,isFormData:bv,isArrayBufferView:av,isString:lv,isNumber:Jd,isBoolean:cv,isObject:Hn,isPlainObject:oi,isEmptyObject:uv,isReadableStream:wv,isRequest:xv,isResponse:Sv,isHeaders:Cv,isUndefined:Mn,isDate:dv,isFile:fv,isReactNativeBlob:hv,isReactNative:pv,isBlob:gv,isRegExp:Fv,isFunction:wt,isStream:yv,isURLSearchParams:_v,isTypedArray:jv,isFileList:mv,forEach:Ms,merge:ca,extend:Ov,trim:Ev,stripBOM:Dv,inherits:Iv,toFlatObject:Tv,kindOf:Ka,kindOfTest:Gt,endsWith:Nv,toArray:Rv,forEachEntry:kv,matchAll:Av,isHTMLForm:Pv,hasOwnProperty:Oi,hasOwnProp:Oi,hasOwnInPrototypeChain:bs,getSafeProp:ov,reduceDescriptors:rf,freezeMethods:$v,toObjectSet:Bv,toCamelCase:Mv,noop:Vv,toFiniteNumber:Uv,findKey:ef,global:Vr,isContextDefined:tf,isSpecCompliantForm:zv,toJSONObject:qv,isAsyncFn:Hv,isThenable:Wv,setImmediate:nf,asap:Kv,isIterable:sf,isSafeIterable:Qv},Gv=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"]),Yv=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]&&Gv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Xv(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 Zv=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Jv=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Qa(e,t){return D.isArray(e)?e.map(r=>Qa(r,t)):Xv(String(e).replace(t,""))}const eb=e=>Qa(e,Zv),tb=e=>Qa(e,Jv);function of(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=tb(r)}),t}const ec=Symbol("internals");function Yn(e){return e&&String(e).trim().toLowerCase()}function ai(e){return e===!1||e==null?e:D.isArray(e)?e.map(ai):eb(String(e))}function rb(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 nb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(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 sb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function ib(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 dt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,u){const d=Yn(c);if(!d)return;const f=D.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=ai(a))}const o=(a,c)=>D.forEach(a,(u,d)=>i(u,d,c));if(D.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(D.isString(t)&&(t=t.trim())&&!nb(t))o(Yv(t),r);else if(D.isObject(t)&&D.isSafeIterable(t)){let a=Object.create(null),c,u;for(const d of t){if(!D.isArray(d))throw new TypeError("Object iterator must return a key-value pair");u=d[0],D.hasOwnProp(a,u)?(c=a[u],a[u]=D.isArray(c)?[...c,d[1]]:[c,d[1]]):a[u]=d[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=Yn(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return rb(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=Yn(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||go(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=Yn(o),o){const a=D.findKey(n,o);a&&(!r||go(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||go(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]=ai(s),delete r[i];return}const a=t?sb(i):String(i).trim();a!==i&&delete r[i],r[a]=ai(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[ec]=this[ec]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Yn(o);n[a]||(ib(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);D.reduceDescriptors(dt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});D.freezeMethods(dt);const ob="[REDACTED ****]";function ab(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 lb(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 dt&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const u=s(a);D.isUndefined(u)||(o[c]=u)});else{if(!D.isPlainObject(i)&&ab(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const u=r.has(a.toLowerCase())?ob:s(c);D.isUndefined(u)||(o[a]=u)}}return n.pop(),o};return s(e)}let G=class af extends Error{static from(t,r,n,s,i,o){const a=new af(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?lb(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}}};G.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";G.ERR_BAD_OPTION="ERR_BAD_OPTION";G.ECONNABORTED="ECONNABORTED";G.ETIMEDOUT="ETIMEDOUT";G.ECONNREFUSED="ECONNREFUSED";G.ERR_NETWORK="ERR_NETWORK";G.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";G.ERR_DEPRECATED="ERR_DEPRECATED";G.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";G.ERR_BAD_REQUEST="ERR_BAD_REQUEST";G.ERR_CANCELED="ERR_CANCELED";G.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";G.ERR_INVALID_URL="ERR_INVALID_URL";G.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const cb=null,lf=100;function ua(e){return D.isPlainObject(e)||D.isArray(e)}function cf(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function mo(e,t,r){return e?e.concat(t).map(function(s,i){return s=cf(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function ub(e){return D.isArray(e)&&!e.some(ua)}const db=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function Wi(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,x){return!D.isUndefined(x[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?lf:r.maxDepth,u=a&&D.isSpecCompliantForm(t),d=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(D.isDate(v))return v.toISOString();if(D.isBoolean(v))return v.toString();if(!u&&D.isBlob(v))throw new G("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(v)||D.isTypedArray(v)?u&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function p(v){if(v>c)throw new G("Object is too deeply nested ("+v+" levels). Max depth: "+c,G.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(v,b){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(C,E){if(!D.isObject(E))return E;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(E),p(b+x.length-1),E})}function _(v,b,x){let w=v;if(D.isReactNative(t)&&D.isReactNativeBlob(v))return t.append(mo(x,b,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(D.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=m(v,1);else if(D.isArray(v)&&ub(v)||(D.isFileList(v)||D.endsWith(b,"[]"))&&(w=D.toArray(v)))return b=cf(b),w.forEach(function(E,N){!(D.isUndefined(E)||E===null)&&t.append(o===!0?mo([b],N,i):o===null?b:b+"[]",f(E))}),!1}return ua(v)?!0:(t.append(mo(x,b,i),f(v)),!1)}const h=Object.assign(db,{defaultVisitor:_,convertValue:f,isVisitable:ua});function y(v,b,x=0){if(!D.isUndefined(v)){if(p(x),d.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));d.push(v),D.forEach(v,function(C,E){(!(D.isUndefined(C)||C===null)&&s.call(t,C,D.isString(E)?E.trim():E,b,h))===!0&&y(C,b?b.concat(E):[E],x+1)}),d.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return y(e),t}function tc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Ga(e,t){this._pairs=[],e&&Wi(e,this,t)}const uf=Ga.prototype;uf.append=function(t,r){this._pairs.push([t,r])};uf.toString=function(t){const r=t?function(n){return t.call(this,n,tc)}:tc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function fb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function df(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||fb,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new Ga(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class rc{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 Ya={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},hb=typeof URLSearchParams<"u"?URLSearchParams:Ga,pb=typeof FormData<"u"?FormData:null,gb=typeof Blob<"u"?Blob:null,mb={isBrowser:!0,classes:{URLSearchParams:hb,FormData:pb,Blob:gb},protocols:["http","https","file","blob","url","data"]},Xa=typeof window<"u"&&typeof document<"u",da=typeof navigator=="object"&&navigator||void 0,yb=Xa&&(!da||["ReactNative","NativeScript","NS"].indexOf(da.product)<0),vb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bb=Xa&&window.location.href||"http://localhost",_b=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xa,hasStandardBrowserEnv:yb,hasStandardBrowserWebWorkerEnv:vb,navigator:da,origin:bb},Symbol.toStringTag,{value:"Module"})),tt={..._b,...mb};function wb(e,t){return Wi(e,new tt.classes.URLSearchParams,{visitor:function(r,n,s,i){return tt.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const nc=lf;function ff(e){if(e>nc)throw new G("FormData field is too deeply nested ("+e+" levels). Max depth: "+nc,G.ERR_FORM_DATA_DEPTH_EXCEEDED)}function xb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)ff(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Sb(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 hf(e){function t(r,n,s,i){ff(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]=Sb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(xb(n),s,r,0)}),r}return null}const ln=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function Cb(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 Ls={transitional:Ya,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(hf(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=ln(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return wb(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=ln(this,"env"),d=u&&u.FormData;return Wi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(r.setContentType("application/json",!1),Cb(t)):t}],transformResponse:[function(t){const r=ln(this,"transitional")||Ls.transitional,n=r&&r.forcedJSONParsing,s=ln(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,ln(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?G.from(c,G.ERR_BAD_RESPONSE,this,null,ln(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tt.classes.FormData,Blob:tt.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=>{Ls.headers[e]={}});function yo(e,t){const r=this||Ls,n=t||r,s=dt.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 pf(e){return!!(e&&e.__CANCEL__)}let Fs=class extends G{constructor(t,r,n){super(t??"canceled",G.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function gf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new G("Request failed with status code "+r.status,r.status>=400&&r.status<500?G.ERR_BAD_REQUEST:G.ERR_BAD_RESPONSE,r.config,r.request,r))}function Eb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Ob(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 u=Date.now(),d=n[i];o||(o=u),r[s]=c,n[s]=u;let f=i,p=0;for(;f!==s;)p+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const m=d&&u-d;return m?Math.round(p*1e3/m):void 0}}function Db(e,t){let r=0,n=1e3/t,s,i;const o=(u,d=Date.now())=>{r=d,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-r;f>=n?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Di=(e,t,r=3)=>{let n=0;const s=Ob(50,250);return Db(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,u=Math.max(0,c-n),d=s(u);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a?(a-c)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},sc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ic=e=>(...t)=>D.asap(()=>e(...t)),Ib=tt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,tt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(tt.origin),tt.navigator&&/(msie|trident)/i.test(tt.navigator.userAgent)):()=>!0,Tb=tt.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 Nb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Rb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const jb=/^https?:(?!\/\/)/i,kb=/[\t\n\r]/g;function Ab(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Pb(e){return Ab(e).replace(kb,"")}function oc(e,t){if(typeof e=="string"&&jb.test(Pb(e)))throw new G('Invalid URL: missing "//" after protocol',G.ERR_INVALID_URL,t)}function mf(e,t,r,n){oc(t,n);let s=!Nb(t);return e&&(s||r===!1)?(oc(e,n),Rb(e,t)):t}const ac=e=>e instanceof dt?{...e}:e;function rn(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(d,f,p,m){return D.isPlainObject(d)&&D.isPlainObject(f)?D.merge.call({caseless:m},d,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(d,f,p,m){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d,p,m)}else return n(d,f,p,m)}function i(d,f){if(!D.isUndefined(f))return n(void 0,f)}function o(d,f){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d)}else return n(void 0,f)}function a(d){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,d))return f[d]}else return;const p=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(p)&&D.hasOwnProp(p,d))return p[d]}function c(d,f,p){if(D.hasOwnProp(t,p))return n(d,f);if(D.hasOwnProp(e,p))return n(void 0,d)}const u={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:(d,f,p)=>s(ac(d),ac(f),p,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const p=D.hasOwnProp(u,f)?u[f]:s,m=D.hasOwnProp(e,f)?e[f]:void 0,_=D.hasOwnProp(t,f)?t[f]:void 0,h=p(m,_,f);D.isUndefined(h)&&p!==c||(r[f]=h)}),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 Mb=["content-type","content-length"];function Lb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Mb.includes(n.toLowerCase())&&e.set(n,s)})}const Fb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function yf(e){const t=rn({},e),r=p=>D.hasOwnProp(t,p)?t[p]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=dt.from(a),t.url=df(mf(u,f,d,t),r("params"),r("paramsSerializer")),c){const p=D.getSafeProp(c,"username")||"",m=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(p+":"+(m?Fb(m):"")))}if(D.isFormData(n)&&(tt.hasStandardBrowserEnv||tt.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&Lb(a,n.getHeaders(),r("formDataHeaderPolicy"))),tt.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&Ib(t.url))){const m=i&&o&&Tb.read(o);m&&a.set(i,m)}return t}const $b=typeof XMLHttpRequest<"u",Bb=$b&&function(e){return new Promise(function(r,n){const s=yf(e);let i=s.data;const o=dt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,d,f,p,m,_;function h(){m&&m(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=dt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};gf(function(N){r(N),h()},function(N){n(N),h()},C),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new G("Request aborted",G.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const C=w&&w.message?w.message:"Network Error",E=new G(C,G.ERR_NETWORK,e,y);E.event=w||null,n(E),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Ya;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new G(w,C.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&D.forEach(of(o),function(w,C){y.setRequestHeader(C,w)}),D.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),u&&([p,_]=Di(u,!0),y.addEventListener("progress",p)),c&&y.upload&&([f,m]=Di(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(d=x=>{y&&(n(!x||x.type?new Fs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const b=Eb(s.url);if(b&&!tt.protocols.includes(b)){n(new G("Unsupported protocol "+b+":",G.ERR_BAD_REQUEST,e));return}y.send(i||null)})},Vb=(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 u=c instanceof Error?c:this.reason;r.abort(u instanceof G?u:new Fs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new G(`timeout of ${t}ms exceeded`,G.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},Ub=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},zb=async function*(e,t){for await(const r of qb(e))yield*Ub(r,t)},qb=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()}},lc=(e,t,r,n)=>{const s=zb(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){a(),c.close();return}let f=d.byteLength;if(r){let p=i+=f;r(p)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Hb=(e,t,r)=>t+2<r&&Ii(e.charCodeAt(t+1))&&Ii(e.charCodeAt(t+2));function Wb(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 m=0;m<a;m++)if(n.charCodeAt(m)===37&&m+2<a){const _=n.charCodeAt(m+1),h=n.charCodeAt(m+2);Ii(_)&&Ii(h)&&(o-=2,m+=2)}let c=0,u=a-1;const d=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);u>=0&&(n.charCodeAt(u)===61?(c++,u--):d(u)&&(c++,u-=3)),c===1&&u>=0&&(n.charCodeAt(u)===61||d(u))&&c++;const p=Math.floor(o/4)*3-(c||0);return p>0?p:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Hb(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 u=n.charCodeAt(o+1);u>=56320&&u<=57343?(i+=4,o++):i+=3}else i+=3}return i}const Za="1.18.0",cc=64*1024,{isFunction:Ks}=D,Kb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),uc=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},dc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Qb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Gb=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?Ks(s):typeof fetch=="function",c=Ks(i),u=Ks(o);if(!a)return!1;const d=a&&Ks(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),p=c&&d&&dc(()=>{let v=!1;const b=new i(tt.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!x}),m=u&&d&&dc(()=>D.isReadableStream(new o("").body)),_={stream:m&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,x)=>{let w=b&&b[v];if(w)return w.call(b);throw new G(`Response type '${v}' is not supported`,G.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(D.isBlob(v))return v.size;if(D.isSpecCompliantForm(v))return(await new i(tt.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(D.isArrayBufferView(v)||D.isArrayBuffer(v))return v.byteLength;if(D.isURLSearchParams(v)&&(v=v+""),D.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const x=D.toFiniteNumber(v.getContentLength());return x??h(b)};return async v=>{let{url:b,method:x,data:w,signal:C,cancelToken:E,timeout:N,onDownloadProgress:j,onUploadProgress:F,responseType:k,headers:P,withCredentials:V="same-origin",fetchOptions:R,maxContentLength:M,maxBodyLength:L}=yf(v);const Z=D.isNumber(M)&&M>-1,ne=D.isNumber(L)&&L>-1,z=K=>D.hasOwnProp(v,K)?v[K]:void 0;let J=s||fetch;k=k?(k+"").toLowerCase():"text";let ee=Vb([C,E&&E.toAbortSignal()],N),W=null;const X=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let se,ye=null;const Ce=()=>new G("Request body larger than maxBodyLength limit",G.ERR_BAD_REQUEST,v,W);try{let K;const le=z("auth");if(le){const te=D.getSafeProp(le,"username")||"",He=D.getSafeProp(le,"password")||"";K={username:te,password:He}}if(Qb(b)){const te=new URL(b,tt.origin);if(!K&&(te.username||te.password)){const He=uc(te.username),gt=uc(te.password);K={username:He,password:gt}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(K&&(P.delete("authorization"),P.set("Authorization","Basic "+btoa(Kb((K.username||"")+":"+(K.password||""))))),Z&&typeof b=="string"&&b.startsWith("data:")&&Wb(b)>M)throw new G("maxContentLength size of "+M+" exceeded",G.ERR_BAD_RESPONSE,v,W);if(ne&&x!=="get"&&x!=="head"){const te=await h(w);if(typeof te=="number"&&isFinite(te)&&(se=te,te>L))throw Ce()}const de=ne&&(D.isReadableStream(w)||D.isStream(w)),Pe=(te,He,gt)=>lc(te,cc,Ct=>{if(ne&&Ct>L)throw ye=Ce();He&&He(Ct)},gt);if(p&&x!=="get"&&x!=="head"&&(F||de)){if(se=se??await y(P,w),se!==0||de){let te=new i(b,{method:"POST",body:w,duplex:"half"}),He;if(D.isFormData(w)&&(He=te.headers.get("content-type"))&&P.setContentType(He),te.body){const[gt,Ct]=F&&sc(se,Di(ic(F)))||[];w=Pe(te.body,gt,Ct)}}}else if(de&&!c&&d&&x!=="get"&&x!=="head")w=Pe(w);else if(de&&c&&!p&&x!=="get"&&x!=="head")throw new G("Stream request bodies are not supported by the current fetch implementation",G.ERR_NOT_SUPPORT,v,W);D.isString(V)||(V=V?"include":"omit");const pe=c&&"credentials"in i.prototype;if(D.isFormData(w)){const te=P.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&P.delete("content-type")}P.set("User-Agent","axios/"+Za,!1);const Bt={...R,signal:ee,method:x.toUpperCase(),headers:of(P.normalize()),body:w,duplex:"half",credentials:pe?V:void 0};W=c&&new i(b,Bt);let Me=await(c?J(W,R):J(b,Bt));const St=dt.from(Me.headers);if(Z){const te=D.toFiniteNumber(St.getContentLength());if(te!=null&&te>M)throw new G("maxContentLength size of "+M+" exceeded",G.ERR_BAD_RESPONSE,v,W)}const rt=m&&(k==="stream"||k==="response");if(m&&Me.body&&(j||Z||rt&&X)){const te={};["status","statusText","headers"].forEach(jt=>{te[jt]=Me[jt]});const He=D.toFiniteNumber(St.getContentLength()),[gt,Ct]=j&&sc(He,Di(ic(j),!0))||[];let mt=0;const ar=jt=>{if(Z&&(mt=jt,mt>M))throw new G("maxContentLength size of "+M+" exceeded",G.ERR_BAD_RESPONSE,v,W);gt&>(jt)};Me=new o(lc(Me.body,cc,ar,()=>{Ct&&Ct(),X&&X()}),te)}k=k||"text";let Be=await _[D.findKey(_,k)||"text"](Me,v);if(Z&&!m&&!rt){let te;if(Be!=null&&(typeof Be.byteLength=="number"?te=Be.byteLength:typeof Be.size=="number"?te=Be.size:typeof Be=="string"&&(te=typeof n=="function"?new n().encode(Be).byteLength:Be.length)),typeof te=="number"&&te>M)throw new G("maxContentLength size of "+M+" exceeded",G.ERR_BAD_RESPONSE,v,W)}return!rt&&X&&X(),await new Promise((te,He)=>{gf(te,He,{data:Be,headers:dt.from(Me.headers),status:Me.status,statusText:Me.statusText,config:v,request:W})})}catch(K){if(X&&X(),ee&&ee.aborted&&ee.reason instanceof G){const le=ee.reason;throw le.config=v,W&&(le.request=W),K!==le&&(le.cause=K),le}throw ye?(W&&!ye.request&&(ye.request=W),ye):K instanceof G?(W&&!K.request&&(K.request=W),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new G("Network Error",G.ERR_NETWORK,v,W,K&&K.response),{cause:K.cause||K}):G.from(K,K&&K.code,v,W,K&&K.response)}}},Yb=new Map,vf=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,u,d=Yb;for(;a--;)c=i[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:Gb(t)),d=u;return u};vf();const Ja={http:cb,xhr:Bb,fetch:{get:vf}};D.forEach(Ja,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const fc=e=>`- ${e}`,Xb=e=>D.isFunction(e)||e===null||e===!1;function Zb(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,!Xb(n)&&(s=Ja[(a=String(n)).toLowerCase()],s===void 0))throw new G(`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,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
|
|
451
451
|
`+o.map(fc).join(`
|
|
452
|
-
`):" "+fc(o[0]):"as no adapter specified";throw new
|
|
452
|
+
`):" "+fc(o[0]):"as no adapter specified";throw new G("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const bf={getAdapter:Zb,adapters:Ja};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fs(null,e)}function hc(e){return vo(e),e.headers=dt.from(e.headers),e.data=yo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),bf.getAdapter(e.adapter||Ls.adapter,e)(e).then(function(n){vo(e),e.response=n;try{n.data=yo.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=dt.from(n.headers),n},function(n){if(!pf(n)&&(vo(e),n&&n.response)){e.response=n.response;try{n.response.data=yo.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=dt.from(n.response.headers)}return Promise.reject(n)})}const Ki={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ki[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const pc={};Ki.transitional=function(t,r,n){function s(i,o){return"[Axios v"+Za+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new G(s(o," has been removed"+(r?" in "+r:"")),G.ERR_DEPRECATED);return r&&!pc[o]&&(pc[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}};Ki.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Jb(e,t,r){if(typeof e!="object")throw new G("options must be an object",G.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 G("option "+i+" must be "+c,G.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new G("Unknown option "+i,G.ERR_BAD_OPTION)}}const li={assertOptions:Jb,validators:Ki},st=li.validators;let Jr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new rc,response:new rc}}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=rn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&li.assertOptions(n,{silentJSONParsing:nt.transitional(nt.boolean),forcedJSONParsing:nt.transitional(nt.boolean),clarifyTimeoutError:nt.transitional(nt.boolean),legacyInterceptorReqResOrdering:nt.transitional(nt.boolean),advertiseZstdAcceptEncoding:nt.transitional(nt.boolean),validateStatusUndefinedResolves:nt.transitional(nt.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:li.assertOptions(s,{encode:nt.function,serialize:nt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),li.assertOptions(r,{baseUrl:nt.spelling("baseURL"),withXsrfToken:nt.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"],b=>{delete i[b]}),r.headers=ut.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||Ya;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,m;if(!c){const b=[hc.bind(this),void 0];for(b.unshift(...a),b.push(...u),m=b.length,d=Promise.resolve(r);f<m;)d=d.then(b[f++],b[f++]);return d}m=a.length;let g=r;for(;f<m;){const b=a[f++],h=a[f++];try{g=b(g)}catch(y){h.call(this,y);break}}try{d=hc.call(this,g)}catch(b){return Promise.reject(b)}for(f=0,m=u.length;f<m;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=rn(this.defaults,t);const r=mf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return df(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){Jr.prototype[t]=function(r,n){return this.request(rn(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(rn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Jr.prototype[t]=r(),t!=="query"&&(Jr.prototype[t+"Form"]=r(!0))});let jb=class _f{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 Fs(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 _f(function(s){t=s}),cancel:t}}};function kb(e){return function(r){return e.apply(null,r)}}function Ab(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 wf(e){const t=new Jr(e),r=Yd(Jr.prototype.request,t);return D.extend(r,Jr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return wf(rn(e,s))},r}const Fe=wf(Ls);Fe.Axios=Jr;Fe.CanceledError=Fs;Fe.CancelToken=jb;Fe.isCancel=pf;Fe.VERSION=Za;Fe.toFormData=Wi;Fe.AxiosError=Q;Fe.Cancel=Fe.CanceledError;Fe.all=function(t){return Promise.all(t)};Fe.spread=kb;Fe.isAxiosError=Ab;Fe.mergeConfig=rn;Fe.AxiosHeaders=ut;Fe.formToJSON=e=>hf(D.isHTMLForm(e)?new FormData(e):e);Fe.getAdapter=bf.getAdapter;Fe.HttpStatusCode=fa;Fe.default=Fe;const{Axios:zj,AxiosError:qj,CanceledError:Hj,isCancel:Wj,CancelToken:Kj,VERSION:Qj,all:Gj,Cancel:Yj,isAxiosError:Xj,spread:Zj,toFormData:Jj,AxiosHeaders:ek,HttpStatusCode:tk,formToJSON:rk,getAdapter:nk,mergeConfig:sk,create:ik}=Fe;let ha="";function xf(e){ha=e}const $e=Fe.create({timeout:3e4});$e.interceptors.request.use(async e=>{var s,i;const{useEditorStore:t}=await Promise.resolve().then(()=>Wd),n=(i=(s=t.getState().editorConfig)==null?void 0:s.context)==null?void 0:i.authToken;return n&&(e.headers=e.headers??{},e.headers.Authorization=`Bearer ${n}`),ha&&(e.baseURL=ha),e});function Sf(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(u=>Sf(u,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 Pb(e){var s,i,o,a,c,u,d;const t=await $e.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)||((u=(c=t.data)==null?void 0:c.params)==null?void 0:u.err)||((d=t.data)==null?void 0:d.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Sf(r);return{content:r,rootNode:n}}async function Mb(e,t,r,n){await $e.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})}async function Lb(e){await $e.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:""}}})}async function Fb(e){var r,n;return(n=(r=(await $e.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function $b(e,t){await $e.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Bb="_overlay_109ur_1",Vb="_modal_109ur_11",Ub="_modalHeader_109ur_23",zb="_modalHeaderClose_109ur_33",qb="_modalBody_109ur_51",Hb="_modalFooter_109ur_58",Wb="_checkRow_109ur_65",Kb="_checkIcon_109ur_74",Qb="_pass_109ur_84",Gb="_fail_109ur_88",Yb="_divider_109ur_92",Xb="_errorBanner_109ur_98",Zb="_formGroup_109ur_108",Jb="_textarea_109ur_119",e_="_sliderGroup_109ur_140",t_="_sliderValue_109ur_152",r_="_sliderLabels_109ur_160",n_="_sectionTitle_109ur_168",ye={overlay:Bb,modal:Vb,modalHeader:Ub,modalHeaderClose:zb,modalBody:qb,modalFooter:Hb,checkRow:Wb,checkIcon:Kb,pass:Qb,fail:Gb,divider:Yb,errorBanner:Xb,formGroup:Zb,textarea:Jb,sliderGroup:e_,sliderValue:t_,sliderLabels:r_,sectionTitle:n_};function s_(){return l.jsx("span",{className:`${ye.checkIcon} ${ye.pass}`,"aria-label":"passed",children:"✓"})}function i_(){return l.jsx("span",{className:`${ye.checkIcon} ${ye.fail}`,"aria-label":"failed",children:"✗"})}const o_=({contentId:e,onConfirm:t,onCancel:r})=>{const[n,s]=p.useState(!1),i=Te(b=>b.treeData),o=Se(b=>b.publishChecklist)??[],[a,c]=p.useState({}),u=o.every(b=>a[b.code]),d=p.useMemo(()=>{var N,j,F,k,M,q;const b=i[0],h=!!(b!=null&&b.name&&b.name.trim().length>0),y=!!((N=b==null?void 0:b.description)!=null&&N.trim()||(F=(j=b==null?void 0:b.metadata)==null?void 0:j.description)!=null&&F.trim()),v=!!(b!=null&&b.appIcon||(k=b==null?void 0:b.metadata)!=null&&k.appIcon),_=(b==null?void 0:b.children)??[],x=_.some(R=>R.isFolder);function w(R){for(const P of R)if(!P.isFolder||P.children&&w(P.children))return!0;return!1}const S=w(_),O=!!((q=(M=b==null?void 0:b.metadata)==null?void 0:M.license)!=null&&q.trim());return[{label:"Root node has a title and description",passed:h&&y,critical:!0},{label:"Root node has an app icon",passed:v,critical:!0},{label:"At least one unit exists",passed:x,critical:!0},{label:"At least one content item added",passed:S,critical:!0},{label:"License field is set",passed:O,critical:!0}]},[i]),f=d.every(b=>!b.critical||b.passed)&&u,m=d.filter(b=>!b.passed).length,g=async()=>{s(!0);try{await Lb(e),Le.success("Content published successfully"),t()}catch(b){const h=b instanceof Error?b.message:"Failed to publish content";Le.error(h)}finally{s(!1)}};return l.jsx("div",{className:ye.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:ye.modal,children:[l.jsxs("div",{className:ye.modalHeader,children:[l.jsx("span",{id:"publish-modal-title",children:"Publish Checklist"}),l.jsx("button",{className:ye.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsxs("div",{className:ye.modalBody,children:[l.jsx("p",{className:ye.sectionTitle,children:"Pre-publish validation"}),d.map(b=>l.jsxs("div",{className:ye.checkRow,children:[b.passed?l.jsx(s_,{}):l.jsx(i_,{}),l.jsx("span",{children:b.label})]},b.label)),o.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:ye.divider}),l.jsx("p",{className:ye.sectionTitle,children:"Reviewer confirmation"}),o.map(b=>l.jsxs("label",{className:ye.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!a[b.code],disabled:n,onChange:h=>c(y=>({...y,[b.code]:h.target.checked}))}),l.jsx("span",{children:b.label})]},b.code))]}),m>0&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:ye.divider}),l.jsx("div",{className:ye.errorBanner,children:m===1?"1 check failed. Please resolve it before publishing.":`${m} checks failed. Please resolve them before publishing.`})]})]}),l.jsxs("div",{className:ye.modalFooter,children:[l.jsx(je,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(je,{variant:"primary",onClick:g,disabled:!f||n,isLoading:n,children:n?"Publishing…":"Publish"})]})]})})},a_=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",u=c?"Review Quality":"Reject Content",d=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:ye.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:ye.modal,children:[l.jsxs("div",{className:ye.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:u}),l.jsx("button",{className:ye.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:ye.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ye.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:ye.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:m=>a(Number(m.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:ye.sliderValue,children:o})]}),l.jsxs("div",{className:ye.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:ye.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:ye.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:m=>i(m.target.value),rows:4})]})]}):l.jsxs("div",{className:ye.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:ye.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:m=>i(m.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:ye.modalFooter,children:[l.jsx(je,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(je,{variant:c?"primary":"danger",onClick:f,disabled:d,children:c?"Approve":"Reject"})]})]})})},Cf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function l_(e,t={}){var s,i,o;const r={"organisations.roles":"CONTENT_CREATOR"};return t.rootOrgId&&(r.rootOrgId=t.rootOrgId),((o=(i=(s=(await $e.post("/api/user/v1/search",{request:{query:e,filters:r,fields:Cf,offset:0,limit:t.limit??20}})).data)==null?void 0:s.result)==null?void 0:i.response)==null?void 0:o.content)??[]}async function c_(e){var r,n,s;return e.length?((s=(n=(r=(await $e.post("/api/user/v1/search",{request:{filters:{userId:e},fields:Cf,limit:e.length}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}const u_="_container_1cpb1_1",d_="_header_1cpb1_13",f_="_title_1cpb1_22",h_="_closeBtn_1cpb1_29",p_="_body_1cpb1_45",g_="_label_1cpb1_54",m_="_searchSection_1cpb1_62",y_="_searchRow_1cpb1_68",v_="_searchInput_1cpb1_74",b_="_searchSpinner_1cpb1_89",__="_resultsList_1cpb1_105",w_="_resultItem_1cpb1_118",x_="_userInfo_1cpb1_133",S_="_userName_1cpb1_141",C_="_userEmail_1cpb1_150",E_="_noResults_1cpb1_158",O_="_collabSection_1cpb1_165",D_="_sectionTitle_1cpb1_170",T_="_badge_1cpb1_180",I_="_emptyCollab_1cpb1_194",N_="_collabList_1cpb1_205",R_="_collabItem_1cpb1_214",j_="_userAvatar_1cpb1_228",k_="_error_1cpb1_242",A_="_success_1cpb1_248",P_="_footer_1cpb1_254",we={container:u_,header:d_,title:f_,closeBtn:h_,body:p_,label:g_,searchSection:m_,searchRow:y_,searchInput:v_,searchSpinner:b_,resultsList:__,resultItem:w_,userInfo:x_,userName:S_,userEmail:C_,noResults:E_,collabSection:O_,sectionTitle:D_,badge:T_,emptyCollab:I_,collabList:N_,collabItem:R_,userAvatar:j_,error:k_,success:A_,footer:P_},M_=({contentId:e,onClose:t})=>{const[r,n]=p.useState(""),[s,i]=p.useState([]),[o,a]=p.useState(!1),[c,u]=p.useState([]),[d,f]=p.useState(!1),[m,g]=p.useState(""),[b,h]=p.useState(!1),y=p.useRef(null);p.useEffect(()=>{let S=!1;return(async()=>{try{const O=await Fb(e),N=(O==null?void 0:O.collaborators)??[];if(!N.length)return;const j=await c_(N);if(S)return;const F=N.map(k=>j.find(M=>M.identifier===k)??{identifier:k,firstName:k});u(F)}catch{}})(),()=>{S=!0}},[e]),p.useEffect(()=>{y.current&&clearTimeout(y.current);const S=r.trim();if(S.length<2){i([]);return}return y.current=setTimeout(async()=>{a(!0);try{const O=await l_(S),N=new Set(c.map(j=>j.identifier));i(O.filter(j=>!N.has(j.identifier)))}catch{i([])}finally{a(!1)}},300),()=>{y.current&&clearTimeout(y.current)}},[r,c]);const v=p.useCallback(S=>{u(O=>O.find(N=>N.identifier===S.identifier)?O:[...O,S]),i(O=>O.filter(N=>N.identifier!==S.identifier)),h(!1)},[]),_=p.useCallback(S=>{u(O=>O.filter(N=>N.identifier!==S)),h(!1)},[]),x=p.useCallback(async()=>{f(!0),g(""),h(!1);try{await $b(e,c.map(S=>S.identifier)),h(!0)}catch{g("Failed to save collaborators. Please try again.")}finally{f(!1)}},[e,c]),w=S=>`${S.firstName}${S.lastName?` ${S.lastName}`:""}`;return l.jsxs("div",{className:we.container,children:[l.jsxs("div",{className:we.header,children:[l.jsx("h2",{className:we.title,children:"Manage Collaborators"}),l.jsx("button",{className:we.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:we.body,children:[l.jsxs("div",{className:we.searchSection,children:[l.jsx("label",{className:we.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:we.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:we.searchInput,placeholder:"Search by name or email...",value:r,onChange:S=>n(S.target.value)}),o&&l.jsx("span",{className:we.searchSpinner,"aria-label":"Searching..."})]}),s.length>0&&l.jsx("ul",{className:we.resultsList,role:"listbox","aria-label":"Search results",children:s.map(S=>l.jsxs("li",{className:we.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:we.userInfo,children:[l.jsx("span",{className:we.userName,children:w(S)}),S.email&&l.jsx("span",{className:we.userEmail,children:S.email})]}),l.jsx(je,{variant:"primary",size:"sm",onClick:()=>v(S),children:"Add"})]},S.identifier))}),r.trim().length>=2&&!o&&s.length===0&&l.jsx("p",{className:we.noResults,children:"No users found."})]}),l.jsxs("div",{className:we.collabSection,children:[l.jsxs("h3",{className:we.sectionTitle,children:["Current Collaborators",c.length>0&&l.jsx("span",{className:we.badge,children:c.length})]}),c.length===0?l.jsx("p",{className:we.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:we.collabList,children:c.map(S=>l.jsxs("li",{className:we.collabItem,children:[l.jsx("div",{className:we.userAvatar,"aria-hidden":"true",children:w(S).charAt(0).toUpperCase()}),l.jsxs("div",{className:we.userInfo,children:[l.jsx("span",{className:we.userName,children:w(S)}),S.email&&l.jsx("span",{className:we.userEmail,children:S.email})]}),l.jsx(je,{variant:"danger",size:"sm",onClick:()=>_(S.identifier),children:"Remove"})]},S.identifier))})]}),m&&l.jsx("p",{className:we.error,role:"alert",children:m}),b&&l.jsx("p",{className:we.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:we.footer,children:[l.jsx(je,{variant:"ghost",onClick:t,disabled:d,children:"Cancel"}),l.jsx(je,{variant:"primary",isLoading:d,onClick:x,children:"Save"})]})]})};async function L_(e){return(await $e.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function F_(e,t){var n,s;return((s=(n=(await $e.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:n.result)==null?void 0:s.processId)??""}async function $_(e){var r;return((r=(await $e.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}const B_="_topbar_1k1pv_1",V_="_left_1k1pv_15",U_="_right_1k1pv_23",z_="_backBtn_1k1pv_30",q_="_title_1k1pv_49",H_="_statusChip_1k1pv_61",W_="_savedIndicator_1k1pv_73",K_="_unsaved_1k1pv_83",Q_="_iconBtn_1k1pv_87",G_="_iconBtnLabel_1k1pv_114",Y_="_qrDropdown_1k1pv_118",X_="_qrMenu_1k1pv_122",Z_="_reviewBtns_1k1pv_157",J_="_sourcingBtns_1k1pv_166",ew="_modalOverlay_1k1pv_175",tw="_sbOverlay_1k1pv_185",rw="_sbModal_1k1pv_195",nw="_sbModalHeader_1k1pv_206",sw="_sbModalTitle_1k1pv_214",iw="_sbModalClose_1k1pv_221",ow="_sbModalBody_1k1pv_234",aw="_sbLabel_1k1pv_241",lw="_sbTextarea_1k1pv_248",cw="_sbError_1k1pv_265",uw="_sbModalFooter_1k1pv_272",de={topbar:B_,left:V_,right:U_,backBtn:z_,title:q_,statusChip:H_,savedIndicator:W_,unsaved:K_,iconBtn:Q_,iconBtnLabel:G_,qrDropdown:Y_,qrMenu:X_,reviewBtns:Z_,sourcingBtns:J_,modalOverlay:ew,sbOverlay:tw,sbModal:rw,sbModalHeader:nw,sbModalTitle:sw,sbModalClose:iw,sbModalBody:ow,sbLabel:aw,sbTextarea:lw,sbError:cw,sbModalFooter:uw};function dw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function fw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const hw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState("");return l.jsx("div",{className:de.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"sendback-title",children:l.jsxs("div",{className:de.sbModal,children:[l.jsxs("div",{className:de.sbModalHeader,children:[l.jsx("span",{id:"sendback-title",className:de.sbModalTitle,children:"Send Back for Corrections"}),l.jsx("button",{className:de.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:de.sbModalBody,children:[l.jsxs("label",{className:de.sbLabel,htmlFor:"sendback-comment",children:["Comment ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"sendback-comment",className:de.sbTextarea,placeholder:"Describe what needs to be corrected…",value:r,onChange:s=>n(s.target.value),rows:4,required:!0,"aria-required":"true"}),r.trim().length===0&&l.jsx("p",{className:de.sbError,children:"A comment is required."})]}),l.jsxs("div",{className:de.sbModalFooter,children:[l.jsx(je,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(je,{variant:"primary",onClick:()=>e(r.trim()),disabled:r.trim().length===0,children:"Send Back"})]})]})})},pw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=1&&s<=250;return l.jsx("div",{className:de.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:de.sbModal,children:[l.jsxs("div",{className:de.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:de.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:de.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:de.sbModalBody,children:[l.jsxs("label",{className:de.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:1,max:250,className:de.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (1–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:de.sbError,children:"Enter a number between 1 and 250."})]}),l.jsxs("div",{className:de.sbModalFooter,children:[l.jsx(je,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(je,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},gw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,onToolbarEvent:s})=>{var H,J;const o=Te(G=>G.treeData)[0],a=(o==null?void 0:o.name)??"Untitled",c=fw(((H=o==null?void 0:o.metadata)==null?void 0:H.status)??(o==null?void 0:o.status)),u=Se(G=>{var se,ue,X,ve;return((ue=(se=G.editorConfig)==null?void 0:se.context)==null?void 0:ue.contentId)??((ve=(X=G.editorConfig)==null?void 0:X.context)==null?void 0:ve.identifier)??""}),{activeModal:d,modalData:f,closeModal:m,openModal:g}=ky(),[b,h]=p.useState(!1),[y,v]=p.useState(!1),_=p.useRef(null),[x,w]=p.useState(!1);p.useEffect(()=>{if(!y)return;const G=se=>{var ue;(ue=_.current)!=null&&ue.contains(se.target)||v(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[y]);const[S,O]=p.useState(!1),[N,j]=p.useState(!1),{updateNode:F}=Te(),k=(J=o==null?void 0:o.metadata)==null?void 0:J.qrCodeProcessId,M=p.useCallback(async G=>{if(u){w(!1),O(!0);try{const se=await F_(u,G);se&&o&&F(o.id,{qrCodeProcessId:se}),ht.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{ht.error("Failed to generate QR Codes. Please try again.")}finally{O(!1)}}},[u,o,F]),q=p.useCallback(async()=>{if(!k){ht.error("No QR codes generated yet. Generate QR Codes first.");return}j(!0);try{const se=(await $_(k)).zipFileName;if(se){const ue=document.createElement("a");ue.href=se,ue.download="qrcodes.zip",ue.target="_blank",document.body.appendChild(ue),ue.click(),document.body.removeChild(ue)}else ht.error("QR Codes not ready yet. Please wait and try again.")}catch{ht.error("Failed to download QR Codes.")}finally{j(!1)}},[k]),R=e==="edit",P=e==="review",L=e==="sourcingreview",ee=e==="read",Y=p.useCallback((G,se)=>{s({action:G,data:se})},[s]),z=p.useCallback(()=>{m(),Y("publish")},[m,Y]),te=p.useCallback((G,se)=>{const ue=f==null?void 0:f.action;m(),ue==="approve"?Y("sourcingApprove",{comment:G,score:se}):Y("reject",{comment:G})},[m,Y,f]),ie=p.useCallback(G=>{h(!1),Y("sendBackForCorrections",{comment:G})},[Y]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:de.topbar,role:"banner",children:[l.jsxs("div",{className:de.left,children:[l.jsx("button",{className:de.backBtn,onClick:()=>Y("back"),"aria-label":"Go back",type:"button",children:l.jsx(Jm,{size:18})}),l.jsx("h1",{className:de.title,title:a,children:a}),l.jsx("span",{className:`sbx-chip ${de.statusChip}`,"aria-label":`Status: ${c}`,children:c})]}),l.jsxs("div",{className:de.right,children:[t?l.jsx("span",{className:de.savedIndicator,"aria-live":"polite",children:"Saving…"}):n?l.jsxs("span",{className:de.savedIndicator,"aria-live":"polite",children:[l.jsx(Un,{size:14,"aria-hidden":"true"}),"Saved ",dw(n)]}):r?l.jsx("span",{className:`${de.savedIndicator} ${de.unsaved}`,"aria-live":"polite",children:"Unsaved changes"}):null,!ee&&l.jsx(je,{variant:"ghost",size:"sm",onClick:()=>Y("saveCollection"),children:"Save as Draft"}),R&&l.jsxs(l.Fragment,{children:[l.jsxs(je,{variant:"primary",size:"sm",onClick:()=>Y("sendForReview"),children:[l.jsx(gy,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:de.iconBtn,onClick:()=>g("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(vy,{size:16,"aria-hidden":"true"})}),l.jsxs("div",{className:de.qrDropdown,ref:_,children:[l.jsxs("button",{className:de.iconBtn,onClick:()=>v(G=>!G),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":y,children:[l.jsx(Ul,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:de.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),y&&l.jsxs("div",{className:de.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{v(!1),w(!0)},disabled:S,children:[l.jsx(Ul,{size:14}),S?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{v(!1),q()},disabled:N||!k,children:[l.jsx(ny,{size:14}),N?"Downloading…":"Download QR Codes"]})]})]})]}),P&&l.jsxs("div",{className:de.reviewBtns,children:[l.jsxs(je,{variant:"primary",size:"sm",onClick:()=>g("publishChecklist"),children:[l.jsx($d,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(je,{variant:"danger",size:"sm",onClick:()=>g("qualityParams",{action:"reject"}),children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>h(!0),children:[l.jsx(hy,{size:14,"aria-hidden":"true"})," Send Back"]})]}),L&&l.jsxs("div",{className:de.sourcingBtns,children:[l.jsxs(je,{variant:"primary",size:"sm",onClick:()=>g("qualityParams",{action:"approve"}),children:[l.jsx(my,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(je,{variant:"danger",size:"sm",onClick:()=>g("qualityParams",{action:"reject"}),children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),d==="publishChecklist"&&l.jsx(o_,{contentId:u,onConfirm:z,onCancel:m}),d==="qualityParams"&&l.jsx(a_,{contentId:u,action:(f==null?void 0:f.action)??"reject",onConfirm:te,onCancel:m}),d==="manageCollaborators"&&l.jsx("div",{className:de.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(M_,{contentId:u,onClose:m})}),b&&l.jsx(hw,{onConfirm:ie,onCancel:()=>h(!1)}),x&&l.jsx(pw,{onConfirm:M,onCancel:()=>w(!1)})]})};var mw=Wa();const Ef=p.createContext(null);function xt(){const e=p.useContext(Ef);if(e===null)throw new Error("No Tree Api Provided");return e}const Of=p.createContext(null);function yw(){const e=p.useContext(Of);if(e===null)throw new Error("Provide a NodesContext");return e}const Df=p.createContext(null);function vw(){const e=p.useContext(Df);if(e===null)throw new Error("Provide a DnDContext");return e}const Tf=p.createContext(0);function If(){p.useContext(Tf)}function ci(e,t,r){return Math.max(Math.min(e,r),t)}function Nf(e){return e&&e.isLeaf}function Rf(e){return e&&e.isInternal&&!e.isOpen}function jf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const kf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Af=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function el(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=el(r,t);if(n)return n}return null}function Ii(e,t){if(t(e),e.children)for(let r of e.children)Ii(r,t)}function Pf(e){const t=Lf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=bw(t,n);break}r==null||r.focus()}function Mf(e){const t=Lf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=_w(t,n);break}r==null||r.focus()}function bw(e,t){return t+1<e.length?e[t+1]:e[0]}function _w(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Lf(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 is(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function vn(e){return typeof e=="string"?e:e.id}function ww(e,...t){if(e)return e(...t)}function Ff(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function $f(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 Bf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const xw=Object.freeze(Object.defineProperty({__proto__:null,access:is,bound:ci,dfs:el,focusNextElement:Pf,focusPrevElement:Mf,getInsertIndex:$f,getInsertParentId:Bf,identify:vn,indexOf:Af,isClosed:Rf,isDescendant:kf,isItem:Nf,isOpenWithEmptyChildren:jf,safeRun:ww,waitFor:Ff,walk:Ii},Symbol.toStringTag,{value:"Module"})),Sw={display:"flex",alignItems:"center",zIndex:1},Cw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Ew={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Ow=p.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({},Sw),s),children:[l.jsx("div",{style:Object.assign({},Ew)}),l.jsx("div",{style:Object.assign({},Cw)})]})});function Dw({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 Tw(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(Nw,Object.assign({},e)):l.jsx(Iw,Object.assign({},e))]})}function Iw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function Nw({node:e}){const t=p.useRef();return p.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 _s="__REACT_ARBORIST_INTERNAL_ROOT__";function gc(e){var t;function r(i,o,a){const c=e.accessId(i),u=new ws({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),d=e.accessChildren(i);return d&&(u.children=d.map(f=>r(f,o+1,u))),u}const n=new ws({tree:e,id:_s,data:{id:_s},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 ws{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===_s}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 ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function bo(e){return{type:"EDIT",id:e}}function Rw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function cn(e){return{type:"FOCUS",id:e}}function jw(){return{type:"TREE_BLUR"}}function kw(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 pa={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 mc(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 Aw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:mc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:mc(e.unfiltered,t)}):e}const Ln=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}}},vr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:vn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(vn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(vn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:vn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:vn(e)})};function Pw(e=Ln().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 Fn={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 Mw(e=Ln().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 Ln().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Lw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Fw=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 Vf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(Bw,{isDragging:s,children:[l.jsx(Vw,{offset:e,children:l.jsx(zw,{id:r,dragIds:n})}),l.jsx(Uw,{mouse:t,count:n.length})]})}const Bw=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Lw,children:t.children}):null});function Vw(e){return l.jsx("div",{className:"row preview",style:Fw(e.offset),children:e.children})}function Uw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:$w(r),children:t}):null}const zw=p.memo(function(t){const r=xt(),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 ga(){return ga=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},ga.apply(null,arguments)}function yc(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 qw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ma(e,t)}var vc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Hw(e,t){return!!(e===t||vc(e)&&vc(t))}function Ww(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Hw(e[r],t[r]))return!1;return!0}function _o(e,t){t===void 0&&(t=Ww);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 Kw=typeof performance=="object"&&typeof performance.now=="function",bc=Kw?function(){return performance.now()}:function(){return Date.now()};function _c(e){cancelAnimationFrame(e.id)}function Qw(e,t){var r=bc();function n(){bc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var wo=-1;function wc(e){if(e===void 0&&(e=!1),wo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),wo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return wo}var un=null;function xc(e){if(e===void 0&&(e=!1),un===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?un="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?un="negative":un="positive-ascending"),document.body.removeChild(t),un}return un}process.env.NODE_ENV;var Gw=150,Yw=function(t,r){return t},ui=null,di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ui=new WeakSet,di=new WeakSet);function Uf(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=function(f){qw(m,f);function m(b){var h;return h=f.call(this,b)||this,h._instanceProps=c(h.props,yc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:yc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=_o(function(y,v,_,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:_,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=_o(function(y,v,_){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:_})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,_=v.direction,x=v.itemSize,w=v.layout,S=h._getItemStyleCache(u&&x,u&&w,u&&_),O;if(S.hasOwnProperty(y))O=S[y];else{var N=r(h.props,y,h._instanceProps),j=s(h.props,y,h._instanceProps),F=_==="horizontal"||w==="horizontal",k=_==="rtl",M=F?N:0;S[y]=O={position:"absolute",left:k?void 0:M,right:k?M:void 0,top:F?0:N,height:F?"100%":j,width:F?j:"100%"}}return O},h._getItemStyleCache=void 0,h._getItemStyleCache=_o(function(y,v,_){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,_=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(S){if(S.scrollOffset===x)return null;var O=h.props.direction,N=x;if(O==="rtl")switch(xc()){case"negative":N=-x;break;case"positive-descending":N=w-_-x;break}return N=Math.max(0,Math.min(N,w-_)),{isScrolling:!0,scrollDirection:S.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,_=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(S){if(S.scrollOffset===w)return null;var O=Math.max(0,Math.min(w,x-_));return{isScrolling:!0,scrollDirection:S.scrollOffset<O?"forward":"backward",scrollOffset:O,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&_c(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Qw(h._resetIsScrolling,Gw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,y){return Xw(h,y),d(h),null};var g=m.prototype;return g.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,_=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,_-1));var S=0;if(this._outerRef){var O=this._outerRef;x==="vertical"?S=O.scrollWidth>O.clientWidth?wc():0:S=O.scrollHeight>O.clientHeight?wc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,S))},g.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,_=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||_==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,_=this.state,x=_.scrollOffset,w=_.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var S=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(xc()){case"negative":S.scrollLeft=-x;break;case"positive-ascending":S.scrollLeft=x;break;default:var O=S.clientWidth,N=S.scrollWidth;S.scrollLeft=N-O-x;break}else S.scrollLeft=x;else S.scrollTop=x}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&_c(this._resetIsScrollingTimeoutId)},g.render=function(){var h=this.props,y=h.children,v=h.className,_=h.direction,x=h.height,w=h.innerRef,S=h.innerElementType,O=h.innerTagName,N=h.itemCount,j=h.itemData,F=h.itemKey,k=F===void 0?Yw:F,M=h.layout,q=h.outerElementType,R=h.outerTagName,P=h.style,L=h.useIsScrolling,ee=h.width,Y=this.state.isScrolling,z=_==="horizontal"||M==="horizontal",te=z?this._onScrollHorizontal:this._onScrollVertical,ie=this._getRangeToRender(),H=ie[0],J=ie[1],G=[];if(N>0)for(var se=H;se<=J;se++)G.push(p.createElement(y,{data:j,key:k(se,j),index:se,isScrolling:L?Y:void 0,style:this._getItemStyle(se)}));var ue=n(this.props,this._instanceProps);return p.createElement(q||R||"div",{className:v,onScroll:te,ref:this._outerRefSetter,style:ga({position:"relative",height:x,width:ee,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},P)},p.createElement(S||O||"div",{children:G,ref:w,style:{height:z?"100%":ue,pointerEvents:Y?"none":void 0,width:z?ue:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],_=y[1],x=y[2],w=y[3];this._callOnItemsRendered(v,_,x,w)}}if(typeof this.props.onScroll=="function"){var S=this.state,O=S.scrollDirection,N=S.scrollOffset,j=S.scrollUpdateWasRequested;this._callOnScroll(O,N,j)}},g._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,_=this.state,x=_.isScrolling,w=_.scrollDirection,S=_.scrollOffset;if(y===0)return[0,0,0,0];var O=o(this.props,S,this._instanceProps),N=a(this.props,O,S,this._instanceProps),j=!x||w==="backward"?Math.max(1,v):1,F=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,O-j),Math.max(0,Math.min(y-1,N+F)),O,N]},m}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Xw=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,d=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&di&&!di.has(d)&&(di.add(d),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":ui&&!ui.has(d)&&(ui.add(d),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},Zw=50,_n=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var u=o[a];c=u.offset+u.size}for(var d=a+1;d<=r;d++){var f=i(d);o[d]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},Jw=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?zf(t,r,i,0,n):ex(t,r,Math.max(0,i),n)},zf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=_n(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},ex=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&_n(t,n,r).offset<s;)n+=o,o*=2;return zf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Sc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var u=n-o-1,d=u*i;return a+d},tx=Uf({getItemOffset:function(t,r,n){return _n(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Sc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.layout,d=t.width,f=a==="horizontal"||u==="horizontal",m=f?d:c,g=_n(t,r,i),b=Sc(t,i),h=Math.max(0,Math.min(b-m,g.offset)),y=Math.max(0,g.offset-m+g.size+o);switch(n==="smart"&&(s>=y-m&&s<=h+m?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return Jw(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,u=t.width,d=i==="horizontal"||c==="horizontal",f=d?u:o,m=_n(t,r,s),g=n+f,b=m.offset+m.size,h=r;h<a-1&&b<g;)h++,b+=_n(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||Zw,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.'))}}),rx=Uf({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.itemCount,d=t.itemSize,f=t.layout,m=t.width,g=a==="horizontal"||f==="horizontal",b=g?m:c,h=Math.max(0,u*d-b),y=Math.min(h,r*d),v=Math.max(0,r*d-b+d+o);switch(n==="smart"&&(s>=v-b&&s<=y+b?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var _=Math.round(v+(y-v)/2);return _<Math.ceil(b/2)?0:_>h+Math.floor(b/2)?h:_}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,m=d?u:i,g=Math.ceil((m+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 nx(){var e,t;const r=xt(),s=vw().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 sx=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 ix=p.forwardRef(function(t,r){const{children:n}=t,s=sx(t,["children"]),i=xt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(ox,{}),n]}))}),ox=()=>{const e=xt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(nx,{})})};var ax=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 lx=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=ax(t,["style"]);const u=xt(),d=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=u.props.padding)!==null&&i!==void 0?i:u.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+f}px`})},c))});var qf=p.createContext({dragDropManager:void 0}),$t;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})($t||($t={}));function oe(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 tl="dnd-core/INIT_COORDS",Qi="dnd-core/BEGIN_DRAG",rl="dnd-core/PUBLISH_DRAG_SOURCE",Gi="dnd-core/HOVER",Yi="dnd-core/DROP",Xi="dnd-core/END_DRAG";function Cc(e,t){return{type:tl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}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 cx(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function ux(e,t){return e.filter(function(r){return r!==t})}function Hf(e){return fi(e)==="object"}function dx(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 fx(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var hx={type:tl,payload:{clientOffset:null,sourceClientOffset:null}};function px(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),u=e.getRegistry();e.dispatch(Cc(o)),gx(r,c,u);var d=vx(r,c);if(d===null){e.dispatch(hx);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");mx(a),f=a(d)}e.dispatch(Cc(o,f));var m=u.getSource(d),g=m.beginDrag(c,d);if(g!=null){yx(g),u.pinSource(d);var b=u.getSourceType(d);return{type:Qi,payload:{itemType:b,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function gx(e,t,r){oe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){oe(r.getSource(n),"Expected sourceIds to be registered.")})}function mx(e){oe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function yx(e){oe(Hf(e),"Item must be an object.")}function vx(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 bx(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:rl}}}function ya(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function _x(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;wx(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();xx(i,o,a);var c=o.getItemType();return Sx(i,a,c),Cx(i,o,a),{type:Gi,payload:{targetIds:i,clientOffset:s||null}}}}function wx(e){oe(Array.isArray(e),"Expected targetIds to be an array.")}function xx(e,t,r){oe(t.isDragging(),"Cannot call hover while not dragging."),oe(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];oe(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);oe(i,"Expected targetIds to be registered.")}}function Sx(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);ya(i,r)||e.splice(n,1)}}function Cx(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Ec(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 Oc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ec(Object(r),!0).forEach(function(n){Ex(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ec(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ex(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ox(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Dx(n);var i=Nx(n);i.forEach(function(o,a){var c=Tx(o,a,s,n),u={type:Yi,payload:{dropResult:Oc(Oc({},r),c)}};e.dispatch(u)})}}function Dx(e){oe(e.isDragging(),"Cannot call drop while not dragging."),oe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Tx(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Ix(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Ix(e){oe(typeof e>"u"||Hf(e),"Drop result must either be an object or undefined.")}function Nx(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Rx(e){return function(){var r=e.getMonitor(),n=e.getRegistry();jx(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Xi}}}function jx(e){oe(e.isDragging(),"Cannot call endDrag while not dragging.")}function kx(e){return{beginDrag:px(e),publishDragSource:bx(e),hover:_x(e),drop:Ox(e),endDrag:Rx(e)}}function Ax(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Px(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 Mx(e,t,r){return t&&Px(e.prototype,t),e}function Xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Lx=function(){function e(t,r){var n=this;Ax(this,e),Xn(this,"store",void 0),Xn(this,"monitor",void 0),Xn(this,"backend",void 0),Xn(this,"isSetUp",!1),Xn(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 Mx(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];var d=o.apply(r,c);typeof d<"u"&&n(d)}}var i=kx(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 At(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 Dc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Tc=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ic={INIT:"@@redux/INIT"+Tc(),REPLACE:"@@redux/REPLACE"+Tc()};function Fx(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 $x(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(Ux(e))return"date";if(Vx(e))return"error";var r=Bx(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 Bx(e){return typeof e.constructor=="function"?e.constructor.name:null}function Vx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Ux(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=$x(e)),t}function Wf(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"?At(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"?At(1):"Expected the enhancer to be a function. Instead, received: '"+dn(r)+"'");return r(Wf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?At(2):"Expected the root reducer to be a function. Instead, received: '"+dn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function u(){a===o&&(a=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?At(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?At(4):"Expected the listener to be a function. Instead, received: '"+dn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?At(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 y=!0;return u(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?At(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.");y=!1,u();var _=a.indexOf(h);a.splice(_,1),o=null}}}function m(h){if(!Fx(h))throw new Error(process.env.NODE_ENV==="production"?At(7):"Actions must be plain objects. Instead, the actual type was: '"+dn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?At(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"?At(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var _=y[v];_()}return h}function g(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?At(10):"Expected the nextReducer to be a function. Instead, received: '"+dn(h));s=h,m({type:Ic.REPLACE})}function b(){var h,y=f;return h={subscribe:function(_){if(typeof _!="object"||_===null)throw new Error(process.env.NODE_ENV==="production"?At(11):"Expected the observer to be an object. Instead, received: '"+dn(_)+"'");function x(){_.next&&_.next(d())}x();var w=y(x);return{unsubscribe:w}}},h[Dc]=function(){return this},h}return m({type:Ic.INIT}),n={dispatch:m,subscribe:f,getState:d,replaceReducer:g},n[Dc]=b,n}var zx=function(t,r){return t===r};function qx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Hx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:zx;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 Nc(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 Rc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nc(Object(r),!0).forEach(function(n){Wx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Kx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case tl:case Qi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Gi:return qx(e.clientOffset,r.clientOffset)?e:Rc(Rc({},e),{},{clientOffset:r.clientOffset});case Xi:case Yi:return jc;default:return e}}var nl="dnd-core/ADD_SOURCE",sl="dnd-core/ADD_TARGET",il="dnd-core/REMOVE_SOURCE",Zi="dnd-core/REMOVE_TARGET";function Qx(e){return{type:nl,payload:{sourceId:e}}}function Gx(e){return{type:sl,payload:{targetId:e}}}function Yx(e){return{type:il,payload:{sourceId:e}}}function Xx(e){return{type:Zi,payload:{targetId:e}}}function kc(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 Pt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kc(Object(r),!0).forEach(function(n){Zx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Jx={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function eS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Jx,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Qi:return Pt(Pt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rl:return Pt(Pt({},e),{},{isSourcePublic:!0});case Gi:return Pt(Pt({},e),{},{targetIds:r.targetIds});case Zi:return e.targetIds.indexOf(r.targetId)===-1?e:Pt(Pt({},e),{},{targetIds:ux(e.targetIds,r.targetId)});case Yi:return Pt(Pt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Xi:return Pt(Pt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function tS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case nl:case sl:return e+1;case il:case Zi:return e-1;default:return e}}var Ni=[],ol=[];Ni.__IS_NONE__=!0;ol.__IS_ALL__=!0;function rS(e,t){if(e===Ni)return!1;if(e===ol||typeof t>"u")return!0;var r=fx(t,e);return r.length>0}function nS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Gi:break;case nl:case sl:case Zi:case il:return Ni;case Qi:case rl:case Xi:case Yi:default:return ol}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=dx(n,i),a=o.length>0||!Hx(n,i);if(!a)return Ni;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function sS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Ac(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 Pc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ac(Object(r),!0).forEach(function(n){iS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ac(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:nS(e.dirtyHandlerIds,{type:t.type,payload:Pc(Pc({},t.payload),{},{prevTargetIds:cx(e,"dragOperation.targetIds",[])})}),dragOffset:Kx(e.dragOffset,t),refCount:tS(e.refCount,t),dragOperation:eS(e.dragOperation,t),stateId:sS(e.stateId)}}function aS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Kf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function lS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Kf(aS(t,n),r)}function cS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Kf(t,r)}function uS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dS(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&&dS(e.prototype,t),e}function Mc(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,r){uS(this,e),Mc(this,"store",void 0),Mc(this,"registry",void 0),this.store=t,this.registry=r}return fS(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;oe(typeof r=="function","listener must be a function."),oe(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var u=n.store.getState(),d=u.stateId;try{var f=d===o||d===o+1&&!rS(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;oe(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 oe(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(oe(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 ya(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(oe(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&&!ya(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 lS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return cS(this.store.getState().dragOffset)}}]),e}(),pS=0;function gS(){return pS++}function hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hi=function(r){return typeof r}:hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hi(e)}function mS(e){oe(typeof e.canDrag=="function","Expected canDrag to be a function."),oe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),oe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function yS(e){oe(typeof e.canDrop=="function","Expected canDrop to be a function."),oe(typeof e.hover=="function","Expected hover to be a function."),oe(typeof e.drop=="function","Expected beginDrag to be a function.")}function va(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return va(r,!1)});return}oe(typeof e=="string"||hi(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 Lc=typeof global<"u"?global:self,Qf=Lc.MutationObserver||Lc.WebKitMutationObserver;function Gf(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function vS(e){let t=1;const r=new Qf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const bS=typeof Qf=="function"?vS:Gf;class _S{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=bS(this.flush),this.requestErrorThrow=Gf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class wS{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 xS{create(t){const r=this.freeTasks,n=r.length?r.pop():new wS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Yf=new _S,SS=new xS(Yf.registerPendingError);function CS(e){Yf.enqueueTask(SS.create(e))}function ES(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OS(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 DS(e,t,r){return t&&OS(e.prototype,t),e}function fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TS(e,t){return jS(e)||RS(e,t)||NS(e,t)||IS()}function IS(){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
|
|
458
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BS(e,t){if(e){if(typeof e=="string")return Vc(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 Vc(e,t)}}function Vc(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 VS(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 US(e){if(Array.isArray(e))return e}function zS(e,t){if(e==null)return{};var r=qS(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 qS(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 Uc=0,pi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),HS=p.memo(function(t){var r=t.children,n=zS(t,LS),s=WS(n),i=FS(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=Xf();return++Uc,function(){--Uc===0&&(c[pi]=null)}}},[]),l.jsx(qf.Provider,Object.assign({value:o},{children:r}),void 0)});function WS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=KS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function KS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xf(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[pi]||(s[pi]={dragDropManager:PS(e,t,r,n)}),s[pi]}function Xf(){return typeof global<"u"?global:window}function QS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GS(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 YS(e,t,r){return t&&GS(e.prototype,t),e}function zc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xo=!1,So=!1,XS=function(){function e(t){QS(this,e),zc(this,"internalMonitor",void 0),zc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return YS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){oe(!xo,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{xo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;oe(!So,"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 So=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{So=!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 ZS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JS(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 e0(e,t,r){return t&&JS(e.prototype,t),e}function qc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Co=!1,t0=function(){function e(t){ZS(this,e),qc(this,"internalMonitor",void 0),qc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return e0(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;oe(!Co,"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 Co=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Co=!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 r0(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 n0(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(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;r0(s);var i=r?function(o){return e(o,r)}:e;return s0(s,i)}}function Zf(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=n0(n);t[r]=function(){return s}}}),t}function Hc(e,t){typeof e=="function"?e(t):e.current=t}function s0(e,t){var r=e.ref;return oe(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?p.cloneElement(e,{ref:function(s){Hc(r,s),Hc(t,s)}}):p.cloneElement(e,{ref:t})}function gi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gi=function(r){return typeof r}:gi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gi(e)}function ba(e){return e!==null&&gi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _a(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var u=i[c];if(!a(u))return!1;var d=e[u],f=t[u];if(s=void 0,s===!1||s===void 0&&d!==f)return!1}return!0}function i0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o0(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 a0(e,t,r){return t&&o0(e.prototype,t),e}function st(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l0=function(){function e(t){var r=this;i0(this,e),st(this,"hooks",Zf({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ba(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ba(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),st(this,"handlerId",null),st(this,"dragSourceRef",null),st(this,"dragSourceNode",void 0),st(this,"dragSourceOptionsInternal",null),st(this,"dragSourceUnsubscribe",void 0),st(this,"dragPreviewRef",null),st(this,"dragPreviewNode",void 0),st(this,"dragPreviewOptionsInternal",null),st(this,"dragPreviewUnsubscribe",void 0),st(this,"lastConnectedHandlerId",null),st(this,"lastConnectedDragSource",null),st(this,"lastConnectedDragSourceOptions",null),st(this,"lastConnectedDragPreview",null),st(this,"lastConnectedDragPreviewOptions",null),st(this,"backend",void 0),this.backend=t}return a0(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!_a(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!_a(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 c0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u0(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 d0(e,t,r){return t&&u0(e.prototype,t),e}function Jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f0=function(){function e(t){var r=this;c0(this,e),Jt(this,"hooks",Zf({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ba(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Jt(this,"handlerId",null),Jt(this,"dropTargetRef",null),Jt(this,"dropTargetNode",void 0),Jt(this,"dropTargetOptionsInternal",null),Jt(this,"unsubscribeDropTarget",void 0),Jt(this,"lastConnectedHandlerId",null),Jt(this,"lastConnectedDropTarget",null),Jt(this,"lastConnectedDropTargetOptions",null),Jt(this,"backend",void 0),this.backend=t}return d0(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!_a(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 h0(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function p0(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var nn=typeof window<"u"?p.useLayoutEffect:p.useEffect;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 g0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m0(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 y0(e,t,r){return t&&m0(e.prototype,t),e}function Eo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v0=function(){function e(t,r,n){g0(this,e),Eo(this,"spec",void 0),Eo(this,"monitor",void 0),Eo(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return y0(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return mi(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 b0(e,t,r){var n=p.useMemo(function(){return new v0(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function on(){var e=p.useContext(qf),t=e.dragDropManager;return oe(t!=null,"Expected drag drop context"),t}function _0(e){return p.useMemo(function(){var t=e.type;return oe(t!=null,"spec.type must be defined"),t},[e])}function w0(e,t){return E0(e)||C0(e,t)||S0(e,t)||x0()}function x0(){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
|
|
460
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
461
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
462
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
463
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
464
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
465
|
-
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Gs(hn,lh,{exposeProperties:{text:function(t,r){return Oo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),hn);function RC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jC(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 kC(e,t,r){return t&&jC(e.prototype,t),e}function tu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var AC=function(){function e(t){RC(this,e),tu(this,"item",void 0),tu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return kC(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 PC(e,t){var r=new AC(xa[e]);return r.loadDataTransfer(t),r}function Do(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(xa).filter(function(r){var n=xa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function MC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LC(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 FC(e,t,r){return t&&LC(e.prototype,t),e}function To(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $C=function(){function e(t,r){MC(this,e),To(this,"ownerDocument",null),To(this,"globalContext",void 0),To(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return FC(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 ru(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 nu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ru(Object(r),!0).forEach(function(n){fe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ru(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VC(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 UC(e,t,r){return t&&VC(e.prototype,t),e}function fe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var zC=function(){function e(t,r,n){var s=this;BC(this,e),fe(this,"options",void 0),fe(this,"actions",void 0),fe(this,"monitor",void 0),fe(this,"registry",void 0),fe(this,"enterLeaveCounter",void 0),fe(this,"sourcePreviewNodes",new Map),fe(this,"sourcePreviewNodeOptions",new Map),fe(this,"sourceNodes",new Map),fe(this,"sourceNodeOptions",new Map),fe(this,"dragStartSourceIds",null),fe(this,"dropTargetIds",[]),fe(this,"dragEnterTargetIds",[]),fe(this,"currentNativeSource",null),fe(this,"currentNativeHandle",null),fe(this,"currentDragSourceNode",null),fe(this,"altKeyPressed",!1),fe(this,"mouseMoveTimeoutTimer",null),fe(this,"asyncEndDragFrameId",null),fe(this,"dragOverTargetIds",null),fe(this,"lastClientOffset",null),fe(this,"hoverRafId",null),fe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&ih(o)||null}),fe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),fe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),fe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),fe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Qs(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,u=Do(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=s.monitor.getSourceId(),f=s.sourceNodes.get(d),m=s.sourcePreviewNodes.get(d)||f;if(m){var g=s.getCurrentSourcePreviewNodeOptions(),b=g.anchorX,h=g.anchorY,y=g.offsetX,v=g.offsetY,_={anchorX:b,anchorY:h},x={offsetX:y,offsetY:v},w=NC(f,m,a,_,x);c.setDragImage(m,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var S=s.getCurrentSourcePreviewNodeOptions(),O=S.captureDraggingState;O?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(u)s.beginDragNativeItem(u);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),fe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Do(a);c&&s.beginDragNativeItem(c,a)}}),fe(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:Qs(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),fe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),fe(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=Qs(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"))}),fe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),fe(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 Do(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),fe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Qs(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),fe(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 $C(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new xC(this.isNodeInDocument)}return UC(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(u){return i.handleDragStart(u,r)},a=function(u){return i.handleSelectStart(u)};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(u){return s.handleDragEnter(u,r)},o=function(u){return s.handleDragOver(u,r)},a=function(u){return s.handleDrop(u,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 nu({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 nu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(eu).some(function(n){return eu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=PC(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}(),Ys;function qC(){return Ys||(Ys=new Image,Ys.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ys}var HC=function(t,r,n){return new zC(t,r,n)};function WC(e,t){return typeof e=="function"?e(t):e??"NODE"}function KC(e){return e.isDraggable&&!e.isEditing}function QC(e){const t=xt(),r=t.selectedIds,[n,s,i]=G0(()=>({canDrag:()=>KC(e),type:WC(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Fn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Fn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(qC())},[i]),s}function GC(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,u=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:u,atTop:!u&&o,atBottom:!u&&a}}function YC(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 Xs(e,t){return{parentId:e||null,index:t}}function pn(e,t){return{type:"line",index:e,level:t}}function XC(e){return{type:"highlight",id:e}}function Io(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=Af(n)+1;return{parentId:s,index:i}}function uh(e){var t;const r=GC(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,u]=YC(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Xs(i.id,null),cursor:XC(i.id)};if(!c)return{drop:Xs((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:pn(0,0)};if(Nf(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:Io(c,d),cursor:pn(c.rowIndex+1,d)}}if(Rf(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:Io(c,d),cursor:pn(c.rowIndex+1,d)}}if(jf(c)){const d=ci(s,0,c.level+1);return d>c.level?{drop:Xs(c.id,0),cursor:pn(c.rowIndex+1,d)}:{drop:Io(c,d),cursor:pn(c.rowIndex+1,d)}}return{drop:Xs(c==null?void 0:c.id,0),cursor:pn(c.rowIndex+1,c.level+1)}}function ZC(e,t){const r=xt(),[n,s]=rh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:u}=uh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Fn.hovering(u.parentId,u.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 JC(e){const t=xt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const su=p.memo(function({index:t,style:r}){If(),yw();const n=xt(),s=JC(t),i=p.useRef(null),o=QC(s),a=ZC(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),u=n.indent*s.level,d=p.useMemo(()=>({paddingLeft:u}),[u]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),m={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const g=n.renderNode,b=n.renderRow;return l.jsx(b,{node:s,innerRef:c,attrs:m,children:l.jsx(g,{node:s,tree:n,style:d,dragHandle:o})})});let No="",iu=null;function dh(){If();const e=xt();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(),Pf(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Mf(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(iu),No+=t.key,iu=setTimeout(()=>{No=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(No):!1});n&&e.focus(n.id)},children:l.jsx(e1,{})})}function e1(){var e,t;const r=xt(),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:ix,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:lx,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(tx,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:su})):l.jsx(rx,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:su}))}function ou(e){return e.isFiltered?r1(e.root,e.isMatch.bind(e)):t1(e.root)}function t1(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(fh),t}function r1(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(fh),n}function fh(e,t){e.rowIndex=t}const au=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ro=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(d){try{u(n.next(d))}catch(f){o(f)}}function c(d){try{u(n.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};const{safeRun:it}=xw;class ds{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=gc(this),this.visibleNodes=ou(this),this.idToIndex=au(this.visibleNodes)}update(t){this.props=t,this.root=gc(this),this.visibleNodes=ou(this),this.idToIndex=au(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=is(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=is(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 ws)return t.id;const r=this.props.idAccessor||"id";return is(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 Ro(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?Bf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:$f(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield it(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 Ro(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 it(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(bo(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=>{ds.editPromise=i})}submit(t,r){return Ro(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield it(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(bo(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(bo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&it(this.props.onActivate,r)}resolveEdit(t){const r=ds.editPromise;r&&r(t),ds.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(cn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&it(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(cn(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&&it(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(vr.remove(r)),it(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(cn(n.id)),n.isSelectable&&(this.dispatch(vr.add(n.id)),this.dispatch(vr.anchor(n.id)),this.dispatch(vr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&it(this.props.onFocus,this.focusedNode),it(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(cn(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(vr.remove(this.nodesBetween(s,i))),this.dispatch(vr.add(o)),this.dispatch(vr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&it(this.props.onFocus,this.focusedNode),it(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(cn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&it(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(vr.set({ids:n,anchor:s,mostRecent:i})),it(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&&kf(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;it(this.props.onMove,{dragIds:n,parentId:t===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Fn.cursor({type:"none"}))}showCursor(t){this.dispatch(Fn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(pa.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),it(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(pa.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),it(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=el(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(){Ii(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ii(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),Ff(()=>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===_s)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!is(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(cn(t.id))}onBlur(){this.dispatch(jw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||dh}get renderRow(){return this.props.renderRow||Dw}get renderNode(){return this.props.children||Tw}get renderDragPreview(){return this.props.renderDragPreview||Vf}get renderCursor(){return this.props.renderCursor||Ow}}function ot(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 n1=typeof Symbol=="function"&&Symbol.observable||"@@observable",lu=n1,jo=()=>Math.random().toString(36).substring(7).split("").join("."),s1={INIT:`@@redux/INIT${jo()}`,REPLACE:`@@redux/REPLACE${jo()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${jo()}`},en=s1;function hh(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 i1(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(l1(e))return"date";if(a1(e))return"error";const r=o1(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 o1(e){return typeof e.constructor=="function"?e.constructor.name:null}function a1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function l1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function wr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=i1(e)),t}function ph(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ot(2):`Expected the root reducer to be a function. Instead, received: '${wr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ot(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"?ot(1):`Expected the enhancer to be a function. Instead, received: '${wr(r)}'`);return r(ph)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function u(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?ot(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(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ot(4):`Expected the listener to be a function. Instead, received: '${wr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ot(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 v=!0;u();const _=a++;return o.set(_,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?ot(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,u(),o.delete(_),i=null}}}function m(y){if(!hh(y))throw new Error(process.env.NODE_ENV==="production"?ot(7):`Actions must be plain objects. Instead, the actual type was: '${wr(y)}'. 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 y.type>"u")throw new Error(process.env.NODE_ENV==="production"?ot(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?ot(17):`Action "type" property must be a string. Instead, the actual type was: '${wr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ot(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(_=>{_()}),y}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ot(10):`Expected the nextReducer to be a function. Instead, received: '${wr(y)}`);n=y,m({type:en.REPLACE})}function b(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?ot(11):`Expected the observer to be an object. Instead, received: '${wr(v)}'`);function _(){const w=v;w.next&&w.next(d())}return _(),{unsubscribe:y(_)}},[lu](){return this}}}return m({type:en.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:g,[lu]:b}}function cu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function c1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===en.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(!hh(e))return`The ${i} has unexpected type of "${wr(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===en.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 u1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:en.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ot(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:en.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ot(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${en.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 uu(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"&&cu(`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{u1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=c1(a,r,c,s);f&&cu(f)}let u=!1;const d={};for(let f=0;f<n.length;f++){const m=n[f],g=r[m],b=a[m],h=g(b,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ot(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${m}" 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.`)}d[m]=h,u=u||h!==b}return u=u||n.length!==Object.keys(a).length,u?d:a}}function d1(e=Ln().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 f1=uu({nodes:uu({focus:kw,edit:Rw,open:Aw,selection:Pw,drag:d1}),dnd:Mw}),h1=Ln();function p1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(ph(f1,Ln(e))),o=mw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>h1),a=p.useMemo(()=>new ds(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(pa.clear(!0))},[a.props.searchTerm]),l.jsx(Ef.Provider,{value:a,children:l.jsx(Tf.Provider,{value:c.current,children:l.jsx(Of.Provider,{value:o.nodes,children:l.jsx(Df.Provider,{value:o.dnd,children:l.jsx(HS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||HC,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function g1(){const e=xt(),[,t]=rh(()=>({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}=uh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Fn.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 m1(e){return g1(),e.children}function y1(){const t=xt().props.renderContainer||dh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function v1(){const e=xt(),{offset:t,mouse:r,item:n,isDragging:s}=mC(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||Vf;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 b1(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 _1{constructor(t,r={}){this.accessors=b1(r),this.root=w1(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 w1(e,t){const r=new gh({},null,t,"ROOT");return r.children=e.map(n=>al(n,r,t)),r}function al(e,t,r){const n=new gh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>al(i,n,r))),n}class gh{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=al(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 x1=0;function S1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new _1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=b=>{for(const h of b.dragIds)o.move({id:h,parentId:b.parentId,index:b.index});n(o.data)},c=({name:b,id:h})=>{o.update({id:h,changes:{name:b}}),n(o.data)},u=typeof s=="string"?s:"id",d=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:b,index:h,type:y})=>{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(y==="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 v={[u]:`simple-tree-id-${x1++}`,name:""};return y==="internal"&&(v[d]=[]),o.create({parentId:b,index:h,data:v}),n(o.data),v},onDelete:b=>{b.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function C1(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]=S1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function E1(e,t){const r=C1(e);return l.jsxs(p1,{treeProps:r,imperativeHandle:t,children:[l.jsx(m1,{children:l.jsx(y1,{})}),l.jsx(v1,{})]})}const O1=p.forwardRef(E1),du={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},fu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},hu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],D1=[{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 T1(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 Ji(e){const t=T1(e);return{key:t,color:du[t]??du.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:fu[t]??fu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const I1="_row_10dbr_1",N1="_grip_10dbr_16",R1="_menuBtn_10dbr_19",j1="_selected_10dbr_23",k1="_title_10dbr_28",A1="_dropTarget_10dbr_33",P1="_toggle_10dbr_50",M1="_ctIcon_10dbr_65",L1="_renameInput_10dbr_86",F1="_dropHere_10dbr_95",$1="_menuWrap_10dbr_105",B1="_menu_10dbr_19",V1="_dangerItem_10dbr_157",Ot={row:I1,grip:N1,menuBtn:R1,selected:j1,title:k1,dropTarget:A1,toggle:P1,ctIcon:M1,renameInput:L1,dropHere:F1,menuWrap:$1,menu:B1,dangerItem:V1},U1={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},z1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,u]=p.useState(e.data.name),d=p.useRef(null),f=n==="edit",m=Ji(e.data),g=U1[m.key]??zn,b=e.isSelected,h=e.data.isFolder??(e.children&&e.children.length>0);p.useEffect(()=>{if(!s)return;const _=x=>{var w;(w=d.current)!=null&&w.contains(x.target)||i(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[s]);const y=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),v=p.useCallback(_=>{_.key==="Enter"&&y(),_.key==="Escape"&&(u(e.data.name),a(!1))},[y,e.data.name]);return l.jsxs("div",{className:[Ot.row,b?Ot.selected:"",e.state.isOver&&h?Ot.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":h?"true":void 0,role:"treeitem","aria-selected":b,"aria-expanded":h?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Ot.grip,"aria-hidden":"true",children:l.jsx(Ud,{size:14})}),l.jsx("button",{className:Ot.toggle,onClick:_=>{_.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:h?"visible":"hidden"},children:e.isClosed?l.jsx(Fd,{size:14}):l.jsx(ks,{size:14})}),l.jsx("span",{className:`${Ot.ctIcon} ${m.bgClass}`,"aria-hidden":"true",children:l.jsx(g,{size:12})}),o?l.jsx("input",{className:Ot.renameInput,value:c,autoFocus:!0,onChange:_=>u(_.target.value),onBlur:y,onKeyDown:v,onClick:_=>_.stopPropagation()}):l.jsx("span",{className:Ot.title,onDoubleClick:()=>f&&a(!0),children:e.data.name}),e.state.isOver&&h&&l.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ot.menuWrap,ref:d,children:[l.jsx("button",{className:Ot.menuBtn,onClick:_=>{_.stopPropagation(),i(x=>!x)},"aria-label":"Node options",children:l.jsx(Bd,{size:14})}),s&&l.jsxs("div",{className:Ot.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(fy,{size:13})," Rename"]}),h&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Vd,{size:13})," Add sub-unit"]}),e.data.parent&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(As,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(qa,{size:13})," Delete"]})]})]})]})};async function q1(e,t){var i,o;const n=((i=(await $e.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 H1(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 W1(e,t){var o;const r=await q1(e,t.name),n=await H1(r,t);return{processId:(((o=(await $e.post(`/action/collection/v1/import/${e}`,{request:{fileUrl:n,mimeType:"text/csv"}})).data)==null?void 0:o.result)??{}).processId??""}}async function K1(e){var r;return((r=(await $e.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function mh(e){var n,s,i;const r=(i=(s=(n=(await $e.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 Q1(e){return mh(e)}const G1="_container_1m4t0_1",Y1="_header_1m4t0_13",X1="_title_1m4t0_22",Z1="_closeBtn_1m4t0_29",J1="_body_1m4t0_45",eE="_dropZone_1m4t0_54",tE="_dragOver_1m4t0_67",rE="_hasFile_1m4t0_72",nE="_hiddenInput_1m4t0_78",sE="_fileInfo_1m4t0_82",iE="_fileIcon_1m4t0_89",oE="_fileName_1m4t0_93",aE="_fileSize_1m4t0_100",lE="_dropHint_1m4t0_105",cE="_dropIcon_1m4t0_112",uE="_dropText_1m4t0_117",dE="_dropSubtext_1m4t0_124",fE="_sampleLink_1m4t0_130",hE="_statusBar_1m4t0_145",pE="_status_uploading_1m4t0_154",gE="_status_processing_1m4t0_154",mE="_status_done_1m4t0_159",yE="_status_error_1m4t0_164",vE="_successDetail_1m4t0_170",bE="_spinner_1m4t0_175",_E="_spin_1m4t0_175",wE="_errorMsg_1m4t0_191",xE="_failedSection_1m4t0_197",SE="_failedTitle_1m4t0_203",CE="_tableWrap_1m4t0_213",EE="_failedTable_1m4t0_219",OE="_reasonCell_1m4t0_244",DE="_footer_1m4t0_248",xe={container:G1,header:Y1,title:X1,closeBtn:Z1,body:J1,dropZone:eE,dragOver:tE,hasFile:rE,hiddenInput:nE,fileInfo:sE,fileIcon:iE,fileName:oE,fileSize:aE,dropHint:lE,dropIcon:cE,dropText:uE,dropSubtext:dE,sampleLink:fE,statusBar:hE,status_uploading:pE,status_processing:gE,status_done:mE,status_error:yE,successDetail:vE,spinner:bE,spin:_E,errorMsg:wE,failedSection:xE,failedTitle:SE,tableWrap:CE,failedTable:EE,reasonCell:OE,footer:DE},TE=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,u]=p.useState("idle"),[d,f]=p.useState(""),[m,g]=p.useState([]),[b,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),_=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>_(),[_]);const x=k=>k.name.toLowerCase().endsWith(".csv")?k.size>10*1024*1024?(f("File size must not exceed 10 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(k=>{f(""),g([]),h(null),u("idle"),x(k)&&i(k)},[]),S=p.useCallback(k=>{k.preventDefault(),a(!1);const M=k.dataTransfer.files[0];M&&w(M)},[w]),O=p.useCallback(k=>{var q;const M=(q=k.target.files)==null?void 0:q[0];M&&w(M),k.target.value=""},[w]),N=p.useCallback(async()=>{try{const k=await Q1(e),M=document.createElement("a");M.href=k,M.download="sample_hierarchy.csv",M.target="_blank",M.click()}catch{f("Failed to download sample CSV.")}},[e]),j=p.useCallback(async()=>{if(s){u("uploading"),f(""),g([]);try{const{processId:k}=await W1(e,s);if(!k){u("done"),h(null),setTimeout(t,1500);return}u("processing"),v.current=setInterval(async()=>{try{const M=await K1(k);M.status==="COMPLETED"?(_(),u("done"),h(M.successCount??null),M.failedRecords&&M.failedRecords.length>0?g(M.failedRecords):setTimeout(t,1500)):M.status==="FAILED"&&(_(),u("error"),f("Upload processing failed. Please check the error rows below."),M.failedRecords&&g(M.failedRecords))}catch{_(),u("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{u("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,_]),F={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:xe.container,children:[l.jsxs("div",{className:xe.header,children:[l.jsx("h2",{className:xe.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:xe.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:xe.body,children:[l.jsxs("div",{className:`${xe.dropZone} ${o?xe.dragOver:""} ${s?xe.hasFile:""}`,onDragEnter:k=>{k.preventDefault(),a(!0)},onDragOver:k=>{k.preventDefault(),a(!0)},onDragLeave:k=>{k.preventDefault(),a(!1)},onDrop:S,onClick:()=>{var k;return(k=y.current)==null?void 0:k.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:k=>{var M;return k.key==="Enter"&&((M=y.current)==null?void 0:M.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:xe.hiddenInput,onChange:O,"aria-hidden":"true"}),s?l.jsxs("div",{className:xe.fileInfo,children:[l.jsx("span",{className:xe.fileIcon,children:"📄"}),l.jsx("span",{className:xe.fileName,children:s.name}),l.jsxs("span",{className:xe.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:xe.dropHint,children:[l.jsx("span",{className:xe.dropIcon,children:"⬆️"}),l.jsx("p",{className:xe.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:xe.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:xe.sampleLink,onClick:N,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${xe.statusBar} ${xe[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:xe.spinner,"aria-hidden":"true"}),F[c],c==="done"&&b!==null&&l.jsxs("span",{className:xe.successDetail,children:[" — ",b," item(s) imported"]})]}),d&&l.jsx("p",{className:xe.errorMsg,role:"alert",children:d}),m.length>0&&l.jsxs("div",{className:xe.failedSection,children:[l.jsxs("h4",{className:xe.failedTitle,children:["Failed Rows (",m.length,")"]}),l.jsx("div",{className:xe.tableWrap,children:l.jsxs("table",{className:xe.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:m.map((k,M)=>l.jsxs("tr",{children:[l.jsx("td",{children:k.rowNumber??M+1}),l.jsx("td",{children:k.name??"—"}),l.jsx("td",{className:xe.reasonCell,children:k.reason??"Unknown error"})]},M))})]})})]})]}),l.jsxs("div",{className:xe.footer,children:[l.jsx(je,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(je,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:j,children:c==="done"?"Uploaded":"Upload"})]})]})},IE="_container_1y30m_1",NE="_header_1y30m_8",RE="_headerActions_1y30m_19",jE="_iconBtn_1y30m_25",kE="_menuWrap_1y30m_43",AE="_dropdownMenu_1y30m_47",PE="_treeWrapper_1y30m_79",ME="_csvModal_1y30m_95",LE="_footer_1y30m_105",er={container:IE,header:NE,headerActions:RE,iconBtn:jE,menuWrap:kE,dropdownMenu:AE,treeWrapper:PE,csvModal:ME,footer:LE},FE=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[m,g]=p.useState("create"),{treeData:b,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:_,reorderChildren:x}=Te(),w=e==="edit",S=Se(R=>{var P,L,ee,Y;return((L=(P=R.editorConfig)==null?void 0:P.context)==null?void 0:L.contentId)??((Y=(ee=R.editorConfig)==null?void 0:ee.context)==null?void 0:Y.identifier)??""});p.useEffect(()=>{const R=s.current;if(!R)return;const P=new ResizeObserver(()=>{a(R.clientHeight||400)});return P.observe(R),a(R.clientHeight||400),()=>P.disconnect()},[]),p.useEffect(()=>{if(!c)return;const R=P=>{var L;(L=i.current)!=null&&L.contains(P.target)||u(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[c]);const O=p.useCallback(R=>{R.length>0&&y(R[0].data.id)},[y]),N=p.useCallback(({parentId:R,index:P,dragIds:L})=>{if(!R)return;const ee=L[0],Y=yh(b,R);if(!(Y!=null&&Y.children))return;const z=Y.children.findIndex(te=>te.id===ee);z<0||x(R,z,P>z?P-1:P)},[b,x]),j=p.useCallback(({ids:R})=>{R.forEach(P=>_(P))},[_]),F=p.useCallback(({parentId:R})=>{var ee;const P=R??((ee=b[0])==null?void 0:ee.id)??"";if(!P)return{id:crypto.randomUUID()};const L=v(P,"unit");return L?{id:L}:(ht.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,b]),k=p.useCallback(()=>{var P;const R=(P=b[0])==null?void 0:P.id;R&&(v(R,"unit")||ht.error("Maximum depth reached"))},[b,v]),M=p.useCallback(()=>{h&&(v(h,"subunit")||ht.error("Maximum depth reached"))},[h,v]),q=p.useCallback(async()=>{if(u(!1),!!S)try{const R=await mh(S),P=document.createElement("a");P.href=R,P.download=`${S}-folders.csv`,P.target="_blank",document.body.appendChild(P),P.click(),document.body.removeChild(P)}catch{ht.error("Failed to download CSV")}},[S]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[w&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>u(R=>!R),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Bd,{size:15})}),c&&l.jsxs("div",{className:er.dropdownMenu,role:"menu",children:[l.jsx("button",{role:"menuitem",type:"button",onClick:()=>{u(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",onClick:q,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",onClick:()=>{u(!1),g("update"),f(!0)},children:"Update folder metadata using csv file"})]})]}),r&&l.jsx("button",{type:"button",className:er.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(uy,{size:15}):l.jsx(cy,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(O1,{ref:n,data:b,idAccessor:"id",childrenAccessor:"children",onSelect:O,onMove:w?N:void 0,onDelete:w?j:void 0,onCreate:w?F:void 0,disableEdit:!w,disableDrop:!w,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:R=>l.jsx(z1,{...R,editorMode:e})})}),w&&l.jsxs("div",{className:er.footer,children:[l.jsxs(je,{variant:"ghost",size:"sm",onClick:k,children:[l.jsx(As,{size:14})," Add Unit"]}),l.jsxs(je,{variant:"ghost",size:"sm",onClick:M,disabled:!h,children:[l.jsx(Vd,{size:14})," Add Sub-unit"]})]}),d&&l.jsx("div",{className:er.csvModal,children:l.jsx(TE,{contentId:S,mode:m,onComplete:()=>f(!1),onClose:()=>f(!1)})})]})};function yh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=yh(r.children,t);if(n)return n}}}const $E="_breadcrumb_zd1aj_1",BE="_crumb_zd1aj_10",VE="_sep_zd1aj_26",UE="_current_zd1aj_31",Jn={breadcrumb:$E,crumb:BE,sep:VE,current:UE},zE=({crumbs:e})=>{const t=Te(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Jn.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Jn.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(iy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Fd,{size:13,className:Jn.sep}),n<e.length-1?l.jsx("button",{className:Jn.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Jn.current,children:r.name})]},r.id))]}):null},qE="_tabBar_qhks1_1",HE="_tab_qhks1_1",WE="_active_qhks1_29",KE="_error_qhks1_35",QE="_errorDot_qhks1_39",es={tabBar:qE,tab:HE,active:WE,error:KE,errorDot:QE},pu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],GE=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?pu.filter(i=>n.includes(i.id)):pu;return l.jsx("div",{className:es.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:[es.tab,e===i.id?es.active:"",r.includes(i.id)?es.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:es.errorDot,"aria-label":"Has errors"})]},i.id))})};var $s=e=>e.type==="checkbox",Ur=e=>e instanceof Date,Ze=e=>e==null;const vh=e=>typeof e=="object";var ke=e=>!Ze(e)&&!Array.isArray(e)&&vh(e)&&!Ur(e),Sa=e=>ke(e)&&e.target?$s(e.target)?e.target.checked:e.target.value:e,bh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),_h=e=>{const t=e.constructor&&e.constructor.prototype;return ke(t)&&t.hasOwnProperty("isPrototypeOf")},eo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Pe(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(eo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(ke(e)&&_h(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Pe(e[s]));return n}const Sr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wt={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"},ko="form",wh="root",xh=["__proto__","constructor","prototype"];var Bs=e=>/^\w*$/.test(e),Oe=e=>e===void 0,to=e=>e.split(/[.[\]'"]/g).filter(Boolean),U=(e,t,r)=>{if(!t||!ke(e))return r;const n=Bs(t)?[t]:to(t);if(n.some(i=>xh.includes(i)))return r;const s=n.reduce((i,o)=>Ze(i)?void 0:i[o],e);return Oe(s)||s===e?Oe(e[t])?r:e[t]:s},Nt=e=>typeof e=="boolean",lt=e=>typeof e=="function",Ee=(e,t,r)=>{let n=-1;const s=Bs(t)?[t]:to(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const u=e[a];c=ke(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(xh.includes(a))return;e[a]=c,e=e[a]}};const ll=p.createContext(null);ll.displayName="HookFormControlContext";const cl=()=>p.useContext(ll);var Sh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Wt.all&&(t._proxyFormState[o]=!n||Wt.all),r&&(r[o]=!0),e[o]}});return s};const ul=eo?p.useLayoutEffect:p.useEffect;function YE(e){const t=cl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ul(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Sh(o,r,c.current,!1),[o,r])}var ct=e=>typeof e=="string",Ca=(e,t,r,n,s)=>ct(e)?(n&&t.watch.add(e),U(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),U(r,i))):(n&&(t.watchAll=!0),r),Ea=e=>Ze(e)||!vh(e);const gu=(e,t)=>t.length===0&&!Array.isArray(e)&&!_h(e);function Rt(e,t,r=new WeakMap){if(e===t)return!0;if(Ea(e)||Ea(t))return Object.is(e,t);if(Ur(e)&&Ur(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(gu(e,n)||gu(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(Ur(a)&&Ur(c)||(ke(a)||Array.isArray(a))&&(ke(c)||Array.isArray(c))?!Rt(a,c,r):!Object.is(a,c))return!1}}return!0}function XE(e){const t=cl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),u=p.useRef(a),d=p.useRef(void 0),f=p.useRef(r),m=p.useRef(n);u.current=a;const[g,b]=p.useState(()=>{const w=r._getWatch(n,c.current);return u.current?u.current(w):w}),h=p.useCallback(w=>{const S=Ca(n,r._names,w||r._formValues,!1,c.current);return u.current?u.current(S):S},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const S=Ca(n,r._names,w||r._formValues,!1,c.current);if(u.current){const O=u.current(S);Rt(O,d.current)||(b(O),d.current=O)}else b(S)}},[r._formValues,r._names,i,n]);ul(()=>((f.current!==r||!Rt(m.current,n))&&(f.current=r,m.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,_=m.current,x=p.useMemo(()=>{if(i)return null;const w=!v&&!Rt(_,n);return v||w?h():null},[i,v,n,_,h]);return x!==null?x:g}function ro(e){const t=cl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=bh(s._names.array,r),u=p.useMemo(()=>U(s._formValues,r,U(s._defaultValues,r,o)),[s,r,o]),d=XE({control:s,name:r,defaultValue:u,exact:a}),f=YE({control:s,name:r,exact:a}),m=p.useRef(e),g=p.useRef(null),b=p.useRef(s.register(r,{...e.rules,value:d,...Nt(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!U(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!U(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!U(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!U(f.validatingFields,r)},error:{enumerable:!0,get:()=>U(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const S=Sa(w);return U(s._fields,r)||(b.current=s.register(r,{...m.current.rules,value:S})),b.current.onChange({target:{value:Sa(w),name:r},type:Sr.CHANGE})},[r,s]),v=p.useCallback(()=>b.current.onBlur({target:{value:U(s._formValues,r),name:r},type:Sr.BLUR}),[r,s._formValues]),_=p.useCallback(w=>{w&&(g.current={focus:()=>lt(w.focus)&&w.focus(),select:()=>lt(w.select)&&w.select(),setCustomValidity:O=>lt(w.setCustomValidity)&&w.setCustomValidity(O),reportValidity:()=>lt(w.reportValidity)&&w.reportValidity()});const S=U(s._fields,r);S&&S._f&&w&&(S._f.ref=g.current)},[s._fields,r]),x=p.useMemo(()=>({name:r,value:d,...Nt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:_}),[r,n,f.disabled,y,v,_,d]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...m.current.rules,...Nt(m.current.disabled)?{disabled:m.current.disabled}:{}});const S=(O,N)=>{const j=U(s._fields,O);j&&j._f&&(j._f.mount=N)};if(S(r,!0),w){const O=Pe(U(i?s._defaultValues:s._options.values||s._defaultValues,r,U(s._options.defaultValues,r,m.current.defaultValue)));Ee(s._defaultValues,r,O),Oe(U(s._formValues,r))&&Ee(s._formValues,r,O)}if(!c&&s.register(r),g.current){const O=U(s._fields,r);O&&O._f&&(O._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):S(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const dl=p.createContext(null);dl.displayName="HookFormContext";const Yt=()=>p.useContext(dl),ZE=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:m,unregister:g,control:b,register:h,setFocus:y,subscribe:v})=>{const _=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:m,unregister:g,control:b,register:h,setFocus:y,subscribe:v}),[i,b,u,n,r,m,h,f,d,s,y,o,a,v,c,g,t]);return p.createElement(dl.Provider,{value:_},p.createElement(ll.Provider,{value:_.control},e))};var JE=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Ch=e=>Array.isArray(e)?e.filter(Boolean):[],yi=e=>Array.isArray(e)?e:[e],mu=()=>{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 Eh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&ke(s)&&i){const o=Eh(s,i);ke(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Ke=e=>ke(e)&&!Object.keys(e).length,fl=e=>e.type==="file",Ri=e=>{if(!eo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Oh=e=>e.type==="select-multiple",hl=e=>e.type==="radio",eO=e=>hl(e)||$s(e),Ao=e=>Ri(e)&&e.isConnected;function tO(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(Ze(e)){e=void 0;break}e=e[t[n]],n++}return e}function rO(e){for(const t in e)if(e.hasOwnProperty(t)&&!Oe(e[t]))return!1;return!0}function Ve(e,t){if(ct(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Bs(t)?[t]:to(t),n=r.length===1?e:tO(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(ke(n)&&Ke(n)||Array.isArray(n)&&rO(n))&&Ve(e,r.slice(0,-1)),e}var nO=e=>{for(const t in e)if(lt(e[t]))return!0;return!1};function Dh(e){return Array.isArray(e)||ke(e)&&!nO(e)}function Oa(e,t={}){for(const r in e){const n=e[r];Dh(n)?(t[r]=Array.isArray(n)?[]:{},Oa(n,t[r])):Oe(n)||(t[r]=!0)}return t}function Da(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Da(r));return t.some(r=>r!==void 0)?t:void 0}if(ke(e)){const t={};for(const r in e){const n=Da(e[r]);Oe(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Fr(e,t,r){r||(r=Oa(t));for(const n in e){const s=e[n];if(Dh(s))Oe(t)||Ea(r[n])?r[n]=Oa(s,Array.isArray(s)?[]:{}):Fr(s,Ze(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Rt(s,i)}}return Da(r)||{}}const yu={value:!1,isValid:!1},vu={value:!0,isValid:!0};var Th=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&&!Oe(e[0].attributes.value)?Oe(e[0].value)||e[0].value===""?vu:{value:e[0].value,isValid:!0}:vu:yu}return yu},Ih=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Oe(e)?e:t?e===""?NaN:e&&+e:r&&ct(e)?new Date(e):n?n(e):e;const bu={isValid:!1,value:null};var Nh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,bu):bu;function _u(e){const t=e.ref;return fl(t)?t.files:hl(t)?Nh(e.refs).value:Oh(t)?[...t.selectedOptions].map(({value:r})=>r):$s(t)?Th(e.refs).value:Ih(Oe(t.value)?e.ref.value:t.value,e)}var sO=(e,t,r,n)=>{const s={};for(const i of e){const o=U(t,i);o&&Ee(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},ji=e=>e instanceof RegExp,ts=e=>Oe(e)?e:ji(e)?e.source:ke(e)?ji(e.value)?e.value.source:e.value:e,wu=e=>({isOnSubmit:!e||e===Wt.onSubmit,isOnBlur:e===Wt.onBlur,isOnChange:e===Wt.onChange,isOnAll:e===Wt.all,isOnTouch:e===Wt.onTouched});const xu="AsyncFunction";var iO=e=>!!e&&!!e.validate&&!!(lt(e.validate)&&e.validate.constructor.name===xu||ke(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xu)),oO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Po=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const fs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=U(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(fs(a,t))break}else if(ke(a)&&fs(a,t))break}}};function Su(e,t,r){const n=U(e,r);if(n||Bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=U(t,i),a=U(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 aO=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Ke(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Wt.all))},lO=(e,t,r)=>!e||!t||e===t||yi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),cO=(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,uO=(e,t)=>!Ch(U(e,t)).length&&Ve(e,t),Cu=(e,t,r)=>{const n=U(e,r),s=Array.isArray(n)?n:[];return Ee(s,wh,t[r]),Ee(e,r,s),e};function Eu(e,t,r="validate"){if(ct(e)||Array.isArray(e)&&e.every(ct)||Nt(e)&&!e)return{type:r,message:ct(e)?e:"",ref:t}}var gn=e=>ke(e)&&!ji(e)?e:{value:e,message:""},Ou=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:d,min:f,max:m,pattern:g,validate:b,name:h,valueAsNumber:y,mount:v}=e._f,_=U(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=q=>{if(s&&x.reportValidity){const R=Nt(q)?"":q||"";a?a.forEach(P=>P.setCustomValidity(R)):x.setCustomValidity(R),x.reportValidity()}},S={},O=hl(o),N=$s(o),j=O||N,F=(y||fl(o))&&Oe(o.value)&&Oe(_)||Ri(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,k=JE.bind(null,h,n,S),M=(q,R,P,L=qt.maxLength,ee=qt.minLength)=>{const Y=q?R:P;S[h]={type:q?L:ee,message:Y,ref:o,...k(q?L:ee,Y)}};if(i?!Array.isArray(_)||!_.length:c&&(!j&&(F||Ze(_))||Nt(_)&&!_||N&&!Th(a).isValid||O&&!Nh(a).isValid)){const{value:q,message:R}=ct(c)?{value:!!c,message:c}:gn(c);if(q&&(S[h]={type:qt.required,message:R,ref:x,...k(qt.required,R)},!n))return w(R),S}if(!F&&(!Ze(f)||!Ze(m))){let q,R;const P=gn(m),L=gn(f);if(!Ze(_)&&!isNaN(_)){const ee=o.valueAsNumber||_&&+_;Ze(P.value)||(q=ee>P.value),Ze(L.value)||(R=ee<L.value)}else{const ee=o.valueAsDate||new Date(_),Y=ie=>new Date(new Date().toDateString()+" "+ie),z=o.type=="time",te=o.type=="week";ct(P.value)&&_&&(q=z?Y(_)>Y(P.value):te?_>P.value:ee>new Date(P.value)),ct(L.value)&&_&&(R=z?Y(_)<Y(L.value):te?_<L.value:ee<new Date(L.value))}if((q||R)&&(M(!!q,P.message,L.message,qt.max,qt.min),!n))return w(S[h].message),S}if((u||d)&&!F&&(ct(_)||i&&Array.isArray(_))){const q=gn(u),R=gn(d),P=!Ze(q.value)&&_.length>+q.value,L=!Ze(R.value)&&_.length<+R.value;if((P||L)&&(M(P,q.message,R.message),!n))return w(S[h].message),S}if(g&&!F&&ct(_)){const{value:q,message:R}=gn(g);if(ji(q)&&!_.match(q)&&(S[h]={type:qt.pattern,message:R,ref:o,...k(qt.pattern,R)},!n))return w(R),S}if(b){if(lt(b)){const q=await b(_,r),R=Eu(q,x);if(R&&(S[h]={...R,...k(qt.validate,R.message)},!n))return w(R.message),S}else if(ke(b)){let q={};for(const R in b){if(!Ke(q)&&!n)break;const P=Eu(await b[R](_,r),x,R);P&&(q={...P,...k(R,P.message)},w(P.message),n&&(S[h]=q))}if(!Ke(q)&&(S[h]={ref:x,...q},!n))return S}}return w(!0),S};const dO={mode:Wt.onSubmit,reValidateMode:Wt.onChange,shouldFocusError:!0},Rh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function fO(e={}){let t={...dO,...e},r={...Pe(Rh),isLoading:lt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=ke(t.defaultValues)||ke(t.values)?Pe(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Pe(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,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let m={...f};const g={array:mu(),state:mu()},b=t.criteriaMode===Wt.all,h=C=>T=>{clearTimeout(u),u=setTimeout(C,T)},y=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||m.isValid||C)){let T;t.resolver?(T=Ke((await k()).errors),v()):T=await R({fields:n,onlyCheckValid:!0,eventType:Sr.VALID}),T!==r.isValid&&g.state.next({isValid:T})}},v=(C,T)=>{!t.disabled&&(f.isValidating||f.validatingFields||m.isValidating||m.validatingFields)&&((C||Array.from(a.mount)).forEach(I=>{I&&(T?Ee(r.validatingFields,I,T):Ve(r.validatingFields,I))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Ke(r.validatingFields)}))},_=()=>{r.dirtyFields=Fr(s,i)},x=(C,T=[],I,$,B=!0,W=!0)=>{if($&&I&&!t.disabled){if(o.action=!0,W&&Array.isArray(U(n,C))){const V=I(U(n,C),$.argA,$.argB);B&&Ee(n,C,V)}if(W&&Array.isArray(U(r.errors,C))){const V=I(U(r.errors,C),$.argA,$.argB);B&&Ee(r.errors,C,V),uO(r.errors,C)}if((f.touchedFields||m.touchedFields)&&W&&Array.isArray(U(r.touchedFields,C))){const V=I(U(r.touchedFields,C),$.argA,$.argB);B&&Ee(r.touchedFields,C,V)}(f.dirtyFields||m.dirtyFields)&&_(),g.state.next({name:C,isDirty:L(C,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ee(i,C,T)},w=(C,T)=>{Ee(r.errors,C,T),r.errors={...r.errors},g.state.next({errors:r.errors})},S=C=>{r.errors=C,g.state.next({errors:r.errors,isValid:!1})},O=C=>{const T=Bs(C)?[C]:to(C);let I=i,$=s;for(let B=0;B<T.length-1;B++){const W=T[B];if(I=Ze(I)?I:I[W],$=Ze($)?$:$[W],I===null&&$!==null)return!0}return!1},N=(C,T,I,$)=>{const B=U(n,C);if(B){if(O(C))return;const W=Oe(U(i,C)),V=U(i,C,Oe(I)?U(s,C):I);Oe(V)||$&&$.defaultChecked||T?Ee(i,C,T?V:_u(B._f)):z(C,V),o.mount&&!o.action&&(y(),W&&r.isDirty&&(f.isDirty||m.isDirty)&&(L()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&W&&!Oe(U(i,C))&&Po(C,a)&&(o.watch=!0))}},j=(C,T,I,$,B)=>{let W=!1,V=!1;const Z={name:C};if(!t.disabled){if(!I||$){(f.isDirty||m.isDirty)&&(V=r.isDirty,r.isDirty=Z.isDirty=L(),W=V!==Z.isDirty);const ce=Rt(U(s,C),T);V=!!U(r.dirtyFields,C),ce!==r.isDirty?r.dirtyFields=Fr(s,i):ce?Ve(r.dirtyFields,C):Ee(r.dirtyFields,C,!0),Z.dirtyFields=r.dirtyFields,W=W||(f.dirtyFields||m.dirtyFields)&&V!==!ce}if(I){const ce=U(r.touchedFields,C);ce||(Ee(r.touchedFields,C,I),Z.touchedFields=r.touchedFields,W=W||(f.touchedFields||m.touchedFields)&&ce!==I)}W&&B&&g.state.next(Z)}return W?Z:{}},F=(C,T,I,$)=>{const B=U(r.errors,C),W=(f.isValid||m.isValid)&&Nt(T)&&r.isValid!==T;if(t.delayError&&I?(c=h(()=>w(C,I)),c(t.delayError)):(clearTimeout(u),c=null,I?Ee(r.errors,C,I):Ve(r.errors,C),r.errors={...r.errors}),(I?!Rt(B,I):B)||!Ke($)||W){const V={...$,...W&&Nt(T)?{isValid:T}:{},errors:r.errors,name:C};r={...r,...V},g.state.next(V)}},k=async C=>(v(C,!0),await t.resolver(i,t.context,sO(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),M=async C=>{const{errors:T}=await k(C);if(v(C),C){for(const I of C){const $=U(T,I);$?a.array.has(I)&&ke($)&&!Object.keys($).some(B=>!Number.isNaN(Number(B)))?Cu(r.errors,{[I]:$},I):Ee(r.errors,I,$):Ve(r.errors,I)}r.errors={...r.errors}}else r.errors=T;return T},q=async({name:C,eventType:T})=>{if(e.validate){const I=await e.validate({formValues:i,formState:r,name:C,eventType:T});if(ke(I))for(const $ in I){const B=I[$];B&&Ue(`${ko}.${$}`,{message:ct(B.message)?B.message:"",type:B.type||qt.validate})}else ct(I)||!I?Ue(ko,{message:I||"",type:qt.validate}):Ie(ko);return I}return!0},R=async({fields:C,onlyCheckValid:T,name:I,eventType:$,context:B={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(B.runRootValidation=!0,!await q({name:I,eventType:$})&&(B.valid=!1,T)))return B.valid;for(const W in C){const V=C[W];if(V){const{_f:Z,...ce}=V;if(Z){const Ne=a.array.has(Z.name),yt=V._f&&iO(V._f),vt=f.validatingFields||f.isValidating||m.validatingFields||m.isValidating;yt&&vt&&v([Z.name],!0);const lr=await Ou(V,a.disabled,i,b,t.shouldUseNativeValidation&&!T,Ne);if(yt&&vt&&v([Z.name]),lr[Z.name]&&(B.valid=!1,T)||(!T&&(U(lr,Z.name)?Ne?Cu(r.errors,lr,Z.name):Ee(r.errors,Z.name,lr[Z.name]):Ve(r.errors,Z.name)),e.shouldUseNativeValidation&&lr[Z.name]))break}!Ke(ce)&&await R({context:B,onlyCheckValid:T,fields:ce,name:W,eventType:$})}}return B.valid},P=()=>{for(const C of a.unMount){const T=U(n,C);T&&(T._f.refs?T._f.refs.every(I=>!Ao(I)):!Ao(T._f.ref))&&St(C)}a.unMount=new Set},L=(C,T)=>!t.disabled&&(C&&T&&Ee(i,C,T),!Rt(X(),s)),ee=(C,T,I)=>Ca(C,a,{...o.mount?i:Oe(T)?s:ct(C)?{[C]:T}:T},I,T),Y=C=>Ch(U(o.mount?i:s,C,t.shouldUnregister?U(s,C,[]):[])),z=(C,T,I={},$=!1)=>{const B=U(n,C);let W=T;if(B){const V=B._f;V&&(!V.disabled&&Ee(i,C,Ih(T,V)),W=Ri(V.ref)&&Ze(T)?"":T,Oh(V.ref)?[...V.ref.options].forEach(Z=>Z.selected=W.includes(Z.value)):V.refs?$s(V.ref)?V.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(W)?Z.checked=!!W.find(ce=>ce===Z.value):Z.checked=W===Z.value||!!W)}):V.refs.forEach(Z=>Z.checked=Z.value===W):fl(V.ref)?V.ref.value="":(V.ref.value=W,V.ref.type||g.state.next({name:C,values:$?i:Pe(i)})))}(I.shouldDirty||I.shouldTouch)&&j(C,W,I.shouldTouch,I.shouldDirty,!0),I.shouldValidate&&ue(C)},te=(C,T,I,$=!1)=>{for(const B in T){if(!T.hasOwnProperty(B))return;const W=T[B],V=C+"."+B,Z=U(n,V);(a.array.has(C)||ke(W)||Z&&!Z._f)&&!Ur(W)?te(V,W,I,$):z(V,W,I,$)}},ie=(C,T,I,$)=>{const B=U(n,C),W=a.array.has(C),V=$?T:Pe(T),Z=U(i,C),ce=Rt(Z,V);if(ce||Ee(i,C,V),W)g.array.next({name:C,values:$?i:Pe(i)}),(f.isDirty||f.dirtyFields||m.isDirty||m.dirtyFields)&&I.shouldDirty&&(_(),g.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:L(C,V)}));else{const Ne=Array.isArray(V)&&!V.length||Ke(V);!B||B._f||Ze(V)||Ne?z(C,V,I,$):te(C,V,I,$)}if(!ce){const Ne=Po(C,a),yt=$?i:Pe(i);g.state.next({...Ne&&r,name:o.mount||Ne?C:void 0,values:yt})}},H=(C,T,I={})=>ie(C,T,I,!1),J=(C,T={})=>{const I=lt(C)?C(i):C;if(!Rt(i,I)){i={...i,...I};for(const $ of a.mount)ie($,U(I,$),T,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),T.shouldValidate&&y()}},G=async C=>{o.mount=!0;const T=C.target;let I=T.name,$=!0;const B=U(n,I),W=ce=>{$=Number.isNaN(ce)||Ur(ce)&&isNaN(ce.getTime())||Rt(ce,U(i,I,ce))},V=wu(t.mode),Z=wu(t.reValidateMode);if(B){let ce,Ne;const yt=T.type?_u(B._f):Sa(C),vt=C.type===Sr.BLUR||C.type===Sr.FOCUS_OUT,lr=!oO(B._f)&&!e.validate&&!t.resolver&&!U(r.errors,I)&&!B._f.deps||cO(vt,U(r.touchedFields,I),r.isSubmitted,Z,V),Wn=Po(I,a,vt);Ee(i,I,yt),vt?(!T||!T.readOnly)&&(B._f.onBlur&&B._f.onBlur(C),c&&c(0)):B._f.onChange&&B._f.onChange(C);const Pr=j(I,yt,vt),He=!Ke(Pr)||Wn;if(!vt&&g.state.next({name:I,type:C.type,values:Pe(i)}),lr)return(f.isValid||m.isValid)&&(t.mode==="onBlur"?vt&&y():vt||y()),He&&g.state.next({name:I,...Wn?{}:Pr});if(!t.resolver&&e.validate&&await q({name:I,eventType:C.type}),!vt&&Wn&&g.state.next({...r}),t.resolver){const{errors:rt}=await k([I]);if(v([I]),W(yt),!$){!Ke(Pr)&&g.state.next(Pr);return}const dt=Su(r.errors,n,I),Vt=Su(rt,n,dt.name||I);ce=Vt.error,I=Vt.name,Ne=Ke(rt)}else v([I],!0),ce=(await Ou(B,a.disabled,i,b,t.shouldUseNativeValidation))[I],v([I]),W(yt),$&&(ce?Ne=!1:(f.isValid||m.isValid)&&(Ne=await R({fields:n,onlyCheckValid:!0,name:I,eventType:C.type})));$&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&ue(B._f.deps),F(I,Ne,ce,Pr))}},se=(C,T)=>{if(U(r.errors,T)&&C.focus)return C.focus(),1},ue=async(C,T={})=>{let I,$;const B=yi(C);if(t.resolver){const W=await M(Oe(C)?C:B);I=Ke(W),$=C?!B.some(V=>U(W,V)):I}else C?($=(await Promise.all(B.map(async W=>{const V=U(n,W);return await R({fields:V&&V._f?{[W]:V}:V,eventType:Sr.TRIGGER})}))).every(Boolean),!(!$&&!r.isValid)&&y()):$=I=await R({fields:n,name:C,eventType:Sr.TRIGGER});return g.state.next({...!ct(C)||(f.isValid||m.isValid)&&I!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:I}:{},errors:r.errors}),T.shouldFocus&&!$&&fs(n,se,C?B:a.mount),$},X=(C,T)=>{let I={...o.mount?i:s};return T&&(I=Eh(T.dirtyFields?r.dirtyFields:r.touchedFields,I)),Oe(C)?I:ct(C)?U(I,C):C.map($=>U(I,$))},ve=(C,T)=>({invalid:!!U((T||r).errors,C),isDirty:!!U((T||r).dirtyFields,C),error:U((T||r).errors,C),isValidating:!!U(r.validatingFields,C),isTouched:!!U((T||r).touchedFields,C)}),Ie=C=>{const T=C?yi(C):void 0;T==null||T.forEach(I=>Ve(r.errors,I)),T?T.forEach(I=>{g.state.next({name:I,errors:r.errors})}):g.state.next({errors:{}})},Ue=(C,T,I)=>{const $=(U(n,C,{_f:{}})._f||{}).ref,B=U(r.errors,C)||{},{ref:W,message:V,type:Z,...ce}=B;Ee(r.errors,C,{...ce,...T,ref:$}),g.state.next({name:C,errors:r.errors,isValid:!1}),I&&I.shouldFocus&&$&&$.focus&&$.focus()},me=(C,T)=>lt(C)?g.state.subscribe({next:I=>"values"in I&&C(I.values||ee(void 0,T),I)}):ee(C,T,!0),Bt=C=>g.state.subscribe({next:T=>{if(lO(C.name,T.name,C.exact)&&aO(T,C.formState||f,Vs,C.reRenderRoot)){const I={...i};C.callback({values:I,...r,...T,defaultValues:s})}}}).unsubscribe,Ae=C=>(o.mount=!0,m={...m,...C.formState},Bt({...C,formState:{...d,...C.formState}})),St=(C,T={})=>{for(const I of C?yi(C):a.mount)a.mount.delete(I),a.array.delete(I),T.keepValue||(Ve(n,I),Ve(i,I)),!T.keepError&&Ve(r.errors,I),!T.keepDirty&&Ve(r.dirtyFields,I),!T.keepTouched&&Ve(r.touchedFields,I),!T.keepIsValidating&&Ve(r.validatingFields,I),!t.shouldUnregister&&!T.keepDefaultValue&&Ve(s,I);g.state.next({values:Pe(i)}),g.state.next({...r,...T.keepDirty?{isDirty:L()}:{}}),!T.keepIsValid&&y()},tt=({disabled:C,name:T})=>{if(Nt(C)&&o.mount||C||a.disabled.has(T)){const B=a.disabled.has(T)!==!!C;C?a.disabled.add(T):a.disabled.delete(T),B&&o.mount&&!o.action&&y()}},Be=(C,T={})=>{let I=U(n,C);const $=Nt(T.disabled)||Nt(t.disabled),B=!a.registerName.has(C)&&I&&I._f&&!I._f.mount;return Ee(n,C,{...I||{},_f:{...I&&I._f?I._f:{ref:{name:C}},name:C,mount:!0,...T}}),a.mount.add(C),I&&!B?tt({disabled:Nt(T.disabled)?T.disabled:t.disabled,name:C}):N(C,!0,T.value),{...$?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:ts(T.min),max:ts(T.max),minLength:ts(T.minLength),maxLength:ts(T.maxLength),pattern:ts(T.pattern)}:{},name:C,onChange:G,onBlur:G,ref:W=>{if(W){a.registerName.add(C),Be(C,T),a.registerName.delete(C),I=U(n,C);const V=Oe(W.value)&&W.querySelectorAll&&W.querySelectorAll("input,select,textarea")[0]||W,Z=eO(V),ce=I._f.refs||[];if(Z?ce.find(Ne=>Ne===V):V===I._f.ref)return;Ee(n,C,{_f:{...I._f,...Z?{refs:[...ce.filter(Ao),V,...Array.isArray(U(s,C))?[{}]:[]],ref:{type:V.type,name:C}}:{ref:V}}}),N(C,!1,void 0,V)}else I=U(n,C,{}),I._f&&(I._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(bh(a.array,C)&&o.action)&&a.unMount.add(C)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&fs(n,se,a.mount),qe=C=>{Nt(C)&&(g.state.next({disabled:C}),fs(n,(T,I)=>{const $=U(n,I);$&&(T.disabled=$._f.disabled||C,Array.isArray($._f.refs)&&$._f.refs.forEach(B=>{B.disabled=$._f.disabled||C}))},0,!1))},gt=(C,T)=>async I=>{let $;I&&(I.preventDefault&&I.preventDefault(),I.persist&&I.persist());let B=Pe(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:W,values:V}=await k();v(),r.errors=W,B=Pe(V)}else await R({fields:n,eventType:Sr.SUBMIT});if(a.disabled.size)for(const W of a.disabled)Ve(B,W);if(Ve(r.errors,wh),Ke(r.errors)){g.state.next({errors:{}});try{await C(B,I)}catch(W){$=W}}else T&&await T({...r.errors},I),re(),setTimeout(re);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ke(r.errors)&&!$,submitCount:r.submitCount+1,errors:r.errors}),$)throw $},Ct=(C,T={})=>{U(n,C)&&(Oe(T.defaultValue)?H(C,Pe(U(s,C))):(H(C,T.defaultValue),Ee(s,C,Pe(T.defaultValue))),T.keepTouched||Ve(r.touchedFields,C),T.keepDirty||(Ve(r.dirtyFields,C),r.isDirty=T.defaultValue?L(C,Pe(U(s,C))):L()),T.keepError||(Ve(r.errors,C),f.isValid&&y()),g.state.next({...r}))},mt=(C,T={})=>{const I=C?Pe(C):s,$=Pe(I),B=Ke(C),W=$;if(T.keepDefaultValues||(s=I),!T.keepValues){if(T.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(Fr(s,i))]);for(const Z of Array.from(V)){const ce=U(r.dirtyFields,Z),Ne=U(i,Z),yt=U(W,Z);ce&&!Oe(Ne)?Ee(W,Z,Ne):!ce&&!Oe(yt)&&H(Z,yt)}}else{if(eo&&Oe(C))for(const V of a.mount){const Z=U(n,V);if(Z&&Z._f){const ce=Array.isArray(Z._f.refs)?Z._f.refs[0]:Z._f.ref;if(Ri(ce)){const Ne=ce.closest("form");if(Ne){Ne.reset();break}}}}if(T.keepFieldsRef)for(const V of a.mount)H(V,U(W,V));else n={}}if(t.shouldUnregister){if(i=T.keepDefaultValues?Pe(s):{},T.keepFieldsRef)for(const V of a.mount)Ee(i,V,U(W,V))}else i=Pe(W);g.array.next({values:{...W}}),g.state.next({values:{...W}})}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&&!Ke(W),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:B?!1:T.keepDirty?r.isDirty:T.keepValues?L():!!(T.keepDefaultValues&&!Rt(C,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:B?{}:T.keepDirtyValues?T.keepDefaultValues&&i?Fr(s,i):r.dirtyFields:T.keepDefaultValues&&C?Fr(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})},ar=(C,T)=>mt(lt(C)?C(i):C,{...t.resetOptions,...T}),jt=(C,T={})=>{const I=U(n,C),$=I&&I._f;if($){const B=$.refs?$.refs[0]:$.ref;B.focus&&setTimeout(()=>{B.focus(),T.shouldSelect&<(B.select)&&B.select()})}},Vs=C=>{r={...r,...C}},Us={control:{register:Be,unregister:St,getFieldState:ve,handleSubmit:gt,setError:Ue,_subscribe:Bt,_runSchema:k,_updateIsValidating:v,_focusError:re,_getWatch:ee,_getDirty:L,_setValid:y,_setFieldArray:x,_setDisabledField:tt,_setErrors:S,_getFieldArray:Y,_reset:mt,_resetDefaultValues:()=>lt(t.defaultValues)&&t.defaultValues().then(C=>{ar(C,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:P,_disableForm:qe,_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:Ae,trigger:ue,register:Be,handleSubmit:gt,watch:me,setValue:H,setValues:J,getValues:X,reset:ar,resetField:Ct,resetDefaultValues:(C,T={})=>{if(s=Pe(C),!T.keepDirty){const I=Fr(s,i);r.dirtyFields=I,r.isDirty=!Ke(I)}T.keepIsValid||y(),g.state.next({...r,defaultValues:s})},clearErrors:Ie,unregister:St,setError:Ue,setFocus:jt,getFieldState:ve};return{...Us,formControl:Us}}function hO(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Pe(Rh),isLoading:lt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:lt(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&&!lt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=fO(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,ul(()=>{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]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!Rt(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]),p.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=p.useMemo(()=>Sh(s,o),[o,s]),t.current}async function Du(e){var r,n;return(n=(r=(await $e.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function jh(e,t){const r=Ol({queryKey:["framework",e],queryFn:()=>Du(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Ol({queryKey:["framework",n],queryFn:()=>Du(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}const pO={"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."}},Tu={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},gO={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"},kh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Iu=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function mO(e,t,r,n){return e!=null&&e.length?e.filter(s=>!(n&&(s.code==="dialCode"||s.code==="dialcode")||s.visible===!1)).map(s=>{const i=s.code??"",o=_O(s),a=wO(s,r,t),c=t[i],u=Ah(c,o);return{code:i,label:s.label??i,inputType:o,required:!!(s.required??s.validations),editable:s.editable!==!1,placeholder:s.placeholder,maxLength:s.maxLength,options:vO(a,u,o,r),depends:s.depends,tab:bO(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:u}}):CO(t,n,r)}function yO(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 vO(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=yO(n);for(const c of s){const u=String(c);o.has(u)||(i.push({label:a.get(u)??u,value:u}),o.add(u))}return i}function bO(e){const t=e.section;if(t&&Tu[t])return Tu[t];const r=e.code??"";return gO[r]??"details"}function Ah(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 _O(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 wO(e,t,r){const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(a=>({label:a,value:a})):n.map(a=>({label:a.name,value:a.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(a=>({label:a,value:a}));const i=e.code??"",o=e.sourceCategory??kh[i];if(o)return Ph(i,o,e,t,r)}function Ph(e,t,r,n,s){var f,m,g,b,h;const i=Iu.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=y=>({label:y.name,value:i?y.identifier:y.name}),a=(m=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:m.find(y=>y.code===t),c=(h=(b=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:b.categories)==null?void 0:h.find(y=>y.code===t);let u=(Iu.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 d=r.depends;if(d!=null&&d.length){const y=d.flatMap(v=>{const _=s[v];return Array.isArray(_)?_:_!=null&&_!==""?[_]:[]}).map(String);if(y.length){const v=u.filter(_=>{const x=_.associations;return!x||!x.length?!0:x.some(w=>y.includes(w.identifier)||y.includes(w.code)||y.includes(w.name))});v.length&&(u=v)}}return u.map(o)}function mn(e,t){const r=kh[e];if(r)return Ph(e,r,{},t,{})}const xO=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],SO=[{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 Xe(e,t,r){return Ah(e[t],r)}function CO(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:Xe(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:Xe(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:Xe(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:Xe(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:Xe(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:mn("board",r),currentValue:Xe(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:mn("subject",r),currentValue:Xe(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:xO,currentValue:Xe(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:mn("targetBoardIds",r),currentValue:Xe(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:mn("targetMediumIds",r),currentValue:Xe(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:mn("targetGradeLevelIds",r),currentValue:Xe(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:mn("targetSubjectIds",r),currentValue:Xe(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Xe(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Xe(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Xe(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Xe(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:SO,currentValue:Xe(e,"license","select")})),n}function EO(e,t){const{watch:r,setValue:n}=e;p.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 OO="_section_ylgu8_1",DO="_header_ylgu8_11",TO="_title_ylgu8_17",IO="_description_ylgu8_24",NO="_divider_ylgu8_30",RO="_fields_ylgu8_36",yn={section:OO,header:DO,title:TO,description:IO,divider:NO,fields:RO},jO=({title:e,description:t,children:r})=>l.jsxs("div",{className:yn.section,children:[l.jsxs("div",{className:yn.header,children:[l.jsx("h3",{className:yn.title,children:e}),t&&l.jsx("p",{className:yn.description,children:t})]}),l.jsx("hr",{className:yn.divider}),l.jsx("div",{className:yn.fields,children:r})]}),kO="_field_hrhbs_1",AO="_fullWidth_hrhbs_7",PO="_label_hrhbs_11",MO="_required_hrhbs_19",LO="_input_hrhbs_24",FO="_textarea_hrhbs_45",$O="_inputError_hrhbs_50",BO="_error_hrhbs_54",VO="_selectBtn_hrhbs_59",UO="_selectOpen_hrhbs_83",zO="_placeholder_hrhbs_87",qO="_selectedVal_hrhbs_91",HO="_chevronUp_hrhbs_95",WO="_dropdown_hrhbs_100",KO="_option_hrhbs_116",QO="_optionSelected_hrhbs_134",GO="_noOpts_hrhbs_139",YO="_chipGroup_hrhbs_146",XO="_chipInput_hrhbs_158",ZO="_addChipBtn_hrhbs_167",JO="_radioGroup_hrhbs_184",eD="_radioLabel_hrhbs_191",tD="_iconWrap_hrhbs_199",rD="_iconPreview_hrhbs_214",nD="_iconPlaceholder_hrhbs_220",sD="_removeIconBtn_hrhbs_233",iD="_tagChip_hrhbs_252",oD="_tagChipRemove_hrhbs_264",aD="_nestedSelectRow_hrhbs_278",lD="_dialcodeRow_hrhbs_287",cD="_validateBtn_hrhbs_293",uD="_dialcodeValid_hrhbs_315",dD="_dialcodeSpinner_hrhbs_325",A={field:kO,fullWidth:AO,label:PO,required:MO,input:LO,textarea:FO,inputError:$O,error:BO,selectBtn:VO,selectOpen:UO,placeholder:zO,selectedVal:qO,chevronUp:HO,dropdown:WO,option:KO,optionSelected:QO,noOpts:GO,chipGroup:YO,chipInput:XO,addChipBtn:ZO,radioGroup:JO,radioLabel:eD,iconWrap:tD,iconPreview:rD,iconPlaceholder:nD,removeIconBtn:sD,tagChip:iD,tagChipRemove:oD,nestedSelectRow:aD,dialcodeRow:lD,validateBtn:cD,dialcodeValid:uD,dialcodeSpinner:dD},Nu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),u=c[e],d={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[A.field,s?A.fullWidth:""].join(" "),children:[l.jsxs("label",{className:A.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[A.input,A.textarea,u?A.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,d)}):l.jsx("input",{id:e,type:"text",className:[A.input,u?A.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,d)}),u&&l.jsx("span",{className:A.error,children:String(u.message)})]})},fD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),m=u(e),g=((h=r.find(y=>y.value===m))==null?void 0:h.label)??"Select…",b=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var _;(_=a.current)!=null&&_.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:A.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[A.selectBtn,b?A.inputError:"",i?A.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m?A.selectedVal:A.placeholder,children:g}),l.jsx(ks,{size:14,className:i?A.chevronUp:""})]}),i&&l.jsxs("div",{className:A.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[A.option,m===y.value?A.optionSelected:""].join(" "),onClick:()=>{d(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),m===y.value&&l.jsx(Un,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:A.noOpts,children:"No options"})]}),b&&l.jsx("span",{className:A.error,children:String(b.message)})]})},hD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),m=u(e)??[],g=f[e],b=m.length?`${m.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var _;(_=a.current)!=null&&_.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=m.includes(y)?m.filter(_=>_!==y):[...m,y];d(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:A.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[A.selectBtn,g?A.inputError:"",i?A.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m.length?A.selectedVal:A.placeholder,children:b}),l.jsx(ks,{size:14,className:i?A.chevronUp:""})]}),i&&l.jsxs("div",{className:A.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[A.option,m.includes(y.value)?A.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Un,{size:13,style:{opacity:m.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:A.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:A.error,children:String(g.message)})]})},pD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),u=p.useRef(null),{watch:d,setValue:f,formState:{errors:m}}=Yt(),g=d(e)??[],b=m[e],h=()=>{const v=i.trim();v&&!g.includes(v)&&f(e,[...g,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,g.filter(_=>_!==v),{shouldDirty:!0});return l.jsxs("div",{className:[A.field,A.fullWidth].join(" "),children:[l.jsxs("label",{className:A.label,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsxs("div",{className:A.chipGroup,children:[g.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:u,autoFocus:!0,className:A.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:A.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=u.current)==null?void 0:v.focus()},50)},children:[l.jsx(As,{size:12})," Add"]}))]}),b&&l.jsx("span",{className:A.error,children:String(b.message)})]})},gD=({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:A.field,children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("div",{className:A.radioGroup,children:r.map(c=>l.jsxs("label",{className:A.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:A.error,children:String(a.message)})]})},mD="_overlay_1o29p_1",yD="_modal_1o29p_12",vD="_header_1o29p_24",bD="_title_1o29p_33",_D="_closeBtn_1o29p_39",wD="_tabs_1o29p_57",xD="_tab_1o29p_57",SD="_activeTab_1o29p_83",CD="_body_1o29p_88",ED="_searchWrap_1o29p_99",OD="_searchIcon_1o29p_104",DD="_searchInput_1o29p_113",TD="_grid_1o29p_132",ID="_imgCell_1o29p_148",ND="_imgCellSelected_1o29p_166",RD="_thumb_1o29p_171",jD="_noThumb_1o29p_177",kD="_checkBadge_1o29p_183",AD="_loadMoreBtn_1o29p_198",PD="_loadingRow_1o29p_220",MD="_empty_1o29p_230",LD="_spinner_1o29p_237",FD="_uploadArea_1o29p_247",$D="_dropZone_1o29p_256",BD="_uploadIcon_1o29p_277",VD="_dropText_1o29p_281",UD="_dropSubtext_1o29p_288",zD="_uploadPreview_1o29p_294",qD="_hiddenInput_1o29p_301",HD="_fileName_1o29p_305",WD="_errorText_1o29p_311",KD="_footer_1o29p_318",QD="_cancelBtn_1o29p_328",GD="_confirmBtn_1o29p_345",le={overlay:mD,modal:yD,header:vD,title:bD,closeBtn:_D,tabs:wD,tab:xD,activeTab:SD,body:CD,searchWrap:ED,searchIcon:OD,searchInput:DD,grid:TD,imgCell:ID,imgCellSelected:ND,thumb:RD,noThumb:jD,checkBadge:kD,loadMoreBtn:AD,loadingRow:PD,empty:MD,spinner:LD,uploadArea:FD,dropZone:$D,uploadIcon:BD,dropText:VD,dropSubtext:UD,uploadPreview:zD,hiddenInput:qD,fileName:HD,errorText:WD,footer:KD,cancelBtn:QD,confirmBtn:GD},Ru=18,Mh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,u]=p.useState([]),[d,f]=p.useState(0),[m,g]=p.useState(!1),[b,h]=p.useState(null),[y,v]=p.useState(0),[_,x]=p.useState(null),[w,S]=p.useState(""),[O,N]=p.useState(!1),[j,F]=p.useState(""),k=p.useRef(null),M=Se(H=>{var J,G;return((G=(J=H.editorConfig)==null?void 0:J.context)==null?void 0:G.channel)??""}),q=Se(H=>{var J,G;return((G=(J=H.editorConfig)==null?void 0:J.context)==null?void 0:G.uid)??""}),R=p.useCallback(async(H,J,G=!1)=>{var se;g(!0);try{const ue={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&q&&(ue.createdBy=q),M&&(ue.channel=M);const ve=((se=(await $e.post("/action/composite/v3/search",{request:{filters:ue,query:H,limit:Ru,offset:J,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:se.result)??{},Ie=ve.content??[];f(ve.count??0),u(Ue=>G?[...Ue,...Ie]:Ie)}catch{}finally{g(!1)}},[s,q,M]);p.useEffect(()=>{s!=="upload"&&(u([]),v(0),R(o,0))},[s]);const P=p.useRef(),L=H=>{a(H),clearTimeout(P.current),P.current=setTimeout(()=>{u([]),v(0),R(H,0)},400)},ee=()=>{const H=y+Ru;v(H),R(o,H,!0)},Y=()=>{const H=(b==null?void 0:b.artifactUrl)??(b==null?void 0:b.appIcon)??(b==null?void 0:b.downloadUrl)??"";H&&r(H)},z=H=>{var G;const J=(G=H.target.files)==null?void 0:G[0];if(H.target.value="",!!J){if(!J.type.startsWith("image/")){F("Only image files are accepted.");return}if(J.size>4*1024*1024){F("Image must be under 4 MB.");return}x(J),S(URL.createObjectURL(J)),F("")}},te=async()=>{var H,J;if(_){N(!0),F("");try{const G=new FormData;G.append("file",_);const ue=(J=(H=(await $e.post(`/action/content/v3/upload/${e}?fileType=image`,G,{headers:{"Content-Type":"multipart/form-data"}})).data)==null?void 0:H.result)==null?void 0:J.artifactUrl;if(!ue)throw new Error("No URL in response");r(ue)}catch(G){F(G instanceof Error?G.message:"Upload failed.")}finally{N(!1)}}},ie=c.length<d;return l.jsx("div",{className:le.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:le.modal,children:[l.jsxs("div",{className:le.header,children:[l.jsx("span",{className:le.title,children:"Select App Icon"}),l.jsx("button",{className:le.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:18})})]}),l.jsxs("div",{className:le.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${le.tab} ${s==="my"?le.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${le.tab} ${s==="all"?le.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${le.tab} ${s==="upload"?le.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(zl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:le.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:le.searchWrap,children:[l.jsx(oa,{size:14,className:le.searchIcon}),l.jsx("input",{type:"search",className:le.searchInput,placeholder:"Search images…",value:o,onChange:H=>L(H.target.value)})]}),m&&c.length===0?l.jsxs("div",{className:le.loadingRow,children:[l.jsx(si,{size:20,className:le.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:le.empty,children:"No images found"}):l.jsx("div",{className:le.grid,children:c.map(H=>{const J=H.appIcon??H.artifactUrl??H.downloadUrl??"",G=(b==null?void 0:b.identifier)===H.identifier;return l.jsxs("button",{type:"button",className:`${le.imgCell} ${G?le.imgCellSelected:""}`,onClick:()=>h(H),title:H.name,children:[J?l.jsx("img",{src:J,alt:H.name,className:le.thumb}):l.jsx("div",{className:le.noThumb,children:"IMG"}),G&&l.jsx("div",{className:le.checkBadge,children:l.jsx(Un,{size:12})})]},H.identifier)})}),ie&&!m&&l.jsx("button",{className:le.loadMoreBtn,onClick:ee,children:"Load More"}),m&&c.length>0&&l.jsx("div",{className:le.loadingRow,children:l.jsx(si,{size:16,className:le.spinner})})]}):l.jsxs("div",{className:le.uploadArea,children:[l.jsx("div",{className:le.dropZone,onClick:()=>{var H;return(H=k.current)==null?void 0:H.click()},onDragOver:H=>H.preventDefault(),onDrop:H=>{H.preventDefault();const J=H.dataTransfer.files[0];J&&z({target:{files:[J],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:le.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(zl,{size:32,className:le.uploadIcon}),l.jsx("p",{className:le.dropText,children:"Drag & drop or click to browse"}),l.jsx("p",{className:le.dropSubtext,children:"PNG, JPG, SVG · max 4 MB"})]})}),l.jsx("input",{ref:k,type:"file",accept:"image/*",className:le.hiddenInput,onChange:z}),_&&l.jsx("p",{className:le.fileName,children:_.name}),j&&l.jsx("p",{className:le.errorText,children:j})]})}),l.jsxs("div",{className:le.footer,children:[l.jsx("button",{className:le.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:le.confirmBtn,disabled:!_||O,onClick:te,children:O?l.jsxs(l.Fragment,{children:[l.jsx(si,{size:14,className:le.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:le.confirmBtn,disabled:!b,onClick:Y,children:"Use Selected"})]})]})})},YD=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:u,formState:{errors:d}}=Yt(),f=a(e),m=d[e],g=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},b=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:A.field,children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...u(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:A.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:A.iconPreview}):l.jsxs("div",{className:A.iconPlaceholder,children:[l.jsx(zd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:A.removeIconBtn,onClick:b,"aria-label":"Remove app icon",children:[l.jsx(qa,{size:13}),l.jsx("span",{children:"Remove"})]}),m&&l.jsx("span",{className:A.error,children:String(m.message)}),i&&l.jsx(Mh,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},XD=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:A.field,children:[l.jsxs("label",{className:A.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[A.input,o?A.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:A.error,children:String(o.message)})]})},ZD=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),u=p.useRef(null),d=i.value??[],f=h=>{const y=h.trim();!y||d.includes(y)||i.onChange([...d,y])},m=h=>{i.onChange(d.filter(y=>y!==h))},g=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&d.length>0&&m(d[d.length-1])},b=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[A.field,A.fullWidth].join(" "),children:[l.jsxs("label",{className:A.label,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsxs("div",{className:[A.chipGroup,o?A.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=u.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(h=>l.jsxs("span",{className:A.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:A.tagChipRemove,onClick:y=>{y.stopPropagation(),m(h)},"aria-label":`Remove ${h}`,children:l.jsx(sn,{size:11})})]},h)),!n&&l.jsx("input",{ref:u,className:A.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:g,onBlur:b,placeholder:d.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:A.error,children:String(o.message)})]})},JD=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=ro({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},u=(d,f,m)=>{const g={};for(let b=0;b<f;b++)g[r[b].code]=c[r[b].code]??"";g[d]=m;for(let b=f+1;b<r.length;b++)g[r[b].code]="";o.onChange(g)};return l.jsxs("div",{className:[A.field,A.fullWidth].join(" "),children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("div",{className:A.nestedSelectRow,children:r.map((d,f)=>{const m=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:A.field,style:{flex:1},children:[l.jsx("label",{className:A.label,htmlFor:`${e}_${d.code}`,children:d.label}),l.jsxs("select",{id:`${e}_${d.code}`,className:[A.input,a?A.inputError:""].join(" "),disabled:s||m,value:c[d.code]??"",onChange:g=>u(d.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),d.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},d.code)})}),a&&l.jsx("span",{className:A.error,children:String(a.message)})]})},ju=[{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"}],eT=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:u,formState:{errors:d}}=Yt(),f=c(e),m=ju.find(h=>h.value===f),g=(m==null?void 0:m.label)??"Select license…",b=d[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:A.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:A.label,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[A.selectBtn,b?A.inputError:"",s?A.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?A.selectedVal:A.placeholder,children:g}),l.jsx(ks,{size:14,className:s?A.chevronUp:""})]}),s&&l.jsx("div",{className:A.dropdown,role:"listbox",children:ju.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[A.option,f===h.value?A.optionSelected:""].join(" "),onClick:()=>{u(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Un,{size:13})]},h.value))}),b&&l.jsx("span",{className:A.error,children:String(b.message)})]})},tT=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[u,d]=p.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),d("Enter a dial code to validate.");return}c("loading"),d("");try{const b=await L_(g),h=b==null?void 0:b.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),d("Dial code is valid.")):(c("invalid"),d("Dial code not found."))}catch{c("invalid"),d("Validation failed. Please try again.")}},m=()=>a==="loading"?l.jsx(si,{size:16,className:A.dialcodeSpinner}):a==="valid"?l.jsx($d,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(ia,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:A.field,children:[l.jsxs("label",{className:A.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsxs("div",{className:A.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[A.input,o?A.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:g=>{i.onChange(g),c("idle"),d("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:A.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),m()]}),o&&l.jsx("span",{className:A.error,children:String(o.message)}),!o&&u&&l.jsx("span",{className:a==="valid"?A.dialcodeValid:A.error,children:u})]})},rT="_form_szqex_1",nT="_ungrouped_szqex_7",sT="_noFields_szqex_18",Mo={form:rT,ungrouped:nT,noFields:sT},iT=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var L,ee,Y;const a=Se(z=>z.editorConfig),c=Se(z=>z.rootFormConfig),u=Se(z=>z.unitFormConfig),{organisationFramework:d,targetFrameworks:f,isLoading:m}=jh((L=a==null?void 0:a.context)==null?void 0:L.framework,(ee=a==null?void 0:a.context)==null?void 0:ee.targetFWIds),g={organisationFramework:d,targetFrameworks:f},b=Te(z=>z.selectedNodeId),h=Te(z=>z.treeCache),y=b?h[b]??{}:{},v={...e,...y},_=r?c:u,x=_||(((Y=a==null?void 0:a.config.hierarchy)==null?void 0:Y.formConfig)??[]),w=mO(x,v,g,r),S=w.filter(z=>z.tab===t&&z.inputType!=="appIcon"),O=hO({mode:"onChange",defaultValues:Object.fromEntries(w.map(z=>{const te=["multiselect","chips","keywords","tagsinput"],ie=["nestedselect"];return te.includes(z.inputType)?[z.code,z.currentValue??z.defaultValue??[]]:ie.includes(z.inputType)?[z.code,z.currentValue??z.defaultValue??{}]:[z.code,z.currentValue??z.defaultValue??""]}))});EO(O,w);const{updateNode:N}=Te(),j=p.useRef(w);j.current=w;const F=p.useRef(b);F.current=b;const k=p.useRef(i);k.current=i;const M=p.useRef(o);M.current=o,p.useEffect(()=>{const z=O.watch((te,{name:ie})=>{const H=F.current;if(!H)return;const J=j.current,G=new Set(J.map(X=>X.code));if(ie&&G.has(ie)){const X=O.getValues(ie);N(H,{[ie]:X}),k.current({[ie]:X})}else if(!ie){const X=O.getValues(),ve=Object.fromEntries(Object.entries(X).filter(([Ie])=>G.has(Ie)));Object.keys(ve).length>0&&(N(H,ve),k.current(ve))}const se=O.formState.errors,ue=Array.from(new Set(Object.keys(se).map(X=>{var ve;return(ve=J.find(Ie=>Ie.code===X))==null?void 0:ve.tab}).filter(Boolean)));M.current(Object.keys(se).length===0,ue)});return()=>z.unsubscribe()},[O]);const q=s!=="edit",R=S.reduce((z,te)=>{const ie=z[z.length-1];return ie&&ie.section===te.section?ie.fields.push(te):z.push({section:te.section,fields:[te]}),z},[]),P=z=>{const te={key:z.code,name:z.code,label:z.label,required:z.required,disabled:q||z.editable===!1};switch(z.inputType){case"textarea":return l.jsx(Nu,{...te,multiline:!0,maxLength:z.maxLength});case"select":return l.jsx(fD,{...te,options:z.options??[]});case"multiselect":return l.jsx(hD,{...te,options:z.options??[]});case"chips":return l.jsx(pD,{...te});case"radio":return l.jsx(gD,{...te,options:z.options??[]});case"appIcon":return l.jsx(YD,{...te,nodeId:b??""});case"datepicker":case"datetime":return l.jsx(XD,{...te});case"keywords":case"tagsinput":return l.jsx(ZD,{...te});case"nestedselect":return l.jsx(JD,{...te,levels:z.levels??[]});case"license":return l.jsx(eT,{...te});case"dialcode":return l.jsx(tT,{...te});default:return l.jsx(Nu,{...te,maxLength:z.maxLength})}};return l.jsx(ZE,{...O,children:l.jsxs("div",{className:Mo.form,children:[R.map((z,te)=>{const ie=z.section?pO[z.section]:void 0;return ie?l.jsx(jO,{title:ie.title,description:ie.description,children:z.fields.map(P)},z.section??te):l.jsx("div",{className:Mo.ungrouped,children:z.fields.map(P)},te)}),S.length===0&&!m&&l.jsx("p",{className:Mo.noFields,children:"No fields configured for this tab."})]})})};function Lh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function oT(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Zs(e){return e!==null&&e>=0}function aT(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 lT(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Fh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Lh(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}},Js={scaleX:1,scaleY:1},cT=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 u=i[o];return u?{x:0,y:r<o?u.top+u.height-(a.top+a.height):u.top-a.top,...Js}:null}const c=uT(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Js}:s<r&&s>=o?{x:0,y:a.height+c,...Js}:{x:0,y:0,...Js}};function uT(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 $h="Sortable",Bh=p.createContext({activeIndex:-1,containerId:$h,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fh,disabled:{draggable:!1,droppable:!1}});function dT(e){let{children:t,id:r,items:n,strategy:s=Fh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=Md(),f=Rs($h,r),m=a.rect!==null,g=p.useMemo(()=>n.map(O=>typeof O=="object"&&"id"in O?O.id:O),[n]),b=o!=null,h=o?g.indexOf(o.id):-1,y=u?g.indexOf(u.id):-1,v=p.useRef(g),_=!aT(g,v.current),x=y!==-1&&h===-1||_,w=lT(i);Kt(()=>{_&&b&&d(g)},[_,g,b,d]),p.useEffect(()=>{v.current=g},[g]);const S=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:g,overIndex:y,useDragOverlay:m,sortedRects:oT(g,c),strategy:s}),[h,f,w.draggable,w.droppable,x,g,y,c,m,s]);return p.createElement(Bh.Provider,{value:S},t)}const fT=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Lh(r,n,s).indexOf(t)},hT=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:u}=e;return!u||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},pT={duration:200,easing:"ease"},Vh="transform",gT=kr.Transition.toString({property:Vh,duration:0,easing:"linear"}),mT={roleDescription:"sortable"};function yT(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const u=Vn(n.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function vT(e){let{animateLayoutChanges:t=hT,attributes:r,disabled:n,data:s,getNewIndex:i=fT,id:o,strategy:a,resizeObserverConfig:c,transition:u=pT}=e;const{items:d,containerId:f,activeIndex:m,disabled:g,disableTransforms:b,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:_}=p.useContext(Bh),x=bT(n,g),w=d.indexOf(o),S=p.useMemo(()=>({sortable:{containerId:f,index:w,items:d},...s}),[f,s,w,d]),O=p.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:N,node:j,isOver:F,setNodeRef:k}=Mm({id:o,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...c}}),{active:M,activatorEvent:q,activeNodeRect:R,attributes:P,setNodeRef:L,listeners:ee,isDragging:Y,over:z,setActivatorNodeRef:te,transform:ie}=Pd({id:o,data:S,attributes:{...mT,...r},disabled:x.draggable}),H=wg(k,L),J=!!M,G=J&&!b&&Zs(m)&&Zs(y),se=!v&&Y,ue=se&&G?ie:null,ve=G?ue??(a??_)({rects:h,activeNodeRect:R,activeIndex:m,overIndex:y,index:w}):null,Ie=Zs(m)&&Zs(y)?i({id:o,items:d,activeIndex:m,overIndex:y}):w,Ue=M==null?void 0:M.id,me=p.useRef({activeId:Ue,items:d,newIndex:Ie,containerId:f}),Bt=d!==me.current.items,Ae=t({active:M,containerId:f,isDragging:Y,isSorting:J,id:o,index:w,items:d,newIndex:me.current.newIndex,previousItems:me.current.items,previousContainerId:me.current.containerId,transition:u,wasDragging:me.current.activeId!=null}),St=yT({disabled:!Ae,index:w,node:j,rect:N});return p.useEffect(()=>{J&&me.current.newIndex!==Ie&&(me.current.newIndex=Ie),f!==me.current.containerId&&(me.current.containerId=f),d!==me.current.items&&(me.current.items=d)},[J,Ie,f,d]),p.useEffect(()=>{if(Ue===me.current.activeId)return;if(Ue&&!me.current.activeId){me.current.activeId=Ue;return}const Be=setTimeout(()=>{me.current.activeId=Ue},50);return()=>clearTimeout(Be)},[Ue]),{active:M,activeIndex:m,attributes:P,data:S,rect:N,index:w,newIndex:Ie,items:d,isOver:F,isSorting:J,isDragging:Y,listeners:ee,node:j,overIndex:y,over:z,setNodeRef:H,setActivatorNodeRef:te,setDroppableNodeRef:k,setDraggableNodeRef:L,transform:St??ve,transition:tt()};function tt(){if(St||Bt&&me.current.newIndex===w)return gT;if(!(se&&!$i(q)||!u)&&(J||Ae))return kr.Transition.toString({...u,property:Vh})}}function bT(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 ki(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 _T=[ge.Down,ge.Right,ge.Up,ge.Left],wT=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(_T.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=s.get(f.id);if(m)switch(e.code){case ge.Down:n.top<m.top&&c.push(f);break;case ge.Up:n.top>m.top&&c.push(f);break;case ge.Left:n.left>m.left&&c.push(f);break;case ge.Right:n.left<m.left&&c.push(f);break}});const u=Fg({collisionRect:n,droppableRects:s,droppableContainers:c});let d=vd(u,"id");if(d===(o==null?void 0:o.id)&&u.length>1&&(d=u[1].id),d!=null){const f=i.get(r.id),m=i.get(d),g=m?s.get(m.id):null,b=m==null?void 0:m.node.current;if(b&&g&&f&&m){const y=Bi(b).some((O,N)=>a[N]!==O),v=Uh(f,m),_=xT(f,m),x=y||!v?{x:0,y:0}:{x:_?n.width-g.width:0,y:_?n.height-g.height:0},w={x:g.left,y:g.top};return x.x&&x.y?w:ys(w,x)}}}};function Uh(e,t){return!ki(e)||!ki(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function xT(e,t){return!ki(e)||!ki(t)||!Uh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const ST="_row_11nth_1",CT="_removeBtn_11nth_14",ET="_grip_11nth_17",OT="_ctIcon_11nth_34",DT="_info_11nth_38",TT="_name_11nth_46",IT="_meta_11nth_55",Mr={row:ST,removeBtn:CT,grip:ET,ctIcon:OT,info:DT,name:TT,meta:IT},NT={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},RT=({item:e,onRemove:t,isEditable:r})=>{const n=Ji(e),s=NT[n.key]??zn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:u,isDragging:d}=vT({id:e.id,disabled:!r}),f={transform:kr.Transform.toString(c),transition:u,opacity:d?.5:1};return l.jsxs("div",{ref:a,style:f,className:Mr.row,role:"listitem",children:[r&&l.jsx("span",{className:Mr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Ud,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Mr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Mr.info,children:[l.jsx("span",{className:Mr.name,title:e.name,children:e.name}),l.jsx("span",{className:Mr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Mr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(sn,{size:14})})]})},jT="_container_lzvke_1",kT="_header_lzvke_7",AT="_heading_lzvke_13",PT="_count_lzvke_21",MT="_list_lzvke_30",LT="_emptyState_lzvke_36",FT="_addRow_lzvke_52",Lr={container:jT,header:kT,heading:AT,count:PT,list:MT,emptyState:LT,addRow:FT},$T=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Te(),i=t?r(t):[],o=e==="edit",a=gd(ta(Vi,{activationConstraint:{distance:5}}),ta(Ma,{coordinateGetter:wT})),c=p.useCallback(d=>{const{active:f,over:m}=d;if(!m||f.id===m.id||!t)return;const g=Te.getState().getChildrenOf(t),b=g.findIndex(y=>y.id===f.id),h=g.findIndex(y=>y.id===m.id);b<0||h<0||n(t,b,h)},[t,n]),u=p.useCallback(d=>{window.confirm("Remove this content from the unit?")&&s(d)},[s]);return t?l.jsxs("div",{className:Lr.container,children:[l.jsxs("div",{className:Lr.header,children:[l.jsx("span",{className:Lr.heading,children:"Content in this unit"}),l.jsx("span",{className:Lr.count,children:i.length})]}),i.length>0?l.jsx(Ad,{sensors:a,collisionDetection:Lg,onDragEnd:c,children:l.jsx(dT,{items:i.map(d=>d.id),strategy:cT,children:l.jsx("div",{className:Lr.list,role:"list",children:i.map(d=>l.jsx(RT,{item:d,onRemove:u,isEditable:o},d.id))})})}):l.jsxs("div",{className:Lr.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:Lr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(As,{size:14})," Add content"]})]}):null},BT="_dropZone_ijo5w_1",VT="_active_ijo5w_14",ku={dropZone:BT,active:VT},UT=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${ku.dropZone} ${e?ku.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 zT(e){var s;const t={status:["Live"],contentType:["Resource"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((s=(await $e.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:s.result)??{};return{content:n.content??[],count:n.count??0}}async function qT(e){var r,n;return(n=(r=(await $e.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const HT="_contentPlayerRoot_ryh6z_1",WT="_stage_ryh6z_9",KT="_playerHeader_ryh6z_19",QT="_playerHeaderThumb_ryh6z_33",GT="_playerHeaderTitle_ryh6z_43",YT="_typeBadge_ryh6z_53",XT="_typeDot_ryh6z_92",ZT="_aspectRatio_ryh6z_99",JT="_playerFrame_ryh6z_112",eI="_coverOverlay_ryh6z_120",tI="_coverHidden_ryh6z_132",rI="_coverThumb_ryh6z_137",nI="_coverPlayRing_ryh6z_146",sI="_coverPlayIcon_ryh6z_159",iI="_coverLabel_ryh6z_168",oI="_coverSkeleton_ryh6z_174",aI="_playerWrapper_ryh6z_200",lI="_infoStrip_ryh6z_210",cI="_infoChip_ryh6z_226",uI="_infoChipLabel_ryh6z_245",dI="_infoChipIcon_ryh6z_254",fI="_playerError_ryh6z_260",hI="_playerErrorIcon_ryh6z_274",pI="_playerErrorMsg_ryh6z_279",gI="_qumlRoot_ryh6z_286",De={contentPlayerRoot:HT,stage:WT,playerHeader:KT,playerHeaderThumb:QT,playerHeaderTitle:GT,typeBadge:YT,typeDot:XT,aspectRatio:ZT,playerFrame:JT,coverOverlay:eI,coverHidden:tI,coverThumb:rI,coverPlayRing:nI,coverPlayIcon:sI,coverLabel:iI,coverSkeleton:oI,playerWrapper:aI,infoStrip:lI,infoChip:cI,infoChipLabel:uI,infoChipIcon:dI,playerError:fI,playerErrorIcon:hI,playerErrorMsg:pI,qumlRoot:gI},mI=[{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 yI(e){return mI.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const vI={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},bI={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},_I={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},wI="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Lo(e){for(const[t,r]of Object.entries(vI))if(r.includes(e))return t;return"default-player"}function xI(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 SI(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 CI(e,t,r=100){await SI(bI[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 EI=[{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 OI({node:e}){const t=e.metadata??{},r=EI.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:De.infoStrip,children:r.map(n=>l.jsxs("div",{className:De.infoChip,children:[n.icon&&l.jsx("span",{className:De.infoChipIcon,children:n.icon}),l.jsx("span",{className:De.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function DI({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${De.coverOverlay} ${t?De.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:De.coverThumb}),l.jsx("div",{className:De.coverPlayRing,children:l.jsx("div",{className:De.coverPlayIcon})}),l.jsx("span",{className:De.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:De.coverSkeleton})})}function TI({message:e}){return l.jsxs("div",{className:De.playerError,children:[l.jsx("span",{className:De.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:De.playerErrorMsg,children:e})]})}function II({mimeType:e}){const t=yI(e);return l.jsxs("span",{className:De.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:De.typeDot}),t.label]})}const Ta=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(RI,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:De.contentPlayerRoot,children:[l.jsxs("div",{className:De.stage,children:[l.jsxs("div",{className:De.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:De.playerHeaderThumb}),l.jsx("span",{className:De.playerHeaderTitle,children:e.name}),l.jsx(II,{mimeType:e.mimeType??""})]}),l.jsx(NI,{node:e})]}),l.jsx(OI,{node:e})]})};function NI({node:e}){var y;const t=Se(v=>v.editorConfig),[r,n]=p.useState(()=>Lo(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,u]=p.useState(e.metadata??{}),[d,f]=p.useState(!1),m=p.useRef(null),g=p.useRef(null),b=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??wI;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),u(e.metadata??{}),n(Lo(e.mimeType??"")),qT(e.identifier).then(_=>{if(v)return;const x={...e.metadata??{},..._};u(x);const w=_.mimeType??e.mimeType??"";n(Lo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=xI(e,c,t);return p.useEffect(()=>{if(!d||r!=="default-player")return;const v=m.current;if(!v)return;v.src=b;const _=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",_),v.addEventListener("error",x),()=>{v.removeEventListener("load",_),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,b,d]),p.useEffect(()=>{if(!d||r==="default-player")return;const v=g.current;if(!v)return;const _=_I[r];if(!_)return;const x=h;CI(_,r).then(()=>{if(!g.current)return;if(!customElements.get(_)){n("default-player");return}const w=document.createElement(_);w.setAttribute("player-config",JSON.stringify(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,d]),l.jsxs("div",{className:De.aspectRatio,children:[o?l.jsx(TI,{message:o}):l.jsx(DI,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:m,id:"contentPlayer",title:e.name,className:De.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:De.playerFrame})]})}function RI({node:e,editorMode:t}){const r=Se(s=>s.editorConfig),n=p.useRef(null);return p.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:De.qumlRoot,children:l.jsx("div",{ref:n,className:De.playerWrapper})})}const jI="_overlay_1856m_1",kI="_modal_1856m_11",AI="_header_1856m_21",PI="_body_1856m_37",MI="_hint_1856m_43",LI="_list_1856m_49",FI="_item_1856m_55",$I="_selected_1856m_68",BI="_empty_1856m_73",VI="_footer_1856m_79",UI="_cancelBtn_1856m_87",zI="_moveBtn_1856m_95",Mt={overlay:jI,modal:kI,header:AI,body:PI,hint:MI,list:LI,item:FI,selected:$I,empty:BI,footer:VI,cancelBtn:UI,moveBtn:zI};function qI(e,t){const r=[],n=s=>{var i;for(const o of s)o.isFolder&&o.id!==t&&r.push(o),(i=o.children)!=null&&i.length&&n(o.children)};return n(e),r}const HI=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{const{treeData:s,moveNode:i}=Te(),o=qI(s,r),[a,c]=p.useState(null),u=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Mt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Mt.modal,children:[l.jsxs("div",{className:Mt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsxs("div",{className:Mt.body,children:[l.jsx("p",{className:Mt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Mt.list,children:[o.map(d=>l.jsxs("li",{className:`${Mt.item} ${a===d.id?Mt.selected:""}`,onClick:()=>c(d.id),children:[l.jsx(sy,{size:14}),l.jsx("span",{children:d.name})]},d.id)),o.length===0&&l.jsx("li",{className:Mt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Mt.footer,children:[l.jsx("button",{className:Mt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Mt.moveBtn,onClick:u,disabled:!a,children:"Move here"})]})]})})},WI="_overlay_pv0x1_1",KI="_modal_pv0x1_11",QI="_header_pv0x1_21",GI="_body_pv0x1_37",YI="_table_pv0x1_43",XI="_pageInput_pv0x1_61",ZI="_empty_pv0x1_68",JI="_footer_pv0x1_74",eN="_cancelBtn_pv0x1_82",tN="_saveBtn_pv0x1_90",tr={overlay:WI,modal:KI,header:QI,body:GI,table:YI,pageInput:XI,empty:ZI,footer:JI,cancelBtn:eN,saveBtn:tN};function rN(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 nN=({onClose:e})=>{const{treeData:t,updateNode:r}=Te(),n=rN(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.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:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsx("div",{className:tr.body,children:n.length===0?l.jsx("p",{className:tr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:tr.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(u=>({...u,[a.id]:c.target.value})),className:tr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:tr.footer,children:[l.jsx("button",{className:tr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:tr.saveBtn,onClick:o,children:[l.jsx(py,{size:14})," Save"]})]})]})})},sN="_container_1a7t2_1",iN="_panelHeader_1a7t2_10",oN="_panelHeaderLeft_1a7t2_19",aN="_panelCollapseBtn_1a7t2_27",lN="_titleRow_1a7t2_46",cN="_field_1a7t2_47",uN="_moveBtn_1a7t2_64",dN="_icon_1a7t2_84",fN="_nameInput_1a7t2_93",hN="_fieldHeader_1a7t2_118",pN="_label_1a7t2_124",gN="_fieldCount_1a7t2_133",mN="_chips_1a7t2_170",yN="_chip_1a7t2_170",vN="_chipRemove_1a7t2_188",bN="_keywordInput_1a7t2_202",_N="_input_1a7t2_207",wN="_addBtn_1a7t2_220",xN="_radioGroup_1a7t2_234",SN="_radioLabel_1a7t2_239",Re={container:sN,panelHeader:iN,panelHeaderLeft:oN,panelCollapseBtn:aN,titleRow:lN,field:cN,moveBtn:uN,icon:dN,nameInput:fN,fieldHeader:hN,label:pN,fieldCount:gN,chips:mN,chip:yN,chipRemove:vN,keywordInput:bN,input:_N,addBtn:wN,radioGroup:xN,radioLabel:SN},CN=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var M,q;const{updateNode:s,markDirty:i}=Te(),o=t==="edit",a=Ji(e),c=Se(R=>R.relationalFormConfig),u=R=>c==null?void 0:c.find(P=>P.code===R),d=R=>!c||!!u(R),f=(R,P)=>{var L;return((L=u(R))==null?void 0:L.label)||P},[m,g]=p.useState(!0),b=((M=e.metadata)==null?void 0:M.relationalMetadata)??{},[h,y]=p.useState(b.name??e.name??""),[v,_]=p.useState(""),[x,w]=p.useState(Array.isArray(b.keywords)?b.keywords:Array.isArray((q=e.metadata)==null?void 0:q.keywords)?e.metadata.keywords:[]),[S,O]=p.useState(!!b.optional);p.useEffect(()=>{var P,L;const R=((P=e.metadata)==null?void 0:P.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((L=e.metadata)==null?void 0:L.keywords)?e.metadata.keywords:[]),O(!!R.optional)},[e.id]);const N=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},j=()=>{const R=v.trim();if(R&&!x.includes(R)){const P=[...x,R];w(P),s(e.id,{keywords:P}),i()}_("")},F=R=>{const P=x.filter(L=>L!==R);w(P),s(e.id,{keywords:P}),i()},k=R=>{O(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:Re.container,children:[l.jsxs("div",{className:Re.panelHeader,children:[l.jsxs("div",{className:Re.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Re.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Re.panelCollapseBtn,onClick:()=>g(R=>!R),"aria-expanded":m,"aria-label":m?"Collapse metadata panel":"Expand metadata panel",title:m?"Collapse":"Expand",children:m?l.jsx(ks,{size:15}):l.jsx(ty,{size:15})})]}),m&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Re.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Re.icon}),l.jsx("input",{type:"text",className:Re.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:N,placeholder:"Content name"})]}),d("keywords")&&l.jsxs("div",{className:Re.field,children:[l.jsx("div",{className:Re.fieldHeader,children:l.jsxs("label",{className:Re.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:Re.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:Re.chips,children:x.map(R=>l.jsxs("span",{className:Re.chip,children:[R,o&&l.jsx("button",{type:"button",className:Re.chipRemove,onClick:()=>F(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:Re.keywordInput,children:[l.jsx("input",{type:"text",className:Re.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>_(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),j())}}),l.jsx("button",{type:"button",className:Re.addBtn,onClick:j,children:"Add"})]})]}),d("optional")&&l.jsxs("div",{className:Re.field,children:[l.jsx("label",{className:Re.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Re.radioGroup,children:[l.jsxs("label",{className:Re.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:S===!0,onChange:()=>k(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Re.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:S===!1,onChange:()=>k(!1),disabled:!o}),"No"]})]})]})]}),n]})},EN="_iconBtn_vl14u_1",ON="_editable_vl14u_14",DN="_iconImg_vl14u_26",TN="_placeholder_vl14u_34",IN="_removeBtn_vl14u_41",rs={iconBtn:EN,editable:ON,iconImg:DN,placeholder:TN,removeBtn:IN},NN=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=Te(),a=u=>{i(e,{appIcon:u}),o(),s(!1)},c=u=>{u.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[rs.iconBtn,r?rs.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:u=>{r&&(u.key==="Enter"||u.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:rs.iconImg}):l.jsx("div",{className:rs.placeholder,children:l.jsx(zd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:rs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(qa,{size:11})})]}),n&&l.jsx(Mh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},RN="_leafContentLayout_1e8xj_1",jN="_container_1e8xj_17",kN="_emptyState_1e8xj_26",AN="_titleRow_1e8xj_36",PN="_nodeTitle_1e8xj_52",MN="_formArea_1e8xj_74",LN="_contentListArea_1e8xj_78",FN="_dropZone_1e8xj_83",$N="_reviewComment_1e8xj_90",BN="_reviewCommentLabel_1e8xj_103",VN="_reviewCommentText_1e8xj_109",Ut={leafContentLayout:RN,container:jN,emptyState:kN,titleRow:AN,nodeTitle:PN,formArea:MN,contentListArea:LN,dropZone:FN,reviewComment:$N,reviewCommentLabel:BN,reviewCommentText:VN},UN=["application/vnd.sunbird.questionset"],zN=({editorMode:e,onToolbarEvent:t})=>{var M,q,R,P;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,u]=p.useState(!1),d=p.useRef(null),f=p.useRef(),{selectedNodeId:m,breadcrumb:g,activeNodeMeta:b,updateNode:h,treeData:y}=Te(),v=Se(L=>{var ee,Y,z,te;return((Y=(ee=L.editorConfig)==null?void 0:ee.context)==null?void 0:Y.contentId)??((te=(z=L.editorConfig)==null?void 0:z.context)==null?void 0:te.identifier)??""}),_=m?zh(y,m):null,x=!!_&&!_.parent,w=!!(_!=null&&_.isFolder),S=_&&UN.includes(_.mimeType??""),O=_&&!_.isFolder&&!S&&!x,N=((M=_==null?void 0:_.metadata)==null?void 0:M.rejectComment)??(x?(R=(q=y[0])==null?void 0:q.metadata)==null?void 0:R.rejectComment:void 0),j=p.useCallback(()=>{const L=d.current;if(!L||!m)return;const ee=L.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(m,{name:ee})},600)},[m,h]),F=p.useCallback(L=>{t({action:"onFormValueChange",data:L})},[t]),k=p.useCallback((L,ee)=>{i(ee),t({action:"onFormStatusChange",data:{isValid:L}})},[t]);return _?S?l.jsx(Ta,{node:_,editorMode:e,type:"quml"}):O?l.jsxs("div",{className:Ut.leafContentLayout,children:[l.jsx(Ta,{node:_,editorMode:e,type:"content"}),l.jsx(CN,{node:_,editorMode:e,onMoveClick:()=>a(_.identifier),reorderDialog:o?l.jsx(HI,{resourceId:o,resourceName:_.name,currentUnitId:_.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Ut.container,children:[l.jsx(zE,{crumbs:g}),e==="review"&&N&&l.jsxs("div",{className:Ut.reviewComment,role:"alert",children:[l.jsx("span",{className:Ut.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Ut.reviewCommentText,children:N})]}),l.jsxs("div",{className:Ut.titleRow,children:[x&&m&&l.jsx(NN,{nodeId:m,value:String(_.appIcon??((P=_.metadata)==null?void 0:P.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:d,className:Ut.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:j,onBlur:j,"data-placeholder":"Untitled","aria-label":"Node title",children:_.name})]}),l.jsx(GE,{activeTab:r,onChange:L=>n(L),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:Ut.formArea,children:l.jsx(iT,{nodeMetadata:b,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:F,onFormStatusChange:k},`${m??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:Ut.contentListArea,children:l.jsx($T,{editorMode:e})}),l.jsx(UT,{isActive:!1,label:"Drop to add content to this unit",nodeId:m??void 0,className:Ut.dropZone}),c&&l.jsx(nN,{contentId:v,onClose:()=>u(!1)})]}):l.jsx("div",{className:Ut.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function zh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=zh(r.children,t);if(n)return n}}}const qh=qi((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})}})),qN=20;function Hh(){var u;const e=Se(d=>d.editorConfig),t=Te(d=>d.selectedNodeId),r=Te(d=>d.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function d(f,m,g=0){var b;for(const h of f){if(h.id===m)return g;if((b=h.children)!=null&&b.length){const y=d(h.children,m,g+1);if(y>=0)return y}}return-1}return Math.max(0,d(r,t))},[t,r])(),s=(u=e==null?void 0:e.config)==null?void 0:u.hierarchy;if(!s)return[...hu];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:[...hu]}function HN(){const e=qh(),t=Se(f=>{var m,g;return((g=(m=f.editorConfig)==null?void 0:m.context)==null?void 0:g.channel)??""}),r=Hh(),n=p.useRef(),s=p.useCallback(async(f="",m="all",g={},b=!0,h=!1)=>{var y,v,_,x,w;e.setLoading(!0);try{const S={status:["Live"],contentType:["Resource"],primaryCategory:m&&m!=="all"?[m]:r};(y=g==null?void 0:g.board)!=null&&y.length&&(S.board=g.board),(v=g==null?void 0:g.medium)!=null&&v.length&&(S.medium=g.medium),(_=g==null?void 0:g.gradeLevel)!=null&&_.length&&(S.gradeLevel=g.gradeLevel),(x=g==null?void 0:g.subject)!=null&&x.length&&(S.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(S.primaryCategory=g.primaryCategory);const O=b?0:e.offset,{content:N,count:j}=await zT({filters:S,query:f,limit:f?50:qN,offset:O,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});b?e.setContent(N,j):e.appendContent(N,j)}catch(S){console.error("[useLibrary] load error:",S)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.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=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.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]),u=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),d=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:d,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:u,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const WN="_card_yw3wq_1",KN="_addBtn_yw3wq_17",QN="_dragging_yw3wq_24",GN="_ctIcon_yw3wq_29",YN="_info_yw3wq_33",XN="_name_yw3wq_41",ZN="_meta_yw3wq_50",JN="_added_yw3wq_78",eR="_addedBadge_yw3wq_87",ur={card:WN,addBtn:KN,dragging:QN,ctIcon:GN,info:YN,name:XN,meta:ZN,added:JN,addedBadge:eR},tR={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},rR=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var m,g;const i=Ji(e),o=tR[i.key]??zn,{attributes:a,listeners:c,setNodeRef:u,isDragging:d}=Pd({id:e.identifier,disabled:!n,data:{type:"library-item",item:e}}),f=()=>{r&&r(e)};return l.jsxs("div",{ref:u,className:[ur.card,d?ur.dragging:"",s?ur.added:""].join(" "),"aria-label":e.name,...n?{...a,...c}:{},role:"listitem",onClick:f,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,ur.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:ur.info,children:[l.jsx("span",{className:ur.name,title:e.name,children:e.name}),l.jsxs("span",{className:ur.meta,children:[((m=e.organisation)==null?void 0:m[0])??e.channel??"",(g=e.organisation)!=null&&g[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:ur.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Un,{size:12})}),!s&&l.jsx("button",{type:"button",className:ur.addBtn,onClick:b=>{b.stopPropagation(),t(e)},"aria-label":`Add ${e.name} to unit`,title:"Add to unit",children:l.jsx(As,{size:14})})]})},nR="_chips_xhhaq_1",sR="_chip_xhhaq_1",Au={chips:nR,chip:sR},iR=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Au.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",Au.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),oR="_panel_1cl11_1",aR="_header_1cl11_10",lR="_headerTitle_1cl11_19",cR="_closeBtn_1cl11_25",uR="_body_1cl11_43",dR="_section_1cl11_59",fR="_sectionLabel_1cl11_65",hR="_chips_1cl11_73",pR="_chip_1cl11_73",gR="_active_1cl11_96",mR="_footer_1cl11_102",yR="_resetBtn_1cl11_112",vR="_applyBtn_1cl11_129",Qe={panel:oR,header:aR,headerTitle:lR,closeBtn:cR,body:uR,section:dR,sectionLabel:fR,chips:hR,chip:pR,active:gR,footer:mR,resetBtn:yR,applyBtn:vR},bR=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],_R=new Set(["board","medium","gradeLevel","subject","topic"]),wR=({local:e,toggle:t})=>{const r=Hh();return r.length?l.jsxs("div",{className:Qe.section,children:[l.jsx("div",{className:Qe.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:Qe.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[Qe.chip,(e.primaryCategory??[]).includes(n)?Qe.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},xR=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,b;const s=Se(h=>h.editorConfig),i=Se(h=>h.searchFormConfig),{organisationFramework:o}=jh((g=s==null?void 0:s.context)==null?void 0:g.framework,(b=s==null?void 0:s.context)==null?void 0:b.targetFWIds),[a,c]=p.useState(t),u=i!=null&&i.length?i.filter(h=>_R.has(h.code)).map(h=>({key:h.code,label:h.label||h.code})):bR;p.useEffect(()=>{c(t)},[t]);const d=(h,y)=>{c(v=>{const _=v[h]??[],x=_.includes(y)?_.filter(w=>w!==y):[..._,y];return{...v,[h]:x}})},f=(o==null?void 0:o.categories)??[],m=h=>{var y;return((y=f.find(v=>v.code===h))==null?void 0:y.terms)??[]};return e?l.jsxs("div",{className:Qe.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:Qe.header,children:[l.jsx("span",{className:Qe.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:Qe.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(sn,{size:16})})]}),l.jsxs("div",{className:Qe.body,children:[u.map(({key:h,label:y})=>{const v=m(h);return v.length?l.jsxs("div",{className:Qe.section,children:[l.jsx("div",{className:Qe.sectionLabel,children:y}),l.jsx("div",{className:Qe.chips,children:v.slice(0,20).map(_=>l.jsx("button",{type:"button",className:[Qe.chip,(a[h]??[]).includes(_.name)?Qe.active:""].join(" "),onClick:()=>d(h,_.name),children:_.name},_.identifier))})]},h):null}),l.jsx(wR,{local:a,toggle:d})]}),l.jsxs("div",{className:Qe.footer,children:[l.jsx("button",{type:"button",className:Qe.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:Qe.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},SR="_panel_6qdpu_1",CR="_header_6qdpu_10",ER="_title_6qdpu_20",OR="_headerActions_6qdpu_31",DR="_iconBtn_6qdpu_38",TR="_playerArea_6qdpu_56",IR="_footer_6qdpu_64",NR="_addBtn_6qdpu_73",RR="_modalOverlay_6qdpu_92",jR="_modalPanel_6qdpu_103",zt={panel:SR,header:CR,title:ER,headerActions:OR,iconBtn:DR,playerArea:TR,footer:IR,addBtn:NR,modalOverlay:RR,modalPanel:jR},kR=({content:e,onAdd:t,onClose:r})=>{const[n,s]=p.useState(!1);if(!e)return null;const i={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},o=l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:zt.header,children:[l.jsx("span",{className:zt.title,title:e.name,children:e.name}),l.jsxs("div",{className:zt.headerActions,children:[l.jsx("button",{type:"button",className:zt.iconBtn,onClick:()=>s(a=>!a),"aria-label":n?"Collapse preview":"Expand preview",title:n?"Collapse":"Expand",children:n?l.jsx(ly,{size:15}):l.jsx(ay,{size:15})}),l.jsx("button",{type:"button",className:zt.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(sn,{size:16})})]})]}),l.jsx("div",{className:zt.playerArea,children:l.jsx(Ta,{node:i,editorMode:"read",type:"content"})}),l.jsx("div",{className:zt.footer,children:l.jsx("button",{type:"button",className:zt.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]});return n?$r.createPortal(l.jsx("div",{className:zt.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",children:l.jsx("div",{className:zt.modalPanel,children:o})}),document.body):l.jsx("div",{className:zt.panel,children:o})},AR="_dock_1lpg0_1",PR="_header_1lpg0_8",MR="_headerLeft_1lpg0_17",LR="_headerTitle_1lpg0_24",FR="_count_1lpg0_30",$R="_searchRow_1lpg0_39",BR="_searchWrap_1lpg0_47",VR="_searchIcon_1lpg0_53",UR="_searchInput_1lpg0_62",zR="_filterToggleBtn_1lpg0_80",qR="_filterToggleBtnActive_1lpg0_99",HR="_filterBadge_1lpg0_105",WR="_filters_1lpg0_124",KR="_mainArea_1lpg0_134",QR="_sidePanelOverlay_1lpg0_143",GR="_cardList_1lpg0_152",YR="_skeleton_1lpg0_168",XR="_skeletonIcon_1lpg0_178",ZR="_skeletonText_1lpg0_186",JR="_skeletonLine_1lpg0_193",ej="_skeletonLineSm_1lpg0_200",tj="_loadMoreBtn_1lpg0_215",rj="_emptyState_1lpg0_240",nj="_collapseBtn_1lpg0_260",Ce={dock:AR,header:PR,headerLeft:MR,headerTitle:LR,count:FR,searchRow:$R,searchWrap:BR,searchIcon:VR,searchInput:UR,filterToggleBtn:zR,filterToggleBtnActive:qR,filterBadge:HR,filters:WR,mainArea:KR,sidePanelOverlay:QR,cardList:GR,skeleton:YR,skeletonIcon:XR,skeletonText:ZR,skeletonLine:JR,skeletonLineSm:ej,loadMoreBtn:tj,emptyState:rj,collapseBtn:nj};function sj(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 ij=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:u,search:d,setFilter:f,applyAdvancedFilters:m,toggleSort:g,loadMore:b}=HN(),{addResource:h,selectedNodeId:y,treeData:v}=Te(),_=e==="edit",[x,w]=p.useState(!1),[S,O]=p.useState({}),[N,j]=p.useState(null),F=p.useMemo(()=>sj(v),[v]),k=p.useCallback(L=>{if(!y){ht.error("Select a unit first");return}h(L,y),ht.success(`Added "${L.name}"`)},[y,h]),M=p.useCallback(L=>{O(L),m(L)},[m]),q=p.useCallback(L=>{j(L)},[]),R=p.useCallback(L=>{k(L),j(null)},[k]),P=p.useMemo(()=>Object.values(S).reduce((L,ee)=>L+((ee==null?void 0:ee.length)??0),0),[S]);return l.jsxs("div",{className:Ce.dock,children:[l.jsx("div",{className:Ce.header,children:l.jsxs("div",{className:Ce.headerLeft,children:[l.jsx("button",{type:"button",className:Ce.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(dy,{size:15})}),l.jsx(oy,{size:16}),l.jsx("span",{className:Ce.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ce.count,children:i})]})}),l.jsxs("div",{className:Ce.searchRow,children:[l.jsxs("div",{className:Ce.searchWrap,children:[l.jsx(oa,{size:14,className:Ce.searchIcon}),l.jsx("input",{type:"search",className:Ce.searchInput,placeholder:"Search content…",value:a,onChange:L=>d(L.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ce.filterToggleBtn,c?Ce.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(ey,{size:15}):l.jsx(ry,{size:15})}),l.jsxs("button",{type:"button",className:[Ce.filterToggleBtn,x?Ce.filterToggleBtnActive:""].join(" "),onClick:()=>w(L=>!L),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(yy,{size:15}),P>0&&l.jsx("span",{className:Ce.filterBadge,children:P})]})]}),l.jsx("div",{className:Ce.filters,children:l.jsx(iR,{filters:D1,active:o,onChange:f})}),l.jsxs("div",{className:Ce.mainArea,children:[l.jsx("div",{className:Ce.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((L,ee)=>l.jsxs("div",{className:Ce.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ce.skeletonIcon}),l.jsxs("div",{className:Ce.skeletonText,children:[l.jsx("div",{className:Ce.skeletonLine}),l.jsx("div",{className:Ce.skeletonLineSm})]})]},ee)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(L=>l.jsx(rR,{item:L,onAdd:k,onPreview:q,isDraggable:_,isAdded:F.has(L.identifier)},L.identifier)),u&&l.jsx("button",{type:"button",className:Ce.loadMoreBtn,onClick:b,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ce.emptyState,children:[l.jsx(oa,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:Ce.sidePanelOverlay,children:l.jsx(xR,{isOpen:x,filters:S,onApply:M,onClose:()=>w(!1)})}),N&&l.jsx("div",{className:Ce.sidePanelOverlay,children:l.jsx(kR,{content:N,onAdd:R,onClose:()=>j(null)})})]})]})};function oj(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 u(m,g=!1){const b={};for(const[h,y]of Object.entries(m))if(!i.has(h)&&!(g&&o.has(h)))if(a.has(h))Array.isArray(y)?b[h]=y:y!=null&&y!==""?b[h]=[y]:b[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(b[h]=v)}else b[h]=y;return b}function d(m){var b;const g={};for(const h of m.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,..._}=y;if(Object.keys(_).length===0)continue;const x=((b=h.metadata)==null?void 0:b.relationalMetadata)??{};g[h.identifier]={name:h.name,...x,..._}}return g}function f(m,g){var x,w;const b=m.identifier,h=t[b],y=b.startsWith("temp-")||!!(h!=null&&h.isNew),v=!m.isFolder&&!g;if(g||y||h&&!v){let S;if(y)S={mimeType:"application/vnd.ekstep.content-collection",code:b,contentType:((x=m.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=m.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:m.name,visibility:"Parent",channel:r,...u(m.metadata??{})};else if(g){const{isNew:O,...N}=h??{};S={...u(m.metadata??{},!0),...u(N,!1),name:m.name}}else{const{isNew:O,...N}=h??{};S={name:m.name,visibility:"Parent",...u(N,!0)}}n[b]={metadata:S,objectType:m.objectType||(m.isFolder?"Collection":"Content"),root:g,isNew:y}}const _=m.isFolder?d(m):{};s[b]={name:m.name,children:(m.children??[]).map(S=>S.identifier),...Object.keys(_).length>0?{relationalMetadata:_}:{},root:g},(m.children??[]).forEach(S=>f(S,!1))}return e.forEach((m,g)=>f(m,g===0)),{nodesModified:n,hierarchy:s}}function aj(){const[e,t]=p.useState(!1),r=p.useRef(),n=Te(d=>d.treeCache),s=Te(d=>d.treeData),i=Se(d=>d.isDirty),{setIsDirty:o,setLastSaved:a}=Se(),c=Se(d=>d.editorConfig),u=p.useCallback(async()=>{if(!c||e)return;const d=c.context.contentId??c.context.identifier??"";if(!d)return;const f=c.context.channel??"",m=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:g,hierarchy:b}=oj(s,n,f);await Mb(d,g,b,m);const h=new Date().toISOString();a(h),o(!1)}catch(g){console.error("[useSaveHierarchy] save failed:",g),ht.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,s,n,o,a]);return p.useEffect(()=>{if(i)return clearTimeout(r.current),r.current=setTimeout(u,1500),()=>clearTimeout(r.current)},[i,n,u]),{save:u,isSaving:e,isDirty:i,lastSaved:Se.getState().lastSaved}}const lj="_shell_90fon_1",cj="_workspace_90fon_8",uj="_sidebarCollapsed_90fon_16",dj="_dockCollapsed_90fon_19",fj="_dock_90fon_19",hj="_outline_90fon_40",pj="_reopenTab_90fon_45",gj="_outlineHidden_90fon_79",mj="_editor_90fon_86",yj="_dockHidden_90fon_101",vj="_dockReopenTab_90fon_108",bj="_dragChip_90fon_133",_j="_dragChipLabel_90fon_148",Dt={shell:lj,workspace:cj,sidebarCollapsed:uj,dockCollapsed:dj,dock:fj,outline:hj,reopenTab:pj,outlineHidden:gj,editor:mj,dockHidden:yj,dockReopenTab:vj,dragChip:bj,dragChipLabel:_j},wj=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,u]=p.useState(!1),{addResource:d,treeData:f}=Te(),m=Te(S=>S.selectedNodeId),{save:g,isSaving:b,isDirty:h,lastSaved:y}=aj(),v=gd(ta(Vi,{activationConstraint:{distance:8}})),_=p.useCallback(S=>{var N;const O=(N=S.active.data.current)==null?void 0:N.item;O&&i(O)},[]),x=p.useCallback(S=>{var k,M;i(null);const O=(k=S.active.data.current)==null?void 0:k.item;if(!O)return;const N=S.over,j=(N==null?void 0:N.id)??m??void 0;if(!j){ht.error("Drop onto a unit to add content");return}const F=(M=f[0])==null?void 0:M.id;if(j===F){ht.error("Drop content onto a unit, not directly on the course.");return}d(O,j),r==null||r(O,j),ht.success(`Added "${O.name}" to unit`)},[m,d,r]),w=p.useCallback(S=>{S.action==="saveCollection"&&g().then(()=>{n==null||n(f)}),t==null||t(S)},[g,t,n,f]);return l.jsxs(Ad,{sensors:v,onDragStart:_,onDragEnd:x,children:[l.jsxs("div",{className:Dt.shell,children:[l.jsx(gw,{editorMode:e,isSaving:b,isDirty:h,lastSaved:y,onToolbarEvent:w}),l.jsxs("div",{className:[Dt.workspace,o?Dt.sidebarCollapsed:"",c?Dt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Dt.outline,o?Dt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(FE,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(S=>!S)})}),o&&l.jsx("button",{className:Dt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Dt.editor,role:"main","aria-label":"Content editor",children:l.jsx(zN,{editorMode:e,onToolbarEvent:w})}),l.jsx("aside",{className:[Dt.dock,c?Dt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(ij,{editorMode:e,collapsed:c,onToggleCollapse:()=>u(S=>!S)})}),c&&l.jsx("button",{className:Dt.dockReopenTab,onClick:()=>u(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Gm,{dropAnimation:null,children:s?l.jsx("div",{className:Dt.dragChip,children:l.jsx("span",{className:Dt.dragChipLabel,children:s.name})}):null})]})},xj="v4";function Sj(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 Pu(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:Sj(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 br(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(Pu(i,s))}else n.code&&r.push(Pu(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function Cj(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 Ej(e,t,r="Collection"){var c,u;const s=(u=(c=(await $e.post(`/action/object/category/definition/${xj}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:c.result)==null?void 0:u.objectCategoryDefinition,i=(s==null?void 0:s.forms)??{},o=(s==null?void 0:s.objectMetadata)??{},a=o.config??{};return{rootForm:br(i.create),unitForm:br(i.unitMetadata),childForm:br(i.childMetadata),searchForm:br(i.search??i.searchConfig),relationalForm:br(i.relationalMetadata),publishChecklist:br(i.publishchecklist),reviewChecklist:br(i.review),rfcChecklist:br(i.requestforchangeschecklist),schemaDefaults:Cj(o.schema),frameworkMetadata:a.frameworkMetadata??{},sourcingSettings:a.sourcingSettings??{}}}function Oj({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:u,setCategoryDefinition:d}=Se(),{setTreeData:f,selectNode:m}=Te();return p.useEffect(()=>{let g=!1;async function b(){var h,y;try{n(!0),i(null),e.apiBaseUrl&&xf(e.apiBaseUrl),c(e),u(e.config.mode);const v=e.context.contentId??e.context.identifier??"";if(v){const{rootNode:_}=await Pb(v);g||(f(_?[_]:[]),_&&m(_.id));const x=e.config.primaryCategory??"Course",w=e.context.channel??"";try{const S=await Ej(x,w,e.config.objectType??"Collection");if(!g){d(S);const O=(y=(h=S.sourcingSettings)==null?void 0:h.collection)==null?void 0:y.maxDepth;O&&!e.config.maxDepth&&c({...e,config:{...e.config,maxDepth:O}})}}catch{}}g||a(!0)}catch(v){if(!g){const _=v instanceof Error?v:new Error(String(v));i(_),t==null||t(_)}}finally{g||n(!1)}}return b(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Dj="_root_qcpw6_1",Tj="_loadingState_qcpw6_10",Ij="_loadingSpinner_qcpw6_20",Nj="_errorState_qcpw6_34",os={root:Dj,loadingState:Tj,loadingSpinner:Ij,errorState:Nj},Rj=new bp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class jj extends p.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:os.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 kj(e){const{isLoading:t,error:r}=Oj({config:e,onError:e.onError}),n=Se(s=>s.editorMode);return t?l.jsxs("div",{className:os.loadingState,children:[l.jsx("div",{className:os.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${os.root}`,children:l.jsx(wj,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Wh=e=>l.jsx(jj,{onError:e.onError,children:l.jsxs(wp,{client:Rj,children:[l.jsx(kj,{...e}),l.jsx(_g,{position:"top-right",toastOptions:{duration:3e3}})]})}),Ai=Symbol.for("r2wc.reactRender"),Mu=Symbol.for("r2wc.shouldRender"),ei=Symbol.for("r2wc.root");function Aj(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Pj(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Lu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Ai]()}}),e[Ai]()}};function Mj(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var u=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?u.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.'),u.attachShadow({mode:"open"})),u},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(u,d){return d in e.propTypes||d in a},set:function(u,d,f,m){return i&&(s[d]=!0),typeof d=="symbol"||s[d]||d in u?(e.propTypes&&d in e.propTypes&&Lu.expando(m,d,f),Reflect.set(u,d,f,m)):(Lu.expando(m,d,f),!0)},getOwnPropertyDescriptor:function(u,d){var f=Reflect.getOwnPropertyDescriptor(u,d);if(f)return f;if(d in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Mu]=!0,this[Ai]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ei].unmount():r.unmountComponentAtNode(this)},a[Ai]=function(){if(this[Mu]===!0){var u={};Object.keys(this).forEach(function(m){s[m]!==!1&&(u[m]=this[m])},this),i=!0;const d=n.shadow?this.shadowRoot:this,f=t.createElement(e,u);typeof r.createRoot=="function"?(this[ei]||(this[ei]=r.createRoot(d)),this[ei].render(f)):r.render(f,d),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return Aj(u)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(u,d,f){var m=n.dashStyleAttributes?Pj(u):u;this[m]=f}),o}var as={},ns=$r;if(process.env.NODE_ENV==="production")as.createRoot=ns.createRoot,as.hydrateRoot=ns.hydrateRoot;else{var ti=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;as.createRoot=function(e,t){ti.usingClientEntryPoint=!0;try{return ns.createRoot(e,t)}finally{ti.usingClientEntryPoint=!1}},as.hydrateRoot=function(e,t,r){ti.usingClientEntryPoint=!0;try{return ns.hydrateRoot(e,t,r)}finally{ti.usingClientEntryPoint=!1}}}function Lj(){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 Fj(e="sb-collection-editor"){if(Lj(),typeof customElements>"u"||customElements.get(e))return;const t=Mj(Wh,p,as,{});customElements.define(e,t)}exports.CollectionEditor=Wh;exports.registerCollectionEditor=Fj;exports.setApiBaseUrl=xf;exports.useEditorStore=Se;exports.useLibraryStore=qh;exports.useTreeStore=Te;
|
|
456
|
+
`+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=rn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&li.assertOptions(n,{silentJSONParsing:st.transitional(st.boolean),forcedJSONParsing:st.transitional(st.boolean),clarifyTimeoutError:st.transitional(st.boolean),legacyInterceptorReqResOrdering:st.transitional(st.boolean),advertiseZstdAcceptEncoding:st.transitional(st.boolean),validateStatusUndefinedResolves:st.transitional(st.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:li.assertOptions(s,{encode:st.function,serialize:st.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),li.assertOptions(r,{baseUrl:st.spelling("baseURL"),withXsrfToken:st.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&D.merge(i.common,i[r.method]);i&&D.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=dt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||Ya;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,p;if(!c){const _=[hc.bind(this),void 0];for(_.unshift(...a),_.push(...u),p=_.length,d=Promise.resolve(r);f<p;)d=d.then(_[f++],_[f++]);return d}p=a.length;let m=r;for(;f<p;){const _=a[f++],h=a[f++];try{m=_(m)}catch(y){h.call(this,y);break}}try{d=hc.call(this,m)}catch(_){return Promise.reject(_)}for(f=0,p=u.length;f<p;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=rn(this.defaults,t);const r=mf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return df(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){Jr.prototype[t]=function(r,n){return this.request(rn(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(rn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Jr.prototype[t]=r(),t!=="query"&&(Jr.prototype[t+"Form"]=r(!0))});let e_=class _f{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 Fs(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 _f(function(s){t=s}),cancel:t}}};function t_(e){return function(r){return e.apply(null,r)}}function r_(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 wf(e){const t=new Jr(e),r=Yd(Jr.prototype.request,t);return D.extend(r,Jr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return wf(rn(e,s))},r}const $e=wf(Ls);$e.Axios=Jr;$e.CanceledError=Fs;$e.CancelToken=e_;$e.isCancel=pf;$e.VERSION=Za;$e.toFormData=Wi;$e.AxiosError=G;$e.Cancel=$e.CanceledError;$e.all=function(t){return Promise.all(t)};$e.spread=t_;$e.isAxiosError=r_;$e.mergeConfig=rn;$e.AxiosHeaders=dt;$e.formToJSON=e=>hf(D.isHTMLForm(e)?new FormData(e):e);$e.getAdapter=bf.getAdapter;$e.HttpStatusCode=fa;$e.default=$e;const{Axios:Kj,AxiosError:Qj,CanceledError:Gj,isCancel:Yj,CancelToken:Xj,VERSION:Zj,all:Jj,Cancel:ek,isAxiosError:tk,spread:rk,toFormData:nk,AxiosHeaders:sk,HttpStatusCode:ik,formToJSON:ok,getAdapter:ak,mergeConfig:lk,create:ck}=$e;let ha="";function xf(e){ha=e}const Ae=$e.create({timeout:3e4});Ae.interceptors.request.use(async e=>{var s,i;const{useEditorStore:t}=await Promise.resolve().then(()=>Wd),n=(i=(s=t.getState().editorConfig)==null?void 0:s.context)==null?void 0:i.authToken;return n&&(e.headers=e.headers??{},e.headers.Authorization=`Bearer ${n}`),ha&&(e.baseURL=ha),e});const Sf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function n_(e,t={}){var s,i,o;const r={"organisations.roles":"CONTENT_CREATOR"};return t.rootOrgId&&(r.rootOrgId=t.rootOrgId),((o=(i=(s=(await Ae.post("/api/user/v1/search",{request:{query:e,filters:r,fields:Sf,offset:0,limit:t.limit??20}})).data)==null?void 0:s.result)==null?void 0:i.response)==null?void 0:o.content)??[]}async function s_(e){var r,n,s;return e.length?((s=(n=(r=(await Ae.post("/api/user/v1/search",{request:{filters:{userId:e},fields:Sf,limit:e.length}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}function Cf(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(u=>Cf(u,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 i_(e){var s,i,o,a,c,u,d;const t=await Ae.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)||((u=(c=t.data)==null?void 0:c.params)==null?void 0:u.err)||((d=t.data)==null?void 0:d.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Cf(r);return{content:r,rootNode:n}}async function o_(e,t,r,n){await Ae.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})}async function a_(e,t=""){await Ae.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function l_(e){var r,n;return(n=(r=(await Ae.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function c_(e){await Ae.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function u_(e,t){await Ae.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function d_(e,t){await Ae.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const f_="_container_1cpb1_1",h_="_header_1cpb1_13",p_="_title_1cpb1_22",g_="_closeBtn_1cpb1_29",m_="_body_1cpb1_45",y_="_label_1cpb1_54",v_="_searchSection_1cpb1_62",b_="_searchRow_1cpb1_68",__="_searchInput_1cpb1_74",w_="_searchSpinner_1cpb1_89",x_="_resultsList_1cpb1_105",S_="_resultItem_1cpb1_118",C_="_userInfo_1cpb1_133",E_="_userName_1cpb1_141",O_="_userEmail_1cpb1_150",D_="_noResults_1cpb1_158",I_="_collabSection_1cpb1_165",T_="_sectionTitle_1cpb1_170",N_="_badge_1cpb1_180",R_="_emptyCollab_1cpb1_194",j_="_collabList_1cpb1_205",k_="_collabItem_1cpb1_214",A_="_userAvatar_1cpb1_228",P_="_error_1cpb1_242",M_="_success_1cpb1_248",L_="_footer_1cpb1_254",xe={container:f_,header:h_,title:p_,closeBtn:g_,body:m_,label:y_,searchSection:v_,searchRow:b_,searchInput:__,searchSpinner:w_,resultsList:x_,resultItem:S_,userInfo:C_,userName:E_,userEmail:O_,noResults:D_,collabSection:I_,sectionTitle:T_,badge:N_,emptyCollab:R_,collabList:j_,collabItem:k_,userAvatar:A_,error:P_,success:M_,footer:L_},F_=({contentId:e,onClose:t})=>{const[r,n]=g.useState(""),[s,i]=g.useState([]),[o,a]=g.useState(!1),[c,u]=g.useState([]),[d,f]=g.useState(!1),[p,m]=g.useState(""),[_,h]=g.useState(!1),y=g.useRef(null);g.useEffect(()=>{let C=!1;return(async()=>{try{const E=await l_(e),N=(E==null?void 0:E.collaborators)??[];if(!N.length)return;const j=await s_(N);if(C)return;const F=N.map(k=>j.find(P=>P.identifier===k)??{identifier:k,firstName:k});u(F)}catch{}})(),()=>{C=!0}},[e]),g.useEffect(()=>{y.current&&clearTimeout(y.current);const C=r.trim();if(C.length<2){i([]);return}return y.current=setTimeout(async()=>{a(!0);try{const E=await n_(C),N=new Set(c.map(j=>j.identifier));i(E.filter(j=>!N.has(j.identifier)))}catch{i([])}finally{a(!1)}},300),()=>{y.current&&clearTimeout(y.current)}},[r,c]);const v=g.useCallback(C=>{u(E=>E.find(N=>N.identifier===C.identifier)?E:[...E,C]),i(E=>E.filter(N=>N.identifier!==C.identifier)),h(!1)},[]),b=g.useCallback(C=>{u(E=>E.filter(N=>N.identifier!==C)),h(!1)},[]),x=g.useCallback(async()=>{f(!0),m(""),h(!1);try{await d_(e,c.map(C=>C.identifier)),h(!0)}catch{m("Failed to save collaborators. Please try again.")}finally{f(!1)}},[e,c]),w=C=>`${C.firstName}${C.lastName?` ${C.lastName}`:""}`;return l.jsxs("div",{className:xe.container,children:[l.jsxs("div",{className:xe.header,children:[l.jsx("h2",{className:xe.title,children:"Manage Collaborators"}),l.jsx("button",{className:xe.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:xe.body,children:[l.jsxs("div",{className:xe.searchSection,children:[l.jsx("label",{className:xe.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:xe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:xe.searchInput,placeholder:"Search by name or email...",value:r,onChange:C=>n(C.target.value)}),o&&l.jsx("span",{className:xe.searchSpinner,"aria-label":"Searching..."})]}),s.length>0&&l.jsx("ul",{className:xe.resultsList,role:"listbox","aria-label":"Search results",children:s.map(C=>l.jsxs("li",{className:xe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:w(C)}),C.email&&l.jsx("span",{className:xe.userEmail,children:C.email})]}),l.jsx(Te,{variant:"primary",size:"sm",onClick:()=>v(C),children:"Add"})]},C.identifier))}),r.trim().length>=2&&!o&&s.length===0&&l.jsx("p",{className:xe.noResults,children:"No users found."})]}),l.jsxs("div",{className:xe.collabSection,children:[l.jsxs("h3",{className:xe.sectionTitle,children:["Current Collaborators",c.length>0&&l.jsx("span",{className:xe.badge,children:c.length})]}),c.length===0?l.jsx("p",{className:xe.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:xe.collabList,children:c.map(C=>l.jsxs("li",{className:xe.collabItem,children:[l.jsx("div",{className:xe.userAvatar,"aria-hidden":"true",children:w(C).charAt(0).toUpperCase()}),l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:w(C)}),C.email&&l.jsx("span",{className:xe.userEmail,children:C.email})]}),l.jsx(Te,{variant:"danger",size:"sm",onClick:()=>b(C.identifier),children:"Remove"})]},C.identifier))})]}),p&&l.jsx("p",{className:xe.error,role:"alert",children:p}),_&&l.jsx("p",{className:xe.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:xe.footer,children:[l.jsx(Te,{variant:"ghost",onClick:t,disabled:d,children:"Cancel"}),l.jsx(Te,{variant:"primary",isLoading:d,onClick:x,children:"Save"})]})]})};async function $_(e){return(await Ae.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function B_(e,t){var n,s;return((s=(n=(await Ae.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:n.result)==null?void 0:s.processId)??""}async function V_(e){var r;return((r=(await Ae.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}const U_="_topbar_1k1pv_1",z_="_left_1k1pv_15",q_="_right_1k1pv_23",H_="_backBtn_1k1pv_30",W_="_title_1k1pv_49",K_="_statusChip_1k1pv_61",Q_="_savedIndicator_1k1pv_73",G_="_unsaved_1k1pv_83",Y_="_iconBtn_1k1pv_87",X_="_iconBtnLabel_1k1pv_114",Z_="_qrDropdown_1k1pv_118",J_="_qrMenu_1k1pv_122",ew="_reviewBtns_1k1pv_157",tw="_sourcingBtns_1k1pv_166",rw="_modalOverlay_1k1pv_175",nw="_sbOverlay_1k1pv_185",sw="_sbModal_1k1pv_195",iw="_sbModalHeader_1k1pv_206",ow="_sbModalTitle_1k1pv_214",aw="_sbModalClose_1k1pv_221",lw="_sbModalBody_1k1pv_234",cw="_sbLabel_1k1pv_241",uw="_sbTextarea_1k1pv_248",dw="_sbError_1k1pv_265",fw="_sbModalFooter_1k1pv_272",ie={topbar:U_,left:z_,right:q_,backBtn:H_,title:W_,statusChip:K_,savedIndicator:Q_,unsaved:G_,iconBtn:Y_,iconBtnLabel:X_,qrDropdown:Z_,qrMenu:J_,reviewBtns:ew,sourcingBtns:tw,modalOverlay:rw,sbOverlay:nw,sbModal:sw,sbModalHeader:iw,sbModalTitle:ow,sbModalClose:aw,sbModalBody:lw,sbLabel:cw,sbTextarea:uw,sbError:dw,sbModalFooter:fw};function hw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function pw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const gw=({onConfirm:e,onCancel:t})=>{const[r,n]=g.useState("");return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"sendback-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"sendback-title",className:ie.sbModalTitle,children:"Send Back for Corrections"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsxs("label",{className:ie.sbLabel,htmlFor:"sendback-comment",children:["Comment ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"sendback-comment",className:ie.sbTextarea,placeholder:"Describe what needs to be corrected…",value:r,onChange:s=>n(s.target.value),rows:4,required:!0,"aria-required":"true"}),r.trim().length===0&&l.jsx("p",{className:ie.sbError,children:"A comment is required."})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:()=>e(r.trim()),disabled:r.trim().length===0,children:"Send Back"})]})]})})},mw=({onConfirm:e,onCancel:t})=>{const[r,n]=g.useState(!1);return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ie.sbModalTitle,children:"Send for Review"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsx("p",{style:{fontSize:13,color:"var(--sbx-gray-600, #4B5563)",lineHeight:1.5,margin:0},children:"Once sent for review, this content will be locked for editing until the review is complete. Please ensure all units and content are finalised."}),l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",marginTop:14,fontSize:13},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsx("span",{children:"I confirm this content adheres to the content policy and is ready for review."})]})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:e,disabled:!r,children:"Send for review"})]})]})})},yw=({onConfirm:e,onCancel:t})=>{const[r,n]=g.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=1&&s<=250;return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ie.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsxs("label",{className:ie.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:1,max:250,className:ie.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (1–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ie.sbError,children:"Enter a number between 1 and 250."})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(Te,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Te,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},vw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,onToolbarEvent:s})=>{var ye,Ce;const o=Ne(K=>K.treeData)[0],a=(o==null?void 0:o.name)??"Untitled",c=pw(((ye=o==null?void 0:o.metadata)==null?void 0:ye.status)??(o==null?void 0:o.status)),u=be(K=>{var le,de,Pe,pe;return((de=(le=K.editorConfig)==null?void 0:le.context)==null?void 0:de.contentId)??((pe=(Pe=K.editorConfig)==null?void 0:Pe.context)==null?void 0:pe.identifier)??""}),{activeModal:d,modalData:f,closeModal:p,openModal:m}=ky(),_=be(K=>K.buttonLoaders),[h,y]=g.useState(!1),[v,b]=g.useState(!1),[x,w]=g.useState(!1),C=g.useRef(null),[E,N]=g.useState(!1);g.useEffect(()=>{if(!x)return;const K=le=>{var de;(de=C.current)!=null&&de.contains(le.target)||w(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[x]);const[j,F]=g.useState(!1),[k,P]=g.useState(!1),{updateNode:V}=Ne(),R=(Ce=o==null?void 0:o.metadata)==null?void 0:Ce.qrCodeProcessId,M=g.useCallback(async K=>{if(u){N(!1),F(!0);try{const le=await B_(u,K);le&&o&&V(o.id,{qrCodeProcessId:le}),Ue.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ue.error("Failed to generate QR Codes. Please try again.")}finally{F(!1)}}},[u,o,V]),L=g.useCallback(async()=>{if(!R){Ue.error("No QR codes generated yet. Generate QR Codes first.");return}P(!0);try{const le=(await V_(R)).zipFileName;if(le){const de=document.createElement("a");de.href=le,de.download="qrcodes.zip",de.target="_blank",document.body.appendChild(de),de.click(),document.body.removeChild(de)}else Ue.error("QR Codes not ready yet. Please wait and try again.")}catch{Ue.error("Failed to download QR Codes.")}finally{P(!1)}},[R]),Z=e==="edit",ne=e==="review",z=e==="sourcingreview",J=e==="read",ee=g.useCallback((K,le)=>{s({action:K,data:le})},[s]),W=g.useCallback(()=>{p(),ee("publish")},[p,ee]),X=g.useCallback((K,le)=>{const de=f==null?void 0:f.action;p(),de==="approve"?ee("sourcingApprove",{comment:K,score:le}):ee("reject",{comment:K})},[p,ee,f]),se=g.useCallback(K=>{y(!1),ee("sendBackForCorrections",{comment:K})},[ee]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ie.topbar,role:"banner",children:[l.jsxs("div",{className:ie.left,children:[l.jsx("button",{className:ie.backBtn,onClick:()=>ee("back"),"aria-label":"Go back",type:"button",children:l.jsx(Jm,{size:18})}),l.jsx("h1",{className:ie.title,title:a,children:a}),l.jsx("span",{className:`sbx-chip ${ie.statusChip}`,"aria-label":`Status: ${c}`,children:c})]}),l.jsxs("div",{className:ie.right,children:[t?l.jsx("span",{className:ie.savedIndicator,"aria-live":"polite",children:"Saving…"}):n?l.jsxs("span",{className:ie.savedIndicator,"aria-live":"polite",children:[l.jsx(Un,{size:14,"aria-hidden":"true"}),"Saved ",hw(n)]}):r?l.jsx("span",{className:`${ie.savedIndicator} ${ie.unsaved}`,"aria-live":"polite",children:"Unsaved changes"}):null,!J&&!ne&&!z&&c!=="Review"&&l.jsx(Te,{variant:"ghost",size:"sm",onClick:()=>ee("saveCollection"),children:"Save as Draft"}),Z&&l.jsxs(l.Fragment,{children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>b(!0),disabled:_.saveCollection,isLoading:_.saveCollection,children:[l.jsx(gy,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ie.iconBtn,onClick:()=>m("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(vy,{size:16,"aria-hidden":"true"})}),l.jsxs("div",{className:ie.qrDropdown,ref:C,children:[l.jsxs("button",{className:ie.iconBtn,onClick:()=>w(K=>!K),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":x,children:[l.jsx(Ul,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ie.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),x&&l.jsxs("div",{className:ie.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{w(!1),N(!0)},disabled:j,children:[l.jsx(Ul,{size:14}),j?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{w(!1),L()},disabled:k||!R,children:[l.jsx(ny,{size:14}),k?"Downloading…":"Download QR Codes"]})]})]})]}),ne&&l.jsxs("div",{className:ie.reviewBtns,children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>m("publishChecklist"),disabled:_.publishCollection,isLoading:_.publishCollection,children:[l.jsx($d,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Te,{variant:"danger",size:"sm",onClick:()=>m("qualityParams",{action:"reject"}),disabled:_.rejectCollection,isLoading:_.rejectCollection,children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Te,{variant:"ghost",size:"sm",onClick:()=>y(!0),children:[l.jsx(hy,{size:14,"aria-hidden":"true"})," Send Back"]})]}),z&&l.jsxs("div",{className:ie.sourcingBtns,children:[l.jsxs(Te,{variant:"primary",size:"sm",onClick:()=>m("qualityParams",{action:"approve"}),children:[l.jsx(my,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Te,{variant:"danger",size:"sm",onClick:()=>m("qualityParams",{action:"reject"}),children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),d==="publishChecklist"&&l.jsx(nv,{contentId:u,onConfirm:W,onCancel:p}),d==="qualityParams"&&l.jsx(sv,{contentId:u,action:(f==null?void 0:f.action)??"reject",onConfirm:X,onCancel:p}),d==="manageCollaborators"&&l.jsx("div",{className:ie.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(F_,{contentId:u,onClose:p})}),v&&l.jsx(mw,{onConfirm:()=>{b(!1),ee("sendForReview")},onCancel:()=>b(!1)}),h&&l.jsx(gw,{onConfirm:se,onCancel:()=>y(!1)}),E&&l.jsx(yw,{onConfirm:M,onCancel:()=>N(!1)})]})};var bw=Wa();const Ef=g.createContext(null);function xt(){const e=g.useContext(Ef);if(e===null)throw new Error("No Tree Api Provided");return e}const Of=g.createContext(null);function _w(){const e=g.useContext(Of);if(e===null)throw new Error("Provide a NodesContext");return e}const Df=g.createContext(null);function ww(){const e=g.useContext(Df);if(e===null)throw new Error("Provide a DnDContext");return e}const If=g.createContext(0);function Tf(){g.useContext(If)}function ci(e,t,r){return Math.max(Math.min(e,r),t)}function Nf(e){return e&&e.isLeaf}function Rf(e){return e&&e.isInternal&&!e.isOpen}function jf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const kf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Af=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function el(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=el(r,t);if(n)return n}return null}function Ti(e,t){if(t(e),e.children)for(let r of e.children)Ti(r,t)}function Pf(e){const t=Lf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=xw(t,n);break}r==null||r.focus()}function Mf(e){const t=Lf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Sw(t,n);break}r==null||r.focus()}function xw(e,t){return t+1<e.length?e[t+1]:e[0]}function Sw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Lf(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 is(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function vn(e){return typeof e=="string"?e:e.id}function Cw(e,...t){if(e)return e(...t)}function Ff(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function $f(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 Bf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Ew=Object.freeze(Object.defineProperty({__proto__:null,access:is,bound:ci,dfs:el,focusNextElement:Pf,focusPrevElement:Mf,getInsertIndex:$f,getInsertParentId:Bf,identify:vn,indexOf:Af,isClosed:Rf,isDescendant:kf,isItem:Nf,isOpenWithEmptyChildren:jf,safeRun:Cw,waitFor:Ff,walk:Ti},Symbol.toStringTag,{value:"Module"})),Ow={display:"flex",alignItems:"center",zIndex:1},Dw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Iw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Tw=g.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},Ow),s),children:[l.jsx("div",{style:Object.assign({},Iw)}),l.jsx("div",{style:Object.assign({},Dw)})]})});function Nw({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 Rw(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(kw,Object.assign({},e)):l.jsx(jw,Object.assign({},e))]})}function jw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function kw({node:e}){const t=g.useRef();return g.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const _s="__REACT_ARBORIST_INTERNAL_ROOT__";function gc(e){var t;function r(i,o,a){const c=e.accessId(i),u=new ws({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),d=e.accessChildren(i);return d&&(u.children=d.map(f=>r(f,o+1,u))),u}const n=new ws({tree:e,id:_s,data:{id:_s},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 ws{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===_s}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 ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function bo(e){return{type:"EDIT",id:e}}function Aw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function cn(e){return{type:"FOCUS",id:e}}function Pw(){return{type:"TREE_BLUR"}}function Mw(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 pa={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 mc(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 Lw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:mc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:mc(e.unfiltered,t)}):e}const Ln=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}}},vr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:vn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(vn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(vn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:vn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:vn(e)})};function Fw(e=Ln().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 Fn={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 $w(e=Ln().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 Ln().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Bw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Vw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},Uw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Vf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(zw,{isDragging:s,children:[l.jsx(qw,{offset:e,children:l.jsx(Ww,{id:r,dragIds:n})}),l.jsx(Hw,{mouse:t,count:n.length})]})}const zw=g.memo(function(t){return t.isDragging?l.jsx("div",{style:Bw,children:t.children}):null});function qw(e){return l.jsx("div",{className:"row preview",style:Vw(e.offset),children:e.children})}function Hw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:Uw(r),children:t}):null}const Ww=g.memo(function(t){const r=xt(),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 ga(){return ga=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},ga.apply(null,arguments)}function yc(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 Kw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ma(e,t)}var vc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Qw(e,t){return!!(e===t||vc(e)&&vc(t))}function Gw(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Qw(e[r],t[r]))return!1;return!0}function _o(e,t){t===void 0&&(t=Gw);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 Yw=typeof performance=="object"&&typeof performance.now=="function",bc=Yw?function(){return performance.now()}:function(){return Date.now()};function _c(e){cancelAnimationFrame(e.id)}function Xw(e,t){var r=bc();function n(){bc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var wo=-1;function wc(e){if(e===void 0&&(e=!1),wo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),wo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return wo}var un=null;function xc(e){if(e===void 0&&(e=!1),un===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?un="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?un="negative":un="positive-ascending"),document.body.removeChild(t),un}return un}process.env.NODE_ENV;var Zw=150,Jw=function(t,r){return t},ui=null,di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ui=new WeakSet,di=new WeakSet);function Uf(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=function(f){Kw(p,f);function p(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,yc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:yc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=_o(function(y,v,b,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=_o(function(y,v,b){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:b})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,b=v.direction,x=v.itemSize,w=v.layout,C=h._getItemStyleCache(u&&x,u&&w,u&&b),E;if(C.hasOwnProperty(y))E=C[y];else{var N=r(h.props,y,h._instanceProps),j=s(h.props,y,h._instanceProps),F=b==="horizontal"||w==="horizontal",k=b==="rtl",P=F?N:0;C[y]=E={position:"absolute",left:k?void 0:P,right:k?P:void 0,top:F?0:N,height:F?"100%":j,width:F?j:"100%"}}return E},h._getItemStyleCache=void 0,h._getItemStyleCache=_o(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===x)return null;var E=h.props.direction,N=x;if(E==="rtl")switch(xc()){case"negative":N=-x;break;case"positive-descending":N=w-b-x;break}return N=Math.max(0,Math.min(N,w-b)),{isScrolling:!0,scrollDirection:C.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var E=Math.max(0,Math.min(w,x-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<E?"forward":"backward",scrollOffset:E,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&_c(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Xw(h._resetIsScrolling,Zw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}p.getDerivedStateFromProps=function(h,y){return ex(h,y),d(h),null};var m=p.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var C=0;if(this._outerRef){var E=this._outerRef;x==="vertical"?C=E.scrollWidth>E.clientWidth?wc():0:C=E.scrollHeight>E.clientHeight?wc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},m.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||b==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,x=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(xc()){case"negative":C.scrollLeft=-x;break;case"positive-ascending":C.scrollLeft=x;break;default:var E=C.clientWidth,N=C.scrollWidth;C.scrollLeft=N-E-x;break}else C.scrollLeft=x;else C.scrollTop=x}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&_c(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,x=h.height,w=h.innerRef,C=h.innerElementType,E=h.innerTagName,N=h.itemCount,j=h.itemData,F=h.itemKey,k=F===void 0?Jw:F,P=h.layout,V=h.outerElementType,R=h.outerTagName,M=h.style,L=h.useIsScrolling,Z=h.width,ne=this.state.isScrolling,z=b==="horizontal"||P==="horizontal",J=z?this._onScrollHorizontal:this._onScrollVertical,ee=this._getRangeToRender(),W=ee[0],X=ee[1],se=[];if(N>0)for(var ye=W;ye<=X;ye++)se.push(g.createElement(y,{data:j,key:k(ye,j),index:ye,isScrolling:L?ne:void 0,style:this._getItemStyle(ye)}));var Ce=n(this.props,this._instanceProps);return g.createElement(V||R||"div",{className:v,onScroll:J,ref:this._outerRefSetter,style:ga({position:"relative",height:x,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},M)},g.createElement(C||E||"div",{children:se,ref:w,style:{height:z?"100%":Ce,pointerEvents:ne?"none":void 0,width:z?Ce:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],x=y[2],w=y[3];this._callOnItemsRendered(v,b,x,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,E=C.scrollDirection,N=C.scrollOffset,j=C.scrollUpdateWasRequested;this._callOnScroll(E,N,j)}},m._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,x=b.isScrolling,w=b.scrollDirection,C=b.scrollOffset;if(y===0)return[0,0,0,0];var E=o(this.props,C,this._instanceProps),N=a(this.props,E,C,this._instanceProps),j=!x||w==="backward"?Math.max(1,v):1,F=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,E-j),Math.max(0,Math.min(y-1,N+F)),E,N]},p}(g.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ex=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,d=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&di&&!di.has(d)&&(di.add(d),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":ui&&!ui.has(d)&&(ui.add(d),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},tx=50,_n=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var u=o[a];c=u.offset+u.size}for(var d=a+1;d<=r;d++){var f=i(d);o[d]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},rx=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?zf(t,r,i,0,n):nx(t,r,Math.max(0,i),n)},zf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=_n(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},nx=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&_n(t,n,r).offset<s;)n+=o,o*=2;return zf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Sc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var u=n-o-1,d=u*i;return a+d},sx=Uf({getItemOffset:function(t,r,n){return _n(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Sc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.layout,d=t.width,f=a==="horizontal"||u==="horizontal",p=f?d:c,m=_n(t,r,i),_=Sc(t,i),h=Math.max(0,Math.min(_-p,m.offset)),y=Math.max(0,m.offset-p+m.size+o);switch(n==="smart"&&(s>=y-p&&s<=h+p?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return rx(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,u=t.width,d=i==="horizontal"||c==="horizontal",f=d?u:o,p=_n(t,r,s),m=n+f,_=p.offset+p.size,h=r;h<a-1&&_<m;)h++,_+=_n(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||tx,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.'))}}),ix=Uf({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.itemCount,d=t.itemSize,f=t.layout,p=t.width,m=a==="horizontal"||f==="horizontal",_=m?p:c,h=Math.max(0,u*d-_),y=Math.min(h,r*d),v=Math.max(0,r*d-_+d+o);switch(n==="smart"&&(s>=v-_&&s<=y+_?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var b=Math.round(v+(y-v)/2);return b<Math.ceil(_/2)?0:b>h+Math.floor(_/2)?h:b}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,p=d?u:i,m=Math.ceil((p+n-f)/a);return Math.max(0,Math.min(o-1,r+m-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 ox(){var e,t;const r=xt(),s=ww().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 ax=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 lx=g.forwardRef(function(t,r){const{children:n}=t,s=ax(t,["children"]),i=xt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(cx,{}),n]}))}),cx=()=>{const e=xt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(ox,{})})};var ux=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 dx=g.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=ux(t,["style"]);const u=xt(),d=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=u.props.padding)!==null&&i!==void 0?i:u.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+d+f}px`})},c))});var qf=g.createContext({dragDropManager:void 0}),$t;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})($t||($t={}));function oe(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 tl="dnd-core/INIT_COORDS",Qi="dnd-core/BEGIN_DRAG",rl="dnd-core/PUBLISH_DRAG_SOURCE",Gi="dnd-core/HOVER",Yi="dnd-core/DROP",Xi="dnd-core/END_DRAG";function Cc(e,t){return{type:tl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}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 fx(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function hx(e,t){return e.filter(function(r){return r!==t})}function Hf(e){return fi(e)==="object"}function px(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 gx(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var mx={type:tl,payload:{clientOffset:null,sourceClientOffset:null}};function yx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),u=e.getRegistry();e.dispatch(Cc(o)),vx(r,c,u);var d=wx(r,c);if(d===null){e.dispatch(mx);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");bx(a),f=a(d)}e.dispatch(Cc(o,f));var p=u.getSource(d),m=p.beginDrag(c,d);if(m!=null){_x(m),u.pinSource(d);var _=u.getSourceType(d);return{type:Qi,payload:{itemType:_,item:m,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function vx(e,t,r){oe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){oe(r.getSource(n),"Expected sourceIds to be registered.")})}function bx(e){oe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function _x(e){oe(Hf(e),"Item must be an object.")}function wx(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 xx(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:rl}}}function ya(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function Sx(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;Cx(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Ex(i,o,a);var c=o.getItemType();return Ox(i,a,c),Dx(i,o,a),{type:Gi,payload:{targetIds:i,clientOffset:s||null}}}}function Cx(e){oe(Array.isArray(e),"Expected targetIds to be an array.")}function Ex(e,t,r){oe(t.isDragging(),"Cannot call hover while not dragging."),oe(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];oe(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);oe(i,"Expected targetIds to be registered.")}}function Ox(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);ya(i,r)||e.splice(n,1)}}function Dx(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Ec(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 Oc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ec(Object(r),!0).forEach(function(n){Ix(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ec(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ix(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Nx(n);var i=kx(n);i.forEach(function(o,a){var c=Rx(o,a,s,n),u={type:Yi,payload:{dropResult:Oc(Oc({},r),c)}};e.dispatch(u)})}}function Nx(e){oe(e.isDragging(),"Cannot call drop while not dragging."),oe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Rx(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return jx(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function jx(e){oe(typeof e>"u"||Hf(e),"Drop result must either be an object or undefined.")}function kx(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ax(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Px(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Xi}}}function Px(e){oe(e.isDragging(),"Cannot call endDrag while not dragging.")}function Mx(e){return{beginDrag:yx(e),publishDragSource:xx(e),hover:Sx(e),drop:Tx(e),endDrag:Ax(e)}}function Lx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fx(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 $x(e,t,r){return t&&Fx(e.prototype,t),e}function Xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bx=function(){function e(t,r){var n=this;Lx(this,e),Xn(this,"store",void 0),Xn(this,"monitor",void 0),Xn(this,"backend",void 0),Xn(this,"isSetUp",!1),Xn(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 $x(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];var d=o.apply(r,c);typeof d<"u"&&n(d)}}var i=Mx(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 At(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 Dc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ic=function(){return Math.random().toString(36).substring(7).split("").join(".")},Tc={INIT:"@@redux/INIT"+Ic(),REPLACE:"@@redux/REPLACE"+Ic()};function Vx(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 Ux(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(Hx(e))return"date";if(qx(e))return"error";var r=zx(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 zx(e){return typeof e.constructor=="function"?e.constructor.name:null}function qx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Hx(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=Ux(e)),t}function Wf(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"?At(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"?At(1):"Expected the enhancer to be a function. Instead, received: '"+dn(r)+"'");return r(Wf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?At(2):"Expected the root reducer to be a function. Instead, received: '"+dn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function u(){a===o&&(a=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?At(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?At(4):"Expected the listener to be a function. Instead, received: '"+dn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?At(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 y=!0;return u(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?At(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.");y=!1,u();var b=a.indexOf(h);a.splice(b,1),o=null}}}function p(h){if(!Vx(h))throw new Error(process.env.NODE_ENV==="production"?At(7):"Actions must be plain objects. Instead, the actual type was: '"+dn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?At(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"?At(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function m(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?At(10):"Expected the nextReducer to be a function. Instead, received: '"+dn(h));s=h,p({type:Tc.REPLACE})}function _(){var h,y=f;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?At(11):"Expected the observer to be an object. Instead, received: '"+dn(b)+"'");function x(){b.next&&b.next(d())}x();var w=y(x);return{unsubscribe:w}}},h[Dc]=function(){return this},h}return p({type:Tc.INIT}),n={dispatch:p,subscribe:f,getState:d,replaceReducer:m},n[Dc]=_,n}var Wx=function(t,r){return t===r};function Kx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Qx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wx;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 Nc(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 Rc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nc(Object(r),!0).forEach(function(n){Gx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Gx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Yx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case tl:case Qi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Gi:return Kx(e.clientOffset,r.clientOffset)?e:Rc(Rc({},e),{},{clientOffset:r.clientOffset});case Xi:case Yi:return jc;default:return e}}var nl="dnd-core/ADD_SOURCE",sl="dnd-core/ADD_TARGET",il="dnd-core/REMOVE_SOURCE",Zi="dnd-core/REMOVE_TARGET";function Xx(e){return{type:nl,payload:{sourceId:e}}}function Zx(e){return{type:sl,payload:{targetId:e}}}function Jx(e){return{type:il,payload:{sourceId:e}}}function eS(e){return{type:Zi,payload:{targetId:e}}}function kc(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 Pt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kc(Object(r),!0).forEach(function(n){tS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function nS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Qi:return Pt(Pt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rl:return Pt(Pt({},e),{},{isSourcePublic:!0});case Gi:return Pt(Pt({},e),{},{targetIds:r.targetIds});case Zi:return e.targetIds.indexOf(r.targetId)===-1?e:Pt(Pt({},e),{},{targetIds:hx(e.targetIds,r.targetId)});case Yi:return Pt(Pt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Xi:return Pt(Pt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function sS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case nl:case sl:return e+1;case il:case Zi:return e-1;default:return e}}var Ni=[],ol=[];Ni.__IS_NONE__=!0;ol.__IS_ALL__=!0;function iS(e,t){if(e===Ni)return!1;if(e===ol||typeof t>"u")return!0;var r=gx(t,e);return r.length>0}function oS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Gi:break;case nl:case sl:case Zi:case il:return Ni;case Qi:case rl:case Xi:case Yi:default:return ol}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=px(n,i),a=o.length>0||!Qx(n,i);if(!a)return Ni;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function aS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Ac(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 Pc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ac(Object(r),!0).forEach(function(n){lS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ac(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:oS(e.dirtyHandlerIds,{type:t.type,payload:Pc(Pc({},t.payload),{},{prevTargetIds:fx(e,"dragOperation.targetIds",[])})}),dragOffset:Yx(e.dragOffset,t),refCount:sS(e.refCount,t),dragOperation:nS(e.dragOperation,t),stateId:aS(e.stateId)}}function uS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Kf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function dS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Kf(uS(t,n),r)}function fS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Kf(t,r)}function hS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pS(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&&pS(e.prototype,t),e}function Mc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var mS=function(){function e(t,r){hS(this,e),Mc(this,"store",void 0),Mc(this,"registry",void 0),this.store=t,this.registry=r}return gS(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;oe(typeof r=="function","listener must be a function."),oe(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var u=n.store.getState(),d=u.stateId;try{var f=d===o||d===o+1&&!iS(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;oe(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 oe(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(oe(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 ya(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(oe(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&&!ya(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 dS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return fS(this.store.getState().dragOffset)}}]),e}(),yS=0;function vS(){return yS++}function hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hi=function(r){return typeof r}:hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hi(e)}function bS(e){oe(typeof e.canDrag=="function","Expected canDrag to be a function."),oe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),oe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function _S(e){oe(typeof e.canDrop=="function","Expected canDrop to be a function."),oe(typeof e.hover=="function","Expected hover to be a function."),oe(typeof e.drop=="function","Expected beginDrag to be a function.")}function va(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return va(r,!1)});return}oe(typeof e=="string"||hi(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 Lc=typeof global<"u"?global:self,Qf=Lc.MutationObserver||Lc.WebKitMutationObserver;function Gf(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function wS(e){let t=1;const r=new Qf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const xS=typeof Qf=="function"?wS:Gf;class SS{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=xS(this.flush),this.requestErrorThrow=Gf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class CS{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 ES{create(t){const r=this.freeTasks,n=r.length?r.pop():new CS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Yf=new SS,OS=new ES(Yf.registerPendingError);function DS(e){Yf.enqueueTask(OS.create(e))}function IS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TS(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 NS(e,t,r){return t&&TS(e.prototype,t),e}function fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function RS(e,t){return PS(e)||AS(e,t)||kS(e,t)||jS()}function jS(){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 kS(e,t){if(e){if(typeof e=="string")return Fc(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 Fc(e,t)}}function Fc(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 AS(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 MS(e){var t=vS().toString();switch(e){case $t.SOURCE:return"S".concat(t);case $t.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function $c(e){switch(e[0]){case"S":return $t.SOURCE;case"T":return $t.TARGET;default:oe(!1,"Cannot parse handler ID: ".concat(e))}}function Bc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=RS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var LS=function(){function e(t){IS(this,e),fn(this,"types",new Map),fn(this,"dragSources",new Map),fn(this,"dropTargets",new Map),fn(this,"pinnedSourceId",null),fn(this,"pinnedSource",null),fn(this,"store",void 0),this.store=t}return NS(e,[{key:"addSource",value:function(r,n){va(r),bS(n);var s=this.addHandler($t.SOURCE,r,n);return this.store.dispatch(Xx(s)),s}},{key:"addTarget",value:function(r,n){va(r,!0),_S(n);var s=this.addHandler($t.TARGET,r,n);return this.store.dispatch(Zx(s)),s}},{key:"containsHandler",value:function(r){return Bc(this.dragSources,r)||Bc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;oe(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 oe(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return oe(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return oe(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=$c(r);return n===$t.SOURCE}},{key:"isTargetId",value:function(r){var n=$c(r);return n===$t.TARGET}},{key:"removeSource",value:function(r){var n=this;oe(this.getSource(r),"Expected an existing source."),this.store.dispatch(Jx(r)),DS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){oe(this.getTarget(r),"Expected an existing target."),this.store.dispatch(eS(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);oe(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){oe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=MS(r);return this.types.set(i,n),r===$t.SOURCE?this.dragSources.set(i,s):r===$t.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function FS(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=$S(n),i=new mS(s,new LS(s)),o=new Bx(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function $S(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Wf(cS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var BS=["children"];function VS(e,t){return HS(e)||qS(e,t)||zS(e,t)||US()}function US(){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 zS(e,t){if(e){if(typeof e=="string")return Vc(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 Vc(e,t)}}function Vc(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 qS(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 HS(e){if(Array.isArray(e))return e}function WS(e,t){if(e==null)return{};var r=KS(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 KS(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 Uc=0,pi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),QS=g.memo(function(t){var r=t.children,n=WS(t,BS),s=GS(n),i=VS(s,2),o=i[0],a=i[1];return g.useEffect(function(){if(a){var c=Xf();return++Uc,function(){--Uc===0&&(c[pi]=null)}}},[]),l.jsx(qf.Provider,Object.assign({value:o},{children:r}),void 0)});function GS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=YS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function YS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xf(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[pi]||(s[pi]={dragDropManager:FS(e,t,r,n)}),s[pi]}function Xf(){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 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 zc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xo=!1,So=!1,eC=function(){function e(t){XS(this,e),zc(this,"internalMonitor",void 0),zc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return JS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){oe(!xo,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{xo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;oe(!So,"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 So=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{So=!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 tC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rC(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 nC(e,t,r){return t&&rC(e.prototype,t),e}function qc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Co=!1,sC=function(){function e(t){tC(this,e),qc(this,"internalMonitor",void 0),qc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return nC(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;oe(!Co,"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 Co=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Co=!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 iC(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 oC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!g.isValidElement(t)){var n=t;return e(n,r),n}var s=t;iC(s);var i=r?function(o){return e(o,r)}:e;return aC(s,i)}}function Zf(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=oC(n);t[r]=function(){return s}}}),t}function Hc(e,t){typeof e=="function"?e(t):e.current=t}function aC(e,t){var r=e.ref;return oe(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?g.cloneElement(e,{ref:function(s){Hc(r,s),Hc(t,s)}}):g.cloneElement(e,{ref:t})}function gi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gi=function(r){return typeof r}:gi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gi(e)}function ba(e){return e!==null&&gi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _a(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var u=i[c];if(!a(u))return!1;var d=e[u],f=t[u];if(s=void 0,s===!1||s===void 0&&d!==f)return!1}return!0}function lC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cC(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 uC(e,t,r){return t&&cC(e.prototype,t),e}function it(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dC=function(){function e(t){var r=this;lC(this,e),it(this,"hooks",Zf({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ba(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ba(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),it(this,"handlerId",null),it(this,"dragSourceRef",null),it(this,"dragSourceNode",void 0),it(this,"dragSourceOptionsInternal",null),it(this,"dragSourceUnsubscribe",void 0),it(this,"dragPreviewRef",null),it(this,"dragPreviewNode",void 0),it(this,"dragPreviewOptionsInternal",null),it(this,"dragPreviewUnsubscribe",void 0),it(this,"lastConnectedHandlerId",null),it(this,"lastConnectedDragSource",null),it(this,"lastConnectedDragSourceOptions",null),it(this,"lastConnectedDragPreview",null),it(this,"lastConnectedDragPreviewOptions",null),it(this,"backend",void 0),this.backend=t}return uC(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!_a(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!_a(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 fC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hC(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 pC(e,t,r){return t&&hC(e.prototype,t),e}function Jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gC=function(){function e(t){var r=this;fC(this,e),Jt(this,"hooks",Zf({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ba(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Jt(this,"handlerId",null),Jt(this,"dropTargetRef",null),Jt(this,"dropTargetNode",void 0),Jt(this,"dropTargetOptionsInternal",null),Jt(this,"unsubscribeDropTarget",void 0),Jt(this,"lastConnectedHandlerId",null),Jt(this,"lastConnectedDropTarget",null),Jt(this,"lastConnectedDropTargetOptions",null),Jt(this,"backend",void 0),this.backend=t}return pC(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!_a(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 mC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function yC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var nn=typeof window<"u"?g.useLayoutEffect:g.useEffect;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 vC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bC(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 _C(e,t,r){return t&&bC(e.prototype,t),e}function Eo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wC=function(){function e(t,r,n){vC(this,e),Eo(this,"spec",void 0),Eo(this,"monitor",void 0),Eo(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return _C(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return mi(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 xC(e,t,r){var n=g.useMemo(function(){return new wC(e,t,r)},[t,r]);return g.useEffect(function(){n.spec=e},[e]),n}function on(){var e=g.useContext(qf),t=e.dragDropManager;return oe(t!=null,"Expected drag drop context"),t}function SC(e){return g.useMemo(function(){var t=e.type;return oe(t!=null,"spec.type must be defined"),t},[e])}function CC(e,t){return IC(e)||DC(e,t)||OC(e,t)||EC()}function EC(){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 OC(e,t){if(e){if(typeof e=="string")return Wc(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 Wc(e,t)}}function Wc(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=on(),s=xC(e,t,r),i=SC(e);nn(function(){if(i!=null){var a=yC(i,s,n),c=CC(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d}},[n,t,r,s,i])}function NC(e){return AC(e)||kC(e)||jC(e)||RC()}function RC(){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 jC(e,t){if(e){if(typeof e=="string")return wa(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 wa(e,t)}}function kC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function AC(e){if(Array.isArray(e))return wa(e)}function wa(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 Jf(e,t){var r=NC(t||[]);return t==null&&typeof e!="function"&&r.push(e),g.useMemo(function(){return typeof e=="function"?e():e},r)}function PC(){var e=on();return g.useMemo(function(){return new eC(e)},[e])}function MC(e,t){var r=on(),n=g.useMemo(function(){return new dC(r.getBackend())},[r]);return nn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),nn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var LC=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 FC=qd(LC);function $C(e,t){return zC(e)||UC(e,t)||VC(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 VC(e,t){if(e){if(typeof e=="string")return Kc(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 Kc(e,t)}}function Kc(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 UC(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 eh(e,t,r){var n=g.useState(function(){return t(e)}),s=$C(n,2),i=s[0],o=s[1],a=g.useCallback(function(){var c=t(e);FC(i,c)||(o(c),r&&r())},[i,e,r]);return nn(a),[i,a]}function qC(e,t){return QC(e)||KC(e,t)||WC(e,t)||HC()}function HC(){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 WC(e,t){if(e){if(typeof e=="string")return Qc(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 Qc(e,t)}}function Qc(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 KC(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 QC(e){if(Array.isArray(e))return e}function GC(e,t,r){var n=eh(e,t,r),s=qC(n,2),i=s[0],o=s[1];return nn(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function th(e,t,r){return GC(t,e||function(){return{}},function(){return r.reconnect()})}function YC(e){return g.useMemo(function(){return e.hooks.dragSource()},[e])}function XC(e){return g.useMemo(function(){return e.hooks.dragPreview()},[e])}function ZC(e,t){var r=Jf(e,t);oe(!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=MC(r.options,r.previewOptions);return TC(r,n,s),[th(r.collect,n,s),YC(s),XC(s)]}function JC(e){var t=e.accept;return g.useMemo(function(){return oe(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function e0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t0(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 r0(e,t,r){return t&&t0(e.prototype,t),e}function Gc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n0=function(){function e(t,r){e0(this,e),Gc(this,"spec",void 0),Gc(this,"monitor",void 0),this.spec=t,this.monitor=r}return r0(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 s0(e,t){var r=g.useMemo(function(){return new n0(e,t)},[t]);return g.useEffect(function(){r.spec=e},[e]),r}function i0(e,t){return c0(e)||l0(e,t)||a0(e,t)||o0()}function o0(){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 a0(e,t){if(e){if(typeof e=="string")return Yc(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 Yc(e,t)}}function Yc(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 l0(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 c0(e){if(Array.isArray(e))return e}function u0(e,t,r){var n=on(),s=s0(e,t),i=JC(e);nn(function(){var a=mC(i,s,n),c=i0(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function d0(){var e=on();return g.useMemo(function(){return new sC(e)},[e])}function f0(e){var t=on(),r=g.useMemo(function(){return new gC(t.getBackend())},[t]);return nn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function h0(e){return g.useMemo(function(){return e.hooks.dropTarget()},[e])}function rh(e,t){var r=Jf(e,t),n=d0(),s=f0(r.options);return u0(r,n,s),[th(r.collect,n,s),h0(s)]}function p0(e,t){return v0(e)||y0(e,t)||m0(e,t)||g0()}function g0(){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 m0(e,t){if(e){if(typeof e=="string")return Xc(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 Xc(e,t)}}function Xc(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 y0(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 v0(e){if(Array.isArray(e))return e}function b0(e){var t=on(),r=t.getMonitor(),n=eh(r,e),s=p0(n,2),i=s[0],o=s[1];return g.useEffect(function(){return r.subscribeToOffsetChange(o)}),g.useEffect(function(){return r.subscribeToStateChange(o)}),i}function nh(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function _0(e,t){return e.filter(function(r){return r!==t})}function w0(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 x0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S0(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 C0(e,t,r){return t&&S0(e.prototype,t),e}function Zc(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){x0(this,e),Zc(this,"entered",[]),Zc(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return C0(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=w0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=_0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),O0=nh(function(){return/firefox/i.test(navigator.userAgent)}),sh=nh(function(){return!!window.safari});function D0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I0(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 T0(e,t,r){return t&&I0(e.prototype,t),e}function Zn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Jc=function(){function e(t,r){D0(this,e),Zn(this,"xs",void 0),Zn(this,"ys",void 0),Zn(this,"c1s",void 0),Zn(this,"c2s",void 0),Zn(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(j,F){return t[j]<t[F]?-1:1});for(var o=[],a=[],c,u,d=0;d<n-1;d++)c=t[d+1]-t[d],u=r[d+1]-r[d],o.push(c),a.push(u/c);for(var f=[a[0]],p=0;p<o.length-1;p++){var m=a[p],_=a[p+1];if(m*_<=0)f.push(0);else{c=o[p];var h=o[p+1],y=c+h;f.push(3*y/((y+h)/m+(y+c)/_))}}f.push(a[a.length-1]);for(var v=[],b=[],x,w=0;w<f.length-1;w++){x=a[w];var C=f[w],E=1/o[w],N=C+f[w+1]-x-x;v.push((x-C-N)*E),b.push(N*E*E)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=b}return T0(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 u=0,d=a.length-1,f;u<=d;){f=Math.floor(.5*(u+d));var p=n[f];if(p<r)u=f+1;else if(p>r)d=f-1;else return s[f]}c=Math.max(0,d);var m=r-n[c],_=m*m;return s[c]+i[c]*m+o[c]*_+a[c]*m*_}}]),e}(),N0=1;function ih(e){var t=e.nodeType===N0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Qs(e){return{x:e.clientX,y:e.clientY}}function R0(e){var t;return e.nodeName==="IMG"&&(O0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function j0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return sh()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function k0(e,t,r,n,s){var i=R0(t),o=i?e:t,a=ih(o),c={x:r.x-a.x,y:r.y-a.y},u=e.offsetWidth,d=e.offsetHeight,f=n.anchorX,p=n.anchorY,m=j0(i,t,u,d),_=m.dragPreviewWidth,h=m.dragPreviewHeight,y=function(){var N=new Jc([0,.5,1],[c.y,c.y/d*h,c.y+h-d]),j=N.interpolate(p);return sh()&&i&&(j+=(window.devicePixelRatio-1)*h),j},v=function(){var N=new Jc([0,.5,1],[c.x,c.x/u*_,c.x+_-u]);return N.interpolate(f)},b=s.offsetX,x=s.offsetY,w=b===0||b,C=x===0||x;return{x:w?b:v(),y:C?x:y()}}var oh="__NATIVE_FILE__",ah="__NATIVE_URL__",lh="__NATIVE_TEXT__",ch="__NATIVE_HTML__";const eu=Object.freeze(Object.defineProperty({__proto__:null,FILE:oh,HTML:ch,TEXT:lh,URL:ah},Symbol.toStringTag,{value:"Module"}));function Oo(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var hn;function Gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xa=(hn={},Gs(hn,oh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Gs(hn,ch,{exposeProperties:{html:function(t,r){return Oo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Gs(hn,ah,{exposeProperties:{urls:function(t,r){return Oo(t,r,"").split(`
|
|
465
|
+
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Gs(hn,lh,{exposeProperties:{text:function(t,r){return Oo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),hn);function A0(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 M0(e,t,r){return t&&P0(e.prototype,t),e}function tu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L0=function(){function e(t){A0(this,e),tu(this,"item",void 0),tu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return M0(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 F0(e,t){var r=new L0(xa[e]);return r.loadDataTransfer(t),r}function Do(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(xa).filter(function(r){var n=xa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function $0(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 V0(e,t,r){return t&&B0(e.prototype,t),e}function Io(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var U0=function(){function e(t,r){$0(this,e),Io(this,"ownerDocument",null),Io(this,"globalContext",void 0),Io(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return V0(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 ru(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 nu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ru(Object(r),!0).forEach(function(n){fe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ru(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function z0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q0(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 H0(e,t,r){return t&&q0(e.prototype,t),e}function fe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var W0=function(){function e(t,r,n){var s=this;z0(this,e),fe(this,"options",void 0),fe(this,"actions",void 0),fe(this,"monitor",void 0),fe(this,"registry",void 0),fe(this,"enterLeaveCounter",void 0),fe(this,"sourcePreviewNodes",new Map),fe(this,"sourcePreviewNodeOptions",new Map),fe(this,"sourceNodes",new Map),fe(this,"sourceNodeOptions",new Map),fe(this,"dragStartSourceIds",null),fe(this,"dropTargetIds",[]),fe(this,"dragEnterTargetIds",[]),fe(this,"currentNativeSource",null),fe(this,"currentNativeHandle",null),fe(this,"currentDragSourceNode",null),fe(this,"altKeyPressed",!1),fe(this,"mouseMoveTimeoutTimer",null),fe(this,"asyncEndDragFrameId",null),fe(this,"dragOverTargetIds",null),fe(this,"lastClientOffset",null),fe(this,"hoverRafId",null),fe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&ih(o)||null}),fe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),fe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),fe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),fe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Qs(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,u=Do(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=s.monitor.getSourceId(),f=s.sourceNodes.get(d),p=s.sourcePreviewNodes.get(d)||f;if(p){var m=s.getCurrentSourcePreviewNodeOptions(),_=m.anchorX,h=m.anchorY,y=m.offsetX,v=m.offsetY,b={anchorX:_,anchorY:h},x={offsetX:y,offsetY:v},w=k0(f,p,a,b,x);c.setDragImage(p,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var C=s.getCurrentSourcePreviewNodeOptions(),E=C.captureDraggingState;E?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(u)s.beginDragNativeItem(u);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),fe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Do(a);c&&s.beginDragNativeItem(c,a)}}),fe(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:Qs(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),fe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),fe(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=Qs(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"))}),fe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),fe(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 Do(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),fe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Qs(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),fe(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 U0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new E0(this.isNodeInDocument)}return H0(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(u){return i.handleDragStart(u,r)},a=function(u){return i.handleSelectStart(u)};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(u){return s.handleDragEnter(u,r)},o=function(u){return s.handleDragOver(u,r)},a=function(u){return s.handleDrop(u,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 nu({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 nu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(eu).some(function(n){return eu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=F0(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}(),Ys;function K0(){return Ys||(Ys=new Image,Ys.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ys}var Q0=function(t,r,n){return new W0(t,r,n)};function G0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Y0(e){return e.isDraggable&&!e.isEditing}function X0(e){const t=xt(),r=t.selectedIds,[n,s,i]=ZC(()=>({canDrag:()=>Y0(e),type:G0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Fn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Fn.dragEnd())}}),[r,e,t.props.dragType]);return g.useEffect(()=>{i(K0())},[i]),s}function Z0(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,u=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:u,atTop:!u&&o,atBottom:!u&&a}}function J0(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 Xs(e,t){return{parentId:e||null,index:t}}function pn(e,t){return{type:"line",index:e,level:t}}function e1(e){return{type:"highlight",id:e}}function To(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=Af(n)+1;return{parentId:s,index:i}}function uh(e){var t;const r=Z0(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,u]=J0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Xs(i.id,null),cursor:e1(i.id)};if(!c)return{drop:Xs((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:pn(0,0)};if(Nf(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:To(c,d),cursor:pn(c.rowIndex+1,d)}}if(Rf(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:To(c,d),cursor:pn(c.rowIndex+1,d)}}if(jf(c)){const d=ci(s,0,c.level+1);return d>c.level?{drop:Xs(c.id,0),cursor:pn(c.rowIndex+1,d)}:{drop:To(c,d),cursor:pn(c.rowIndex+1,d)}}return{drop:Xs(c==null?void 0:c.id,0),cursor:pn(c.rowIndex+1,c.level+1)}}function t1(e,t){const r=xt(),[n,s]=rh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:u}=uh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Fn.hovering(u.parentId,u.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 r1(e){const t=xt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return g.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const su=g.memo(function({index:t,style:r}){Tf(),_w();const n=xt(),s=r1(t),i=g.useRef(null),o=X0(s),a=t1(i,s),c=g.useCallback(h=>{i.current=h,a(h)},[a]),u=n.indent*s.level,d=g.useMemo(()=>({paddingLeft:u}),[u]),f=g.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),p={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};g.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const m=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:p,children:l.jsx(m,{node:s,tree:n,style:d,dragHandle:o})})});let No="",iu=null;function dh(){Tf();const e=xt();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(),Pf(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Mf(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(iu),No+=t.key,iu=setTimeout(()=>{No=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(No):!1});n&&e.focus(n.id)},children:l.jsx(n1,{})})}function n1(){var e,t;const r=xt(),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:lx,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:dx,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(sx,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:su})):l.jsx(ix,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:su}))}function ou(e){return e.isFiltered?i1(e.root,e.isMatch.bind(e)):s1(e.root)}function s1(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(fh),t}function i1(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(fh),n}function fh(e,t){e.rowIndex=t}const au=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ro=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(d){try{u(n.next(d))}catch(f){o(f)}}function c(d){try{u(n.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};const{safeRun:ot}=Ew;class ds{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=gc(this),this.visibleNodes=ou(this),this.idToIndex=au(this.visibleNodes)}update(t){this.props=t,this.root=gc(this),this.visibleNodes=ou(this),this.idToIndex=au(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=is(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=is(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 ws)return t.id;const r=this.props.idAccessor||"id";return is(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 Ro(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?Bf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:$f(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ot(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 Ro(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 ot(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(bo(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=>{ds.editPromise=i})}submit(t,r){return Ro(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ot(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(bo(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(bo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ot(this.props.onActivate,r)}resolveEdit(t){const r=ds.editPromise;r&&r(t),ds.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(cn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ot(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(cn(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&&ot(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(vr.remove(r)),ot(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(cn(n.id)),n.isSelectable&&(this.dispatch(vr.add(n.id)),this.dispatch(vr.anchor(n.id)),this.dispatch(vr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ot(this.props.onFocus,this.focusedNode),ot(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(cn(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(vr.remove(this.nodesBetween(s,i))),this.dispatch(vr.add(o)),this.dispatch(vr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ot(this.props.onFocus,this.focusedNode),ot(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(cn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ot(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(vr.set({ids:n,anchor:s,mostRecent:i})),ot(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&&kf(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;ot(this.props.onMove,{dragIds:n,parentId:t===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Fn.cursor({type:"none"}))}showCursor(t){this.dispatch(Fn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(pa.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),ot(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(pa.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),ot(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=el(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(){Ti(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ti(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),Ff(()=>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===_s)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!is(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(cn(t.id))}onBlur(){this.dispatch(Pw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||dh}get renderRow(){return this.props.renderRow||Nw}get renderNode(){return this.props.children||Rw}get renderDragPreview(){return this.props.renderDragPreview||Vf}get renderCursor(){return this.props.renderCursor||Tw}}function at(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 o1=typeof Symbol=="function"&&Symbol.observable||"@@observable",lu=o1,jo=()=>Math.random().toString(36).substring(7).split("").join("."),a1={INIT:`@@redux/INIT${jo()}`,REPLACE:`@@redux/REPLACE${jo()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${jo()}`},en=a1;function hh(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 l1(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(d1(e))return"date";if(u1(e))return"error";const r=c1(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 c1(e){return typeof e.constructor=="function"?e.constructor.name:null}function u1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function d1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function wr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=l1(e)),t}function ph(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?at(2):`Expected the root reducer to be a function. Instead, received: '${wr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?at(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"?at(1):`Expected the enhancer to be a function. Instead, received: '${wr(r)}'`);return r(ph)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function u(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?at(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(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?at(4):`Expected the listener to be a function. Instead, received: '${wr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?at(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 v=!0;u();const b=a++;return o.set(b,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?at(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,u(),o.delete(b),i=null}}}function p(y){if(!hh(y))throw new Error(process.env.NODE_ENV==="production"?at(7):`Actions must be plain objects. Instead, the actual type was: '${wr(y)}'. 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 y.type>"u")throw new Error(process.env.NODE_ENV==="production"?at(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?at(17):`Action "type" property must be a string. Instead, the actual type was: '${wr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?at(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function m(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?at(10):`Expected the nextReducer to be a function. Instead, received: '${wr(y)}`);n=y,p({type:en.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?at(11):`Expected the observer to be an object. Instead, received: '${wr(v)}'`);function b(){const w=v;w.next&&w.next(d())}return b(),{unsubscribe:y(b)}},[lu](){return this}}}return p({type:en.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:m,[lu]:_}}function cu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function f1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===en.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(!hh(e))return`The ${i} has unexpected type of "${wr(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===en.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 h1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:en.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?at(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:en.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?at(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${en.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 uu(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"&&cu(`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{h1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=f1(a,r,c,s);f&&cu(f)}let u=!1;const d={};for(let f=0;f<n.length;f++){const p=n[f],m=r[p],_=a[p],h=m(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?at(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${p}" 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.`)}d[p]=h,u=u||h!==_}return u=u||n.length!==Object.keys(a).length,u?d:a}}function p1(e=Ln().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 g1=uu({nodes:uu({focus:Mw,edit:Aw,open:Lw,selection:Fw,drag:p1}),dnd:$w}),m1=Ln();function y1({treeProps:e,imperativeHandle:t,children:r}){const n=g.useRef(null),s=g.useRef(null),i=g.useRef(ph(g1,Ln(e))),o=bw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>m1),a=g.useMemo(()=>new ds(i.current,e,n,s),[]),c=g.useRef(0);return g.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),g.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),g.useImperativeHandle(t,()=>a),g.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),g.useEffect(()=>{a.props.searchTerm||i.current.dispatch(pa.clear(!0))},[a.props.searchTerm]),l.jsx(Ef.Provider,{value:a,children:l.jsx(If.Provider,{value:c.current,children:l.jsx(Of.Provider,{value:o.nodes,children:l.jsx(Df.Provider,{value:o.dnd,children:l.jsx(QS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||Q0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function v1(){const e=xt(),[,t]=rh(()=>({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}=uh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Fn.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 b1(e){return v1(),e.children}function _1(){const t=xt().props.renderContainer||dh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function w1(){const e=xt(),{offset:t,mouse:r,item:n,isDragging:s}=b0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||Vf;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 x1(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 S1{constructor(t,r={}){this.accessors=x1(r),this.root=C1(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 C1(e,t){const r=new gh({},null,t,"ROOT");return r.children=e.map(n=>al(n,r,t)),r}function al(e,t,r){const n=new gh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>al(i,n,r))),n}class gh{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=al(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 E1=0;function O1(e,t={}){const[r,n]=g.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=g.useMemo(()=>new S1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const h of _.dragIds)o.move({id:h,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:h})=>{o.update({id:h,changes:{name:_}}),n(o.data)},u=typeof s=="string"?s:"id",d=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,index:h,type:y})=>{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(y==="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 v={[u]:`simple-tree-id-${E1++}`,name:""};return y==="internal"&&(v[d]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function D1(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]=O1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function I1(e,t){const r=D1(e);return l.jsxs(y1,{treeProps:r,imperativeHandle:t,children:[l.jsx(b1,{children:l.jsx(_1,{})}),l.jsx(w1,{})]})}const T1=g.forwardRef(I1),du={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},fu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},hu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],N1=[{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 R1(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 Ji(e){const t=R1(e);return{key:t,color:du[t]??du.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:fu[t]??fu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const j1="_row_10dbr_1",k1="_grip_10dbr_16",A1="_menuBtn_10dbr_19",P1="_selected_10dbr_23",M1="_title_10dbr_28",L1="_dropTarget_10dbr_33",F1="_toggle_10dbr_50",$1="_ctIcon_10dbr_65",B1="_renameInput_10dbr_86",V1="_dropHere_10dbr_95",U1="_menuWrap_10dbr_105",z1="_menu_10dbr_19",q1="_dangerItem_10dbr_157",Ot={row:j1,grip:k1,menuBtn:A1,selected:P1,title:M1,dropTarget:L1,toggle:F1,ctIcon:$1,renameInput:B1,dropHere:V1,menuWrap:U1,menu:z1,dangerItem:q1},H1={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},W1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=g.useState(!1),[o,a]=g.useState(!1),[c,u]=g.useState(e.data.name),d=g.useRef(null),f=n==="edit",p=Ji(e.data),m=H1[p.key]??zn,_=e.isSelected,h=e.data.isFolder??(e.children&&e.children.length>0);g.useEffect(()=>{if(!s)return;const b=x=>{var w;(w=d.current)!=null&&w.contains(x.target)||i(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]);const y=g.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),v=g.useCallback(b=>{b.key==="Enter"&&y(),b.key==="Escape"&&(u(e.data.name),a(!1))},[y,e.data.name]);return l.jsxs("div",{className:[Ot.row,_?Ot.selected:"",e.state.isOver&&h?Ot.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":h?"true":void 0,role:"treeitem","aria-selected":_,"aria-expanded":h?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Ot.grip,"aria-hidden":"true",children:l.jsx(Ud,{size:14})}),l.jsx("button",{className:Ot.toggle,onClick:b=>{b.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:h?"visible":"hidden"},children:e.isClosed?l.jsx(Fd,{size:14}):l.jsx(ks,{size:14})}),l.jsx("span",{className:`${Ot.ctIcon} ${p.bgClass}`,"aria-hidden":"true",children:l.jsx(m,{size:12})}),o?l.jsx("input",{className:Ot.renameInput,value:c,autoFocus:!0,onChange:b=>u(b.target.value),onBlur:y,onKeyDown:v,onClick:b=>b.stopPropagation()}):l.jsx("span",{className:Ot.title,onDoubleClick:()=>f&&a(!0),children:e.data.name}),e.state.isOver&&h&&l.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ot.menuWrap,ref:d,children:[l.jsx("button",{className:Ot.menuBtn,onClick:b=>{b.stopPropagation(),i(x=>!x)},"aria-label":"Node options",children:l.jsx(Bd,{size:14})}),s&&l.jsxs("div",{className:Ot.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(fy,{size:13})," Rename"]}),h&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Vd,{size:13})," Add sub-unit"]}),e.data.parent&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(As,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(qa,{size:13})," Delete"]})]})]})]})};async function K1(e,t){var i,o;const n=((i=(await Ae.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 Q1(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 G1(e,t){var o;const r=await K1(e,t.name),n=await Q1(r,t);return{processId:(((o=(await Ae.post(`/action/collection/v1/import/${e}`,{request:{fileUrl:n,mimeType:"text/csv"}})).data)==null?void 0:o.result)??{}).processId??""}}async function Y1(e){var r;return((r=(await Ae.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function mh(e){var n,s,i;const r=(i=(s=(n=(await Ae.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 X1(e){return mh(e)}const Z1="_container_1m4t0_1",J1="_header_1m4t0_13",eE="_title_1m4t0_22",tE="_closeBtn_1m4t0_29",rE="_body_1m4t0_45",nE="_dropZone_1m4t0_54",sE="_dragOver_1m4t0_67",iE="_hasFile_1m4t0_72",oE="_hiddenInput_1m4t0_78",aE="_fileInfo_1m4t0_82",lE="_fileIcon_1m4t0_89",cE="_fileName_1m4t0_93",uE="_fileSize_1m4t0_100",dE="_dropHint_1m4t0_105",fE="_dropIcon_1m4t0_112",hE="_dropText_1m4t0_117",pE="_dropSubtext_1m4t0_124",gE="_sampleLink_1m4t0_130",mE="_statusBar_1m4t0_145",yE="_status_uploading_1m4t0_154",vE="_status_processing_1m4t0_154",bE="_status_done_1m4t0_159",_E="_status_error_1m4t0_164",wE="_successDetail_1m4t0_170",xE="_spinner_1m4t0_175",SE="_spin_1m4t0_175",CE="_errorMsg_1m4t0_191",EE="_failedSection_1m4t0_197",OE="_failedTitle_1m4t0_203",DE="_tableWrap_1m4t0_213",IE="_failedTable_1m4t0_219",TE="_reasonCell_1m4t0_244",NE="_footer_1m4t0_248",Se={container:Z1,header:J1,title:eE,closeBtn:tE,body:rE,dropZone:nE,dragOver:sE,hasFile:iE,hiddenInput:oE,fileInfo:aE,fileIcon:lE,fileName:cE,fileSize:uE,dropHint:dE,dropIcon:fE,dropText:hE,dropSubtext:pE,sampleLink:gE,statusBar:mE,status_uploading:yE,status_processing:vE,status_done:bE,status_error:_E,successDetail:wE,spinner:xE,spin:SE,errorMsg:CE,failedSection:EE,failedTitle:OE,tableWrap:DE,failedTable:IE,reasonCell:TE,footer:NE},RE=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=g.useState(null),[o,a]=g.useState(!1),[c,u]=g.useState("idle"),[d,f]=g.useState(""),[p,m]=g.useState([]),[_,h]=g.useState(null),y=g.useRef(null),v=g.useRef(null),b=g.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);g.useEffect(()=>()=>b(),[b]);const x=k=>k.name.toLowerCase().endsWith(".csv")?k.size>10*1024*1024?(f("File size must not exceed 10 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=g.useCallback(k=>{f(""),m([]),h(null),u("idle"),x(k)&&i(k)},[]),C=g.useCallback(k=>{k.preventDefault(),a(!1);const P=k.dataTransfer.files[0];P&&w(P)},[w]),E=g.useCallback(k=>{var V;const P=(V=k.target.files)==null?void 0:V[0];P&&w(P),k.target.value=""},[w]),N=g.useCallback(async()=>{try{const k=await X1(e),P=document.createElement("a");P.href=k,P.download="sample_hierarchy.csv",P.target="_blank",P.click()}catch{f("Failed to download sample CSV.")}},[e]),j=g.useCallback(async()=>{if(s){u("uploading"),f(""),m([]);try{const{processId:k}=await G1(e,s);if(!k){u("done"),h(null),setTimeout(t,1500);return}u("processing"),v.current=setInterval(async()=>{try{const P=await Y1(k);P.status==="COMPLETED"?(b(),u("done"),h(P.successCount??null),P.failedRecords&&P.failedRecords.length>0?m(P.failedRecords):setTimeout(t,1500)):P.status==="FAILED"&&(b(),u("error"),f("Upload processing failed. Please check the error rows below."),P.failedRecords&&m(P.failedRecords))}catch{b(),u("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{u("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),F={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Se.container,children:[l.jsxs("div",{className:Se.header,children:[l.jsx("h2",{className:Se.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Se.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Se.body,children:[l.jsxs("div",{className:`${Se.dropZone} ${o?Se.dragOver:""} ${s?Se.hasFile:""}`,onDragEnter:k=>{k.preventDefault(),a(!0)},onDragOver:k=>{k.preventDefault(),a(!0)},onDragLeave:k=>{k.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var k;return(k=y.current)==null?void 0:k.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:k=>{var P;return k.key==="Enter"&&((P=y.current)==null?void 0:P.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Se.hiddenInput,onChange:E,"aria-hidden":"true"}),s?l.jsxs("div",{className:Se.fileInfo,children:[l.jsx("span",{className:Se.fileIcon,children:"📄"}),l.jsx("span",{className:Se.fileName,children:s.name}),l.jsxs("span",{className:Se.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Se.dropHint,children:[l.jsx("span",{className:Se.dropIcon,children:"⬆️"}),l.jsx("p",{className:Se.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Se.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Se.sampleLink,onClick:N,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Se.statusBar} ${Se[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Se.spinner,"aria-hidden":"true"}),F[c],c==="done"&&_!==null&&l.jsxs("span",{className:Se.successDetail,children:[" — ",_," item(s) imported"]})]}),d&&l.jsx("p",{className:Se.errorMsg,role:"alert",children:d}),p.length>0&&l.jsxs("div",{className:Se.failedSection,children:[l.jsxs("h4",{className:Se.failedTitle,children:["Failed Rows (",p.length,")"]}),l.jsx("div",{className:Se.tableWrap,children:l.jsxs("table",{className:Se.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:p.map((k,P)=>l.jsxs("tr",{children:[l.jsx("td",{children:k.rowNumber??P+1}),l.jsx("td",{children:k.name??"—"}),l.jsx("td",{className:Se.reasonCell,children:k.reason??"Unknown error"})]},P))})]})})]})]}),l.jsxs("div",{className:Se.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:j,children:c==="done"?"Uploaded":"Upload"})]})]})},jE="_container_1y30m_1",kE="_header_1y30m_8",AE="_headerActions_1y30m_19",PE="_iconBtn_1y30m_25",ME="_menuWrap_1y30m_43",LE="_dropdownMenu_1y30m_47",FE="_treeWrapper_1y30m_79",$E="_csvModal_1y30m_95",BE="_footer_1y30m_105",er={container:jE,header:kE,headerActions:AE,iconBtn:PE,menuWrap:ME,dropdownMenu:LE,treeWrapper:FE,csvModal:$E,footer:BE},VE=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const n=g.useRef(null),s=g.useRef(null),i=g.useRef(null),[o,a]=g.useState(400),[c,u]=g.useState(!1),[d,f]=g.useState(!1),[p,m]=g.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:x}=Ne(),w=e==="edit",C=be(R=>{var M,L,Z,ne;return((L=(M=R.editorConfig)==null?void 0:M.context)==null?void 0:L.contentId)??((ne=(Z=R.editorConfig)==null?void 0:Z.context)==null?void 0:ne.identifier)??""});g.useEffect(()=>{const R=s.current;if(!R)return;const M=new ResizeObserver(()=>{a(R.clientHeight||400)});return M.observe(R),a(R.clientHeight||400),()=>M.disconnect()},[]),g.useEffect(()=>{if(!c)return;const R=M=>{var L;(L=i.current)!=null&&L.contains(M.target)||u(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[c]);const E=g.useCallback(R=>{R.length>0&&y(R[0].data.id)},[y]),N=g.useCallback(({parentId:R,index:M,dragIds:L})=>{if(!R)return;const Z=L[0],ne=yh(_,R);if(!(ne!=null&&ne.children))return;const z=ne.children.findIndex(J=>J.id===Z);z<0||x(R,z,M>z?M-1:M)},[_,x]),j=g.useCallback(({ids:R})=>{R.forEach(M=>b(M))},[b]),F=g.useCallback(({parentId:R})=>{var Z;const M=R??((Z=_[0])==null?void 0:Z.id)??"";if(!M)return{id:crypto.randomUUID()};const L=v(M,"unit");return L?{id:L}:(Ue.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),k=g.useCallback(()=>{var M;const R=(M=_[0])==null?void 0:M.id;R&&(v(R,"unit")||Ue.error("Maximum depth reached"))},[_,v]),P=g.useCallback(()=>{h&&(v(h,"subunit")||Ue.error("Maximum depth reached"))},[h,v]),V=g.useCallback(async()=>{if(u(!1),!!C)try{const R=await mh(C),M=document.createElement("a");M.href=R,M.download=`${C}-folders.csv`,M.target="_blank",document.body.appendChild(M),M.click(),document.body.removeChild(M)}catch{Ue.error("Failed to download CSV")}},[C]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[w&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>u(R=>!R),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Bd,{size:15})}),c&&l.jsxs("div",{className:er.dropdownMenu,role:"menu",children:[l.jsx("button",{role:"menuitem",type:"button",onClick:()=>{u(!1),m("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",onClick:V,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",onClick:()=>{u(!1),m("update"),f(!0)},children:"Update folder metadata using csv file"})]})]}),r&&l.jsx("button",{type:"button",className:er.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(uy,{size:15}):l.jsx(cy,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(T1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:E,onMove:w?N:void 0,onDelete:w?j:void 0,onCreate:w?F:void 0,disableEdit:!w,disableDrop:!w,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:R=>l.jsx(W1,{...R,editorMode:e})})}),w&&l.jsxs("div",{className:er.footer,children:[l.jsxs(Te,{variant:"ghost",size:"sm",onClick:k,children:[l.jsx(As,{size:14})," Add Unit"]}),l.jsxs(Te,{variant:"ghost",size:"sm",onClick:P,disabled:!h,children:[l.jsx(Vd,{size:14})," Add Sub-unit"]})]}),d&&l.jsx("div",{className:er.csvModal,children:l.jsx(RE,{contentId:C,mode:p,onComplete:()=>f(!1),onClose:()=>f(!1)})})]})};function yh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=yh(r.children,t);if(n)return n}}}const UE="_breadcrumb_zd1aj_1",zE="_crumb_zd1aj_10",qE="_sep_zd1aj_26",HE="_current_zd1aj_31",Jn={breadcrumb:UE,crumb:zE,sep:qE,current:HE},WE=({crumbs:e})=>{const t=Ne(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Jn.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Jn.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(iy,{size:13})}),e.map((r,n)=>l.jsxs(g.Fragment,{children:[l.jsx(Fd,{size:13,className:Jn.sep}),n<e.length-1?l.jsx("button",{className:Jn.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Jn.current,children:r.name})]},r.id))]}):null},KE="_tabBar_qhks1_1",QE="_tab_qhks1_1",GE="_active_qhks1_29",YE="_error_qhks1_35",XE="_errorDot_qhks1_39",es={tabBar:KE,tab:QE,active:GE,error:YE,errorDot:XE},pu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],ZE=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?pu.filter(i=>n.includes(i.id)):pu;return l.jsx("div",{className:es.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:[es.tab,e===i.id?es.active:"",r.includes(i.id)?es.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:es.errorDot,"aria-label":"Has errors"})]},i.id))})};var $s=e=>e.type==="checkbox",Ur=e=>e instanceof Date,Je=e=>e==null;const vh=e=>typeof e=="object";var ke=e=>!Je(e)&&!Array.isArray(e)&&vh(e)&&!Ur(e),Sa=e=>ke(e)&&e.target?$s(e.target)?e.target.checked:e.target.value:e,bh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),_h=e=>{const t=e.constructor&&e.constructor.prototype;return ke(t)&&t.hasOwnProperty("isPrototypeOf")},eo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Le(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(eo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(ke(e)&&_h(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Le(e[s]));return n}const Sr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wt={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"},ko="form",wh="root",xh=["__proto__","constructor","prototype"];var Bs=e=>/^\w*$/.test(e),De=e=>e===void 0,to=e=>e.split(/[.[\]'"]/g).filter(Boolean),q=(e,t,r)=>{if(!t||!ke(e))return r;const n=Bs(t)?[t]:to(t);if(n.some(i=>xh.includes(i)))return r;const s=n.reduce((i,o)=>Je(i)?void 0:i[o],e);return De(s)||s===e?De(e[t])?r:e[t]:s},Nt=e=>typeof e=="boolean",ct=e=>typeof e=="function",Oe=(e,t,r)=>{let n=-1;const s=Bs(t)?[t]:to(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const u=e[a];c=ke(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(xh.includes(a))return;e[a]=c,e=e[a]}};const ll=g.createContext(null);ll.displayName="HookFormControlContext";const cl=()=>g.useContext(ll);var Sh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Wt.all&&(t._proxyFormState[o]=!n||Wt.all),r&&(r[o]=!0),e[o]}});return s};const ul=eo?g.useLayoutEffect:g.useEffect;function JE(e){const t=cl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=g.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=g.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ul(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u,defaultValues:r._defaultValues})}}),[s,n,i]),g.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),g.useMemo(()=>Sh(o,r,c.current,!1),[o,r])}var ut=e=>typeof e=="string",Ca=(e,t,r,n,s)=>ut(e)?(n&&t.watch.add(e),q(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),q(r,i))):(n&&(t.watchAll=!0),r),Ea=e=>Je(e)||!vh(e);const gu=(e,t)=>t.length===0&&!Array.isArray(e)&&!_h(e);function Rt(e,t,r=new WeakMap){if(e===t)return!0;if(Ea(e)||Ea(t))return Object.is(e,t);if(Ur(e)&&Ur(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(gu(e,n)||gu(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(Ur(a)&&Ur(c)||(ke(a)||Array.isArray(a))&&(ke(c)||Array.isArray(c))?!Rt(a,c,r):!Object.is(a,c))return!1}}return!0}function eO(e){const t=cl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=g.useRef(s),u=g.useRef(a),d=g.useRef(void 0),f=g.useRef(r),p=g.useRef(n);u.current=a;const[m,_]=g.useState(()=>{const w=r._getWatch(n,c.current);return u.current?u.current(w):w}),h=g.useCallback(w=>{const C=Ca(n,r._names,w||r._formValues,!1,c.current);return u.current?u.current(C):C},[r._formValues,r._names,n]),y=g.useCallback(w=>{if(!i){const C=Ca(n,r._names,w||r._formValues,!1,c.current);if(u.current){const E=u.current(C);Rt(E,d.current)||(_(E),d.current=E)}else _(C)}},[r._formValues,r._names,i,n]);ul(()=>((f.current!==r||!Rt(p.current,n))&&(f.current=r,p.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),g.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=p.current,x=g.useMemo(()=>{if(i)return null;const w=!v&&!Rt(b,n);return v||w?h():null},[i,v,n,b,h]);return x!==null?x:m}function ro(e){const t=cl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=bh(s._names.array,r),u=g.useMemo(()=>q(s._formValues,r,q(s._defaultValues,r,o)),[s,r,o]),d=eO({control:s,name:r,defaultValue:u,exact:a}),f=JE({control:s,name:r,exact:a}),p=g.useRef(e),m=g.useRef(null),_=g.useRef(s.register(r,{...e.rules,value:d,...Nt(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const h=g.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!q(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!q(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!q(f.validatingFields,r)},error:{enumerable:!0,get:()=>q(f.errors,r)}}),[f,r]),y=g.useCallback(w=>{const C=Sa(w);return q(s._fields,r)||(_.current=s.register(r,{...p.current.rules,value:C})),_.current.onChange({target:{value:Sa(w),name:r},type:Sr.CHANGE})},[r,s]),v=g.useCallback(()=>_.current.onBlur({target:{value:q(s._formValues,r),name:r},type:Sr.BLUR}),[r,s._formValues]),b=g.useCallback(w=>{w&&(m.current={focus:()=>ct(w.focus)&&w.focus(),select:()=>ct(w.select)&&w.select(),setCustomValidity:E=>ct(w.setCustomValidity)&&w.setCustomValidity(E),reportValidity:()=>ct(w.reportValidity)&&w.reportValidity()});const C=q(s._fields,r);C&&C._f&&w&&(C._f.ref=m.current)},[s._fields,r]),x=g.useMemo(()=>({name:r,value:d,...Nt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,d]);return g.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...p.current.rules,...Nt(p.current.disabled)?{disabled:p.current.disabled}:{}});const C=(E,N)=>{const j=q(s._fields,E);j&&j._f&&(j._f.mount=N)};if(C(r,!0),w){const E=Le(q(i?s._defaultValues:s._options.values||s._defaultValues,r,q(s._options.defaultValues,r,p.current.defaultValue)));Oe(s._defaultValues,r,E),De(q(s._formValues,r))&&Oe(s._formValues,r,E)}if(!c&&s.register(r),m.current){const E=q(s._fields,r);E&&E._f&&(E._f.ref=m.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),g.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),g.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const dl=g.createContext(null);dl.displayName="HookFormContext";const Yt=()=>g.useContext(dl),tO=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:p,unregister:m,control:_,register:h,setFocus:y,subscribe:v})=>{const b=g.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:p,unregister:m,control:_,register:h,setFocus:y,subscribe:v}),[i,_,u,n,r,p,h,f,d,s,y,o,a,v,c,m,t]);return g.createElement(dl.Provider,{value:b},g.createElement(ll.Provider,{value:b.control},e))};var rO=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Ch=e=>Array.isArray(e)?e.filter(Boolean):[],yi=e=>Array.isArray(e)?e:[e],mu=()=>{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 Eh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&ke(s)&&i){const o=Eh(s,i);ke(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Qe=e=>ke(e)&&!Object.keys(e).length,fl=e=>e.type==="file",Ri=e=>{if(!eo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Oh=e=>e.type==="select-multiple",hl=e=>e.type==="radio",nO=e=>hl(e)||$s(e),Ao=e=>Ri(e)&&e.isConnected;function sO(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(Je(e)){e=void 0;break}e=e[t[n]],n++}return e}function iO(e){for(const t in e)if(e.hasOwnProperty(t)&&!De(e[t]))return!1;return!0}function Ve(e,t){if(ut(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Bs(t)?[t]:to(t),n=r.length===1?e:sO(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(ke(n)&&Qe(n)||Array.isArray(n)&&iO(n))&&Ve(e,r.slice(0,-1)),e}var oO=e=>{for(const t in e)if(ct(e[t]))return!0;return!1};function Dh(e){return Array.isArray(e)||ke(e)&&!oO(e)}function Oa(e,t={}){for(const r in e){const n=e[r];Dh(n)?(t[r]=Array.isArray(n)?[]:{},Oa(n,t[r])):De(n)||(t[r]=!0)}return t}function Da(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Da(r));return t.some(r=>r!==void 0)?t:void 0}if(ke(e)){const t={};for(const r in e){const n=Da(e[r]);De(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Fr(e,t,r){r||(r=Oa(t));for(const n in e){const s=e[n];if(Dh(s))De(t)||Ea(r[n])?r[n]=Oa(s,Array.isArray(s)?[]:{}):Fr(s,Je(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Rt(s,i)}}return Da(r)||{}}const yu={value:!1,isValid:!1},vu={value:!0,isValid:!0};var Ih=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&&!De(e[0].attributes.value)?De(e[0].value)||e[0].value===""?vu:{value:e[0].value,isValid:!0}:vu:yu}return yu},Th=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>De(e)?e:t?e===""?NaN:e&&+e:r&&ut(e)?new Date(e):n?n(e):e;const bu={isValid:!1,value:null};var Nh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,bu):bu;function _u(e){const t=e.ref;return fl(t)?t.files:hl(t)?Nh(e.refs).value:Oh(t)?[...t.selectedOptions].map(({value:r})=>r):$s(t)?Ih(e.refs).value:Th(De(t.value)?e.ref.value:t.value,e)}var aO=(e,t,r,n)=>{const s={};for(const i of e){const o=q(t,i);o&&Oe(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},ji=e=>e instanceof RegExp,ts=e=>De(e)?e:ji(e)?e.source:ke(e)?ji(e.value)?e.value.source:e.value:e,wu=e=>({isOnSubmit:!e||e===Wt.onSubmit,isOnBlur:e===Wt.onBlur,isOnChange:e===Wt.onChange,isOnAll:e===Wt.all,isOnTouch:e===Wt.onTouched});const xu="AsyncFunction";var lO=e=>!!e&&!!e.validate&&!!(ct(e.validate)&&e.validate.constructor.name===xu||ke(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xu)),cO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Po=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const fs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=q(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(fs(a,t))break}else if(ke(a)&&fs(a,t))break}}};function Su(e,t,r){const n=q(e,r);if(n||Bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=q(t,i),a=q(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 uO=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Qe(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Wt.all))},dO=(e,t,r)=>!e||!t||e===t||yi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),fO=(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,hO=(e,t)=>!Ch(q(e,t)).length&&Ve(e,t),Cu=(e,t,r)=>{const n=q(e,r),s=Array.isArray(n)?n:[];return Oe(s,wh,t[r]),Oe(e,r,s),e};function Eu(e,t,r="validate"){if(ut(e)||Array.isArray(e)&&e.every(ut)||Nt(e)&&!e)return{type:r,message:ut(e)?e:"",ref:t}}var gn=e=>ke(e)&&!ji(e)?e:{value:e,message:""},Ou=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:d,min:f,max:p,pattern:m,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=q(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=V=>{if(s&&x.reportValidity){const R=Nt(V)?"":V||"";a?a.forEach(M=>M.setCustomValidity(R)):x.setCustomValidity(R),x.reportValidity()}},C={},E=hl(o),N=$s(o),j=E||N,F=(y||fl(o))&&De(o.value)&&De(b)||Ri(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,k=rO.bind(null,h,n,C),P=(V,R,M,L=qt.maxLength,Z=qt.minLength)=>{const ne=V?R:M;C[h]={type:V?L:Z,message:ne,ref:o,...k(V?L:Z,ne)}};if(i?!Array.isArray(b)||!b.length:c&&(!j&&(F||Je(b))||Nt(b)&&!b||N&&!Ih(a).isValid||E&&!Nh(a).isValid)){const{value:V,message:R}=ut(c)?{value:!!c,message:c}:gn(c);if(V&&(C[h]={type:qt.required,message:R,ref:x,...k(qt.required,R)},!n))return w(R),C}if(!F&&(!Je(f)||!Je(p))){let V,R;const M=gn(p),L=gn(f);if(!Je(b)&&!isNaN(b)){const Z=o.valueAsNumber||b&&+b;Je(M.value)||(V=Z>M.value),Je(L.value)||(R=Z<L.value)}else{const Z=o.valueAsDate||new Date(b),ne=ee=>new Date(new Date().toDateString()+" "+ee),z=o.type=="time",J=o.type=="week";ut(M.value)&&b&&(V=z?ne(b)>ne(M.value):J?b>M.value:Z>new Date(M.value)),ut(L.value)&&b&&(R=z?ne(b)<ne(L.value):J?b<L.value:Z<new Date(L.value))}if((V||R)&&(P(!!V,M.message,L.message,qt.max,qt.min),!n))return w(C[h].message),C}if((u||d)&&!F&&(ut(b)||i&&Array.isArray(b))){const V=gn(u),R=gn(d),M=!Je(V.value)&&b.length>+V.value,L=!Je(R.value)&&b.length<+R.value;if((M||L)&&(P(M,V.message,R.message),!n))return w(C[h].message),C}if(m&&!F&&ut(b)){const{value:V,message:R}=gn(m);if(ji(V)&&!b.match(V)&&(C[h]={type:qt.pattern,message:R,ref:o,...k(qt.pattern,R)},!n))return w(R),C}if(_){if(ct(_)){const V=await _(b,r),R=Eu(V,x);if(R&&(C[h]={...R,...k(qt.validate,R.message)},!n))return w(R.message),C}else if(ke(_)){let V={};for(const R in _){if(!Qe(V)&&!n)break;const M=Eu(await _[R](b,r),x,R);M&&(V={...M,...k(R,M.message)},w(M.message),n&&(C[h]=V))}if(!Qe(V)&&(C[h]={ref:x,...V},!n))return C}}return w(!0),C};const pO={mode:Wt.onSubmit,reValidateMode:Wt.onChange,shouldFocusError:!0},Rh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function gO(e={}){let t={...pO,...e},r={...Le(Rh),isLoading:ct(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=ke(t.defaultValues)||ke(t.values)?Le(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Le(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,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let p={...f};const m={array:mu(),state:mu()},_=t.criteriaMode===Wt.all,h=S=>I=>{clearTimeout(u),u=setTimeout(S,I)},y=async S=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||p.isValid||S)){let I;t.resolver?(I=Qe((await k()).errors),v()):I=await R({fields:n,onlyCheckValid:!0,eventType:Sr.VALID}),I!==r.isValid&&m.state.next({isValid:I})}},v=(S,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||p.isValidating||p.validatingFields)&&((S||Array.from(a.mount)).forEach(T=>{T&&(I?Oe(r.validatingFields,T,I):Ve(r.validatingFields,T))}),m.state.next({validatingFields:r.validatingFields,isValidating:!Qe(r.validatingFields)}))},b=()=>{r.dirtyFields=Fr(s,i)},x=(S,I=[],T,$,B=!0,H=!0)=>{if($&&T&&!t.disabled){if(o.action=!0,H&&Array.isArray(q(n,S))){const U=T(q(n,S),$.argA,$.argB);B&&Oe(n,S,U)}if(H&&Array.isArray(q(r.errors,S))){const U=T(q(r.errors,S),$.argA,$.argB);B&&Oe(r.errors,S,U),hO(r.errors,S)}if((f.touchedFields||p.touchedFields)&&H&&Array.isArray(q(r.touchedFields,S))){const U=T(q(r.touchedFields,S),$.argA,$.argB);B&&Oe(r.touchedFields,S,U)}(f.dirtyFields||p.dirtyFields)&&b(),m.state.next({name:S,isDirty:L(S,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Oe(i,S,I)},w=(S,I)=>{Oe(r.errors,S,I),r.errors={...r.errors},m.state.next({errors:r.errors})},C=S=>{r.errors=S,m.state.next({errors:r.errors,isValid:!1})},E=S=>{const I=Bs(S)?[S]:to(S);let T=i,$=s;for(let B=0;B<I.length-1;B++){const H=I[B];if(T=Je(T)?T:T[H],$=Je($)?$:$[H],T===null&&$!==null)return!0}return!1},N=(S,I,T,$)=>{const B=q(n,S);if(B){if(E(S))return;const H=De(q(i,S)),U=q(i,S,De(T)?q(s,S):T);De(U)||$&&$.defaultChecked||I?Oe(i,S,I?U:_u(B._f)):z(S,U),o.mount&&!o.action&&(y(),H&&r.isDirty&&(f.isDirty||p.isDirty)&&(L()||(r.isDirty=!1,m.state.next({...r}))),e.shouldUnregister&&H&&!De(q(i,S))&&Po(S,a)&&(o.watch=!0))}},j=(S,I,T,$,B)=>{let H=!1,U=!1;const Y={name:S};if(!t.disabled){if(!T||$){(f.isDirty||p.isDirty)&&(U=r.isDirty,r.isDirty=Y.isDirty=L(),H=U!==Y.isDirty);const ue=Rt(q(s,S),I);U=!!q(r.dirtyFields,S),ue!==r.isDirty?r.dirtyFields=Fr(s,i):ue?Ve(r.dirtyFields,S):Oe(r.dirtyFields,S,!0),Y.dirtyFields=r.dirtyFields,H=H||(f.dirtyFields||p.dirtyFields)&&U!==!ue}if(T){const ue=q(r.touchedFields,S);ue||(Oe(r.touchedFields,S,T),Y.touchedFields=r.touchedFields,H=H||(f.touchedFields||p.touchedFields)&&ue!==T)}H&&B&&m.state.next(Y)}return H?Y:{}},F=(S,I,T,$)=>{const B=q(r.errors,S),H=(f.isValid||p.isValid)&&Nt(I)&&r.isValid!==I;if(t.delayError&&T?(c=h(()=>w(S,T)),c(t.delayError)):(clearTimeout(u),c=null,T?Oe(r.errors,S,T):Ve(r.errors,S),r.errors={...r.errors}),(T?!Rt(B,T):B)||!Qe($)||H){const U={...$,...H&&Nt(I)?{isValid:I}:{},errors:r.errors,name:S};r={...r,...U},m.state.next(U)}},k=async S=>(v(S,!0),await t.resolver(i,t.context,aO(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),P=async S=>{const{errors:I}=await k(S);if(v(S),S){for(const T of S){const $=q(I,T);$?a.array.has(T)&&ke($)&&!Object.keys($).some(B=>!Number.isNaN(Number(B)))?Cu(r.errors,{[T]:$},T):Oe(r.errors,T,$):Ve(r.errors,T)}r.errors={...r.errors}}else r.errors=I;return I},V=async({name:S,eventType:I})=>{if(e.validate){const T=await e.validate({formValues:i,formState:r,name:S,eventType:I});if(ke(T))for(const $ in T){const B=T[$];B&&Pe(`${ko}.${$}`,{message:ut(B.message)?B.message:"",type:B.type||qt.validate})}else ut(T)||!T?Pe(ko,{message:T||"",type:qt.validate}):de(ko);return T}return!0},R=async({fields:S,onlyCheckValid:I,name:T,eventType:$,context:B={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(B.runRootValidation=!0,!await V({name:T,eventType:$})&&(B.valid=!1,I)))return B.valid;for(const H in S){const U=S[H];if(U){const{_f:Y,...ue}=U;if(Y){const Re=a.array.has(Y.name),yt=U._f&&lO(U._f),vt=f.validatingFields||f.isValidating||p.validatingFields||p.isValidating;yt&&vt&&v([Y.name],!0);const lr=await Ou(U,a.disabled,i,_,t.shouldUseNativeValidation&&!I,Re);if(yt&&vt&&v([Y.name]),lr[Y.name]&&(B.valid=!1,I)||(!I&&(q(lr,Y.name)?Re?Cu(r.errors,lr,Y.name):Oe(r.errors,Y.name,lr[Y.name]):Ve(r.errors,Y.name)),e.shouldUseNativeValidation&&lr[Y.name]))break}!Qe(ue)&&await R({context:B,onlyCheckValid:I,fields:ue,name:H,eventType:$})}}return B.valid},M=()=>{for(const S of a.unMount){const I=q(n,S);I&&(I._f.refs?I._f.refs.every(T=>!Ao(T)):!Ao(I._f.ref))&&St(S)}a.unMount=new Set},L=(S,I)=>!t.disabled&&(S&&I&&Oe(i,S,I),!Rt(K(),s)),Z=(S,I,T)=>Ca(S,a,{...o.mount?i:De(I)?s:ut(S)?{[S]:I}:I},T,I),ne=S=>Ch(q(o.mount?i:s,S,t.shouldUnregister?q(s,S,[]):[])),z=(S,I,T={},$=!1)=>{const B=q(n,S);let H=I;if(B){const U=B._f;U&&(!U.disabled&&Oe(i,S,Th(I,U)),H=Ri(U.ref)&&Je(I)?"":I,Oh(U.ref)?[...U.ref.options].forEach(Y=>Y.selected=H.includes(Y.value)):U.refs?$s(U.ref)?U.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(H)?Y.checked=!!H.find(ue=>ue===Y.value):Y.checked=H===Y.value||!!H)}):U.refs.forEach(Y=>Y.checked=Y.value===H):fl(U.ref)?U.ref.value="":(U.ref.value=H,U.ref.type||m.state.next({name:S,values:$?i:Le(i)})))}(T.shouldDirty||T.shouldTouch)&&j(S,H,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&Ce(S)},J=(S,I,T,$=!1)=>{for(const B in I){if(!I.hasOwnProperty(B))return;const H=I[B],U=S+"."+B,Y=q(n,U);(a.array.has(S)||ke(H)||Y&&!Y._f)&&!Ur(H)?J(U,H,T,$):z(U,H,T,$)}},ee=(S,I,T,$)=>{const B=q(n,S),H=a.array.has(S),U=$?I:Le(I),Y=q(i,S),ue=Rt(Y,U);if(ue||Oe(i,S,U),H)m.array.next({name:S,values:$?i:Le(i)}),(f.isDirty||f.dirtyFields||p.isDirty||p.dirtyFields)&&T.shouldDirty&&(b(),m.state.next({name:S,dirtyFields:r.dirtyFields,isDirty:L(S,U)}));else{const Re=Array.isArray(U)&&!U.length||Qe(U);!B||B._f||Je(U)||Re?z(S,U,T,$):J(S,U,T,$)}if(!ue){const Re=Po(S,a),yt=$?i:Le(i);m.state.next({...Re&&r,name:o.mount||Re?S:void 0,values:yt})}},W=(S,I,T={})=>ee(S,I,T,!1),X=(S,I={})=>{const T=ct(S)?S(i):S;if(!Rt(i,T)){i={...i,...T};for(const $ of a.mount)ee($,q(T,$),I,!0);m.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&y()}},se=async S=>{o.mount=!0;const I=S.target;let T=I.name,$=!0;const B=q(n,T),H=ue=>{$=Number.isNaN(ue)||Ur(ue)&&isNaN(ue.getTime())||Rt(ue,q(i,T,ue))},U=wu(t.mode),Y=wu(t.reValidateMode);if(B){let ue,Re;const yt=I.type?_u(B._f):Sa(S),vt=S.type===Sr.BLUR||S.type===Sr.FOCUS_OUT,lr=!cO(B._f)&&!e.validate&&!t.resolver&&!q(r.errors,T)&&!B._f.deps||fO(vt,q(r.touchedFields,T),r.isSubmitted,Y,U),Wn=Po(T,a,vt);Oe(i,T,yt),vt?(!I||!I.readOnly)&&(B._f.onBlur&&B._f.onBlur(S),c&&c(0)):B._f.onChange&&B._f.onChange(S);const Pr=j(T,yt,vt),We=!Qe(Pr)||Wn;if(!vt&&m.state.next({name:T,type:S.type,values:Le(i)}),lr)return(f.isValid||p.isValid)&&(t.mode==="onBlur"?vt&&y():vt||y()),We&&m.state.next({name:T,...Wn?{}:Pr});if(!t.resolver&&e.validate&&await V({name:T,eventType:S.type}),!vt&&Wn&&m.state.next({...r}),t.resolver){const{errors:nt}=await k([T]);if(v([T]),H(yt),!$){!Qe(Pr)&&m.state.next(Pr);return}const ft=Su(r.errors,n,T),Vt=Su(nt,n,ft.name||T);ue=Vt.error,T=Vt.name,Re=Qe(nt)}else v([T],!0),ue=(await Ou(B,a.disabled,i,_,t.shouldUseNativeValidation))[T],v([T]),H(yt),$&&(ue?Re=!1:(f.isValid||p.isValid)&&(Re=await R({fields:n,onlyCheckValid:!0,name:T,eventType:S.type})));$&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&Ce(B._f.deps),F(T,Re,ue,Pr))}},ye=(S,I)=>{if(q(r.errors,I)&&S.focus)return S.focus(),1},Ce=async(S,I={})=>{let T,$;const B=yi(S);if(t.resolver){const H=await P(De(S)?S:B);T=Qe(H),$=S?!B.some(U=>q(H,U)):T}else S?($=(await Promise.all(B.map(async H=>{const U=q(n,H);return await R({fields:U&&U._f?{[H]:U}:U,eventType:Sr.TRIGGER})}))).every(Boolean),!(!$&&!r.isValid)&&y()):$=T=await R({fields:n,name:S,eventType:Sr.TRIGGER});return m.state.next({...!ut(S)||(f.isValid||p.isValid)&&T!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:T}:{},errors:r.errors}),I.shouldFocus&&!$&&fs(n,ye,S?B:a.mount),$},K=(S,I)=>{let T={...o.mount?i:s};return I&&(T=Eh(I.dirtyFields?r.dirtyFields:r.touchedFields,T)),De(S)?T:ut(S)?q(T,S):S.map($=>q(T,$))},le=(S,I)=>({invalid:!!q((I||r).errors,S),isDirty:!!q((I||r).dirtyFields,S),error:q((I||r).errors,S),isValidating:!!q(r.validatingFields,S),isTouched:!!q((I||r).touchedFields,S)}),de=S=>{const I=S?yi(S):void 0;I==null||I.forEach(T=>Ve(r.errors,T)),I?I.forEach(T=>{m.state.next({name:T,errors:r.errors})}):m.state.next({errors:{}})},Pe=(S,I,T)=>{const $=(q(n,S,{_f:{}})._f||{}).ref,B=q(r.errors,S)||{},{ref:H,message:U,type:Y,...ue}=B;Oe(r.errors,S,{...ue,...I,ref:$}),m.state.next({name:S,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&$&&$.focus&&$.focus()},pe=(S,I)=>ct(S)?m.state.subscribe({next:T=>"values"in T&&S(T.values||Z(void 0,I),T)}):Z(S,I,!0),Bt=S=>m.state.subscribe({next:I=>{if(dO(S.name,I.name,S.exact)&&uO(I,S.formState||f,Vs,S.reRenderRoot)){const T={...i};S.callback({values:T,...r,...I,defaultValues:s})}}}).unsubscribe,Me=S=>(o.mount=!0,p={...p,...S.formState},Bt({...S,formState:{...d,...S.formState}})),St=(S,I={})=>{for(const T of S?yi(S):a.mount)a.mount.delete(T),a.array.delete(T),I.keepValue||(Ve(n,T),Ve(i,T)),!I.keepError&&Ve(r.errors,T),!I.keepDirty&&Ve(r.dirtyFields,T),!I.keepTouched&&Ve(r.touchedFields,T),!I.keepIsValidating&&Ve(r.validatingFields,T),!t.shouldUnregister&&!I.keepDefaultValue&&Ve(s,T);m.state.next({values:Le(i)}),m.state.next({...r,...I.keepDirty?{isDirty:L()}:{}}),!I.keepIsValid&&y()},rt=({disabled:S,name:I})=>{if(Nt(S)&&o.mount||S||a.disabled.has(I)){const B=a.disabled.has(I)!==!!S;S?a.disabled.add(I):a.disabled.delete(I),B&&o.mount&&!o.action&&y()}},Be=(S,I={})=>{let T=q(n,S);const $=Nt(I.disabled)||Nt(t.disabled),B=!a.registerName.has(S)&&T&&T._f&&!T._f.mount;return Oe(n,S,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:S}},name:S,mount:!0,...I}}),a.mount.add(S),T&&!B?rt({disabled:Nt(I.disabled)?I.disabled:t.disabled,name:S}):N(S,!0,I.value),{...$?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:ts(I.min),max:ts(I.max),minLength:ts(I.minLength),maxLength:ts(I.maxLength),pattern:ts(I.pattern)}:{},name:S,onChange:se,onBlur:se,ref:H=>{if(H){a.registerName.add(S),Be(S,I),a.registerName.delete(S),T=q(n,S);const U=De(H.value)&&H.querySelectorAll&&H.querySelectorAll("input,select,textarea")[0]||H,Y=nO(U),ue=T._f.refs||[];if(Y?ue.find(Re=>Re===U):U===T._f.ref)return;Oe(n,S,{_f:{...T._f,...Y?{refs:[...ue.filter(Ao),U,...Array.isArray(q(s,S))?[{}]:[]],ref:{type:U.type,name:S}}:{ref:U}}}),N(S,!1,void 0,U)}else T=q(n,S,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(bh(a.array,S)&&o.action)&&a.unMount.add(S)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&fs(n,ye,a.mount),He=S=>{Nt(S)&&(m.state.next({disabled:S}),fs(n,(I,T)=>{const $=q(n,T);$&&(I.disabled=$._f.disabled||S,Array.isArray($._f.refs)&&$._f.refs.forEach(B=>{B.disabled=$._f.disabled||S}))},0,!1))},gt=(S,I)=>async T=>{let $;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let B=Le(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:U}=await k();v(),r.errors=H,B=Le(U)}else await R({fields:n,eventType:Sr.SUBMIT});if(a.disabled.size)for(const H of a.disabled)Ve(B,H);if(Ve(r.errors,wh),Qe(r.errors)){m.state.next({errors:{}});try{await S(B,T)}catch(H){$=H}}else I&&await I({...r.errors},T),te(),setTimeout(te);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Qe(r.errors)&&!$,submitCount:r.submitCount+1,errors:r.errors}),$)throw $},Ct=(S,I={})=>{q(n,S)&&(De(I.defaultValue)?W(S,Le(q(s,S))):(W(S,I.defaultValue),Oe(s,S,Le(I.defaultValue))),I.keepTouched||Ve(r.touchedFields,S),I.keepDirty||(Ve(r.dirtyFields,S),r.isDirty=I.defaultValue?L(S,Le(q(s,S))):L()),I.keepError||(Ve(r.errors,S),f.isValid&&y()),m.state.next({...r}))},mt=(S,I={})=>{const T=S?Le(S):s,$=Le(T),B=Qe(S),H=$;if(I.keepDefaultValues||(s=T),!I.keepValues){if(I.keepDirtyValues){const U=new Set([...a.mount,...Object.keys(Fr(s,i))]);for(const Y of Array.from(U)){const ue=q(r.dirtyFields,Y),Re=q(i,Y),yt=q(H,Y);ue&&!De(Re)?Oe(H,Y,Re):!ue&&!De(yt)&&W(Y,yt)}}else{if(eo&&De(S))for(const U of a.mount){const Y=q(n,U);if(Y&&Y._f){const ue=Array.isArray(Y._f.refs)?Y._f.refs[0]:Y._f.ref;if(Ri(ue)){const Re=ue.closest("form");if(Re){Re.reset();break}}}}if(I.keepFieldsRef)for(const U of a.mount)W(U,q(H,U));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?Le(s):{},I.keepFieldsRef)for(const U of a.mount)Oe(i,U,q(H,U))}else i=Le(H);m.array.next({values:{...H}}),m.state.next({values:{...H}})}a={mount:I.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||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!Qe(H),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),m.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:B?!1:I.keepDirty?r.isDirty:I.keepValues?L():!!(I.keepDefaultValues&&!Rt(S,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:B?{}:I.keepDirtyValues?I.keepDefaultValues&&i?Fr(s,i):r.dirtyFields:I.keepDefaultValues&&S?Fr(s,S):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},ar=(S,I)=>mt(ct(S)?S(i):S,{...t.resetOptions,...I}),jt=(S,I={})=>{const T=q(n,S),$=T&&T._f;if($){const B=$.refs?$.refs[0]:$.ref;B.focus&&setTimeout(()=>{B.focus(),I.shouldSelect&&ct(B.select)&&B.select()})}},Vs=S=>{r={...r,...S}},Us={control:{register:Be,unregister:St,getFieldState:le,handleSubmit:gt,setError:Pe,_subscribe:Bt,_runSchema:k,_updateIsValidating:v,_focusError:te,_getWatch:Z,_getDirty:L,_setValid:y,_setFieldArray:x,_setDisabledField:rt,_setErrors:C,_getFieldArray:ne,_reset:mt,_resetDefaultValues:()=>ct(t.defaultValues)&&t.defaultValues().then(S=>{ar(S,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:He,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(S){o=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},get _options(){return t},set _options(S){t={...t,...S}}},subscribe:Me,trigger:Ce,register:Be,handleSubmit:gt,watch:pe,setValue:W,setValues:X,getValues:K,reset:ar,resetField:Ct,resetDefaultValues:(S,I={})=>{if(s=Le(S),!I.keepDirty){const T=Fr(s,i);r.dirtyFields=T,r.isDirty=!Qe(T)}I.keepIsValid||y(),m.state.next({...r,defaultValues:s})},clearErrors:de,unregister:St,setError:Pe,setFocus:jt,getFieldState:le};return{...Us,formControl:Us}}function mO(e={}){const t=g.useRef(void 0),r=g.useRef(void 0),n=g.useRef(e.formControl),[s,i]=g.useState(()=>({...Le(Rh),isLoading:ct(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ct(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&&!ct(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=gO(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,ul(()=>{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]),g.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),g.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),g.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),g.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),g.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),g.useEffect(()=>{var a;e.values&&!Rt(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]),g.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=g.useMemo(()=>Sh(s,o),[o,s]),t.current}async function Du(e){var r,n;return(n=(r=(await Ae.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function jh(e,t){const r=Ol({queryKey:["framework",e],queryFn:()=>Du(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Ol({queryKey:["framework",n],queryFn:()=>Du(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}const yO={"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."}},Iu={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},vO={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"},kh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Tu=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function bO(e,t,r,n){return e!=null&&e.length?e.filter(s=>!(n&&(s.code==="dialCode"||s.code==="dialcode")||s.visible===!1)).map(s=>{const i=s.code??"",o=SO(s),a=CO(s,r,t),c=t[i],u=Ah(c,o);return{code:i,label:s.label??i,inputType:o,required:!!(s.required??s.validations),editable:s.editable!==!1,placeholder:s.placeholder,maxLength:s.maxLength,options:wO(a,u,o,r),depends:s.depends,tab:xO(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:u}}):DO(t,n,r)}function _O(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 wO(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=_O(n);for(const c of s){const u=String(c);o.has(u)||(i.push({label:a.get(u)??u,value:u}),o.add(u))}return i}function xO(e){const t=e.section;if(t&&Iu[t])return Iu[t];const r=e.code??"";return vO[r]??"details"}function Ah(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 SO(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 CO(e,t,r){const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(a=>({label:a,value:a})):n.map(a=>({label:a.name,value:a.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(a=>({label:a,value:a}));const i=e.code??"",o=e.sourceCategory??kh[i];if(o)return Ph(i,o,e,t,r)}function Ph(e,t,r,n,s){var f,p,m,_,h;const i=Tu.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=y=>({label:y.name,value:i?y.identifier:y.name}),a=(p=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:p.find(y=>y.code===t),c=(h=(_=(m=n.targetFrameworks)==null?void 0:m[0])==null?void 0:_.categories)==null?void 0:h.find(y=>y.code===t);let u=(Tu.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 d=r.depends;if(d!=null&&d.length){const y=d.flatMap(v=>{const b=s[v];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(y.length){const v=u.filter(b=>{const x=b.associations;return!x||!x.length?!0:x.some(w=>y.includes(w.identifier)||y.includes(w.code)||y.includes(w.name))});v.length&&(u=v)}}return u.map(o)}function mn(e,t){const r=kh[e];if(r)return Ph(e,r,{},t,{})}const EO=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],OO=[{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 Ze(e,t,r){return Ah(e[t],r)}function DO(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:Ze(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:Ze(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:Ze(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:Ze(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:Ze(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:mn("board",r),currentValue:Ze(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:mn("subject",r),currentValue:Ze(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:EO,currentValue:Ze(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:mn("targetBoardIds",r),currentValue:Ze(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:mn("targetMediumIds",r),currentValue:Ze(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:mn("targetGradeLevelIds",r),currentValue:Ze(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:mn("targetSubjectIds",r),currentValue:Ze(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Ze(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Ze(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Ze(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:Ze(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:OO,currentValue:Ze(e,"license","select")})),n}function IO(e,t){const{watch:r,setValue:n}=e;g.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 TO="_section_ylgu8_1",NO="_header_ylgu8_11",RO="_title_ylgu8_17",jO="_description_ylgu8_24",kO="_divider_ylgu8_30",AO="_fields_ylgu8_36",yn={section:TO,header:NO,title:RO,description:jO,divider:kO,fields:AO},PO=({title:e,description:t,children:r})=>l.jsxs("div",{className:yn.section,children:[l.jsxs("div",{className:yn.header,children:[l.jsx("h3",{className:yn.title,children:e}),t&&l.jsx("p",{className:yn.description,children:t})]}),l.jsx("hr",{className:yn.divider}),l.jsx("div",{className:yn.fields,children:r})]}),MO="_field_hrhbs_1",LO="_fullWidth_hrhbs_7",FO="_label_hrhbs_11",$O="_required_hrhbs_19",BO="_input_hrhbs_24",VO="_textarea_hrhbs_45",UO="_inputError_hrhbs_50",zO="_error_hrhbs_54",qO="_selectBtn_hrhbs_59",HO="_selectOpen_hrhbs_83",WO="_placeholder_hrhbs_87",KO="_selectedVal_hrhbs_91",QO="_chevronUp_hrhbs_95",GO="_dropdown_hrhbs_100",YO="_option_hrhbs_116",XO="_optionSelected_hrhbs_134",ZO="_noOpts_hrhbs_139",JO="_chipGroup_hrhbs_146",eD="_chipInput_hrhbs_158",tD="_addChipBtn_hrhbs_167",rD="_radioGroup_hrhbs_184",nD="_radioLabel_hrhbs_191",sD="_iconWrap_hrhbs_199",iD="_iconPreview_hrhbs_214",oD="_iconPlaceholder_hrhbs_220",aD="_removeIconBtn_hrhbs_233",lD="_tagChip_hrhbs_252",cD="_tagChipRemove_hrhbs_264",uD="_nestedSelectRow_hrhbs_278",dD="_dialcodeRow_hrhbs_287",fD="_validateBtn_hrhbs_293",hD="_dialcodeValid_hrhbs_315",pD="_dialcodeSpinner_hrhbs_325",A={field:MO,fullWidth:LO,label:FO,required:$O,input:BO,textarea:VO,inputError:UO,error:zO,selectBtn:qO,selectOpen:HO,placeholder:WO,selectedVal:KO,chevronUp:QO,dropdown:GO,option:YO,optionSelected:XO,noOpts:ZO,chipGroup:JO,chipInput:eD,addChipBtn:tD,radioGroup:rD,radioLabel:nD,iconWrap:sD,iconPreview:iD,iconPlaceholder:oD,removeIconBtn:aD,tagChip:lD,tagChipRemove:cD,nestedSelectRow:uD,dialcodeRow:dD,validateBtn:fD,dialcodeValid:hD,dialcodeSpinner:pD},Nu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),u=c[e],d={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[A.field,s?A.fullWidth:""].join(" "),children:[l.jsxs("label",{className:A.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[A.input,A.textarea,u?A.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,d)}):l.jsx("input",{id:e,type:"text",className:[A.input,u?A.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,d)}),u&&l.jsx("span",{className:A.error,children:String(u.message)})]})},gD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=g.useState(!1),a=g.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),p=u(e),m=((h=r.find(y=>y.value===p))==null?void 0:h.label)??"Select…",_=f[e];return g.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:A.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[A.selectBtn,_?A.inputError:"",i?A.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:p?A.selectedVal:A.placeholder,children:m}),l.jsx(ks,{size:14,className:i?A.chevronUp:""})]}),i&&l.jsxs("div",{className:A.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[A.option,p===y.value?A.optionSelected:""].join(" "),onClick:()=>{d(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),p===y.value&&l.jsx(Un,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:A.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:A.error,children:String(_.message)})]})},mD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=g.useState(!1),a=g.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),p=u(e)??[],m=f[e],_=p.length?`${p.length} selected`:"Select…";g.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=p.includes(y)?p.filter(b=>b!==y):[...p,y];d(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:A.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[A.selectBtn,m?A.inputError:"",i?A.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:p.length?A.selectedVal:A.placeholder,children:_}),l.jsx(ks,{size:14,className:i?A.chevronUp:""})]}),i&&l.jsxs("div",{className:A.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[A.option,p.includes(y.value)?A.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Un,{size:13,style:{opacity:p.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:A.noOpts,children:"No options"})]}),m&&l.jsx("span",{className:A.error,children:String(m.message)})]})},yD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=g.useState(""),[a,c]=g.useState(!1),u=g.useRef(null),{watch:d,setValue:f,formState:{errors:p}}=Yt(),m=d(e)??[],_=p[e],h=()=>{const v=i.trim();v&&!m.includes(v)&&f(e,[...m,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,m.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[A.field,A.fullWidth].join(" "),children:[l.jsxs("label",{className:A.label,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsxs("div",{className:A.chipGroup,children:[m.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:u,autoFocus:!0,className:A.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:A.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=u.current)==null?void 0:v.focus()},50)},children:[l.jsx(As,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:A.error,children:String(_.message)})]})},vD=({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:A.field,children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("div",{className:A.radioGroup,children:r.map(c=>l.jsxs("label",{className:A.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:A.error,children:String(a.message)})]})},bD="_overlay_1o29p_1",_D="_modal_1o29p_12",wD="_header_1o29p_24",xD="_title_1o29p_33",SD="_closeBtn_1o29p_39",CD="_tabs_1o29p_57",ED="_tab_1o29p_57",OD="_activeTab_1o29p_83",DD="_body_1o29p_88",ID="_searchWrap_1o29p_99",TD="_searchIcon_1o29p_104",ND="_searchInput_1o29p_113",RD="_grid_1o29p_132",jD="_imgCell_1o29p_148",kD="_imgCellSelected_1o29p_166",AD="_thumb_1o29p_171",PD="_noThumb_1o29p_177",MD="_checkBadge_1o29p_183",LD="_loadMoreBtn_1o29p_198",FD="_loadingRow_1o29p_220",$D="_empty_1o29p_230",BD="_spinner_1o29p_237",VD="_uploadArea_1o29p_247",UD="_dropZone_1o29p_256",zD="_uploadIcon_1o29p_277",qD="_dropText_1o29p_281",HD="_dropSubtext_1o29p_288",WD="_uploadPreview_1o29p_294",KD="_hiddenInput_1o29p_301",QD="_fileName_1o29p_305",GD="_errorText_1o29p_311",YD="_footer_1o29p_318",XD="_cancelBtn_1o29p_328",ZD="_confirmBtn_1o29p_345",ce={overlay:bD,modal:_D,header:wD,title:xD,closeBtn:SD,tabs:CD,tab:ED,activeTab:OD,body:DD,searchWrap:ID,searchIcon:TD,searchInput:ND,grid:RD,imgCell:jD,imgCellSelected:kD,thumb:AD,noThumb:PD,checkBadge:MD,loadMoreBtn:LD,loadingRow:FD,empty:$D,spinner:BD,uploadArea:VD,dropZone:UD,uploadIcon:zD,dropText:qD,dropSubtext:HD,uploadPreview:WD,hiddenInput:KD,fileName:QD,errorText:GD,footer:YD,cancelBtn:XD,confirmBtn:ZD},Ru=18,Mh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=g.useState("my"),[o,a]=g.useState(""),[c,u]=g.useState([]),[d,f]=g.useState(0),[p,m]=g.useState(!1),[_,h]=g.useState(null),[y,v]=g.useState(0),[b,x]=g.useState(null),[w,C]=g.useState(""),[E,N]=g.useState(!1),[j,F]=g.useState(""),k=g.useRef(null),P=be(W=>{var X,se;return((se=(X=W.editorConfig)==null?void 0:X.context)==null?void 0:se.channel)??""}),V=be(W=>{var X,se;return((se=(X=W.editorConfig)==null?void 0:X.context)==null?void 0:se.uid)??""}),R=g.useCallback(async(W,X,se=!1)=>{var ye;m(!0);try{const Ce={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&V&&(Ce.createdBy=V),P&&(Ce.channel=P);const le=((ye=(await Ae.post("/action/composite/v3/search",{request:{filters:Ce,query:W,limit:Ru,offset:X,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ye.result)??{},de=le.content??[];f(le.count??0),u(Pe=>se?[...Pe,...de]:de)}catch{}finally{m(!1)}},[s,V,P]);g.useEffect(()=>{s!=="upload"&&(u([]),v(0),R(o,0))},[s]);const M=g.useRef(),L=W=>{a(W),clearTimeout(M.current),M.current=setTimeout(()=>{u([]),v(0),R(W,0)},400)},Z=()=>{const W=y+Ru;v(W),R(o,W,!0)},ne=()=>{const W=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";W&&r(W)},z=W=>{var se;const X=(se=W.target.files)==null?void 0:se[0];if(W.target.value="",!!X){if(!X.type.startsWith("image/")){F("Only image files are accepted.");return}if(X.size>4*1024*1024){F("Image must be under 4 MB.");return}x(X),C(URL.createObjectURL(X)),F("")}},J=async()=>{var W,X;if(b){N(!0),F("");try{const se=new FormData;se.append("file",b);const Ce=(X=(W=(await Ae.post(`/action/content/v3/upload/${e}?fileType=image`,se,{headers:{"Content-Type":"multipart/form-data"}})).data)==null?void 0:W.result)==null?void 0:X.artifactUrl;if(!Ce)throw new Error("No URL in response");r(Ce)}catch(se){F(se instanceof Error?se.message:"Upload failed.")}finally{N(!1)}}},ee=c.length<d;return l.jsx("div",{className:ce.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ce.modal,children:[l.jsxs("div",{className:ce.header,children:[l.jsx("span",{className:ce.title,children:"Select App Icon"}),l.jsx("button",{className:ce.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:18})})]}),l.jsxs("div",{className:ce.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ce.tab} ${s==="my"?ce.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ce.tab} ${s==="all"?ce.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ce.tab} ${s==="upload"?ce.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(zl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ce.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ce.searchWrap,children:[l.jsx(oa,{size:14,className:ce.searchIcon}),l.jsx("input",{type:"search",className:ce.searchInput,placeholder:"Search images…",value:o,onChange:W=>L(W.target.value)})]}),p&&c.length===0?l.jsxs("div",{className:ce.loadingRow,children:[l.jsx(si,{size:20,className:ce.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ce.empty,children:"No images found"}):l.jsx("div",{className:ce.grid,children:c.map(W=>{const X=W.appIcon??W.artifactUrl??W.downloadUrl??"",se=(_==null?void 0:_.identifier)===W.identifier;return l.jsxs("button",{type:"button",className:`${ce.imgCell} ${se?ce.imgCellSelected:""}`,onClick:()=>h(W),title:W.name,children:[X?l.jsx("img",{src:X,alt:W.name,className:ce.thumb}):l.jsx("div",{className:ce.noThumb,children:"IMG"}),se&&l.jsx("div",{className:ce.checkBadge,children:l.jsx(Un,{size:12})})]},W.identifier)})}),ee&&!p&&l.jsx("button",{className:ce.loadMoreBtn,onClick:Z,children:"Load More"}),p&&c.length>0&&l.jsx("div",{className:ce.loadingRow,children:l.jsx(si,{size:16,className:ce.spinner})})]}):l.jsxs("div",{className:ce.uploadArea,children:[l.jsx("div",{className:ce.dropZone,onClick:()=>{var W;return(W=k.current)==null?void 0:W.click()},onDragOver:W=>W.preventDefault(),onDrop:W=>{W.preventDefault();const X=W.dataTransfer.files[0];X&&z({target:{files:[X],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ce.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(zl,{size:32,className:ce.uploadIcon}),l.jsx("p",{className:ce.dropText,children:"Drag & drop or click to browse"}),l.jsx("p",{className:ce.dropSubtext,children:"PNG, JPG, SVG · max 4 MB"})]})}),l.jsx("input",{ref:k,type:"file",accept:"image/*",className:ce.hiddenInput,onChange:z}),b&&l.jsx("p",{className:ce.fileName,children:b.name}),j&&l.jsx("p",{className:ce.errorText,children:j})]})}),l.jsxs("div",{className:ce.footer,children:[l.jsx("button",{className:ce.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ce.confirmBtn,disabled:!b||E,onClick:J,children:E?l.jsxs(l.Fragment,{children:[l.jsx(si,{size:14,className:ce.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ce.confirmBtn,disabled:!_,onClick:ne,children:"Use Selected"})]})]})})},JD=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=g.useState(!1),{watch:a,setValue:c,register:u,formState:{errors:d}}=Yt(),f=a(e),p=d[e],m=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:A.field,children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...u(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:A.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:A.iconPreview}):l.jsxs("div",{className:A.iconPlaceholder,children:[l.jsx(zd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:A.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(qa,{size:13}),l.jsx("span",{children:"Remove"})]}),p&&l.jsx("span",{className:A.error,children:String(p.message)}),i&&l.jsx(Mh,{nodeId:r,currentValue:f,onSelect:m,onClose:()=>o(!1)})]})},eI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:A.field,children:[l.jsxs("label",{className:A.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[A.input,o?A.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:A.error,children:String(o.message)})]})},tI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=g.useState(""),u=g.useRef(null),d=i.value??[],f=h=>{const y=h.trim();!y||d.includes(y)||i.onChange([...d,y])},p=h=>{i.onChange(d.filter(y=>y!==h))},m=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&d.length>0&&p(d[d.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[A.field,A.fullWidth].join(" "),children:[l.jsxs("label",{className:A.label,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsxs("div",{className:[A.chipGroup,o?A.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=u.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(h=>l.jsxs("span",{className:A.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:A.tagChipRemove,onClick:y=>{y.stopPropagation(),p(h)},"aria-label":`Remove ${h}`,children:l.jsx(sn,{size:11})})]},h)),!n&&l.jsx("input",{ref:u,className:A.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:m,onBlur:_,placeholder:d.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:A.error,children:String(o.message)})]})},rI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=ro({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},u=(d,f,p)=>{const m={};for(let _=0;_<f;_++)m[r[_].code]=c[r[_].code]??"";m[d]=p;for(let _=f+1;_<r.length;_++)m[r[_].code]="";o.onChange(m)};return l.jsxs("div",{className:[A.field,A.fullWidth].join(" "),children:[l.jsxs("label",{className:A.label,children:[t,n&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("div",{className:A.nestedSelectRow,children:r.map((d,f)=>{const p=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:A.field,style:{flex:1},children:[l.jsx("label",{className:A.label,htmlFor:`${e}_${d.code}`,children:d.label}),l.jsxs("select",{id:`${e}_${d.code}`,className:[A.input,a?A.inputError:""].join(" "),disabled:s||p,value:c[d.code]??"",onChange:m=>u(d.code,f,m.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),d.options.map(m=>l.jsx("option",{value:m.value,children:m.label},m.value))]})]},d.code)})}),a&&l.jsx("span",{className:A.error,children:String(a.message)})]})},ju=[{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"}],nI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=g.useState(!1),o=g.useRef(null),{register:a,watch:c,setValue:u,formState:{errors:d}}=Yt(),f=c(e),p=ju.find(h=>h.value===f),m=(p==null?void 0:p.label)??"Select license…",_=d[e];return g.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:A.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:A.label,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[A.selectBtn,_?A.inputError:"",s?A.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?A.selectedVal:A.placeholder,children:m}),l.jsx(ks,{size:14,className:s?A.chevronUp:""})]}),s&&l.jsx("div",{className:A.dropdown,role:"listbox",children:ju.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[A.option,f===h.value?A.optionSelected:""].join(" "),onClick:()=>{u(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Un,{size:13})]},h.value))}),_&&l.jsx("span",{className:A.error,children:String(_.message)})]})},sI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=g.useState("idle"),[u,d]=g.useState(""),f=async()=>{const m=(i.value??"").trim();if(!m){c("invalid"),d("Enter a dial code to validate.");return}c("loading"),d("");try{const _=await $_(m),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),d("Dial code is valid.")):(c("invalid"),d("Dial code not found."))}catch{c("invalid"),d("Validation failed. Please try again.")}},p=()=>a==="loading"?l.jsx(si,{size:16,className:A.dialcodeSpinner}):a==="valid"?l.jsx($d,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(ia,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:A.field,children:[l.jsxs("label",{className:A.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:A.required,children:"*"})]}),l.jsxs("div",{className:A.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[A.input,o?A.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:m=>{i.onChange(m),c("idle"),d("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:A.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),p()]}),o&&l.jsx("span",{className:A.error,children:String(o.message)}),!o&&u&&l.jsx("span",{className:a==="valid"?A.dialcodeValid:A.error,children:u})]})},iI="_form_szqex_1",oI="_ungrouped_szqex_7",aI="_noFields_szqex_18",Mo={form:iI,ungrouped:oI,noFields:aI},lI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var L,Z,ne;const a=be(z=>z.editorConfig),c=be(z=>z.rootFormConfig),u=be(z=>z.unitFormConfig),{organisationFramework:d,targetFrameworks:f,isLoading:p}=jh((L=a==null?void 0:a.context)==null?void 0:L.framework,(Z=a==null?void 0:a.context)==null?void 0:Z.targetFWIds),m={organisationFramework:d,targetFrameworks:f},_=Ne(z=>z.selectedNodeId),h=Ne(z=>z.treeCache),y=_?h[_]??{}:{},v={...e,...y},b=r?c:u,x=b||(((ne=a==null?void 0:a.config.hierarchy)==null?void 0:ne.formConfig)??[]),w=bO(x,v,m,r),C=w.filter(z=>z.tab===t&&z.inputType!=="appIcon"),E=mO({mode:"onChange",defaultValues:Object.fromEntries(w.map(z=>{const J=["multiselect","chips","keywords","tagsinput"],ee=["nestedselect"];return J.includes(z.inputType)?[z.code,z.currentValue??z.defaultValue??[]]:ee.includes(z.inputType)?[z.code,z.currentValue??z.defaultValue??{}]:[z.code,z.currentValue??z.defaultValue??""]}))});IO(E,w);const{updateNode:N}=Ne(),j=g.useRef(w);j.current=w;const F=g.useRef(_);F.current=_;const k=g.useRef(i);k.current=i;const P=g.useRef(o);P.current=o,g.useEffect(()=>{const z=E.watch((J,{name:ee})=>{const W=F.current;if(!W)return;const X=j.current,se=new Set(X.map(K=>K.code));if(ee&&se.has(ee)){const K=E.getValues(ee);N(W,{[ee]:K}),k.current({[ee]:K})}else if(!ee){const K=E.getValues(),le=Object.fromEntries(Object.entries(K).filter(([de])=>se.has(de)));Object.keys(le).length>0&&(N(W,le),k.current(le))}const ye=E.formState.errors,Ce=Array.from(new Set(Object.keys(ye).map(K=>{var le;return(le=X.find(de=>de.code===K))==null?void 0:le.tab}).filter(Boolean)));P.current(Object.keys(ye).length===0,Ce)});return()=>z.unsubscribe()},[E]);const V=s!=="edit",R=C.reduce((z,J)=>{const ee=z[z.length-1];return ee&&ee.section===J.section?ee.fields.push(J):z.push({section:J.section,fields:[J]}),z},[]),M=z=>{const J={key:z.code,name:z.code,label:z.label,required:z.required,disabled:V||z.editable===!1};switch(z.inputType){case"textarea":return l.jsx(Nu,{...J,multiline:!0,maxLength:z.maxLength});case"select":return l.jsx(gD,{...J,options:z.options??[]});case"multiselect":return l.jsx(mD,{...J,options:z.options??[]});case"chips":return l.jsx(yD,{...J});case"radio":return l.jsx(vD,{...J,options:z.options??[]});case"appIcon":return l.jsx(JD,{...J,nodeId:_??""});case"datepicker":case"datetime":return l.jsx(eI,{...J});case"keywords":case"tagsinput":return l.jsx(tI,{...J});case"nestedselect":return l.jsx(rI,{...J,levels:z.levels??[]});case"license":return l.jsx(nI,{...J});case"dialcode":return l.jsx(sI,{...J});default:return l.jsx(Nu,{...J,maxLength:z.maxLength})}};return l.jsx(tO,{...E,children:l.jsxs("div",{className:Mo.form,children:[R.map((z,J)=>{const ee=z.section?yO[z.section]:void 0;return ee?l.jsx(PO,{title:ee.title,description:ee.description,children:z.fields.map(M)},z.section??J):l.jsx("div",{className:Mo.ungrouped,children:z.fields.map(M)},J)}),C.length===0&&!p&&l.jsx("p",{className:Mo.noFields,children:"No fields configured for this tab."})]})})};function Lh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function cI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Zs(e){return e!==null&&e>=0}function uI(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 dI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Fh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Lh(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}},Js={scaleX:1,scaleY:1},fI=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 u=i[o];return u?{x:0,y:r<o?u.top+u.height-(a.top+a.height):u.top-a.top,...Js}:null}const c=hI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Js}:s<r&&s>=o?{x:0,y:a.height+c,...Js}:{x:0,y:0,...Js}};function hI(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 $h="Sortable",Bh=g.createContext({activeIndex:-1,containerId:$h,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fh,disabled:{draggable:!1,droppable:!1}});function pI(e){let{children:t,id:r,items:n,strategy:s=Fh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=Md(),f=Rs($h,r),p=a.rect!==null,m=g.useMemo(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),_=o!=null,h=o?m.indexOf(o.id):-1,y=u?m.indexOf(u.id):-1,v=g.useRef(m),b=!uI(m,v.current),x=y!==-1&&h===-1||b,w=dI(i);Kt(()=>{b&&_&&d(m)},[b,m,_,d]),g.useEffect(()=>{v.current=m},[m]);const C=g.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:m,overIndex:y,useDragOverlay:p,sortedRects:cI(m,c),strategy:s}),[h,f,w.draggable,w.droppable,x,m,y,c,p,s]);return g.createElement(Bh.Provider,{value:C},t)}const gI=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Lh(r,n,s).indexOf(t)},mI=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:u}=e;return!u||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},yI={duration:200,easing:"ease"},Vh="transform",vI=kr.Transition.toString({property:Vh,duration:0,easing:"linear"}),bI={roleDescription:"sortable"};function _I(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=g.useState(null),a=g.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const u=Vn(n.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}r!==a.current&&(a.current=r)},[t,r,n,s]),g.useEffect(()=>{i&&o(null)},[i]),i}function wI(e){let{animateLayoutChanges:t=mI,attributes:r,disabled:n,data:s,getNewIndex:i=gI,id:o,strategy:a,resizeObserverConfig:c,transition:u=yI}=e;const{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=g.useContext(Bh),x=xI(n,m),w=d.indexOf(o),C=g.useMemo(()=>({sortable:{containerId:f,index:w,items:d},...s}),[f,s,w,d]),E=g.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:N,node:j,isOver:F,setNodeRef:k}=Mm({id:o,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:P,activatorEvent:V,activeNodeRect:R,attributes:M,setNodeRef:L,listeners:Z,isDragging:ne,over:z,setActivatorNodeRef:J,transform:ee}=Pd({id:o,data:C,attributes:{...bI,...r},disabled:x.draggable}),W=wg(k,L),X=!!P,se=X&&!_&&Zs(p)&&Zs(y),ye=!v&&ne,Ce=ye&&se?ee:null,le=se?Ce??(a??b)({rects:h,activeNodeRect:R,activeIndex:p,overIndex:y,index:w}):null,de=Zs(p)&&Zs(y)?i({id:o,items:d,activeIndex:p,overIndex:y}):w,Pe=P==null?void 0:P.id,pe=g.useRef({activeId:Pe,items:d,newIndex:de,containerId:f}),Bt=d!==pe.current.items,Me=t({active:P,containerId:f,isDragging:ne,isSorting:X,id:o,index:w,items:d,newIndex:pe.current.newIndex,previousItems:pe.current.items,previousContainerId:pe.current.containerId,transition:u,wasDragging:pe.current.activeId!=null}),St=_I({disabled:!Me,index:w,node:j,rect:N});return g.useEffect(()=>{X&&pe.current.newIndex!==de&&(pe.current.newIndex=de),f!==pe.current.containerId&&(pe.current.containerId=f),d!==pe.current.items&&(pe.current.items=d)},[X,de,f,d]),g.useEffect(()=>{if(Pe===pe.current.activeId)return;if(Pe&&!pe.current.activeId){pe.current.activeId=Pe;return}const Be=setTimeout(()=>{pe.current.activeId=Pe},50);return()=>clearTimeout(Be)},[Pe]),{active:P,activeIndex:p,attributes:M,data:C,rect:N,index:w,newIndex:de,items:d,isOver:F,isSorting:X,isDragging:ne,listeners:Z,node:j,overIndex:y,over:z,setNodeRef:W,setActivatorNodeRef:J,setDroppableNodeRef:k,setDraggableNodeRef:L,transform:St??le,transition:rt()};function rt(){if(St||Bt&&pe.current.newIndex===w)return vI;if(!(ye&&!$i(V)||!u)&&(X||Me))return kr.Transition.toString({...u,property:Vh})}}function xI(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 ki(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 SI=[me.Down,me.Right,me.Up,me.Left],CI=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(SI.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=s.get(f.id);if(p)switch(e.code){case me.Down:n.top<p.top&&c.push(f);break;case me.Up:n.top>p.top&&c.push(f);break;case me.Left:n.left>p.left&&c.push(f);break;case me.Right:n.left<p.left&&c.push(f);break}});const u=Fg({collisionRect:n,droppableRects:s,droppableContainers:c});let d=vd(u,"id");if(d===(o==null?void 0:o.id)&&u.length>1&&(d=u[1].id),d!=null){const f=i.get(r.id),p=i.get(d),m=p?s.get(p.id):null,_=p==null?void 0:p.node.current;if(_&&m&&f&&p){const y=Bi(_).some((E,N)=>a[N]!==E),v=Uh(f,p),b=EI(f,p),x=y||!v?{x:0,y:0}:{x:b?n.width-m.width:0,y:b?n.height-m.height:0},w={x:m.left,y:m.top};return x.x&&x.y?w:ys(w,x)}}}};function Uh(e,t){return!ki(e)||!ki(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function EI(e,t){return!ki(e)||!ki(t)||!Uh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const OI="_row_11nth_1",DI="_removeBtn_11nth_14",II="_grip_11nth_17",TI="_ctIcon_11nth_34",NI="_info_11nth_38",RI="_name_11nth_46",jI="_meta_11nth_55",Mr={row:OI,removeBtn:DI,grip:II,ctIcon:TI,info:NI,name:RI,meta:jI},kI={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},AI=({item:e,onRemove:t,isEditable:r})=>{const n=Ji(e),s=kI[n.key]??zn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:u,isDragging:d}=wI({id:e.id,disabled:!r}),f={transform:kr.Transform.toString(c),transition:u,opacity:d?.5:1};return l.jsxs("div",{ref:a,style:f,className:Mr.row,role:"listitem",children:[r&&l.jsx("span",{className:Mr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Ud,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Mr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Mr.info,children:[l.jsx("span",{className:Mr.name,title:e.name,children:e.name}),l.jsx("span",{className:Mr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Mr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(sn,{size:14})})]})},PI="_container_lzvke_1",MI="_header_lzvke_7",LI="_heading_lzvke_13",FI="_count_lzvke_21",$I="_list_lzvke_30",BI="_emptyState_lzvke_36",VI="_addRow_lzvke_52",Lr={container:PI,header:MI,heading:LI,count:FI,list:$I,emptyState:BI,addRow:VI},UI=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Ne(),i=t?r(t):[],o=e==="edit",a=gd(ta(Vi,{activationConstraint:{distance:5}}),ta(Ma,{coordinateGetter:CI})),c=g.useCallback(d=>{const{active:f,over:p}=d;if(!p||f.id===p.id||!t)return;const m=Ne.getState().getChildrenOf(t),_=m.findIndex(y=>y.id===f.id),h=m.findIndex(y=>y.id===p.id);_<0||h<0||n(t,_,h)},[t,n]),u=g.useCallback(d=>{window.confirm("Remove this content from the unit?")&&s(d)},[s]);return t?l.jsxs("div",{className:Lr.container,children:[l.jsxs("div",{className:Lr.header,children:[l.jsx("span",{className:Lr.heading,children:"Content in this unit"}),l.jsx("span",{className:Lr.count,children:i.length})]}),i.length>0?l.jsx(Ad,{sensors:a,collisionDetection:Lg,onDragEnd:c,children:l.jsx(pI,{items:i.map(d=>d.id),strategy:fI,children:l.jsx("div",{className:Lr.list,role:"list",children:i.map(d=>l.jsx(AI,{item:d,onRemove:u,isEditable:o},d.id))})})}):l.jsxs("div",{className:Lr.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:Lr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(As,{size:14})," Add content"]})]}):null},zI="_dropZone_ijo5w_1",qI="_active_ijo5w_14",ku={dropZone:zI,active:qI},HI=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${ku.dropZone} ${e?ku.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 WI(e){var s;const t={status:["Live"],contentType:["Resource"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((s=(await Ae.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:s.result)??{};return{content:n.content??[],count:n.count??0}}async function KI(e){var r,n;return(n=(r=(await Ae.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const QI="_contentPlayerRoot_ryh6z_1",GI="_stage_ryh6z_9",YI="_playerHeader_ryh6z_19",XI="_playerHeaderThumb_ryh6z_33",ZI="_playerHeaderTitle_ryh6z_43",JI="_typeBadge_ryh6z_53",eT="_typeDot_ryh6z_92",tT="_aspectRatio_ryh6z_99",rT="_playerFrame_ryh6z_112",nT="_coverOverlay_ryh6z_120",sT="_coverHidden_ryh6z_132",iT="_coverThumb_ryh6z_137",oT="_coverPlayRing_ryh6z_146",aT="_coverPlayIcon_ryh6z_159",lT="_coverLabel_ryh6z_168",cT="_coverSkeleton_ryh6z_174",uT="_playerWrapper_ryh6z_200",dT="_infoStrip_ryh6z_210",fT="_infoChip_ryh6z_226",hT="_infoChipLabel_ryh6z_245",pT="_infoChipIcon_ryh6z_254",gT="_playerError_ryh6z_260",mT="_playerErrorIcon_ryh6z_274",yT="_playerErrorMsg_ryh6z_279",vT="_qumlRoot_ryh6z_286",Ie={contentPlayerRoot:QI,stage:GI,playerHeader:YI,playerHeaderThumb:XI,playerHeaderTitle:ZI,typeBadge:JI,typeDot:eT,aspectRatio:tT,playerFrame:rT,coverOverlay:nT,coverHidden:sT,coverThumb:iT,coverPlayRing:oT,coverPlayIcon:aT,coverLabel:lT,coverSkeleton:cT,playerWrapper:uT,infoStrip:dT,infoChip:fT,infoChipLabel:hT,infoChipIcon:pT,playerError:gT,playerErrorIcon:mT,playerErrorMsg:yT,qumlRoot:vT},bT=[{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 _T(e){return bT.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const wT={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},xT={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},ST={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},CT="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Lo(e){for(const[t,r]of Object.entries(wT))if(r.includes(e))return t;return"default-player"}function ET(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 OT(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 DT(e,t,r=100){await OT(xT[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 IT=[{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 TT({node:e}){const t=e.metadata??{},r=IT.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:Ie.infoStrip,children:r.map(n=>l.jsxs("div",{className:Ie.infoChip,children:[n.icon&&l.jsx("span",{className:Ie.infoChipIcon,children:n.icon}),l.jsx("span",{className:Ie.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function NT({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Ie.coverOverlay} ${t?Ie.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Ie.coverThumb}),l.jsx("div",{className:Ie.coverPlayRing,children:l.jsx("div",{className:Ie.coverPlayIcon})}),l.jsx("span",{className:Ie.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Ie.coverSkeleton})})}function RT({message:e}){return l.jsxs("div",{className:Ie.playerError,children:[l.jsx("span",{className:Ie.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Ie.playerErrorMsg,children:e})]})}function jT({mimeType:e}){const t=_T(e);return l.jsxs("span",{className:Ie.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Ie.typeDot}),t.label]})}const Ia=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(AT,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Ie.contentPlayerRoot,children:[l.jsxs("div",{className:Ie.stage,children:[l.jsxs("div",{className:Ie.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Ie.playerHeaderThumb}),l.jsx("span",{className:Ie.playerHeaderTitle,children:e.name}),l.jsx(jT,{mimeType:e.mimeType??""})]}),l.jsx(kT,{node:e})]}),l.jsx(TT,{node:e})]})};function kT({node:e}){var y;const t=be(v=>v.editorConfig),[r,n]=g.useState(()=>Lo(e.mimeType??"")),[s,i]=g.useState(!1),[o,a]=g.useState(null),[c,u]=g.useState(e.metadata??{}),[d,f]=g.useState(!1),p=g.useRef(null),m=g.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??CT;g.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),u(e.metadata??{}),n(Lo(e.mimeType??"")),KI(e.identifier).then(b=>{if(v)return;const x={...e.metadata??{},...b};u(x);const w=b.mimeType??e.mimeType??"";n(Lo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=ET(e,c,t);return g.useEffect(()=>{if(!d||r!=="default-player")return;const v=p.current;if(!v)return;v.src=_;const b=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",x),()=>{v.removeEventListener("load",b),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,_,d]),g.useEffect(()=>{if(!d||r==="default-player")return;const v=m.current;if(!v)return;const b=ST[r];if(!b)return;const x=h;DT(b,r).then(()=>{if(!m.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,d]),l.jsxs("div",{className:Ie.aspectRatio,children:[o?l.jsx(RT,{message:o}):l.jsx(NT,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:p,id:"contentPlayer",title:e.name,className:Ie.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:m,className:Ie.playerFrame})]})}function AT({node:e,editorMode:t}){const r=be(s=>s.editorConfig),n=g.useRef(null);return g.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:Ie.qumlRoot,children:l.jsx("div",{ref:n,className:Ie.playerWrapper})})}const PT="_overlay_1856m_1",MT="_modal_1856m_11",LT="_header_1856m_21",FT="_body_1856m_37",$T="_hint_1856m_43",BT="_list_1856m_49",VT="_item_1856m_55",UT="_selected_1856m_68",zT="_empty_1856m_73",qT="_footer_1856m_79",HT="_cancelBtn_1856m_87",WT="_moveBtn_1856m_95",Mt={overlay:PT,modal:MT,header:LT,body:FT,hint:$T,list:BT,item:VT,selected:UT,empty:zT,footer:qT,cancelBtn:HT,moveBtn:WT};function KT(e,t){const r=[],n=s=>{var i;for(const o of s)o.isFolder&&o.id!==t&&r.push(o),(i=o.children)!=null&&i.length&&n(o.children)};return n(e),r}const QT=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{const{treeData:s,moveNode:i}=Ne(),o=KT(s,r),[a,c]=g.useState(null),u=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Mt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Mt.modal,children:[l.jsxs("div",{className:Mt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsxs("div",{className:Mt.body,children:[l.jsx("p",{className:Mt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Mt.list,children:[o.map(d=>l.jsxs("li",{className:`${Mt.item} ${a===d.id?Mt.selected:""}`,onClick:()=>c(d.id),children:[l.jsx(sy,{size:14}),l.jsx("span",{children:d.name})]},d.id)),o.length===0&&l.jsx("li",{className:Mt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Mt.footer,children:[l.jsx("button",{className:Mt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Mt.moveBtn,onClick:u,disabled:!a,children:"Move here"})]})]})})},GT="_overlay_pv0x1_1",YT="_modal_pv0x1_11",XT="_header_pv0x1_21",ZT="_body_pv0x1_37",JT="_table_pv0x1_43",eN="_pageInput_pv0x1_61",tN="_empty_pv0x1_68",rN="_footer_pv0x1_74",nN="_cancelBtn_pv0x1_82",sN="_saveBtn_pv0x1_90",tr={overlay:GT,modal:YT,header:XT,body:ZT,table:JT,pageInput:eN,empty:tN,footer:rN,cancelBtn:nN,saveBtn:sN};function iN(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 oN=({onClose:e})=>{const{treeData:t,updateNode:r}=Ne(),n=iN(t),[s,i]=g.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=g.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:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsx("div",{className:tr.body,children:n.length===0?l.jsx("p",{className:tr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:tr.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(u=>({...u,[a.id]:c.target.value})),className:tr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:tr.footer,children:[l.jsx("button",{className:tr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:tr.saveBtn,onClick:o,children:[l.jsx(py,{size:14})," Save"]})]})]})})},aN="_container_1a7t2_1",lN="_panelHeader_1a7t2_10",cN="_panelHeaderLeft_1a7t2_19",uN="_panelCollapseBtn_1a7t2_27",dN="_titleRow_1a7t2_46",fN="_field_1a7t2_47",hN="_moveBtn_1a7t2_64",pN="_icon_1a7t2_84",gN="_nameInput_1a7t2_93",mN="_fieldHeader_1a7t2_118",yN="_label_1a7t2_124",vN="_fieldCount_1a7t2_133",bN="_chips_1a7t2_170",_N="_chip_1a7t2_170",wN="_chipRemove_1a7t2_188",xN="_keywordInput_1a7t2_202",SN="_input_1a7t2_207",CN="_addBtn_1a7t2_220",EN="_radioGroup_1a7t2_234",ON="_radioLabel_1a7t2_239",je={container:aN,panelHeader:lN,panelHeaderLeft:cN,panelCollapseBtn:uN,titleRow:dN,field:fN,moveBtn:hN,icon:pN,nameInput:gN,fieldHeader:mN,label:yN,fieldCount:vN,chips:bN,chip:_N,chipRemove:wN,keywordInput:xN,input:SN,addBtn:CN,radioGroup:EN,radioLabel:ON},DN=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var P,V;const{updateNode:s,markDirty:i}=Ne(),o=t==="edit",a=Ji(e),c=be(R=>R.relationalFormConfig),u=R=>c==null?void 0:c.find(M=>M.code===R),d=R=>!c||!!u(R),f=(R,M)=>{var L;return((L=u(R))==null?void 0:L.label)||M},[p,m]=g.useState(!0),_=((P=e.metadata)==null?void 0:P.relationalMetadata)??{},[h,y]=g.useState(_.name??e.name??""),[v,b]=g.useState(""),[x,w]=g.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((V=e.metadata)==null?void 0:V.keywords)?e.metadata.keywords:[]),[C,E]=g.useState(!!_.optional);g.useEffect(()=>{var M,L;const R=((M=e.metadata)==null?void 0:M.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((L=e.metadata)==null?void 0:L.keywords)?e.metadata.keywords:[]),E(!!R.optional)},[e.id]);const N=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},j=()=>{const R=v.trim();if(R&&!x.includes(R)){const M=[...x,R];w(M),s(e.id,{keywords:M}),i()}b("")},F=R=>{const M=x.filter(L=>L!==R);w(M),s(e.id,{keywords:M}),i()},k=R=>{E(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:je.container,children:[l.jsxs("div",{className:je.panelHeader,children:[l.jsxs("div",{className:je.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:je.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:je.panelCollapseBtn,onClick:()=>m(R=>!R),"aria-expanded":p,"aria-label":p?"Collapse metadata panel":"Expand metadata panel",title:p?"Collapse":"Expand",children:p?l.jsx(ks,{size:15}):l.jsx(ty,{size:15})})]}),p&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:je.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:je.icon}),l.jsx("input",{type:"text",className:je.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:N,placeholder:"Content name"})]}),d("keywords")&&l.jsxs("div",{className:je.field,children:[l.jsx("div",{className:je.fieldHeader,children:l.jsxs("label",{className:je.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:je.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:je.chips,children:x.map(R=>l.jsxs("span",{className:je.chip,children:[R,o&&l.jsx("button",{type:"button",className:je.chipRemove,onClick:()=>F(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:je.keywordInput,children:[l.jsx("input",{type:"text",className:je.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>b(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),j())}}),l.jsx("button",{type:"button",className:je.addBtn,onClick:j,children:"Add"})]})]}),d("optional")&&l.jsxs("div",{className:je.field,children:[l.jsx("label",{className:je.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:je.radioGroup,children:[l.jsxs("label",{className:je.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>k(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:je.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>k(!1),disabled:!o}),"No"]})]})]})]}),n]})},IN="_iconBtn_vl14u_1",TN="_editable_vl14u_14",NN="_iconImg_vl14u_26",RN="_placeholder_vl14u_34",jN="_removeBtn_vl14u_41",rs={iconBtn:IN,editable:TN,iconImg:NN,placeholder:RN,removeBtn:jN},kN=({nodeId:e,value:t,editable:r})=>{const[n,s]=g.useState(!1),{updateNode:i,markDirty:o}=Ne(),a=u=>{i(e,{appIcon:u}),o(),s(!1)},c=u=>{u.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[rs.iconBtn,r?rs.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:u=>{r&&(u.key==="Enter"||u.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:rs.iconImg}):l.jsx("div",{className:rs.placeholder,children:l.jsx(zd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:rs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(qa,{size:11})})]}),n&&l.jsx(Mh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},AN="_leafContentLayout_1e8xj_1",PN="_container_1e8xj_17",MN="_emptyState_1e8xj_26",LN="_titleRow_1e8xj_36",FN="_nodeTitle_1e8xj_52",$N="_formArea_1e8xj_74",BN="_contentListArea_1e8xj_78",VN="_dropZone_1e8xj_83",UN="_reviewComment_1e8xj_90",zN="_reviewCommentLabel_1e8xj_103",qN="_reviewCommentText_1e8xj_109",Ut={leafContentLayout:AN,container:PN,emptyState:MN,titleRow:LN,nodeTitle:FN,formArea:$N,contentListArea:BN,dropZone:VN,reviewComment:UN,reviewCommentLabel:zN,reviewCommentText:qN},HN=["application/vnd.sunbird.questionset"],WN=({editorMode:e,onToolbarEvent:t})=>{var P,V,R,M;const[r,n]=g.useState("details"),[s,i]=g.useState([]),[o,a]=g.useState(null),[c,u]=g.useState(!1),d=g.useRef(null),f=g.useRef(),{selectedNodeId:p,breadcrumb:m,activeNodeMeta:_,updateNode:h,treeData:y}=Ne(),v=be(L=>{var Z,ne,z,J;return((ne=(Z=L.editorConfig)==null?void 0:Z.context)==null?void 0:ne.contentId)??((J=(z=L.editorConfig)==null?void 0:z.context)==null?void 0:J.identifier)??""}),b=p?zh(y,p):null,x=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&HN.includes(b.mimeType??""),E=b&&!b.isFolder&&!C&&!x,N=((P=b==null?void 0:b.metadata)==null?void 0:P.rejectComment)??(x?(R=(V=y[0])==null?void 0:V.metadata)==null?void 0:R.rejectComment:void 0),j=g.useCallback(()=>{const L=d.current;if(!L||!p)return;const Z=L.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(p,{name:Z})},600)},[p,h]),F=g.useCallback(L=>{t({action:"onFormValueChange",data:L})},[t]),k=g.useCallback((L,Z)=>{i(Z),t({action:"onFormStatusChange",data:{isValid:L}})},[t]);return b?C?l.jsx(Ia,{node:b,editorMode:e,type:"quml"}):E?l.jsxs("div",{className:Ut.leafContentLayout,children:[l.jsx(Ia,{node:b,editorMode:e,type:"content"}),l.jsx(DN,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(QT,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Ut.container,children:[l.jsx(WE,{crumbs:m}),e==="review"&&N&&l.jsxs("div",{className:Ut.reviewComment,role:"alert",children:[l.jsx("span",{className:Ut.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Ut.reviewCommentText,children:N})]}),l.jsxs("div",{className:Ut.titleRow,children:[x&&p&&l.jsx(kN,{nodeId:p,value:String(b.appIcon??((M=b.metadata)==null?void 0:M.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:d,className:Ut.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:j,onBlur:j,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(ZE,{activeTab:r,onChange:L=>n(L),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:Ut.formArea,children:l.jsx(lI,{nodeMetadata:_,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:F,onFormStatusChange:k},`${p??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:Ut.contentListArea,children:l.jsx(UI,{editorMode:e})}),l.jsx(HI,{isActive:!1,label:"Drop to add content to this unit",nodeId:p??void 0,className:Ut.dropZone}),c&&l.jsx(oN,{contentId:v,onClose:()=>u(!1)})]}):l.jsx("div",{className:Ut.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function zh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=zh(r.children,t);if(n)return n}}}const qh=qi((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})}})),KN=20;function Hh(){var u;const e=be(d=>d.editorConfig),t=Ne(d=>d.selectedNodeId),r=Ne(d=>d.treeData),n=g.useCallback(()=>{if(!t||!r.length)return 0;function d(f,p,m=0){var _;for(const h of f){if(h.id===p)return m;if((_=h.children)!=null&&_.length){const y=d(h.children,p,m+1);if(y>=0)return y}}return-1}return Math.max(0,d(r,t))},[t,r])(),s=(u=e==null?void 0:e.config)==null?void 0:u.hierarchy;if(!s)return[...hu];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:[...hu]}function QN(){const e=qh(),t=be(f=>{var p,m;return((m=(p=f.editorConfig)==null?void 0:p.context)==null?void 0:m.channel)??""}),r=Hh(),n=g.useRef(),s=g.useCallback(async(f="",p="all",m={},_=!0,h=!1)=>{var y,v,b,x,w;e.setLoading(!0);try{const C={status:["Live"],contentType:["Resource"],primaryCategory:p&&p!=="all"?[p]:r};(y=m==null?void 0:m.board)!=null&&y.length&&(C.board=m.board),(v=m==null?void 0:m.medium)!=null&&v.length&&(C.medium=m.medium),(b=m==null?void 0:m.gradeLevel)!=null&&b.length&&(C.gradeLevel=m.gradeLevel),(x=m==null?void 0:m.subject)!=null&&x.length&&(C.subject=m.subject),(w=m==null?void 0:m.primaryCategory)!=null&&w.length&&(C.primaryCategory=m.primaryCategory);const E=_?0:e.offset,{content:N,count:j}=await WI({filters:C,query:f,limit:f?50:KN,offset:E,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(N,j):e.appendContent(N,j)}catch(C){console.error("[useLibrary] load error:",C)}finally{e.setLoading(!1)}},[r,t]);g.useEffect(()=>{s()},[t]);const i=g.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=g.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=g.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=g.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]),u=g.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),d=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:d,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:u,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const GN="_card_yw3wq_1",YN="_addBtn_yw3wq_17",XN="_dragging_yw3wq_24",ZN="_ctIcon_yw3wq_29",JN="_info_yw3wq_33",eR="_name_yw3wq_41",tR="_meta_yw3wq_50",rR="_added_yw3wq_78",nR="_addedBadge_yw3wq_87",ur={card:GN,addBtn:YN,dragging:XN,ctIcon:ZN,info:JN,name:eR,meta:tR,added:rR,addedBadge:nR},sR={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},iR=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,m;const i=Ji(e),o=sR[i.key]??zn,{attributes:a,listeners:c,setNodeRef:u,isDragging:d}=Pd({id:e.identifier,disabled:!n,data:{type:"library-item",item:e}}),f=()=>{r&&r(e)};return l.jsxs("div",{ref:u,className:[ur.card,d?ur.dragging:"",s?ur.added:""].join(" "),"aria-label":e.name,...n?{...a,...c}:{},role:"listitem",onClick:f,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,ur.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:ur.info,children:[l.jsx("span",{className:ur.name,title:e.name,children:e.name}),l.jsxs("span",{className:ur.meta,children:[((p=e.organisation)==null?void 0:p[0])??e.channel??"",(m=e.organisation)!=null&&m[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:ur.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Un,{size:12})}),!s&&l.jsx("button",{type:"button",className:ur.addBtn,onClick:_=>{_.stopPropagation(),t(e)},"aria-label":`Add ${e.name} to unit`,title:"Add to unit",children:l.jsx(As,{size:14})})]})},oR="_chips_xhhaq_1",aR="_chip_xhhaq_1",Au={chips:oR,chip:aR},lR=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Au.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",Au.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),cR="_panel_1cl11_1",uR="_header_1cl11_10",dR="_headerTitle_1cl11_19",fR="_closeBtn_1cl11_25",hR="_body_1cl11_43",pR="_section_1cl11_59",gR="_sectionLabel_1cl11_65",mR="_chips_1cl11_73",yR="_chip_1cl11_73",vR="_active_1cl11_96",bR="_footer_1cl11_102",_R="_resetBtn_1cl11_112",wR="_applyBtn_1cl11_129",Ge={panel:cR,header:uR,headerTitle:dR,closeBtn:fR,body:hR,section:pR,sectionLabel:gR,chips:mR,chip:yR,active:vR,footer:bR,resetBtn:_R,applyBtn:wR},xR=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],SR=new Set(["board","medium","gradeLevel","subject","topic"]),CR=({local:e,toggle:t})=>{const r=Hh();return r.length?l.jsxs("div",{className:Ge.section,children:[l.jsx("div",{className:Ge.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:Ge.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[Ge.chip,(e.primaryCategory??[]).includes(n)?Ge.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},ER=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var m,_;const s=be(h=>h.editorConfig),i=be(h=>h.searchFormConfig),{organisationFramework:o}=jh((m=s==null?void 0:s.context)==null?void 0:m.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=g.useState(t),u=i!=null&&i.length?i.filter(h=>SR.has(h.code)).map(h=>({key:h.code,label:h.label||h.code})):xR;g.useEffect(()=>{c(t)},[t]);const d=(h,y)=>{c(v=>{const b=v[h]??[],x=b.includes(y)?b.filter(w=>w!==y):[...b,y];return{...v,[h]:x}})},f=(o==null?void 0:o.categories)??[],p=h=>{var y;return((y=f.find(v=>v.code===h))==null?void 0:y.terms)??[]};return e?l.jsxs("div",{className:Ge.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:Ge.header,children:[l.jsx("span",{className:Ge.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:Ge.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(sn,{size:16})})]}),l.jsxs("div",{className:Ge.body,children:[u.map(({key:h,label:y})=>{const v=p(h);return v.length?l.jsxs("div",{className:Ge.section,children:[l.jsx("div",{className:Ge.sectionLabel,children:y}),l.jsx("div",{className:Ge.chips,children:v.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[Ge.chip,(a[h]??[]).includes(b.name)?Ge.active:""].join(" "),onClick:()=>d(h,b.name),children:b.name},b.identifier))})]},h):null}),l.jsx(CR,{local:a,toggle:d})]}),l.jsxs("div",{className:Ge.footer,children:[l.jsx("button",{type:"button",className:Ge.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:Ge.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},OR="_panel_6qdpu_1",DR="_header_6qdpu_10",IR="_title_6qdpu_20",TR="_headerActions_6qdpu_31",NR="_iconBtn_6qdpu_38",RR="_playerArea_6qdpu_56",jR="_footer_6qdpu_64",kR="_addBtn_6qdpu_73",AR="_modalOverlay_6qdpu_92",PR="_modalPanel_6qdpu_103",zt={panel:OR,header:DR,title:IR,headerActions:TR,iconBtn:NR,playerArea:RR,footer:jR,addBtn:kR,modalOverlay:AR,modalPanel:PR},MR=({content:e,onAdd:t,onClose:r})=>{const[n,s]=g.useState(!1);if(!e)return null;const i={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},o=l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:zt.header,children:[l.jsx("span",{className:zt.title,title:e.name,children:e.name}),l.jsxs("div",{className:zt.headerActions,children:[l.jsx("button",{type:"button",className:zt.iconBtn,onClick:()=>s(a=>!a),"aria-label":n?"Collapse preview":"Expand preview",title:n?"Collapse":"Expand",children:n?l.jsx(ly,{size:15}):l.jsx(ay,{size:15})}),l.jsx("button",{type:"button",className:zt.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(sn,{size:16})})]})]}),l.jsx("div",{className:zt.playerArea,children:l.jsx(Ia,{node:i,editorMode:"read",type:"content"})}),l.jsx("div",{className:zt.footer,children:l.jsx("button",{type:"button",className:zt.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]});return n?$r.createPortal(l.jsx("div",{className:zt.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",children:l.jsx("div",{className:zt.modalPanel,children:o})}),document.body):l.jsx("div",{className:zt.panel,children:o})},LR="_dock_1lpg0_1",FR="_header_1lpg0_8",$R="_headerLeft_1lpg0_17",BR="_headerTitle_1lpg0_24",VR="_count_1lpg0_30",UR="_searchRow_1lpg0_39",zR="_searchWrap_1lpg0_47",qR="_searchIcon_1lpg0_53",HR="_searchInput_1lpg0_62",WR="_filterToggleBtn_1lpg0_80",KR="_filterToggleBtnActive_1lpg0_99",QR="_filterBadge_1lpg0_105",GR="_filters_1lpg0_124",YR="_mainArea_1lpg0_134",XR="_sidePanelOverlay_1lpg0_143",ZR="_cardList_1lpg0_152",JR="_skeleton_1lpg0_168",ej="_skeletonIcon_1lpg0_178",tj="_skeletonText_1lpg0_186",rj="_skeletonLine_1lpg0_193",nj="_skeletonLineSm_1lpg0_200",sj="_loadMoreBtn_1lpg0_215",ij="_emptyState_1lpg0_240",oj="_collapseBtn_1lpg0_260",Ee={dock:LR,header:FR,headerLeft:$R,headerTitle:BR,count:VR,searchRow:UR,searchWrap:zR,searchIcon:qR,searchInput:HR,filterToggleBtn:WR,filterToggleBtnActive:KR,filterBadge:QR,filters:GR,mainArea:YR,sidePanelOverlay:XR,cardList:ZR,skeleton:JR,skeletonIcon:ej,skeletonText:tj,skeletonLine:rj,skeletonLineSm:nj,loadMoreBtn:sj,emptyState:ij,collapseBtn:oj};function aj(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 lj=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:u,search:d,setFilter:f,applyAdvancedFilters:p,toggleSort:m,loadMore:_}=QN(),{addResource:h,selectedNodeId:y,treeData:v}=Ne(),b=e==="edit",[x,w]=g.useState(!1),[C,E]=g.useState({}),[N,j]=g.useState(null),F=g.useMemo(()=>aj(v),[v]),k=g.useCallback(L=>{if(!y){Ue.error("Select a unit first");return}h(L,y),Ue.success(`Added "${L.name}"`)},[y,h]),P=g.useCallback(L=>{E(L),p(L)},[p]),V=g.useCallback(L=>{j(L)},[]),R=g.useCallback(L=>{k(L),j(null)},[k]),M=g.useMemo(()=>Object.values(C).reduce((L,Z)=>L+((Z==null?void 0:Z.length)??0),0),[C]);return l.jsxs("div",{className:Ee.dock,children:[l.jsx("div",{className:Ee.header,children:l.jsxs("div",{className:Ee.headerLeft,children:[l.jsx("button",{type:"button",className:Ee.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(dy,{size:15})}),l.jsx(oy,{size:16}),l.jsx("span",{className:Ee.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ee.count,children:i})]})}),l.jsxs("div",{className:Ee.searchRow,children:[l.jsxs("div",{className:Ee.searchWrap,children:[l.jsx(oa,{size:14,className:Ee.searchIcon}),l.jsx("input",{type:"search",className:Ee.searchInput,placeholder:"Search content…",value:a,onChange:L=>d(L.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ee.filterToggleBtn,c?Ee.filterToggleBtnActive:""].join(" "),onClick:m,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(ey,{size:15}):l.jsx(ry,{size:15})}),l.jsxs("button",{type:"button",className:[Ee.filterToggleBtn,x?Ee.filterToggleBtnActive:""].join(" "),onClick:()=>w(L=>!L),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(yy,{size:15}),M>0&&l.jsx("span",{className:Ee.filterBadge,children:M})]})]}),l.jsx("div",{className:Ee.filters,children:l.jsx(lR,{filters:N1,active:o,onChange:f})}),l.jsxs("div",{className:Ee.mainArea,children:[l.jsx("div",{className:Ee.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((L,Z)=>l.jsxs("div",{className:Ee.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ee.skeletonIcon}),l.jsxs("div",{className:Ee.skeletonText,children:[l.jsx("div",{className:Ee.skeletonLine}),l.jsx("div",{className:Ee.skeletonLineSm})]})]},Z)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(L=>l.jsx(iR,{item:L,onAdd:k,onPreview:V,isDraggable:b,isAdded:F.has(L.identifier)},L.identifier)),u&&l.jsx("button",{type:"button",className:Ee.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ee.emptyState,children:[l.jsx(oa,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:Ee.sidePanelOverlay,children:l.jsx(ER,{isOpen:x,filters:C,onApply:P,onClose:()=>w(!1)})}),N&&l.jsx("div",{className:Ee.sidePanelOverlay,children:l.jsx(MR,{content:N,onAdd:R,onClose:()=>j(null)})})]})]})};function cj(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 u(p,m=!1){const _={};for(const[h,y]of Object.entries(p))if(!i.has(h)&&!(m&&o.has(h)))if(a.has(h))Array.isArray(y)?_[h]=y:y!=null&&y!==""?_[h]=[y]:_[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(_[h]=v)}else _[h]=y;return _}function d(p){var _;const m={};for(const h of p.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,...b}=y;if(Object.keys(b).length===0)continue;const x=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};m[h.identifier]={name:h.name,...x,...b}}return m}function f(p,m){var x,w;const _=p.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!p.isFolder&&!m;if(m||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((x=p.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=p.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:p.name,visibility:"Parent",channel:r,...u(p.metadata??{})};else if(m){const{isNew:E,...N}=h??{};C={...u(p.metadata??{},!0),...u(N,!1),name:p.name}}else{const{isNew:E,...N}=h??{};C={name:p.name,visibility:"Parent",...u(N,!0)}}n[_]={metadata:C,objectType:p.objectType||(p.isFolder?"Collection":"Content"),root:m,isNew:y}}const b=p.isFolder?d(p):{};s[_]={name:p.name,children:(p.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:m},(p.children??[]).forEach(C=>f(C,!1))}return e.forEach((p,m)=>f(p,m===0)),{nodesModified:n,hierarchy:s}}function uj(){const[e,t]=g.useState(!1),r=g.useRef(),n=Ne(d=>d.treeCache),s=Ne(d=>d.treeData),i=be(d=>d.isDirty),{setIsDirty:o,setLastSaved:a}=be(),c=be(d=>d.editorConfig),u=g.useCallback(async()=>{if(!c||e)return;const d=c.context.contentId??c.context.identifier??"";if(!d)return;const f=c.context.channel??"",p=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:m,hierarchy:_}=cj(s,n,f);await o_(d,m,_,p);const h=new Date().toISOString();a(h),o(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Ue.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,s,n,o,a]);return g.useEffect(()=>{if(i)return clearTimeout(r.current),r.current=setTimeout(u,1500),()=>clearTimeout(r.current)},[i,n,u]),{save:u,isSaving:e,isDirty:i,lastSaved:be.getState().lastSaved}}function dj(e){const t=be(s=>s.editorConfig),r=be(s=>s.setButtonLoader);return{runAction:g.useCallback(async(s,i)=>{var c,u,d,f;const o=((c=t==null?void 0:t.context)==null?void 0:c.contentId)??((u=t==null?void 0:t.context)==null?void 0:u.identifier)??"";if(!o)return Ue.error("No content identifier found."),!1;const a=((d=t==null?void 0:t.context)==null?void 0:d.userId)??((f=t==null?void 0:t.context)==null?void 0:f.uid)??"";try{switch(s){case"sendForReview":return r("saveCollection",!0),await e(),await c_(o),Ue.success("Content sent for review"),!0;case"reject":{r("rejectCollection",!0);const p=(i==null?void 0:i.comment)??"";return await u_(o,p),Ue.success("Content rejected and sent back to the author"),!0}case"publish":return r("publishCollection",!0),await e(),await a_(o,a),Ue.success("Content published successfully"),!0;default:return!1}}catch(p){console.error(`[useToolbarActions] ${s} failed`,p);const m=s==="sendForReview"?"send for review":s==="reject"?"reject":"publish";return Ue.error(`Failed to ${m}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const fj="_shell_90fon_1",hj="_workspace_90fon_8",pj="_sidebarCollapsed_90fon_16",gj="_dockCollapsed_90fon_19",mj="_dock_90fon_19",yj="_outline_90fon_40",vj="_reopenTab_90fon_45",bj="_outlineHidden_90fon_79",_j="_editor_90fon_86",wj="_dockHidden_90fon_101",xj="_dockReopenTab_90fon_108",Sj="_dragChip_90fon_133",Cj="_dragChipLabel_90fon_148",Dt={shell:fj,workspace:hj,sidebarCollapsed:pj,dockCollapsed:gj,dock:mj,outline:yj,reopenTab:vj,outlineHidden:bj,editor:_j,dockHidden:wj,dockReopenTab:xj,dragChip:Sj,dragChipLabel:Cj},Ej=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=g.useState(null),[o,a]=g.useState(!1),[c,u]=g.useState(!1),{addResource:d,treeData:f}=Ne(),p=Ne(E=>E.selectedNodeId),{save:m,isSaving:_,isDirty:h,lastSaved:y}=uj(),{runAction:v}=dj(m),b=gd(ta(Vi,{activationConstraint:{distance:8}})),x=g.useCallback(E=>{var j;const N=(j=E.active.data.current)==null?void 0:j.item;N&&i(N)},[]),w=g.useCallback(E=>{var P,V;i(null);const N=(P=E.active.data.current)==null?void 0:P.item;if(!N)return;const j=E.over,F=(j==null?void 0:j.id)??p??void 0;if(!F){Ue.error("Drop onto a unit to add content");return}const k=(V=f[0])==null?void 0:V.id;if(F===k){Ue.error("Drop content onto a unit, not directly on the course.");return}d(N,F),r==null||r(N,F),Ue.success(`Added "${N.name}" to unit`)},[p,d,r]),C=g.useCallback(async E=>{if(E.action==="saveCollection"){await m(),n==null||n(f),t==null||t(E);return}if(E.action==="sendForReview"||E.action==="reject"||E.action==="publish"){await v(E.action,E.data)&&(t==null||t(E));return}t==null||t(E)},[m,v,t,n,f]);return l.jsxs(Ad,{sensors:b,onDragStart:x,onDragEnd:w,children:[l.jsxs("div",{className:Dt.shell,children:[l.jsx(vw,{editorMode:e,isSaving:_,isDirty:h,lastSaved:y,onToolbarEvent:C}),l.jsxs("div",{className:[Dt.workspace,o?Dt.sidebarCollapsed:"",c?Dt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Dt.outline,o?Dt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(VE,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(E=>!E)})}),o&&l.jsx("button",{className:Dt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Dt.editor,role:"main","aria-label":"Content editor",children:l.jsx(WN,{editorMode:e,onToolbarEvent:C})}),l.jsx("aside",{className:[Dt.dock,c?Dt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(lj,{editorMode:e,collapsed:c,onToggleCollapse:()=>u(E=>!E)})}),c&&l.jsx("button",{className:Dt.dockReopenTab,onClick:()=>u(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Gm,{dropAnimation:null,children:s?l.jsx("div",{className:Dt.dragChip,children:l.jsx("span",{className:Dt.dragChipLabel,children:s.name})}):null})]})},Oj="v4";function Dj(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 Pu(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:Dj(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 br(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(Pu(i,s))}else n.code&&r.push(Pu(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function Ij(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 Tj(e,t,r="Collection"){var c,u;const s=(u=(c=(await Ae.post(`/action/object/category/definition/${Oj}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:c.result)==null?void 0:u.objectCategoryDefinition,i=(s==null?void 0:s.forms)??{},o=(s==null?void 0:s.objectMetadata)??{},a=o.config??{};return{rootForm:br(i.create),unitForm:br(i.unitMetadata),childForm:br(i.childMetadata),searchForm:br(i.search??i.searchConfig),relationalForm:br(i.relationalMetadata),publishChecklist:br(i.publishchecklist),reviewChecklist:br(i.review),rfcChecklist:br(i.requestforchangeschecklist),schemaDefaults:Ij(o.schema),frameworkMetadata:a.frameworkMetadata??{},sourcingSettings:a.sourcingSettings??{}}}function Nj({config:e,onError:t}){const[r,n]=g.useState(!0),[s,i]=g.useState(null),[o,a]=g.useState(!1),{setEditorConfig:c,setEditorMode:u,setCategoryDefinition:d}=be(),{setTreeData:f,selectNode:p}=Ne();return g.useEffect(()=>{let m=!1;async function _(){var h,y;try{n(!0),i(null),e.apiBaseUrl&&xf(e.apiBaseUrl),c(e),u(e.config.mode);const v=e.context.contentId??e.context.identifier??"";if(v){const{rootNode:b}=await i_(v);m||(f(b?[b]:[]),b&&p(b.id));const x=e.config.primaryCategory??"Course",w=e.context.channel??"";try{const C=await Tj(x,w,e.config.objectType??"Collection");if(!m){d(C);const E=(y=(h=C.sourcingSettings)==null?void 0:h.collection)==null?void 0:y.maxDepth;E&&!e.config.maxDepth&&c({...e,config:{...e.config,maxDepth:E}})}}catch{}}m||a(!0)}catch(v){if(!m){const b=v instanceof Error?v:new Error(String(v));i(b),t==null||t(b)}}finally{m||n(!1)}}return _(),()=>{m=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Rj="_root_qcpw6_1",jj="_loadingState_qcpw6_10",kj="_loadingSpinner_qcpw6_20",Aj="_errorState_qcpw6_34",os={root:Rj,loadingState:jj,loadingSpinner:kj,errorState:Aj},Pj=new bp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class Mj extends g.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:os.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 Lj(e){const{isLoading:t,error:r}=Nj({config:e,onError:e.onError}),n=be(s=>s.editorMode);return t?l.jsxs("div",{className:os.loadingState,children:[l.jsx("div",{className:os.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${os.root}`,children:l.jsx(Ej,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Wh=e=>l.jsx(Mj,{onError:e.onError,children:l.jsxs(wp,{client:Pj,children:[l.jsx(Lj,{...e}),l.jsx(_g,{position:"top-right",toastOptions:{duration:3e3}})]})}),Ai=Symbol.for("r2wc.reactRender"),Mu=Symbol.for("r2wc.shouldRender"),ei=Symbol.for("r2wc.root");function Fj(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function $j(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Lu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Ai]()}}),e[Ai]()}};function Bj(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var u=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?u.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.'),u.attachShadow({mode:"open"})),u},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(u,d){return d in e.propTypes||d in a},set:function(u,d,f,p){return i&&(s[d]=!0),typeof d=="symbol"||s[d]||d in u?(e.propTypes&&d in e.propTypes&&Lu.expando(p,d,f),Reflect.set(u,d,f,p)):(Lu.expando(p,d,f),!0)},getOwnPropertyDescriptor:function(u,d){var f=Reflect.getOwnPropertyDescriptor(u,d);if(f)return f;if(d in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Mu]=!0,this[Ai]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ei].unmount():r.unmountComponentAtNode(this)},a[Ai]=function(){if(this[Mu]===!0){var u={};Object.keys(this).forEach(function(p){s[p]!==!1&&(u[p]=this[p])},this),i=!0;const d=n.shadow?this.shadowRoot:this,f=t.createElement(e,u);typeof r.createRoot=="function"?(this[ei]||(this[ei]=r.createRoot(d)),this[ei].render(f)):r.render(f,d),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return Fj(u)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(u,d,f){var p=n.dashStyleAttributes?$j(u):u;this[p]=f}),o}var as={},ns=$r;if(process.env.NODE_ENV==="production")as.createRoot=ns.createRoot,as.hydrateRoot=ns.hydrateRoot;else{var ti=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;as.createRoot=function(e,t){ti.usingClientEntryPoint=!0;try{return ns.createRoot(e,t)}finally{ti.usingClientEntryPoint=!1}},as.hydrateRoot=function(e,t,r){ti.usingClientEntryPoint=!0;try{return ns.hydrateRoot(e,t,r)}finally{ti.usingClientEntryPoint=!1}}}function Vj(){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 Uj(e="sb-collection-editor"){if(Vj(),typeof customElements>"u"||customElements.get(e))return;const t=Bj(Wh,g,as,{});customElements.define(e,t)}exports.CollectionEditor=Wh;exports.registerCollectionEditor=Uj;exports.setApiBaseUrl=xf;exports.useEditorStore=be;exports.useLibraryStore=qh;exports.useTreeStore=Ne;
|