ode-explorer 1.4.19-develop.202411080917 → 1.4.19-develop.202411081819
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -1
- package/dist/index.js +2 -2
- package/dist/version.txt +1 -1
- package/lib/FoldersList.js +13 -14
- package/lib/ResourcesList.js +19 -20
- package/package.json +1 -1
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Exploration des ressources</title>
|
|
7
7
|
<link rel="icon" id="favicon" href="" />
|
|
8
|
-
<link rel="stylesheet" href="/assets/themes/edifice-bootstrap/index.css?v=
|
|
8
|
+
<link rel="stylesheet" href="/assets/themes/edifice-bootstrap/index.css?v=5cd2f659" />
|
|
9
9
|
<script type="module" crossorigin src="/index.js"></script>
|
|
10
10
|
</head>
|
|
11
11
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var iP=t=>{throw TypeError(t)};var OB=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _b=(t,e,r)=>e.has(t)||iP("Cannot "+r);var q=(t,e,r)=>(_b(t,e,"read from private field"),r?r.call(t):e.get(t)),Ke=(t,e,r)=>e.has(t)?iP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Le=(t,e,r,n)=>(_b(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ct=(t,e,r)=>(_b(t,e,"access private method"),r);var xg=(t,e,r,n)=>({set _(i){Le(t,e,i,r)},get _(){return q(t,e,n)}});import{odeServices as ke,FOLDER as Er,LAYER_NAME as DB,SnipletsService as Sb,DocumentHelper as zk,StringUtils as NB,ERROR_CODE as Hk,SORT_ORDER as LB,ResourceService as Vk,ACTION as Gr}from"/assets/js/edifice-ts-client/index.js?v=
|
|
1
|
+
var iP=t=>{throw TypeError(t)};var OB=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _b=(t,e,r)=>e.has(t)||iP("Cannot "+r);var q=(t,e,r)=>(_b(t,e,"read from private field"),r?r.call(t):e.get(t)),Ke=(t,e,r)=>e.has(t)?iP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Le=(t,e,r,n)=>(_b(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ct=(t,e,r)=>(_b(t,e,"access private method"),r);var xg=(t,e,r,n)=>({set _(i){Le(t,e,i,r)},get _(){return q(t,e,n)}});import{odeServices as ke,FOLDER as Er,LAYER_NAME as DB,SnipletsService as Sb,DocumentHelper as zk,StringUtils as NB,ERROR_CODE as Hk,SORT_ORDER as LB,ResourceService as Vk,ACTION as Gr}from"/assets/js/edifice-ts-client/index.js?v=5cd2f659";var qme=OB((tge,E1)=>{function Gk(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Co(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Wk(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xk={exports:{}},Hy={},Yk={exports:{}},ft={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -1403,4 +1403,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1403
1403
|
*
|
|
1404
1404
|
* This source code is licensed under the MIT license found in the
|
|
1405
1405
|
* LICENSE file in the root directory of this source tree.
|
|
1406
|
-
*/var ex=T,Ife=Pfe;function Mfe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kfe=typeof Object.is=="function"?Object.is:Mfe,Ofe=Ife.useSyncExternalStore,Dfe=ex.useRef,Nfe=ex.useEffect,Lfe=ex.useMemo,Ffe=ex.useDebugValue;x8.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=Dfe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Lfe(function(){function l(m){if(!u){if(u=!0,c=m,m=n(m),i!==void 0&&o.hasValue){var y=o.value;if(i(y,m))return h=y}return h=m}if(y=h,kfe(c,m))return y;var v=n(m);return i!==void 0&&i(y,v)?y:(c=m,h=v)}var u=!1,c,h,f=r===void 0?null:r;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,r,n,i]);var a=Ofe(t,s[0],s[1]);return Nfe(function(){o.hasValue=!0,o.value=a},[a]),Ffe(a),a};y8.exports=x8;var jfe=y8.exports;const Bfe=Co(jfe),Ufe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},{useDebugValue:$fe}=Me,{useSyncExternalStoreWithSelector:zfe}=Bfe;let Pk=!1;const Hfe=t=>t;function Vfe(t,e=Hfe,r){(Ufe?"production":void 0)!=="production"&&r&&!Pk&&(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"),Pk=!0);const n=zfe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,r);return $fe(n),n}const _8=async t=>{const e=await ke.resource(t.application).searchContext(t);return{...e,folders:e.folders.filter(r=>!r.trashed)}},Gfe=async({searchParams:t,name:e,parentId:r})=>{const n={name:e,parentId:r,application:t.application,type:t.types[0]};return await ke.resource(t.application).createFolder(n)},Wfe=async({folderId:t,searchParams:e,parentId:r,name:n})=>{const i={folderId:t,name:n,parentId:r,application:e.application,type:e.types[0]};return await ke.resource(e.application).updateFolder(i)},Xfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await ke.resource(t.application).trashAll(i,r)},Yfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await ke.resource(t.application).deleteAll(i,r)},qfe=async({searchParams:t,resourceIds:e,folderIds:r,useAssetIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:r};return await ke.resource(t.application).restoreAll(i,n)},Qfe=async(t,e)=>await ke.resource(t.application).copy({application:t.application,resourceId:e}),S8=async({searchParams:t,resourceIds:e,folderId:r,folderIds:n,useAssetIds:i})=>{const s={application:t.application,folderId:r,resourceIds:e,folderIds:n};return await ke.resource(t.application).moveToFolder(s,i)},Kfe=async t=>await ke.rights().sessionHasWorkflowRights(t),Zfe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getViewUrl(e);window.open(r,"_self")},Jfe=({searchParams:t,params:e})=>ke.resource(t.application).create(e),epe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getPrintUrl(e);return window.open(r,"_blank")},tpe=({searchParams:t,folderId:e})=>{const r=ke.resource(t.application).getFormUrl(e);return window.open(r,"_self")},rpe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getEditUrl(e);return window.open(r,"_self")},npe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getExportUrl(e);return window.open(r,"_self")},E8={id:Er.DEFAULT,name:wn("explorer.filters.mine"),section:!0,children:[]},ipe={config:void 0,searchConfig:{minLength:1},searchParams:{filters:{folder:Er.DEFAULT,owner:void 0,shared:void 0,public:void 0},orders:{updatedAt:LB.DESC},application:"",types:[],pagination:{startIdx:0,pageSize:48,maxIdx:0},trashed:!1},treeData:E8,selectedNodeId:"default",currentFolder:{id:"default"},selectedFolders:[],selectedResources:[],folderIds:[],resourceIds:[],resourceIsTrash:!1,resourceOrFolderIsDraggable:{isDrag:!1,elementDrag:void 0},elementDragOver:{isOver:!1,isTreeview:!1,canMove:!0,overId:void 0},resourceActionDisable:!1,status:void 0},spe=xfe()((t,e)=>({...ipe,actions:{setConfig:r=>t({config:r}),setSearchConfig:r=>t(n=>({searchConfig:{...n.searchConfig,...r}})),setTreeData:r=>t(()=>({treeData:r})),setSearchParams:r=>{t(n=>{const{searchParams:i}=n;return i.search!==r.search?r.search?{...n,selectedFolders:[],selectedNodeId:void 0,selectedResources:[],currentFolder:void 0,searchParams:{...i,...r,trashed:!1,filters:{...i.filters,folder:void 0}}}:{...n,selectedFolders:[],selectedNodeId:"default",selectedResources:[],currentFolder:{id:"default"},searchParams:{...i,...r,trashed:!1,filters:{...i.filters}}}:{searchParams:{...i,...r}}})},setSelectedFolders:r=>t(()=>({selectedFolders:r})),setSelectedResources:r=>t(()=>({selectedResources:r})),setFolderIds:r=>t(()=>({folderIds:r})),setResourceIds:r=>t(()=>({resourceIds:r})),setResourceIsTrash:r=>t(()=>({resourceIsTrash:r})),setResourceOrFolderIsDraggable:r=>t(()=>({resourceOrFolderIsDraggable:r})),setElementDragOver:r=>t(()=>({elementDragOver:r})),setResourceActionDisable:r=>t(()=>({resourceActionDisable:r})),clearSelectedItems:()=>t(()=>({selectedFolders:[],selectedResources:[]})),clearSelectedIds:()=>t(()=>({resourceIds:[],folderIds:[]})),openResource:r=>{try{const{searchParams:n}=e();Zfe({searchParams:n,assetId:r.assetId})}catch(n){console.error("explorer open failed: ",n)}},printSelectedResource:()=>{try{const{searchParams:r,selectedResources:n,resourceIds:i}=e();if(n.length!==1)throw new Error("Cannot open more than 1 resource");const s=n.find(o=>o.id===i[0]);epe({searchParams:r,assetId:s.assetId})}catch(r){console.error("explorer print failed: ",r)}},openFolder:({folderId:r,folder:n,queryClient:i})=>{const{searchParams:s}=e(),o=s.filters.folder,a=r;o!==r&&(e().actions.fetchTreeData(r,i),t(l=>({...l,folderIds:[],resourceIds:[],selectedNodeId:a,currentFolder:n||{id:r},searchParams:{...s,search:void 0,filters:{...s.filters,folder:r},trashed:r===Er.BIN}})))},foldTreeItem:()=>t(r=>({...r,status:"fold"})),fetchTreeData:async(r,n)=>{const i=qi(e().treeData,r),s=i==null?void 0:i.id;if(Array.isArray(i==null?void 0:i.children)&&i.children.length)return;const o=await n.fetchQuery({queryKey:["prefetchContext",{folderId:s,trashed:!1}],queryFn:async()=>await _8({...e().searchParams,filters:{...e().searchParams.filters,folder:s}})});e().actions.setTreeData(Fue(e().treeData,o==null?void 0:o.folders,s||Er.DEFAULT))},selectTreeItem:(r,n)=>{const{treeData:i}=e(),{openFolder:s,fetchTreeData:o}=e().actions,a=qi(i,r);o(r,n),t(l=>({...l,searchParams:{...l.searchParams,search:void 0},status:"select",selectedResources:[]})),s({folder:a,folderId:r})},gotoPreviousFolder:()=>{const{selectedNodeId:r,treeData:n,searchParams:i}=e(),{openFolder:s}=e().actions;if(i.search&&s({folder:E8,folderId:Er.DEFAULT}),!r)return;const o=W6(n,r);s({folder:o,folderId:(o==null?void 0:o.id)||Er.DEFAULT})},goToTrash:()=>{t(r=>({...r,selectedNodeId:void 0,selectedResources:[],resourceIds:[],folderIds:[],status:"select",searchParams:{...r.searchParams,search:void 0,filters:{folder:Er.BIN},trashed:!0},currentFolder:{id:Er.BIN}}))}}}));function rr(t){return Vfe(spe,t)}const ope=t=>t.treeData,ape=t=>t.actions,fc=()=>rr(ope),nr=()=>rr(ape),Rr=()=>rr(t=>t.searchParams),xA=()=>rr(t=>t.selectedNodeId),tx=()=>rr(t=>t.selectedFolders),Im=()=>rr(t=>t.selectedResources),lpe=()=>rr(t=>t.searchConfig),Sh=()=>rr(t=>t.folderIds),Eh=()=>rr(t=>t.resourceIds),rx=()=>rr(t=>t.selectedResources.map(e=>e.assetId)),nx=()=>rr(t=>t.selectedResources.filter(e=>e.assetId===e.id)),ba=()=>rr(t=>t.currentFolder),wa=()=>{const t=ba();return(t==null?void 0:t.id)===Er.BIN},T8=()=>rr(t=>t.resourceIsTrash),ix=()=>rr(t=>t.resourceOrFolderIsDraggable),C8=()=>rr(t=>t.elementDragOver),upe=()=>rr(t=>t.resourceActionDisable),cpe=()=>{const t=ba();return(t==null?void 0:t.id)==="default"},dpe=()=>rr(t=>t.status),hpe=()=>{const t=upe(),{clearSelectedIds:e,setResourceActionDisable:r,clearSelectedItems:n}=nr();return{isActionDisableModalOpen:t,onActionDisableCancel:()=>{e(),n(),r(!1)}}},fpe=()=>{const t=T8(),{clearSelectedIds:e,setResourceIsTrash:r,clearSelectedItems:n}=nr();return{isTrashedModalOpen:t,onTrashedCancel:()=>{e(),n(),r(!1)}}},ppe=175,mpe=10,A8="blog",R8="blog";class P8 extends Vk{getEditUrl(){throw new Error("Method not implemented.")}async create(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=e.public?"/blog/pub":"/blog",i=await this.http.post(n,{title:e.name,description:e.description,visibility:e.public?"PUBLIC":"OWNER",thumbnail:r,trashed:!1,folder:e.folder,slug:e.public?e.slug:"","publish-type":e.publishType||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(i),i}async update(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=await this.http.put(`/blog/${e.entId}`,{trashed:e.trashed,_id:e.entId,title:e.name,thumbnail:r,description:e.description,visibility:e.public?"PUBLIC":"OWNER",slug:e.public?e.slug:"","publish-type":e["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(n),{thumbnail:r,entId:e.entId}}getResourceType(){return R8}getApplication(){return A8}getFormUrl(e){return e?`/blog?folderid=${e}#/edit/new`:"/blog#/edit/new"}getViewUrl(e){return`/blog/id/${e}`}getPrintUrl(e){return`/blog/print/${e}`}}Vk.register({application:A8,resourceType:R8},t=>new P8(t));const hu=document.querySelector("[data-explorer-config]");let Ik;function I8(){var t;if((t=hu==null?void 0:hu.dataset)!=null&&t.explorerConfig){const{explorerConfig:e}=hu.dataset;try{const r=JSON.parse(e);Ik={...r,service:P8,enableOnboarding:r.enableOnboarding!==void 0?r.enableOnboarding:!0}}catch(r){console.error("[Explorer Config] could not parse app params from root data attributes:",hu==null?void 0:hu.dataset,r)}}return Ik}const gpe=(t,e)=>{const r=t.map(i=>i.workflow),n=new Set(r);return{queryKey:[...n],queryFn:()=>Kfe([...n]),select:i=>t.filter(s=>i[s.workflow]).map(s=>({...s,available:!0})),staleTime:1/0,enabled:!!e}},sx=t=>{const e=rr(r=>r.config);return XT(gpe(t,e))},vpe=()=>{const t=rr(o=>o.config),e=Rr(),{filters:r,trashed:n,search:i}=e,s=["context",{folderId:r.folder,filters:r,trashed:n,search:i}];return PV({queryKey:s,queryFn:async({pageParam:o})=>await _8({...e,application:t==null?void 0:t.app,types:t==null?void 0:t.types,pagination:{...e.pagination,startIdx:o}}),staleTime:5e3,initialPageParam:0,enabled:!!t,retry:!1,getNextPageParam:o=>o.pagination.startIdx+o.pagination.pageSize})},ype=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),i=Sh(),s=rx(),o=Eh(),a=nx().length>0,l=a?s:o,{clearSelectedItems:u,clearSelectedIds:c,setTreeData:h,setSearchParams:f}=nr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async()=>await Xfe({searchParams:r,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(wn(x))},onSuccess:async x=>{if(await e.cancelQueries({queryKey:v}),e.getQueryData(v))return t.success(wn("explorer.trash.title")),e.setQueryData(v,_=>{var w;if(_){const E={..._,pages:_==null?void 0:_.pages.map(P=>{var I;return{...P,folders:P.folders.filter(M=>!i.includes(M.id)),pagination:{...P.pagination,maxIdx:((I=P==null?void 0:P.pagination)==null?void 0:I.maxIdx)-x.resources.length},resources:P.resources.filter(M=>a?!s.includes(M.assetId):!l.includes(M.id))}})},A=Nue(n,{folders:i});return h(A),f({...r,pagination:{...r.pagination,maxIdx:((w=r.pagination)==null?void 0:w.maxIdx)-x.resources.length}}),E}})},onSettled:()=>{u(),c()}})},xpe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=Sh(),i=rx(),s=Eh(),o=nx().length>0,a=o?i:s,{setFolderIds:l,setResourceIds:u,setSelectedResources:c,setSelectedFolders:h}=nr(),{filters:f,trashed:m}=r,y=["context",{folderId:f.folder,filters:f,trashed:m}];return Ro({mutationFn:async()=>await qfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(v){typeof v=="string"&&t.error(wn(v))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:y}),e.getQueryData(y))return t.success(wn("explorer.trash.toast")),e.setQueryData(y,x=>{if(x)return{...x,pages:x==null?void 0:x.pages.map(b=>({...b,folders:b.folders.filter(_=>!n.includes(_.id)),resources:b.resources.filter(_=>o?!i.includes(_.assetId):!a.includes(_.id))}))}})},onSettled:()=>{u([]),c([]),l([]),h([])}})},bpe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=Sh(),i=rx(),s=Eh(),o=nx().length>0,a=o?i:s,{clearSelectedItems:l,clearSelectedIds:u}=nr(),{filters:c,trashed:h}=r,f=["context",{folderId:c.folder,filters:c,trashed:h}];return Ro({mutationFn:async()=>await Yfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(m){typeof m=="string"&&t.error(wn(m))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:f}),e.getQueryData(f))return t.success(wn("explorer.removed.from.trash")),e.setQueryData(f,y=>{if(y)return{...y,pages:y==null?void 0:y.pages.map(x=>({...x,folders:x.folders.filter(b=>!n.includes(b.id)),resources:x.resources.filter(b=>o?!i.includes(b.assetId):!a.includes(b.id))}))}})},onSettled:()=>{l(),u()}})},wpe=()=>{const t=Jr(),e=Rr(),r=Zr(),{user:n}=_h(),i=ba(),{filters:s,trashed:o}=e,a="duplicate_start",l=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async u=>(t.info(wn("duplicate.start"),{id:a}),await Qfe(e,u.assetId)),onSuccess:async(u,c)=>{t.remove(a),t.success(wn("duplicate.done")),await r.cancelQueries({queryKey:l});const h=r.getQueryData(l),f={...c,name:`${c.name}${wn("duplicate.suffix")}`,assetId:u.duplicateId,id:u.duplicateId,creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:c.slug||"",modifiedAt:Date.now(),modifierId:(n==null?void 0:n.userId)||"",modifierName:(n==null?void 0:n.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};h&&r.setQueryData(l,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[f,...y.resources]}))}}),i.id&&i.id!==Er.DEFAULT&&S8({searchParams:e,resourceIds:[u.duplicateId],folderId:i.id,folderIds:[],useAssetIds:!0})},onError:u=>{t.remove(a),typeof u=="string"&&t.error(`${wn("duplicate.error")}: ${u}`)}})},M8=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),i=Sh(),s=rx(),o=Eh(),a=nx().length>0,l=a?s:o,{clearSelectedIds:u,clearSelectedItems:c,setTreeData:h,setSearchParams:f}=nr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async x=>await S8({searchParams:r,folderId:x,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(wn(x))},onSuccess:async(x,b)=>{if(e.getQueryData(v))return e.setQueryData(v,w=>{var E;if(w){const A=Lue(n,{destinationId:b,folders:i}),P={...w,pages:w==null?void 0:w.pages.map(I=>{var M;return{...I,folders:I.folders.filter(N=>!i.includes(N.id)),pagination:{...I.pagination,maxIdx:((M=I.pagination)==null?void 0:M.maxIdx)-x.resources.length},resources:I.resources.filter(N=>a?!s.includes(N.assetId):!l.includes(N.id))}})};return h(A),f({...r,pagination:{...r.pagination,maxIdx:((E=r.pagination)==null?void 0:E.maxIdx)-x.resources.length}}),P}});e.invalidateQueries()},onSettled:()=>{c(),u()}})},_pe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),{setTreeData:i}=nr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async({name:l,parentId:u})=>await Gfe({searchParams:r,name:l,parentId:u}),onError(l){typeof l=="string"&&t.error(wn(l))},onSuccess:async(l,u)=>{await e.cancelQueries({queryKey:a});const c=e.getQueryData(a),h={...l,parentId:u.parentId,children:[],rights:[`creator:${l==null?void 0:l.creator_id}`]};if(c)return e.setQueryData(a,f=>{if(f){const m={...f,pages:f==null?void 0:f.pages.map(v=>({...v,folders:[...v.folders,h]}))},y=Due(n,{parentId:u.parentId,newFolder:h});return i(y),m}})}})},Spe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),{setFolderIds:i,setSelectedFolders:s,setTreeData:o}=nr(),{filters:a,trashed:l}=r,u=["context",{folderId:a.folder,filters:a,trashed:l}];return Ro({mutationFn:async({folderId:c,name:h,parentId:f})=>await Wfe({searchParams:r,folderId:c,parentId:f,name:h}),onError(c){typeof c=="string"&&t.error(wn(c))},onSuccess:async(c,h)=>{if(await e.cancelQueries({queryKey:u}),e.getQueryData(u))return e.setQueryData(u,m=>{if(m){const y={...m,pages:m==null?void 0:m.pages.map(x=>({...x,folders:x.folders.map(b=>b.id===c.id?{...c,parentId:h.parentId,rights:b.rights}:b)}))},v=jue(n,{folderId:h.folderId,newFolder:c});return o(v),y}})},onSettled:()=>{i([]),s([])}})},Epe=t=>{const e=Zr(),r=Rr(),{setResourceIds:n,setSelectedResources:i}=nr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return rfe({application:t,options:{onSuccess:async(l,u)=>{if(await e.cancelQueries({queryKey:a}),e.getQueryData(a))return e.setQueryData(a,h=>{if(h)return{...h,pages:h==null?void 0:h.pages.map(f=>({...f,resources:f.resources.map(m=>{if(m.assetId===(u==null?void 0:u.resourceId)){let y=[`creator:${m.creatorId}`];return(u==null?void 0:u.rights.length)>=1&&(y=[...y,...u.rights.flatMap(v=>v.actions.map(x=>`${v.type}:${v.id}:${x.id}`))]),{...m,rights:y}}else return m})}))}})},onSettled:()=>{n([]),i([])}}})},Tpe=t=>{const e=Zr(),r=Rr(),{filters:n,trashed:i}=r,s=["context",{folderId:n.folder,filters:n,trashed:i}];return Bhe({application:t,options:{onSuccess:async(o,a)=>{if(await e.cancelQueries({queryKey:s}),e.getQueryData(s))return e.setQueryData(s,u=>{if(u)return{...u,pages:u==null?void 0:u.pages.map(c=>({...c,resources:c.resources.map(h=>{if(h.assetId===(a==null?void 0:a.entId)){const{name:f,thumbnail:m,public:y,description:v,slug:x,...b}=a;return{...h,...b,name:f,thumbnail:typeof m=="string"?m:URL.createObjectURL(m),public:y,description:v,slug:x}}else return h})}))}})}}})},Cpe=()=>{const t=Jr(),e=Zr(),r=Rr(),{user:n}=_h(),{appCode:i}=vt(),s=["context",{folderId:r.filters.folder,filters:r.filters,trashed:r.trashed}];return Ro({mutationFn:async o=>await Jfe({searchParams:r,params:o}),onError(o){typeof o=="string"&&t.error(wn(o))},onSuccess:async(o,a)=>{var c,h,f;await e.cancelQueries({queryKey:s});const l=e.getQueryData(s),u={...a,thumbnail:o.thumbnail||"",application:i,assetId:o._id||o.entId||"",id:o._id||o.entId||"",creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:a.slug||"",modifiedAt:((c=o.modified)==null?void 0:c.$date)||"",modifierId:((h=o.author)==null?void 0:h.userId)||"",modifierName:((f=o.author)==null?void 0:f.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};if(l)return e.setQueryData(s,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[u,...y.resources]}))}})}})};function Mk(t,e){var n;const r=qi(t,e);return(n=r==null?void 0:r.folder)!=null&&n.childrenIds?[...(r==null?void 0:r.folder.childrenIds)||[],e]:e===Er.BIN?[Er.BIN]:[Er.DEFAULT]}function Ape(){const t=Zr(),e=M8(),r=Jr(),{appCode:n}=vt(),{t:i}=we(["common",n]),s=i("explorer.filters.mine",{ns:n}),{setResourceOrFolderIsDraggable:o,setElementDragOver:a,setResourceIds:l,setFolderIds:u,fetchTreeData:c}=nr(),h=fc(),m=F4(GC,{activationConstraint:{delay:ppe,tolerance:mpe}}),y=F4(HC),v=Une(m,y),x=(E,A)=>{var P;((P=E.data.current)==null?void 0:P.type)==="resource"?r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.resource")," ",g.jsx("strong",{children:A})]})):r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.folder")," ",g.jsx("strong",{children:A})]}))};return{handleDragEnd:async E=>{const{over:A,active:P}=E,I=A==null?void 0:A.data.current,M=P.data.current,N=T2(h,I==null?void 0:I.id),z=Mk(h,I==null?void 0:I.id);if((M==null?void 0:M.id)==(I==null?void 0:I.id)||N.includes(M==null?void 0:M.id)||z.includes(M==null?void 0:M.id))l([]),u([]);else{const j=(I==null?void 0:I.name)??s;if(A)try{await e.mutate(I==null?void 0:I.id),x(P,j)}catch(H){console.error(H)}finally{a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})}}o({isDrag:!1,elementDrag:void 0})},handleDragStart:E=>{const{active:A}=E,P=A.data.current;(P==null?void 0:P.type)==="resource"?l([P==null?void 0:P.id]):(P==null?void 0:P.type)==="folder"&&u([P==null?void 0:P.id]),o({isDrag:!0,elementDrag:P==null?void 0:P.id})},handleDragOver:E=>{const{over:A,active:P}=E,I=A==null?void 0:A.data.current,M=P==null?void 0:P.data.current,N=T2(h,I==null?void 0:I.id),z=Mk(h,I==null?void 0:I.id);if(A){const j={isOver:!0,canMove:!1,overId:I==null?void 0:I.id,isTreeview:I==null?void 0:I.isTreeview};(M==null?void 0:M.id)===(I==null?void 0:I.id)||N.includes(M==null?void 0:M.id)||z.includes(M==null?void 0:M.id)?a({...j,canMove:!1}):(c(I==null?void 0:I.id,t),a({...j,canMove:!0}))}else a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})},sensors:v}}const Rpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>rme),void 0)),Ppe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>ime),void 0)),Ipe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>ome),void 0)),Mpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>lme),void 0)),kpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>cme),void 0)),Ope=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>fme),void 0)),Dpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>mme),void 0)),Npe=()=>{const t=cpe(),e=wa(),r=xA(),n=Rr(),i=ba(),s=Jr(),o=Zr(),{appCode:a}=vt(),{t:l}=we([a]),{setSearchParams:u,setSearchConfig:c,fetchTreeData:h}=nr(),{data:f,isError:m,error:y,isLoading:v,isFetching:x,fetchNextPage:b}=vpe(),_=(f==null?void 0:f.pages[0].folders.length)===0,w=(f==null?void 0:f.pages[0].resources.length)===0,E=_&&w;return T.useEffect(()=>{var A,P;f&&((A=f==null?void 0:f.pages[0])!=null&&A.searchConfig&&c(f.pages[0].searchConfig),!n.search&&i.id==="default"&&h(i.id,o),u({...n,pagination:(P=f==null?void 0:f.pages[(f==null?void 0:f.pages.length)-1])==null?void 0:P.pagination}))},[f]),T.useEffect(()=>{y&&typeof y=="string"&&s.error(l(y))},[y]),v?g.jsx(hr,{}):m?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Ipe,{})}):n.search&&E?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Ppe,{})}):t&&E?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Rpe,{})}):r&&E&&!e?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Mpe,{})}):e&&(f==null?void 0:f.pages[0].resources.length)===0?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(kpe,{})}):g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[g.jsx(Ope,{data:f,isFetching:x}),g.jsx(Dpe,{data:f,isFetching:x,fetchNextPage:b})]})},k8=()=>{const t=Rr(),[e,r]=T.useState(""),n=lpe(),i=dpe(),s=T.useRef(null),{setSearchParams:o}=nr(),a=c=>{const h=c.target.value;r(h.toString())},l=c=>{(c.key==="Enter"||c.key==="Return")&&(c.preventDefault(),o({search:e||void 0}))},u=c=>{c.preventDefault(),o({search:e||void 0})};return T.useEffect(()=>{const h=e.length==0||e.length>=n.minLength?{search:e||void 0}:{};o({...t,...h})},[e,n.minLength]),T.useEffect(()=>{i==="select"&&r("")},[i]),T.useEffect(()=>{r(()=>{var c;return((c=t.search)==null?void 0:c.toString())??""})},[t]),{formRef:s,inputSearch:e,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}},Lpe=()=>{const{appCode:t,currentApp:e}=vt(),{t:r}=we(),[n,i]=T.useState(""),s=c=>{if(c==="0"){i("");return}i(c)},o=ba(),a=Rr(),{setSearchParams:l}=nr();T.useEffect(()=>{const c=()=>n.includes("1")?!0:void 0,h=()=>n.includes("2")?!0:void 0,f=()=>n.includes("7")?!0:void 0;l({...a,filters:{owner:c(),public:f(),shared:h(),folder:o?o.id:"default"}})},[o,l,n]);const u=[{label:r("explorer.filter.all",{ns:t}),value:"0"},{label:r("explorer.filter.owner",{ns:t}),value:"1"},{label:r("explorer.filter.shared",{ns:t}),value:"2"},...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices interactifs",value:"3"}]:[],...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices à rendre",value:"4"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets publics",value:"5"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets internes",value:"6"}]:[],...(e==null?void 0:e.displayName)=="blog"?[{label:r("explorer.filter.public",{ns:t}),value:"7"}]:[]];return{selectedFilters:n,options:u,handleOnSelectFilter:s}},Fpe=()=>{const{appCode:t}=vt(),{t:e}=we(),{selectedFilters:r,options:n,handleOnSelectFilter:i}=Lpe(),{formRef:s,inputSearch:o,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}=k8(),c=r.length>0?r.length:void 0;return g.jsxs("form",{noValidate:!0,className:"bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative d-flex gap-8",ref:s,children:[g.jsxs(kt,{id:"search",className:"input-group",children:[g.jsx(Kn,{type:"search",placeholder:e("explorer.label.search",{ns:t}),size:"lg",noValidationIcon:!0,value:o,onChange:a,onKeyDown:l}),g.jsx(sA,{type:"submit","aria-label":e("explorer.label.search",{ns:t}),onClick:u})]}),g.jsxs(yt,{placement:"bottom-end",children:[g.jsx(yt.Trigger,{label:e("explorer.filters"),icon:g.jsx(Z$,{width:20}),variant:"ghost",badgeContent:c}),g.jsx(yt.Menu,{children:n.map(h=>h.value==="0"?g.jsxs(T.Fragment,{children:[g.jsx(yt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label}),g.jsx(yt.Separator,{})]},"0"):g.jsx(yt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label},h.value))})]})]})},jpe=({id:t,selected:e,onSelect:r})=>{const{t:n}=we();return g.jsx("div",{className:"treeview",children:g.jsx("ul",{role:"tree",className:"m-0 p-0",children:g.jsx("li",{id:t,role:"treeitem","aria-selected":e,children:g.jsx("div",{children:g.jsx("div",{className:"action-container",children:g.jsx("div",{onClick:r,role:"button",tabIndex:0,children:g.jsxs("div",{className:"d-flex align-items-center gap-8 py-8 ps-24",children:[g.jsx(DN,{width:"20",height:"20"}),g.jsx("span",{children:n("explorer.tree.trash")})]})})})})})})})},Bpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>L8),void 0)),Upe=()=>{const[t,e]=Am(),r=Zr(),n=fc(),i=wa(),s=xA(),o=C8(),a=U6(),l=i?Er.BIN:s,{appCode:u}=vt(),{t:c}=we(["common",u]),h={...n,name:c("explorer.filters.mine",{ns:u})},{goToTrash:f,selectTreeItem:m,clearSelectedItems:y,clearSelectedIds:v,fetchTreeData:x}=nr(),b=E=>{m(E,r),a()},_=E=>{var I,M;const A=qi(n,E),P=(I=A==null?void 0:A.children)==null?void 0:I.some(N=>{var z;return Array.isArray(N==null?void 0:N.children)&&((z=N.children)==null?void 0:z.length)>0});(M=A==null?void 0:A.children)==null||M.forEach(N=>{P||x(N.id,r)})},w=()=>{y(),v(),e()};return g.jsxs(g.Fragment,{children:[g.jsx(hd,{data:h,selectedNodeId:l,draggedNode:o!=null&&o.isTreeview?o:void 0,onTreeItemClick:b,onTreeItemUnfold:_}),g.jsx(jpe,{id:Er.BIN,selected:i,onSelect:f}),g.jsx("div",{className:"d-grid my-16",children:g.jsx(st,{disabled:i,type:"button",color:"primary",variant:"outline",leftIcon:g.jsx(u1,{}),onClick:w,children:c("explorer.folder.new")})}),g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:t&&g.jsx(Bpe,{edit:!1,isOpen:t,onSuccess:e,onCancel:e})})]})};function $pe(){const{appCode:t}=vt(),{gotoPreviousFolder:e}=nr(),{t:r}=we(["common",t]),{inputSearch:n}=k8(),i=xA(),s=wa(),o=ba(),a=r("explorer.tree.trash"),l=r("explorer.tree.search"),u=r("explorer.filters.mine",{ns:t}),c=(o==null?void 0:o.name)||u;return g.jsx("div",{className:"py-16",children:i&&i!=="bin"&&i!=="default"&&!s?g.jsxs("div",{className:"d-flex align-items-center gap-8",children:[g.jsx(To,{icon:g.jsx(I$,{}),variant:"ghost",color:"tertiary","aria-label":r("back"),className:"ms-n16",onClick:e}),g.jsx("p",{className:"body py-8 text-truncate",children:g.jsx("strong",{children:c})})]}):g.jsx("h2",{className:"body py-8 fw-bold",children:n.length!==0?l:s?a:u})})}const zpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>bme),void 0)),Hpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Sme),void 0)),Vpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Ome),void 0)),Gpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Nme),void 0)),Wpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Fme),void 0)),Xpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>jme),void 0)),Ype=({config:t})=>{const e=Rr(),{setConfig:r,setSearchParams:n}=nr();T.useEffect(()=>{r(t||{}),n({...e,application:t.app,types:t.types})},[t]);const{currentApp:i}=vt(),{data:s}=sx(t.actions),{isTrashedModalOpen:o,onTrashedCancel:a}=fpe(),{isActionDisableModalOpen:l,onActionDisableCancel:u}=hpe(),{handleDragEnd:c,handleDragOver:h,handleDragStart:f,sensors:m}=Ape();tde();const y=zy("publish",s),v=zy("create",s);return t&&g.jsxs(g.Fragment,{children:[g.jsx(Oue,{render:()=>v?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(zpe,{})}):null,children:g.jsx(fce,{app:i})}),g.jsx(no,{className:"flex-grow-1",children:g.jsxs(zie,{sensors:m,modifiers:[gfe],onDragStart:f,onDragEnd:c,onDragOver:h,children:[g.jsx(no.Col,{sm:"3",lg:"2",xl:"3",className:"border-end pt-16 pe-16 d-none d-lg-block",as:"aside",children:g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[g.jsx(Upe,{}),y&&g.jsx(Hpe,{})]})}),g.jsxs(no.Col,{sm:"4",md:"8",lg:"6",xl:"9",children:[g.jsx(Fpe,{}),g.jsx($pe,{}),g.jsx(Npe,{})]}),g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[g.jsx(Vpe,{}),t.enableOnboarding&&g.jsx(Xpe,{id:"showOnboardingTrash",items:[{src:"onboarding/illu-trash-menu.svg",alt:"explorer.modal.onboarding.trash.screen1.alt",text:"explorer.modal.onboarding.trash.screen1.title"},{src:"onboarding/illu-trash-notif.svg",alt:"explorer.modal.onboarding.trash.screen2.alt",text:"explorer.modal.onboarding.trash.screen2.alt"},{src:"onboarding/illu-trash-delete.svg",alt:"explorer.modal.onboarding.trash.screen3.alt",text:"explorer.modal.onboarding.trash.screen3.title"}],modalOptions:{title:"explorer.modal.onboarding.trash.title",prevText:"explorer.modal.onboarding.trash.prev",nextText:"explorer.modal.onboarding.trash.next",closeText:"explorer.modal.onboarding.trash.close"}}),o&&g.jsx(Wpe,{isOpen:o,onCancel:a}),l&&g.jsx(Gpe,{isOpen:l,onCancel:u})]})]})})]})};function qpe(){const{init:t}=vt(),e=I8();return t?g.jsx(ffe,{children:g.jsx(Ype,{config:e})}):g.jsx(hr,{position:!1})}var Qpe=function(){return null};const Kpe=new fV({queryCache:new pL({onError:t=>{typeof t=="string"&&t===Hk.NOT_LOGGED_IN&&window.location.replace("/auth/login")}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),Zpe=I8(),Jpe=({children:t})=>g.jsxs(yV,{client:Kpe,children:[g.jsx(DV,{params:{app:Zpe.app},children:g.jsx(oue,{children:t})}),g.jsx(Qpe,{initialIsOpen:!1})]}),eme=document.getElementById("root");vN(eme).render(g.jsx(T.StrictMode,{children:g.jsx(Jpe,{children:g.jsx(qpe,{})})}));function tme(){const[t]=Rn(),{appCode:e}=vt(),{theme:r}=xa(),{t:n}=we(),i=rr(u=>u.config),{data:s}=sx(i==null?void 0:i.actions),o=s==null?void 0:s.find(u=>u.id==="create"),a=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.txt2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.consultation",{ns:e}):n("explorer.emptyScreen.txt2d.consultation",{ns:e}),l=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.title2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.consultation",{ns:e}):n("explorer.emptyScreen.title2d.consultation",{ns:e});return g.jsx(ca,{imageSrc:`${t}/emptyscreen/illu-${e}.svg`,imageAlt:n("explorer.emptyScreen.app.alt",{ns:e}),title:l(),text:a()})}const rme=Object.freeze(Object.defineProperty({__proto__:null,default:tme},Symbol.toStringTag,{value:"Module"}));function nme(){const{appCode:t}=vt(),[e]=Rn(),{t:r}=we();return g.jsx(ca,{imageSrc:`${e}/emptyscreen/illu-search.svg`,imageAlt:r("explorer.emptyScreen.search.alt",{ns:t}),text:r("explorer.emptyScreen.search.text",{ns:t})})}const ime=Object.freeze(Object.defineProperty({__proto__:null,default:nme},Symbol.toStringTag,{value:"Module"}));function sme(){const[t]=Rn(),{t:e}=we();return g.jsx(ca,{imageSrc:`${t}/emptyscreen/illu-error.svg`,imageAlt:e("explorer.emptyScreen.error.alt"),text:"explorer.emptyScreen.error.text"})}const ome=Object.freeze(Object.defineProperty({__proto__:null,default:sme},Symbol.toStringTag,{value:"Module"}));function ame(){const[t]=Rn(),{appCode:e}=vt(),{t:r}=we();return g.jsx(ca,{imageSrc:`${t}/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:r("explorer.emptyScreen.folder.empty.alt",{ns:e}),text:r("explorer.emptyScreen.label",{ns:e})})}const lme=Object.freeze(Object.defineProperty({__proto__:null,default:ame},Symbol.toStringTag,{value:"Module"}));function ume(){const{appCode:t}=vt(),[e]=Rn(),{t:r}=we();return g.jsx(ca,{imageSrc:`${e}/emptyscreen/illu-trash.svg`,imageAlt:r("explorer.emptyScreen.trash.alt"),title:r("explorer.emptyScreen.trash.title"),text:r("explorer.emptyScreen.trash.empty",{ns:t})})}const cme=Object.freeze(Object.defineProperty({__proto__:null,default:ume},Symbol.toStringTag,{value:"Module"}));function dme({app:t,type:e}){return e==="folder"?g.jsx(NN,{width:"24",height:"24",className:`color-app-${t==null?void 0:t.displayName}`}):e==="resource"?g.jsx(va,{app:t,iconFit:"ratio",size:"24",variant:"rounded"}):null}const O8=({app:t,type:e,name:r})=>{const n={flexDirection:"row",width:"252px",height:"32px",boxShadow:"0 0.2rem 0.6em rgba(0, 0, 0, 0.15)"};return g.jsxs("div",{className:"d-inline-flex align-items-center card is-selected gap-8",style:n,children:[g.jsx("div",{className:"ms-8",children:g.jsx(dme,{app:t,type:e})}),g.jsx("div",{className:"text-truncate",children:r})]})},D8=({app:t,name:e,idFolder:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=T.useId(),{lg:c}=L6(),{setNodeRef:h}=Hj({id:u,data:{id:r,name:e,isTreeview:!1,accepts:["folder","resource"]}}),{attributes:f,listeners:m,setNodeRef:y,transform:v}=zj({id:u,data:{id:r,type:"folder"},disabled:!c}),x=ix(),b=C8(),_=P=>{y(P),h(P)},w=b.overId===r,E=!b.canMove&&b.isTreeview?"no-drop":a?"grabbing":"default",A={transform:`translate3d(${((v==null?void 0:v.x)??0)/1}px, ${((v==null?void 0:v.y)??0)/1}px, 0)`,touchAction:"none",cursor:E};return T.useEffect(()=>{const P=x.elementDrag===r;l(P)},[x]),g.jsx("div",{ref:_,...m,...f,style:{...A},children:a?g.jsx(O8,{name:e,app:t,type:"folder"}):g.jsx(Jt,{app:t,isSelectable:!a&&i,isSelected:!a&&n||w&&a,isFocused:w,onClick:s,onSelect:o,children:P=>g.jsxs(Jt.Body,{children:[g.jsx(NN,{width:"48",height:"48",className:`color-app-${P}`}),g.jsx(Jt.Title,{children:e})]})})})};D8.displayName="FolderCard";const hme=({data:t})=>{var m,y;const e=Zr(),r=tx(),n=Sh(),i=ix(),s=U6(),{currentApp:o}=vt(),{setSelectedFolders:a,setFolderIds:l,openFolder:u}=nr();function c(v){n.includes(v.id)?(l(n.filter(x=>x!==v.id)),a(r.filter(x=>x.id!==v.id))):(l([v.id,...n]),a([v,...r]))}function h(v){s(),u({folder:v,folderId:v.id,queryClient:e})}const f=d5({from:{opacity:0},to:{opacity:1}});return(m=t==null?void 0:t.pages[0])!=null&&m.folders.length?g.jsx(Il.ul,{className:"grid ps-0 list-unstyled mb-24",children:(y=t==null?void 0:t.pages[0])==null?void 0:y.folders.map(v=>{const{id:x,name:b}=v,_=i.elementDrag===x;return g.jsx(Il.li,{className:`g-col-4 ${_?"z-2000":"z-1"}`,style:{position:"relative",...f},children:g.jsx(D8,{name:b,idFolder:x,app:o,isSelected:n.includes(v.id),onClick:w=>{w.stopPropagation(),h(v)},onSelect:()=>c(v)})},x)})}):null},fme=Object.freeze(Object.defineProperty({__proto__:null,default:hme},Symbol.toStringTag,{value:"Module"})),N8=({app:t,resource:e,time:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=wa(),{lg:c}=L6(),h=`/userbook/avatar/${e==null?void 0:e.creatorId}`;function f(P){const{rights:I,creatorId:M}=P||{};return I.filter(z=>!z.includes(M)).length>=1}const{attributes:m,listeners:y,setNodeRef:v,transform:x}=zj({id:e.id,data:{id:e.id,type:"resource"},disabled:!!u||!c}),b=f(e),_=e==null?void 0:e.public,w=ix(),{t:E}=we(),A={position:a?"absolute":"relative",zIndex:a?2e3:1,transform:`translate3d(${((x==null?void 0:x.x)??0)/1}px, ${((x==null?void 0:x.y)??0)/1}px, 0)`,touchAction:"none"};return T.useEffect(()=>{const P=w.elementDrag===e.id;l(P)},[w]),g.jsx("div",{ref:v,...y,...m,style:{...A},children:a?g.jsx(O8,{app:t,type:"resource",name:e==null?void 0:e.name}):g.jsx(Jt,{app:t,isSelected:!a&&n,isSelectable:!a&&i,onClick:s,onSelect:o,children:P=>g.jsxs(g.Fragment,{children:[g.jsxs(Jt.Body,{children:[g.jsx("div",{className:"card-image medium",children:e!=null&&e.thumbnail?g.jsx(yo,{alt:"",src:`${e==null?void 0:e.thumbnail}?thumbnail=80x80`,objectFit:"cover",className:"h-full w-100"}):g.jsx(va,{app:t,iconFit:"ratio",size:"80",variant:"rounded"})}),g.jsxs("div",{className:"text-truncate",children:[g.jsx(Jt.Title,{children:e==null?void 0:e.name}),g.jsx(Jt.Text,{children:g.jsx("em",{children:r})})]})]}),g.jsxs(Jt.Footer,{children:[g.jsxs("div",{className:"d-inline-flex align-items-center gap-8 text-truncate",children:[h?g.jsx(tc,{alt:(e==null?void 0:e.creatorName)||"",size:"xs",src:h,variant:"circle",width:"24",height:"24"}):g.jsx(xC,{}),g.jsx(Jt.Text,{children:e==null?void 0:e.creatorName})]}),g.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[b&&g.jsx(uo,{message:E("tooltip.shared",{ns:P}),placement:"top",children:g.jsx(jT,{width:16,height:16})}),_&&g.jsx(uo,{message:E("tooltip.public",{ns:P}),placement:"top",children:g.jsx(NT,{width:16,height:16})})]})]})]})})})};N8.displayName="ResourceCard";const pme=({data:t,fetchNextPage:e})=>{const{currentApp:r}=vt(),{t:n}=we(),{fromNow:i}=PL(),s=Rr(),o=Eh(),a=Im(),{setSelectedResources:l,setResourceIds:u,openResource:c,setResourceIsTrash:h}=nr(),f=wa(),m=d5({from:{opacity:0},to:{opacity:1}}),v=s.pagination.startIdx+s.pagination.pageSize<(s.pagination.maxIdx||0),x=T.useCallback(()=>{e()},[]),b=E=>{f?(h(!0),u([E.id]),l([E])):c(E)};async function _(E){if(o.includes(E.id)){u(o.filter(A=>A!==E.id)),l(a.filter(A=>A.id!==E.id));return}u([...o,E.id]),l([...a,E])}const w=Pe("grid ps-0 list-unstyled");return g.jsxs(Me.Fragment,{children:[g.jsx(Il.ul,{className:w,children:t==null?void 0:t.pages.map((E,A)=>g.jsx(Me.Fragment,{children:E.resources.map(P=>{const{id:I,updatedAt:M}=P,N=i(M);return g.jsx(Il.li,{className:"g-col-4",style:{position:"relative",...m},children:g.jsx(N8,{app:r,resource:P,time:N,isSelectable:!0,isSelected:o.includes(P.id),onClick:z=>{z.stopPropagation(),b(P)},onSelect:()=>_(P)})},I)})},A))}),v&&g.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:g.jsx(st,{type:"button",color:"secondary",variant:"filled",onClick:x,children:n("explorer.see.more")})})]})},mme=Object.freeze(Object.defineProperty({__proto__:null,default:pme},Symbol.toStringTag,{value:"Module"}));function gme({edit:t,onSuccess:e,onClose:r}){var E;const n=tx(),i=ba(),s=_pe(),o=Spe(),a=t?(E=n[0])==null?void 0:E.name:void 0,{reset:l,register:u,handleSubmit:c,setFocus:h,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v}}=kT({mode:"onChange",values:{name:a||""}}),x=T.useId(),b=async function({name:A}){var P;try{if(t){const I=(P=n[0])==null?void 0:P.parentId,N=n[0].id;await o.mutate({folderId:N,parentId:I,name:A}),l(),e==null||e()}else{const I=(i==null?void 0:i.id)||Er.DEFAULT;await s.mutate({name:A,parentId:I}),l(),e==null||e()}}catch(I){console.error(I)}};function _(){l(),r()}return{formId:`createModal_${x}`,errors:f,isSubmitting:m,isDirty:y,isValid:v,register:u,setFocus:h,handleSubmit:c,onCancel:_,onSubmit:b}}function vme({isOpen:t,edit:e,onSuccess:r,onCancel:n}){const{t:i}=we(),{isDirty:s,isValid:o,isSubmitting:a,formId:l,onSubmit:u,onCancel:c,handleSubmit:h,register:f,setFocus:m}=gme({edit:e,onSuccess:r,onClose:n});return T.useEffect(()=>{t&&m("name")},[t,m]),t?ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:c,id:"modal_"+l,children:[g.jsx(qe.Header,{onModalClose:c,children:i(e?"explorer.rename.folder":"explorer.create.folder")}),g.jsx(qe.Body,{children:g.jsx("form",{id:l,onSubmit:h(u),children:g.jsxs(kt,{id:"nameFolder",isRequired:!0,children:[g.jsx(Hi,{children:i("explorer.create.folder.name")}),g.jsx(Kn,{type:"text",...f("name",{required:!0,maxLength:60,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:i("explorer.create.folder.name"),size:"md","aria-required":!0,maxLength:60})]})})}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(st,{form:l,type:"submit",color:"primary",variant:"filled",disabled:!s||!o||a,children:i(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal")):null}const L8=Object.freeze(Object.defineProperty({__proto__:null,default:vme},Symbol.toStringTag,{value:"Module"})),yme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>j8),void 0));function xme(){const[t,e]=Am(),r=rr(m=>m.config),{appCode:n}=vt(),{t:i}=we(n),{clearSelectedItems:s,clearSelectedIds:o}=nr(),{data:a}=sx(r==null?void 0:r.actions),l=a==null?void 0:a.find(m=>m.id==="create"),u=ba(),c=Cpe(),h=Rr(),f=()=>{if(n=="scrapbook"){tpe({searchParams:h,folderId:u.id});return}s(),o(),e()};return l?g.jsxs(g.Fragment,{children:[g.jsx(st,{type:"button",color:"primary",variant:"filled",leftIcon:g.jsx(u1,{}),className:"ms-auto",onClick:f,children:i("explorer.create.title")}),g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:t&&g.jsx(yme,{mode:"create",currentFolder:u,createResource:c,isOpen:t,onSuccess:e,onCancel:e,children:(m,y,v,x,b)=>n==="blog"&&zy("createPublic",a)&&g.jsx(v8,{appCode:n,isUpdating:y,resource:m,watch:v,setValue:x,register:b})})})]}):null}const bme=Object.freeze(Object.defineProperty({__proto__:null,default:xme},Symbol.toStringTag,{value:"Module"})),wme=()=>{const{theme:t}=xa(),[e]=Rn(),r=Xce(),n=`${e}/${t==null?void 0:t.bootstrapVersion}/image-library.svg`;return{libraryUrl:r,imageFullURL:n,handleClick:()=>{r&&(window.open(r,"_blank"),ke.data().trackAccessLibraryFromExplorer())}}},_me=()=>{const{libraryUrl:t,imageFullURL:e,handleClick:r}=wme(),{t:n}=we();return t&&g.jsxs("div",{className:"p-16",children:[g.jsx(yo,{width:"270",height:"140",loading:"lazy",className:"rounded",src:e,alt:n("explorer.libray.img.alt")}),g.jsx("p",{className:"m-8",children:n("explorer.libray.title")}),g.jsxs("button",{type:"button",onClick:r,rel:"noreferrer",className:"btn btn-ghost-primary d-inline-flex align-items-center gap-4 p-8",children:[g.jsx("span",{children:n("explorer.libray.btn")}),g.jsx(TS,{})]})]})},Sme=Object.freeze(Object.defineProperty({__proto__:null,default:_me},Symbol.toStringTag,{value:"Module"}));function Eme({roles:t,rights:e,action:r}){const[n,i]=T.useState(!1),{user:s}=_h(),o=wa();T.useEffect(()=>{u()},[t,e]);const a=async function(c){const h=c instanceof Array?c:[c];if(t instanceof Array){const f=await ke.rights().sessionHasAtLeastOneResourceRight(t,h);i(f)}else{const f=await ke.rights().sessionHasResourceRight(t,h);i(f)}},l=async function(c){if(t instanceof Array){const h=await ke.rights().sessionHasAtLeastOneResourceRightForEachList(t,c);i(h)}else{const h=await ke.rights().sessionHasResourceRightForEachList(t,c);i(h)}},u=async function(){var c,h,f;if(t===void 0){i(!0);return}if(o&&((h=(c=e[0])==null?void 0:c.trashedBy)!=null&&h.includes(s==null?void 0:s.userId))&&r==="restore"&&!((f=e[0])!=null&&f.trashed)){i(!0);return}if(e instanceof Array)if(e.length>0)if(typeof e[0]=="string")await a(e);else{const m=e.map(y=>y.rights);await l(m)}else i(!1);else typeof e=="string"?await a(e):await a(e.rights)};return{visible:n,refreshState:u}}function F8(){const[t,e]=T.useState(!1),[r,n]=T.useState("void"),[i,s]=T.useState(),o=rr(he=>he.config),a=ba(),l=Eh(),u=Im(),c=tx(),h=Sh(),f=wa(),m=xpe(),y=T8(),v=Rr(),x=wpe(),b=ix(),{openResource:_,printSelectedResource:w,openFolder:E,clearSelectedItems:A,clearSelectedIds:P}=nr(),{data:I}=sx(o==null?void 0:o.actions);T.useEffect(()=>{if(l.length===0&&h.length===0){e(!1);return}if(y){e(!1);return}if(b.isDrag){e(!1);return}e(!0)},[l,h]);async function M(he){var je;switch((je=document.getElementById("root"))==null||je.setAttribute("aria-hidden","true"),s(he),he.id){case Gr.OPEN:return l.length>0?_(u[0]):E({folder:c[0],folderId:c[0].id});case Gr.COPY:return xe();case Gr.MOVE:return n("move");case Gr.PRINT:return w();case Gr.DELETE:return n("delete");case Gr.RESTORE:return await j();case Gr.PUBLISH:return n("publish");case Gr.UPD_PROPS:case"edit":return Se();case Gr.SHARE:return n("share");case Gr.EXPORT:return n("export");default:throw Error(`Unknown action: ${he.id}`)}}function N(he){const je=l.length+h.length,$e=l.length===1||h.length===1,lt=je===1,Fe=h.length===0;switch(he.id){case Gr.OPEN:return lt;case Gr.MANAGE:return $e;case Gr.COPY:return $e&&Fe;case Gr.PUBLISH:return $e&&Fe;case Gr.UPD_PROPS:return $e&&Fe;case Gr.SHARE:return Fe&&$e;case"export":return $e&&Fe;case Gr.PRINT:return $e&&Fe;case"edit":return lt;default:return!0}}const z=()=>!0;async function j(){try{if(f)await m.mutate();else throw new Error("Cannot restore untrashed resources");H()}catch(he){console.error(he)}}function H(){var he;n("void"),i!=null&&i.id&&((he=document.getElementById(i==null?void 0:i.id))==null||he.focus())}const F=he=>()=>{r===he&&(H(),A(),P())},L=F("move"),O=F("move"),U=F("delete"),V=F("delete"),k=F("publish"),$=F("publish"),B=F("edit_folder"),X=F("edit_folder"),K=F("edit_resource"),Y=F("edit_resource"),re=F("share"),ue=F("share"),le=F("export"),ge=F("export");async function xe(){if(u&&u.length>0){const he=u[0];await x.mutate(he),A(),P()}}function Se(){if(l&&l.length>0){const he=u[0].assetId;(o==null?void 0:o.app)==="scrapbook"?rpe({searchParams:v,assetId:he}):n("edit_resource")}else n("edit_folder")}function Ce(he){return he.id==="edit"&&h.length>0?"explorer.rename":`explorer.actions.${he.id}`}return{onRestore:j,actions:f?o==null?void 0:o.trashActions:I,selectedElement:[...u,...c],currentFolderId:a==null?void 0:a.id,overrideLabel:Ce,handleClick:M,isActivable:f?z:N,isActionBarOpen:t,isMoveModalOpen:r==="move",onMoveCancel:L,onMoveSuccess:O,isDeleteModalOpen:r==="delete",onDeleteCancel:V,onDeleteSuccess:U,isPublishModalOpen:r==="publish",onPublishCancel:$,onPublishSuccess:k,isEditFolderOpen:r==="edit_folder",onEditFolderCancel:X,onEditFolderSuccess:B,isEditResourceOpen:r==="edit_resource",onEditResourceCancel:Y,onEditResourceSuccess:K,isShareResourceOpen:r==="share",onShareResourceCancel:ue,onShareResourceSuccess:re,isExportModalOpen:r==="export",onExportCancel:le,onExportSuccess:ge,onClearActionBar:H}}function Tme({resourceRights:t,roleExpected:e,action:r,children:n,renderWhenForbidden:i}){const{t:s}=we(),{overrideLabel:o}=F8(),{visible:a}=Eme({roles:e,rights:t,action:r==null?void 0:r.id}),{setResourceActionDisable:l}=nr(),u=wa();return a?g.jsx(g.Fragment,{children:n}):i?i():u&&!a?g.jsx(st,{type:"button",color:"primary",variant:"filled",onClick:()=>{l(!0)},children:s(o(r))}):g.jsx(g.Fragment,{})}const Cme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Bme),void 0)),Ame=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>j8),void 0)),Rme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>zme),void 0)),Pme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Gme),void 0)),Ime=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>L8),void 0)),Mme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Yme),void 0));function kme(){const{appCode:t}=vt(),{t:e}=we(),{actions:r,selectedElement:n,isMoveModalOpen:i,isDeleteModalOpen:s,isPublishModalOpen:o,isActionBarOpen:a,isEditFolderOpen:l,overrideLabel:u,onEditFolderCancel:c,onEditFolderSuccess:h,isEditResourceOpen:f,onEditResourceCancel:m,onEditResourceSuccess:y,isShareResourceOpen:v,onShareResourceCancel:x,onShareResourceSuccess:b,isExportModalOpen:_,onExportCancel:w,onExportSuccess:E,onMoveCancel:A,onMoveSuccess:P,onDeleteCancel:I,onDeleteSuccess:M,onPublishCancel:N,onPublishSuccess:z,isActivable:j,handleClick:H}=F8(),L=Im()[0],O=Epe(t),U=Tpe(t),V=dC(a,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return g.jsxs(g.Fragment,{children:[V((k,$)=>$&&g.jsx(Il.div,{className:"position-fixed bottom-0 start-0 end-0",style:{...k,zIndex:4},children:g.jsx(Mue,{children:r==null?void 0:r.filter(B=>B.available&&B.target==="actionbar").map(B=>j(B)&&g.jsx(Tme,{resourceRights:n,roleExpected:B.right,action:B,children:g.jsx(st,{id:B.id,type:"button",color:"primary",variant:"filled",onClick:()=>{H(B)},children:e(u(B))},B.id)},B.id))})})),g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[i&&g.jsx(Pme,{isOpen:i,onCancel:A,onSuccess:P}),s&&g.jsx(Rme,{isOpen:s,onCancel:I,onSuccess:M}),o&&L&&g.jsx(Cme,{isOpen:o,resourceId:L.assetId,onCancel:N,onSuccess:z}),l&&g.jsx(Ime,{edit:!0,isOpen:l,onCancel:c,onSuccess:h}),f&&L&&g.jsx(Ame,{mode:"update",isOpen:f,resourceId:L.assetId,updateResource:U,onCancel:m,onSuccess:y,children:(k,$,B,X,K)=>t==="blog"&&zy("createPublic",r)&&g.jsx(v8,{appCode:t,isUpdating:$,resource:k,watch:B,setValue:X,register:K})}),v&&L&&g.jsx(Jhe,{isOpen:v,shareResource:O,shareOptions:{resourceCreatorId:L.creatorId,resourceId:L.assetId,resourceRights:L.rights},onCancel:x,onSuccess:b,children:t==="blog"?g.jsx(efe,{resourceId:L.assetId,updateResource:U}):null}),_&&L&&g.jsx(Mme,{isOpen:_,onCancel:w,onSuccess:E})]})]})}const Ome=Object.freeze(Object.defineProperty({__proto__:null,default:kme},Symbol.toStringTag,{value:"Module"}));function Dme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:e,id:"trash_action_disable_resource",children:[g.jsx(qe.Header,{onModalClose:()=>e(),children:r("explorer.trash.action.modal.title")}),g.jsx(qe.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.action.modal.text")})}),g.jsx(qe.Footer,{children:g.jsx(st,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Nme=Object.freeze(Object.defineProperty({__proto__:null,default:Dme},Symbol.toStringTag,{value:"Module"}));function Lme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:e,id:"trash_resource",children:[g.jsx(qe.Header,{onModalClose:()=>e(),children:r("explorer.trash.modal.title")}),g.jsx(qe.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.modal.text")})}),g.jsx(qe.Footer,{children:g.jsx(st,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Fme=Object.freeze(Object.defineProperty({__proto__:null,default:Lme},Symbol.toStringTag,{value:"Module"})),jme=Object.freeze(Object.defineProperty({__proto__:null,default:xle},Symbol.toStringTag,{value:"Module"})),j8=Object.freeze(Object.defineProperty({__proto__:null,default:Fhe},Symbol.toStringTag,{value:"Module"})),Bme=Object.freeze(Object.defineProperty({__proto__:null,default:Mhe},Symbol.toStringTag,{value:"Module"}));function Ume({onSuccess:t}){const e=bpe(),r=ype(),n=wa();async function i(){try{n?await e.mutate():await r.mutate(),t==null||t()}catch(s){console.error(s)}}return{isTrashFolder:n,onDelete:i}}function $me({isOpen:t,onSuccess:e=()=>({}),onCancel:r=()=>({})}){const{t:n}=we(),{isTrashFolder:i,onDelete:s}=Ume({onSuccess:e});return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:r,id:"deleteModal",children:[g.jsx(qe.Header,{onModalClose:r,children:n(i?"explorer.delete.title":"explorer.trash.title")}),g.jsx(qe.Body,{children:g.jsx("p",{className:"body",children:n(i?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:n("explorer.cancel")}),g.jsx(st,{color:"danger",onClick:s,type:"button",variant:"filled",children:n(i?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}const zme=Object.freeze(Object.defineProperty({__proto__:null,default:$me},Symbol.toStringTag,{value:"Module"}));function Hme({onSuccess:t}){const[e,r]=T.useState(),n=Zr(),i=M8(),s=tx(),o=Im(),a=fc(),{fetchTreeData:l}=nr();async function u(){try{if(!e)throw new Error("explorer.move.selection.empty");await i.mutate(e),await(t==null?void 0:t())}catch(h){console.error(h)}}const c=h=>{var m,y;const f=T2(a,h);for(const v of s)if(h===v.id||h===v.parentId||(m=v.childrenIds)!=null&&m.includes(h)||f.includes(v.id))return!1;for(const v of o)if(h===((v==null?void 0:v.folderIds)&&v.folderIds[0])||((y=v==null?void 0:v.folderIds)==null?void 0:y.length)===0&&h==="default")return!1;return!0};return{treeData:a,disableSubmit:!e,handleTreeItemSelect:h=>{c(h)?r(h):r(void 0)},handleOnTreeItemUnfold:h=>{var y,v;const f=qi(a,h),m=(y=f==null?void 0:f.children)==null?void 0:y.some(x=>{var b;return Array.isArray(x==null?void 0:x.children)&&((b=x.children)==null?void 0:b.length)>0});(v=f==null?void 0:f.children)==null||v.forEach(x=>{m||l(x.id,n)})},onMove:()=>u()}}function Vme({isOpen:t,onSuccess:e,onCancel:r}){const{appCode:n}=vt(),{t:i}=we(),{treeData:s,handleTreeItemSelect:o,handleOnTreeItemUnfold:a,onMove:l,disableSubmit:u}=Hme({onSuccess:e}),c={...s,name:i("explorer.filters.mine",{ns:n})};return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:r,id:"moveModal",children:[g.jsx(qe.Header,{onModalClose:r,children:i("explorer.move.title")}),g.jsx(qe.Subtitle,{children:i("explorer.move.subtitle")}),g.jsx(qe.Body,{children:g.jsx(hd,{data:c,onTreeItemClick:o,onTreeItemUnfold:a})}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(st,{color:"primary",onClick:l,type:"button",variant:"filled",disabled:u,children:i("explorer.move")})]})]}),document.getElementById("portal"))}const Gme=Object.freeze(Object.defineProperty({__proto__:null,default:Vme},Symbol.toStringTag,{value:"Module"})),Wme=t=>{const e=Im(),r=Rr(),n=Jr(),{t:i}=we();return{handleExportClick:()=>{e.length?(npe({searchParams:r,assetId:e[0].assetId}),t()):n.error(i("explorer.error.noResourceSelected"))}}};function Xme({isOpen:t,onSuccess:e,onCancel:r}){const{handleExportClick:n}=Wme(e),{t:i}=we();return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:r,id:"exportModal",children:[g.jsx(qe.Header,{onModalClose:r,children:i("explorer.export.title")}),g.jsxs(qe.Body,{children:[g.jsxs("ul",{children:[g.jsx("li",{children:i("explorer.export.body.info.1")}),g.jsx("li",{children:i("explorer.export.body.info.2")}),g.jsx("li",{children:i("explorer.export.body.info.3")})]}),g.jsx(Jo,{type:"warning",children:i("explorer.export.body.warning")})]}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(st,{color:"primary",onClick:n,type:"button",variant:"filled",children:i("explorer.actions.export")})]})]}),document.getElementById("portal"))}const Yme=Object.freeze(Object.defineProperty({__proto__:null,default:Xme},Symbol.toStringTag,{value:"Module"}))});export default qme();
|
|
1406
|
+
*/var ex=T,Ife=Pfe;function Mfe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kfe=typeof Object.is=="function"?Object.is:Mfe,Ofe=Ife.useSyncExternalStore,Dfe=ex.useRef,Nfe=ex.useEffect,Lfe=ex.useMemo,Ffe=ex.useDebugValue;x8.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=Dfe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Lfe(function(){function l(m){if(!u){if(u=!0,c=m,m=n(m),i!==void 0&&o.hasValue){var y=o.value;if(i(y,m))return h=y}return h=m}if(y=h,kfe(c,m))return y;var v=n(m);return i!==void 0&&i(y,v)?y:(c=m,h=v)}var u=!1,c,h,f=r===void 0?null:r;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,r,n,i]);var a=Ofe(t,s[0],s[1]);return Nfe(function(){o.hasValue=!0,o.value=a},[a]),Ffe(a),a};y8.exports=x8;var jfe=y8.exports;const Bfe=Co(jfe),Ufe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},{useDebugValue:$fe}=Me,{useSyncExternalStoreWithSelector:zfe}=Bfe;let Pk=!1;const Hfe=t=>t;function Vfe(t,e=Hfe,r){(Ufe?"production":void 0)!=="production"&&r&&!Pk&&(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"),Pk=!0);const n=zfe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,r);return $fe(n),n}const _8=async t=>{const e=await ke.resource(t.application).searchContext(t);return{...e,folders:e.folders.filter(r=>!r.trashed)}},Gfe=async({searchParams:t,name:e,parentId:r})=>{const n={name:e,parentId:r,application:t.application,type:t.types[0]};return await ke.resource(t.application).createFolder(n)},Wfe=async({folderId:t,searchParams:e,parentId:r,name:n})=>{const i={folderId:t,name:n,parentId:r,application:e.application,type:e.types[0]};return await ke.resource(e.application).updateFolder(i)},Xfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await ke.resource(t.application).trashAll(i,r)},Yfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await ke.resource(t.application).deleteAll(i,r)},qfe=async({searchParams:t,resourceIds:e,folderIds:r,useAssetIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:r};return await ke.resource(t.application).restoreAll(i,n)},Qfe=async(t,e)=>await ke.resource(t.application).copy({application:t.application,resourceId:e}),S8=async({searchParams:t,resourceIds:e,folderId:r,folderIds:n,useAssetIds:i})=>{const s={application:t.application,folderId:r,resourceIds:e,folderIds:n};return await ke.resource(t.application).moveToFolder(s,i)},Kfe=async t=>await ke.rights().sessionHasWorkflowRights(t),Zfe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getViewUrl(e);window.open(r,"_self")},Jfe=({searchParams:t,params:e})=>ke.resource(t.application).create(e),epe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getPrintUrl(e);return window.open(r,"_blank")},tpe=({searchParams:t,folderId:e})=>{const r=ke.resource(t.application).getFormUrl(e);return window.open(r,"_self")},rpe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getEditUrl(e);return window.open(r,"_self")},npe=({searchParams:t,assetId:e})=>{const r=ke.resource(t.application).getExportUrl(e);return window.open(r,"_self")},E8={id:Er.DEFAULT,name:wn("explorer.filters.mine"),section:!0,children:[]},ipe={config:void 0,searchConfig:{minLength:1},searchParams:{filters:{folder:Er.DEFAULT,owner:void 0,shared:void 0,public:void 0},orders:{updatedAt:LB.DESC},application:"",types:[],pagination:{startIdx:0,pageSize:48,maxIdx:0},trashed:!1},treeData:E8,selectedNodeId:"default",currentFolder:{id:"default"},selectedFolders:[],selectedResources:[],folderIds:[],resourceIds:[],resourceIsTrash:!1,resourceOrFolderIsDraggable:{isDrag:!1,elementDrag:void 0},elementDragOver:{isOver:!1,isTreeview:!1,canMove:!0,overId:void 0},resourceActionDisable:!1,status:void 0},spe=xfe()((t,e)=>({...ipe,actions:{setConfig:r=>t({config:r}),setSearchConfig:r=>t(n=>({searchConfig:{...n.searchConfig,...r}})),setTreeData:r=>t(()=>({treeData:r})),setSearchParams:r=>{t(n=>{const{searchParams:i}=n;return i.search!==r.search?r.search?{...n,selectedFolders:[],selectedNodeId:void 0,selectedResources:[],currentFolder:void 0,searchParams:{...i,...r,trashed:!1,filters:{...i.filters,folder:void 0}}}:{...n,selectedFolders:[],selectedNodeId:"default",selectedResources:[],currentFolder:{id:"default"},searchParams:{...i,...r,trashed:!1,filters:{...i.filters}}}:{searchParams:{...i,...r}}})},setSelectedFolders:r=>t(()=>({selectedFolders:r})),setSelectedResources:r=>t(()=>({selectedResources:r})),setFolderIds:r=>t(()=>({folderIds:r})),setResourceIds:r=>t(()=>({resourceIds:r})),setResourceIsTrash:r=>t(()=>({resourceIsTrash:r})),setResourceOrFolderIsDraggable:r=>t(()=>({resourceOrFolderIsDraggable:r})),setElementDragOver:r=>t(()=>({elementDragOver:r})),setResourceActionDisable:r=>t(()=>({resourceActionDisable:r})),clearSelectedItems:()=>t(()=>({selectedFolders:[],selectedResources:[]})),clearSelectedIds:()=>t(()=>({resourceIds:[],folderIds:[]})),openResource:r=>{try{const{searchParams:n}=e();Zfe({searchParams:n,assetId:r.assetId})}catch(n){console.error("explorer open failed: ",n)}},printSelectedResource:()=>{try{const{searchParams:r,selectedResources:n,resourceIds:i}=e();if(n.length!==1)throw new Error("Cannot open more than 1 resource");const s=n.find(o=>o.id===i[0]);epe({searchParams:r,assetId:s.assetId})}catch(r){console.error("explorer print failed: ",r)}},openFolder:({folderId:r,folder:n,queryClient:i})=>{const{searchParams:s}=e(),o=s.filters.folder,a=r;o!==r&&(e().actions.fetchTreeData(r,i),t(l=>({...l,folderIds:[],resourceIds:[],selectedNodeId:a,currentFolder:n||{id:r},searchParams:{...s,search:void 0,filters:{...s.filters,folder:r},trashed:r===Er.BIN}})))},foldTreeItem:()=>t(r=>({...r,status:"fold"})),fetchTreeData:async(r,n)=>{const i=qi(e().treeData,r),s=i==null?void 0:i.id;if(Array.isArray(i==null?void 0:i.children)&&i.children.length)return;const o=await n.fetchQuery({queryKey:["prefetchContext",{folderId:s,trashed:!1}],queryFn:async()=>await _8({...e().searchParams,filters:{...e().searchParams.filters,folder:s}})});e().actions.setTreeData(Fue(e().treeData,o==null?void 0:o.folders,s||Er.DEFAULT))},selectTreeItem:(r,n)=>{const{treeData:i}=e(),{openFolder:s,fetchTreeData:o}=e().actions,a=qi(i,r);o(r,n),t(l=>({...l,searchParams:{...l.searchParams,search:void 0},status:"select",selectedResources:[]})),s({folder:a,folderId:r})},gotoPreviousFolder:()=>{const{selectedNodeId:r,treeData:n,searchParams:i}=e(),{openFolder:s}=e().actions;if(i.search&&s({folder:E8,folderId:Er.DEFAULT}),!r)return;const o=W6(n,r);s({folder:o,folderId:(o==null?void 0:o.id)||Er.DEFAULT})},goToTrash:()=>{t(r=>({...r,selectedNodeId:void 0,selectedResources:[],resourceIds:[],folderIds:[],status:"select",searchParams:{...r.searchParams,search:void 0,filters:{folder:Er.BIN},trashed:!0},currentFolder:{id:Er.BIN}}))}}}));function rr(t){return Vfe(spe,t)}const ope=t=>t.treeData,ape=t=>t.actions,fc=()=>rr(ope),nr=()=>rr(ape),Rr=()=>rr(t=>t.searchParams),xA=()=>rr(t=>t.selectedNodeId),tx=()=>rr(t=>t.selectedFolders),Im=()=>rr(t=>t.selectedResources),lpe=()=>rr(t=>t.searchConfig),Sh=()=>rr(t=>t.folderIds),Eh=()=>rr(t=>t.resourceIds),rx=()=>rr(t=>t.selectedResources.map(e=>e.assetId)),nx=()=>rr(t=>t.selectedResources.filter(e=>e.assetId===e.id)),ba=()=>rr(t=>t.currentFolder),wa=()=>{const t=ba();return(t==null?void 0:t.id)===Er.BIN},T8=()=>rr(t=>t.resourceIsTrash),ix=()=>rr(t=>t.resourceOrFolderIsDraggable),C8=()=>rr(t=>t.elementDragOver),upe=()=>rr(t=>t.resourceActionDisable),cpe=()=>{const t=ba();return(t==null?void 0:t.id)==="default"},dpe=()=>rr(t=>t.status),hpe=()=>{const t=upe(),{clearSelectedIds:e,setResourceActionDisable:r,clearSelectedItems:n}=nr();return{isActionDisableModalOpen:t,onActionDisableCancel:()=>{e(),n(),r(!1)}}},fpe=()=>{const t=T8(),{clearSelectedIds:e,setResourceIsTrash:r,clearSelectedItems:n}=nr();return{isTrashedModalOpen:t,onTrashedCancel:()=>{e(),n(),r(!1)}}},ppe=175,mpe=10,A8="blog",R8="blog";class P8 extends Vk{getEditUrl(){throw new Error("Method not implemented.")}async create(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=e.public?"/blog/pub":"/blog",i=await this.http.post(n,{title:e.name,description:e.description,visibility:e.public?"PUBLIC":"OWNER",thumbnail:r,trashed:!1,folder:e.folder,slug:e.public?e.slug:"","publish-type":e.publishType||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(i),i}async update(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=await this.http.put(`/blog/${e.entId}`,{trashed:e.trashed,_id:e.entId,title:e.name,thumbnail:r,description:e.description,visibility:e.public?"PUBLIC":"OWNER",slug:e.public?e.slug:"","publish-type":e["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(n),{thumbnail:r,entId:e.entId}}getResourceType(){return R8}getApplication(){return A8}getFormUrl(e){return e?`/blog?folderid=${e}#/edit/new`:"/blog#/edit/new"}getViewUrl(e){return`/blog/id/${e}`}getPrintUrl(e){return`/blog/print/${e}`}}Vk.register({application:A8,resourceType:R8},t=>new P8(t));const hu=document.querySelector("[data-explorer-config]");let Ik;function I8(){var t;if((t=hu==null?void 0:hu.dataset)!=null&&t.explorerConfig){const{explorerConfig:e}=hu.dataset;try{const r=JSON.parse(e);Ik={...r,service:P8,enableOnboarding:r.enableOnboarding!==void 0?r.enableOnboarding:!0}}catch(r){console.error("[Explorer Config] could not parse app params from root data attributes:",hu==null?void 0:hu.dataset,r)}}return Ik}const gpe=(t,e)=>{const r=t.map(i=>i.workflow),n=new Set(r);return{queryKey:[...n],queryFn:()=>Kfe([...n]),select:i=>t.filter(s=>i[s.workflow]).map(s=>({...s,available:!0})),staleTime:1/0,enabled:!!e}},sx=t=>{const e=rr(r=>r.config);return XT(gpe(t,e))},vpe=()=>{const t=rr(o=>o.config),e=Rr(),{filters:r,trashed:n,search:i}=e,s=["context",{folderId:r.folder,filters:r,trashed:n,search:i}];return PV({queryKey:s,queryFn:async({pageParam:o})=>await _8({...e,application:t==null?void 0:t.app,types:t==null?void 0:t.types,pagination:{...e.pagination,startIdx:o}}),staleTime:5e3,initialPageParam:0,enabled:!!t,retry:!1,getNextPageParam:o=>o.pagination.startIdx+o.pagination.pageSize})},ype=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),i=Sh(),s=rx(),o=Eh(),a=nx().length>0,l=a?s:o,{clearSelectedItems:u,clearSelectedIds:c,setTreeData:h,setSearchParams:f}=nr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async()=>await Xfe({searchParams:r,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(wn(x))},onSuccess:async x=>{if(await e.cancelQueries({queryKey:v}),e.getQueryData(v))return t.success(wn("explorer.trash.title")),e.setQueryData(v,_=>{var w;if(_){const E={..._,pages:_==null?void 0:_.pages.map(P=>{var I;return{...P,folders:P.folders.filter(M=>!i.includes(M.id)),pagination:{...P.pagination,maxIdx:((I=P==null?void 0:P.pagination)==null?void 0:I.maxIdx)-x.resources.length},resources:P.resources.filter(M=>a?!s.includes(M.assetId):!l.includes(M.id))}})},A=Nue(n,{folders:i});return h(A),f({...r,pagination:{...r.pagination,maxIdx:((w=r.pagination)==null?void 0:w.maxIdx)-x.resources.length}}),E}})},onSettled:()=>{u(),c()}})},xpe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=Sh(),i=rx(),s=Eh(),o=nx().length>0,a=o?i:s,{setFolderIds:l,setResourceIds:u,setSelectedResources:c,setSelectedFolders:h}=nr(),{filters:f,trashed:m}=r,y=["context",{folderId:f.folder,filters:f,trashed:m}];return Ro({mutationFn:async()=>await qfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(v){typeof v=="string"&&t.error(wn(v))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:y}),e.getQueryData(y))return t.success(wn("explorer.trash.toast")),e.setQueryData(y,x=>{if(x)return{...x,pages:x==null?void 0:x.pages.map(b=>({...b,folders:b.folders.filter(_=>!n.includes(_.id)),resources:b.resources.filter(_=>o?!i.includes(_.assetId):!a.includes(_.id))}))}})},onSettled:()=>{u([]),c([]),l([]),h([])}})},bpe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=Sh(),i=rx(),s=Eh(),o=nx().length>0,a=o?i:s,{clearSelectedItems:l,clearSelectedIds:u}=nr(),{filters:c,trashed:h}=r,f=["context",{folderId:c.folder,filters:c,trashed:h}];return Ro({mutationFn:async()=>await Yfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(m){typeof m=="string"&&t.error(wn(m))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:f}),e.getQueryData(f))return t.success(wn("explorer.removed.from.trash")),e.setQueryData(f,y=>{if(y)return{...y,pages:y==null?void 0:y.pages.map(x=>({...x,folders:x.folders.filter(b=>!n.includes(b.id)),resources:x.resources.filter(b=>o?!i.includes(b.assetId):!a.includes(b.id))}))}})},onSettled:()=>{l(),u()}})},wpe=()=>{const t=Jr(),e=Rr(),r=Zr(),{user:n}=_h(),i=ba(),{filters:s,trashed:o}=e,a="duplicate_start",l=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async u=>(t.info(wn("duplicate.start"),{id:a}),await Qfe(e,u.assetId)),onSuccess:async(u,c)=>{t.remove(a),t.success(wn("duplicate.done")),await r.cancelQueries({queryKey:l});const h=r.getQueryData(l),f={...c,name:`${c.name}${wn("duplicate.suffix")}`,assetId:u.duplicateId,id:u.duplicateId,creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:c.slug||"",modifiedAt:Date.now(),modifierId:(n==null?void 0:n.userId)||"",modifierName:(n==null?void 0:n.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};h&&r.setQueryData(l,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[f,...y.resources]}))}}),i.id&&i.id!==Er.DEFAULT&&S8({searchParams:e,resourceIds:[u.duplicateId],folderId:i.id,folderIds:[],useAssetIds:!0})},onError:u=>{t.remove(a),typeof u=="string"&&t.error(`${wn("duplicate.error")}: ${u}`)}})},M8=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),i=Sh(),s=rx(),o=Eh(),a=nx().length>0,l=a?s:o,{clearSelectedIds:u,clearSelectedItems:c,setTreeData:h,setSearchParams:f}=nr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async x=>await S8({searchParams:r,folderId:x,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(wn(x))},onSuccess:async(x,b)=>{if(e.getQueryData(v))return e.setQueryData(v,w=>{var E;if(w){const A=Lue(n,{destinationId:b,folders:i}),P={...w,pages:w==null?void 0:w.pages.map(I=>{var M;return{...I,folders:I.folders.filter(N=>!i.includes(N.id)),pagination:{...I.pagination,maxIdx:((M=I.pagination)==null?void 0:M.maxIdx)-x.resources.length},resources:I.resources.filter(N=>a?!s.includes(N.assetId):!l.includes(N.id))}})};return h(A),f({...r,pagination:{...r.pagination,maxIdx:((E=r.pagination)==null?void 0:E.maxIdx)-x.resources.length}}),P}});e.invalidateQueries()},onSettled:()=>{c(),u()}})},_pe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),{setTreeData:i}=nr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async({name:l,parentId:u})=>await Gfe({searchParams:r,name:l,parentId:u}),onError(l){typeof l=="string"&&t.error(wn(l))},onSuccess:async(l,u)=>{await e.cancelQueries({queryKey:a});const c=e.getQueryData(a),h={...l,parentId:u.parentId,children:[],rights:[`creator:${l==null?void 0:l.creator_id}`]};if(c)return e.setQueryData(a,f=>{if(f){const m={...f,pages:f==null?void 0:f.pages.map(v=>({...v,folders:[...v.folders,h]}))},y=Due(n,{parentId:u.parentId,newFolder:h});return i(y),m}})}})},Spe=()=>{const t=Jr(),e=Zr(),r=Rr(),n=fc(),{setFolderIds:i,setSelectedFolders:s,setTreeData:o}=nr(),{filters:a,trashed:l}=r,u=["context",{folderId:a.folder,filters:a,trashed:l}];return Ro({mutationFn:async({folderId:c,name:h,parentId:f})=>await Wfe({searchParams:r,folderId:c,parentId:f,name:h}),onError(c){typeof c=="string"&&t.error(wn(c))},onSuccess:async(c,h)=>{if(await e.cancelQueries({queryKey:u}),e.getQueryData(u))return e.setQueryData(u,m=>{if(m){const y={...m,pages:m==null?void 0:m.pages.map(x=>({...x,folders:x.folders.map(b=>b.id===c.id?{...c,parentId:h.parentId,rights:b.rights}:b)}))},v=jue(n,{folderId:h.folderId,newFolder:c});return o(v),y}})},onSettled:()=>{i([]),s([])}})},Epe=t=>{const e=Zr(),r=Rr(),{setResourceIds:n,setSelectedResources:i}=nr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return rfe({application:t,options:{onSuccess:async(l,u)=>{if(await e.cancelQueries({queryKey:a}),e.getQueryData(a))return e.setQueryData(a,h=>{if(h)return{...h,pages:h==null?void 0:h.pages.map(f=>({...f,resources:f.resources.map(m=>{if(m.assetId===(u==null?void 0:u.resourceId)){let y=[`creator:${m.creatorId}`];return(u==null?void 0:u.rights.length)>=1&&(y=[...y,...u.rights.flatMap(v=>v.actions.map(x=>`${v.type}:${v.id}:${x.id}`))]),{...m,rights:y}}else return m})}))}})},onSettled:()=>{n([]),i([])}}})},Tpe=t=>{const e=Zr(),r=Rr(),{filters:n,trashed:i}=r,s=["context",{folderId:n.folder,filters:n,trashed:i}];return Bhe({application:t,options:{onSuccess:async(o,a)=>{if(await e.cancelQueries({queryKey:s}),e.getQueryData(s))return e.setQueryData(s,u=>{if(u)return{...u,pages:u==null?void 0:u.pages.map(c=>({...c,resources:c.resources.map(h=>{if(h.assetId===(a==null?void 0:a.entId)){const{name:f,thumbnail:m,public:y,description:v,slug:x,...b}=a;return{...h,...b,name:f,thumbnail:typeof m=="string"?m:URL.createObjectURL(m),public:y,description:v,slug:x}}else return h})}))}})}}})},Cpe=()=>{const t=Jr(),e=Zr(),r=Rr(),{user:n}=_h(),{appCode:i}=vt(),s=["context",{folderId:r.filters.folder,filters:r.filters,trashed:r.trashed}];return Ro({mutationFn:async o=>await Jfe({searchParams:r,params:o}),onError(o){typeof o=="string"&&t.error(wn(o))},onSuccess:async(o,a)=>{var c,h,f;await e.cancelQueries({queryKey:s});const l=e.getQueryData(s),u={...a,thumbnail:o.thumbnail||"",application:i,assetId:o._id||o.entId||"",id:o._id||o.entId||"",creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:a.slug||"",modifiedAt:((c=o.modified)==null?void 0:c.$date)||"",modifierId:((h=o.author)==null?void 0:h.userId)||"",modifierName:((f=o.author)==null?void 0:f.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};if(l)return e.setQueryData(s,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[u,...y.resources]}))}})}})};function Mk(t,e){var n;const r=qi(t,e);return(n=r==null?void 0:r.folder)!=null&&n.childrenIds?[...(r==null?void 0:r.folder.childrenIds)||[],e]:e===Er.BIN?[Er.BIN]:[Er.DEFAULT]}function Ape(){const t=Zr(),e=M8(),r=Jr(),{appCode:n}=vt(),{t:i}=we(["common",n]),s=i("explorer.filters.mine",{ns:n}),{setResourceOrFolderIsDraggable:o,setElementDragOver:a,setResourceIds:l,setFolderIds:u,fetchTreeData:c}=nr(),h=fc(),m=F4(GC,{activationConstraint:{delay:ppe,tolerance:mpe}}),y=F4(HC),v=Une(m,y),x=(E,A)=>{var P;((P=E.data.current)==null?void 0:P.type)==="resource"?r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.resource")," ",g.jsx("strong",{children:A})]})):r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.folder")," ",g.jsx("strong",{children:A})]}))};return{handleDragEnd:async E=>{const{over:A,active:P}=E,I=A==null?void 0:A.data.current,M=P.data.current,N=T2(h,I==null?void 0:I.id),z=Mk(h,I==null?void 0:I.id);if((M==null?void 0:M.id)==(I==null?void 0:I.id)||N.includes(M==null?void 0:M.id)||z.includes(M==null?void 0:M.id))l([]),u([]);else{const j=(I==null?void 0:I.name)??s;if(A)try{await e.mutate(I==null?void 0:I.id),x(P,j)}catch(H){console.error(H)}finally{a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})}}o({isDrag:!1,elementDrag:void 0})},handleDragStart:E=>{const{active:A}=E,P=A.data.current;(P==null?void 0:P.type)==="resource"?l([P==null?void 0:P.id]):(P==null?void 0:P.type)==="folder"&&u([P==null?void 0:P.id]),o({isDrag:!0,elementDrag:P==null?void 0:P.id})},handleDragOver:E=>{const{over:A,active:P}=E,I=A==null?void 0:A.data.current,M=P==null?void 0:P.data.current,N=T2(h,I==null?void 0:I.id),z=Mk(h,I==null?void 0:I.id);if(A){const j={isOver:!0,canMove:!1,overId:I==null?void 0:I.id,isTreeview:I==null?void 0:I.isTreeview};(M==null?void 0:M.id)===(I==null?void 0:I.id)||N.includes(M==null?void 0:M.id)||z.includes(M==null?void 0:M.id)?a({...j,canMove:!1}):(c(I==null?void 0:I.id,t),a({...j,canMove:!0}))}else a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})},sensors:v}}const Rpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>rme),void 0)),Ppe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>ime),void 0)),Ipe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>ome),void 0)),Mpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>lme),void 0)),kpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>cme),void 0)),Ope=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>fme),void 0)),Dpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>mme),void 0)),Npe=()=>{const t=cpe(),e=wa(),r=xA(),n=Rr(),i=ba(),s=Jr(),o=Zr(),{appCode:a}=vt(),{t:l}=we([a]),{setSearchParams:u,setSearchConfig:c,fetchTreeData:h}=nr(),{data:f,isError:m,error:y,isLoading:v,isFetching:x,fetchNextPage:b}=vpe(),_=(f==null?void 0:f.pages[0].folders.length)===0,w=(f==null?void 0:f.pages[0].resources.length)===0,E=_&&w;return T.useEffect(()=>{var A,P;f&&((A=f==null?void 0:f.pages[0])!=null&&A.searchConfig&&c(f.pages[0].searchConfig),!n.search&&i.id==="default"&&h(i.id,o),u({...n,pagination:(P=f==null?void 0:f.pages[(f==null?void 0:f.pages.length)-1])==null?void 0:P.pagination}))},[f]),T.useEffect(()=>{y&&typeof y=="string"&&s.error(l(y))},[y]),v?g.jsx(hr,{}):m?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Ipe,{})}):n.search&&E?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Ppe,{})}):t&&E?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Rpe,{})}):r&&E&&!e?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(Mpe,{})}):e&&(f==null?void 0:f.pages[0].resources.length)===0?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(kpe,{})}):g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[g.jsx(Ope,{data:f,isFetching:x}),g.jsx(Dpe,{data:f,isFetching:x,fetchNextPage:b})]})},k8=()=>{const t=Rr(),[e,r]=T.useState(""),n=lpe(),i=dpe(),s=T.useRef(null),{setSearchParams:o}=nr(),a=c=>{const h=c.target.value;r(h.toString())},l=c=>{(c.key==="Enter"||c.key==="Return")&&(c.preventDefault(),o({search:e||void 0}))},u=c=>{c.preventDefault(),o({search:e||void 0})};return T.useEffect(()=>{const h=e.length==0||e.length>=n.minLength?{search:e||void 0}:{};o({...t,...h})},[e,n.minLength]),T.useEffect(()=>{i==="select"&&r("")},[i]),T.useEffect(()=>{r(()=>{var c;return((c=t.search)==null?void 0:c.toString())??""})},[t]),{formRef:s,inputSearch:e,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}},Lpe=()=>{const{appCode:t,currentApp:e}=vt(),{t:r}=we(),[n,i]=T.useState(""),s=c=>{if(c==="0"){i("");return}i(c)},o=ba(),a=Rr(),{setSearchParams:l}=nr();T.useEffect(()=>{const c=()=>n.includes("1")?!0:void 0,h=()=>n.includes("2")?!0:void 0,f=()=>n.includes("7")?!0:void 0;l({...a,filters:{owner:c(),public:f(),shared:h(),folder:o?o.id:"default"}})},[o,l,n]);const u=[{label:r("explorer.filter.all",{ns:t}),value:"0"},{label:r("explorer.filter.owner",{ns:t}),value:"1"},{label:r("explorer.filter.shared",{ns:t}),value:"2"},...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices interactifs",value:"3"}]:[],...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices à rendre",value:"4"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets publics",value:"5"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets internes",value:"6"}]:[],...(e==null?void 0:e.displayName)=="blog"?[{label:r("explorer.filter.public",{ns:t}),value:"7"}]:[]];return{selectedFilters:n,options:u,handleOnSelectFilter:s}},Fpe=()=>{const{appCode:t}=vt(),{t:e}=we(),{selectedFilters:r,options:n,handleOnSelectFilter:i}=Lpe(),{formRef:s,inputSearch:o,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}=k8(),c=r.length>0?r.length:void 0;return g.jsxs("form",{noValidate:!0,className:"bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative d-flex gap-8",ref:s,children:[g.jsxs(kt,{id:"search",className:"input-group",children:[g.jsx(Kn,{type:"search",placeholder:e("explorer.label.search",{ns:t}),size:"lg",noValidationIcon:!0,value:o,onChange:a,onKeyDown:l}),g.jsx(sA,{type:"submit","aria-label":e("explorer.label.search",{ns:t}),onClick:u})]}),g.jsxs(yt,{placement:"bottom-end",children:[g.jsx(yt.Trigger,{label:e("explorer.filters"),icon:g.jsx(Z$,{width:20}),variant:"ghost",badgeContent:c}),g.jsx(yt.Menu,{children:n.map(h=>h.value==="0"?g.jsxs(T.Fragment,{children:[g.jsx(yt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label}),g.jsx(yt.Separator,{})]},"0"):g.jsx(yt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label},h.value))})]})]})},jpe=({id:t,selected:e,onSelect:r})=>{const{t:n}=we();return g.jsx("div",{className:"treeview",children:g.jsx("ul",{role:"tree",className:"m-0 p-0",children:g.jsx("li",{id:t,role:"treeitem","aria-selected":e,children:g.jsx("div",{children:g.jsx("div",{className:"action-container",children:g.jsx("div",{onClick:r,role:"button",tabIndex:0,children:g.jsxs("div",{className:"d-flex align-items-center gap-8 py-8 ps-24",children:[g.jsx(DN,{width:"20",height:"20"}),g.jsx("span",{children:n("explorer.tree.trash")})]})})})})})})})},Bpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>L8),void 0)),Upe=()=>{const[t,e]=Am(),r=Zr(),n=fc(),i=wa(),s=xA(),o=C8(),a=U6(),l=i?Er.BIN:s,{appCode:u}=vt(),{t:c}=we(["common",u]),h={...n,name:c("explorer.filters.mine",{ns:u})},{goToTrash:f,selectTreeItem:m,clearSelectedItems:y,clearSelectedIds:v,fetchTreeData:x}=nr(),b=E=>{m(E,r),a()},_=E=>{var I,M;const A=qi(n,E),P=(I=A==null?void 0:A.children)==null?void 0:I.some(N=>{var z;return Array.isArray(N==null?void 0:N.children)&&((z=N.children)==null?void 0:z.length)>0});(M=A==null?void 0:A.children)==null||M.forEach(N=>{P||x(N.id,r)})},w=()=>{y(),v(),e()};return g.jsxs(g.Fragment,{children:[g.jsx(hd,{data:h,selectedNodeId:l,draggedNode:o!=null&&o.isTreeview?o:void 0,onTreeItemClick:b,onTreeItemUnfold:_}),g.jsx(jpe,{id:Er.BIN,selected:i,onSelect:f}),g.jsx("div",{className:"d-grid my-16",children:g.jsx(st,{disabled:i,type:"button",color:"primary",variant:"outline",leftIcon:g.jsx(u1,{}),onClick:w,children:c("explorer.folder.new")})}),g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:t&&g.jsx(Bpe,{edit:!1,isOpen:t,onSuccess:e,onCancel:e})})]})};function $pe(){const{appCode:t}=vt(),{gotoPreviousFolder:e}=nr(),{t:r}=we(["common",t]),{inputSearch:n}=k8(),i=xA(),s=wa(),o=ba(),a=r("explorer.tree.trash"),l=r("explorer.tree.search"),u=r("explorer.filters.mine",{ns:t}),c=(o==null?void 0:o.name)||u;return g.jsx("div",{className:"py-16",children:i&&i!=="bin"&&i!=="default"&&!s?g.jsxs("div",{className:"d-flex align-items-center gap-8",children:[g.jsx(To,{icon:g.jsx(I$,{}),variant:"ghost",color:"tertiary","aria-label":r("back"),className:"ms-n16",onClick:e}),g.jsx("p",{className:"body py-8 text-truncate",children:g.jsx("strong",{children:c})})]}):g.jsx("h2",{className:"body py-8 fw-bold",children:n.length!==0?l:s?a:u})})}const zpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>bme),void 0)),Hpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Sme),void 0)),Vpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Ome),void 0)),Gpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Nme),void 0)),Wpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Fme),void 0)),Xpe=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>jme),void 0)),Ype=({config:t})=>{const e=Rr(),{setConfig:r,setSearchParams:n}=nr();T.useEffect(()=>{r(t||{}),n({...e,application:t.app,types:t.types})},[t]);const{currentApp:i}=vt(),{data:s}=sx(t.actions),{isTrashedModalOpen:o,onTrashedCancel:a}=fpe(),{isActionDisableModalOpen:l,onActionDisableCancel:u}=hpe(),{handleDragEnd:c,handleDragOver:h,handleDragStart:f,sensors:m}=Ape();tde();const y=zy("publish",s),v=zy("create",s);return t&&g.jsxs(g.Fragment,{children:[g.jsx(Oue,{render:()=>v?g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:g.jsx(zpe,{})}):null,children:g.jsx(fce,{app:i})}),g.jsx(no,{className:"flex-grow-1",children:g.jsxs(zie,{sensors:m,modifiers:[gfe],onDragStart:f,onDragEnd:c,onDragOver:h,children:[g.jsx(no.Col,{sm:"3",lg:"2",xl:"3",className:"border-end pt-16 pe-16 d-none d-lg-block",as:"aside",children:g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[g.jsx(Upe,{}),y&&g.jsx(Hpe,{})]})}),g.jsxs(no.Col,{sm:"4",md:"8",lg:"6",xl:"9",children:[g.jsx(Fpe,{}),g.jsx($pe,{}),g.jsx(Npe,{})]}),g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[g.jsx(Vpe,{}),t.enableOnboarding&&g.jsx(Xpe,{id:"showOnboardingTrash",items:[{src:"onboarding/illu-trash-menu.svg",alt:"explorer.modal.onboarding.trash.screen1.alt",text:"explorer.modal.onboarding.trash.screen1.title"},{src:"onboarding/illu-trash-notif.svg",alt:"explorer.modal.onboarding.trash.screen2.alt",text:"explorer.modal.onboarding.trash.screen2.alt"},{src:"onboarding/illu-trash-delete.svg",alt:"explorer.modal.onboarding.trash.screen3.alt",text:"explorer.modal.onboarding.trash.screen3.title"}],modalOptions:{title:"explorer.modal.onboarding.trash.title",prevText:"explorer.modal.onboarding.trash.prev",nextText:"explorer.modal.onboarding.trash.next",closeText:"explorer.modal.onboarding.trash.close"}}),o&&g.jsx(Wpe,{isOpen:o,onCancel:a}),l&&g.jsx(Gpe,{isOpen:l,onCancel:u})]})]})})]})};function qpe(){const{init:t}=vt(),e=I8();return t?g.jsx(ffe,{children:g.jsx(Ype,{config:e})}):g.jsx(hr,{position:!1})}var Qpe=function(){return null};const Kpe=new fV({queryCache:new pL({onError:t=>{typeof t=="string"&&t===Hk.NOT_LOGGED_IN&&window.location.replace("/auth/login")}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),Zpe=I8(),Jpe=({children:t})=>g.jsxs(yV,{client:Kpe,children:[g.jsx(DV,{params:{app:Zpe.app},children:g.jsx(oue,{children:t})}),g.jsx(Qpe,{initialIsOpen:!1})]}),eme=document.getElementById("root");vN(eme).render(g.jsx(T.StrictMode,{children:g.jsx(Jpe,{children:g.jsx(qpe,{})})}));function tme(){const[t]=Rn(),{appCode:e}=vt(),{theme:r}=xa(),{t:n}=we(),i=rr(u=>u.config),{data:s}=sx(i==null?void 0:i.actions),o=s==null?void 0:s.find(u=>u.id==="create"),a=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.txt2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.consultation",{ns:e}):n("explorer.emptyScreen.txt2d.consultation",{ns:e}),l=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.title2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.consultation",{ns:e}):n("explorer.emptyScreen.title2d.consultation",{ns:e});return g.jsx(ca,{imageSrc:`${t}/emptyscreen/illu-${e}.svg`,imageAlt:n("explorer.emptyScreen.app.alt",{ns:e}),title:l(),text:a()})}const rme=Object.freeze(Object.defineProperty({__proto__:null,default:tme},Symbol.toStringTag,{value:"Module"}));function nme(){const{appCode:t}=vt(),[e]=Rn(),{t:r}=we();return g.jsx(ca,{imageSrc:`${e}/emptyscreen/illu-search.svg`,imageAlt:r("explorer.emptyScreen.search.alt",{ns:t}),text:r("explorer.emptyScreen.search.text",{ns:t})})}const ime=Object.freeze(Object.defineProperty({__proto__:null,default:nme},Symbol.toStringTag,{value:"Module"}));function sme(){const[t]=Rn(),{t:e}=we();return g.jsx(ca,{imageSrc:`${t}/emptyscreen/illu-error.svg`,imageAlt:e("explorer.emptyScreen.error.alt"),text:"explorer.emptyScreen.error.text"})}const ome=Object.freeze(Object.defineProperty({__proto__:null,default:sme},Symbol.toStringTag,{value:"Module"}));function ame(){const[t]=Rn(),{appCode:e}=vt(),{t:r}=we();return g.jsx(ca,{imageSrc:`${t}/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:r("explorer.emptyScreen.folder.empty.alt",{ns:e}),text:r("explorer.emptyScreen.label",{ns:e})})}const lme=Object.freeze(Object.defineProperty({__proto__:null,default:ame},Symbol.toStringTag,{value:"Module"}));function ume(){const{appCode:t}=vt(),[e]=Rn(),{t:r}=we();return g.jsx(ca,{imageSrc:`${e}/emptyscreen/illu-trash.svg`,imageAlt:r("explorer.emptyScreen.trash.alt"),title:r("explorer.emptyScreen.trash.title"),text:r("explorer.emptyScreen.trash.empty",{ns:t})})}const cme=Object.freeze(Object.defineProperty({__proto__:null,default:ume},Symbol.toStringTag,{value:"Module"}));function dme({app:t,type:e}){return e==="folder"?g.jsx(NN,{width:"24",height:"24",className:`color-app-${t==null?void 0:t.displayName}`}):e==="resource"?g.jsx(va,{app:t,iconFit:"ratio",size:"24",variant:"rounded"}):null}const O8=({app:t,type:e,name:r})=>{const n={flexDirection:"row",width:"252px",height:"32px",boxShadow:"0 0.2rem 0.6em rgba(0, 0, 0, 0.15)"};return g.jsxs("div",{className:"d-inline-flex align-items-center card is-selected gap-8",style:n,children:[g.jsx("div",{className:"ms-8",children:g.jsx(dme,{app:t,type:e})}),g.jsx("div",{className:"text-truncate",children:r})]})},D8=({app:t,name:e,idFolder:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=T.useId(),{lg:c}=L6(),{setNodeRef:h}=Hj({id:u,data:{id:r,name:e,isTreeview:!1,accepts:["folder","resource"]}}),{attributes:f,listeners:m,setNodeRef:y,transform:v}=zj({id:u,data:{id:r,type:"folder"},disabled:!c}),x=ix(),b=C8(),_=P=>{y(P),h(P)},w=b.overId===r,E=!b.canMove&&b.isTreeview?"no-drop":a?"grabbing":"default",A={transform:`translate3d(${((v==null?void 0:v.x)??0)/1}px, ${((v==null?void 0:v.y)??0)/1}px, 0)`,cursor:E};return T.useEffect(()=>{const P=x.elementDrag===r;l(P)},[x]),g.jsx("div",{ref:_,...m,...f,style:{...A},children:a?g.jsx(O8,{name:e,app:t,type:"folder"}):g.jsx(Jt,{app:t,isSelectable:!a&&i,isSelected:!a&&n||w&&a,isFocused:w,onClick:s,onSelect:o,children:P=>g.jsxs(Jt.Body,{children:[g.jsx(NN,{width:"48",height:"48",className:`color-app-${P}`}),g.jsx(Jt.Title,{children:e})]})})})};D8.displayName="FolderCard";const hme=({data:t})=>{var m,y;const e=Zr(),r=tx(),n=Sh(),i=ix(),s=U6(),{currentApp:o}=vt(),{setSelectedFolders:a,setFolderIds:l,openFolder:u}=nr();function c(v){n.includes(v.id)?(l(n.filter(x=>x!==v.id)),a(r.filter(x=>x.id!==v.id))):(l([v.id,...n]),a([v,...r]))}function h(v){s(),u({folder:v,folderId:v.id,queryClient:e})}const f=d5({from:{opacity:0},to:{opacity:1}});return(m=t==null?void 0:t.pages[0])!=null&&m.folders.length?g.jsx(Il.ul,{className:"grid ps-0 list-unstyled mb-24",children:(y=t==null?void 0:t.pages[0])==null?void 0:y.folders.map(v=>{const{id:x,name:b}=v,_=i.elementDrag===x;return g.jsx(Il.li,{className:`g-col-4 ${_?"z-2000":"z-1"}`,style:{position:"relative",...f},children:g.jsx(D8,{name:b,idFolder:x,app:o,isSelected:n.includes(v.id),onClick:w=>{w.stopPropagation(),h(v)},onSelect:()=>c(v)})},x)})}):null},fme=Object.freeze(Object.defineProperty({__proto__:null,default:hme},Symbol.toStringTag,{value:"Module"})),N8=({app:t,resource:e,time:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=wa(),{lg:c}=L6(),h=`/userbook/avatar/${e==null?void 0:e.creatorId}`;function f(P){const{rights:I,creatorId:M}=P||{};return I.filter(z=>!z.includes(M)).length>=1}const{attributes:m,listeners:y,setNodeRef:v,transform:x}=zj({id:e.id,data:{id:e.id,type:"resource"},disabled:!!u||!c}),b=f(e),_=e==null?void 0:e.public,w=ix(),{t:E}=we(),A={position:a?"absolute":"relative",zIndex:a?2e3:1,transform:`translate3d(${((x==null?void 0:x.x)??0)/1}px, ${((x==null?void 0:x.y)??0)/1}px, 0)`};return T.useEffect(()=>{const P=w.elementDrag===e.id;l(P)},[w]),g.jsx("div",{ref:v,...y,...m,style:{...A},children:a?g.jsx(O8,{app:t,type:"resource",name:e==null?void 0:e.name}):g.jsx(Jt,{app:t,isSelected:!a&&n,isSelectable:!a&&i,onClick:s,onSelect:o,children:P=>g.jsxs(g.Fragment,{children:[g.jsxs(Jt.Body,{children:[g.jsx("div",{className:"card-image medium",children:e!=null&&e.thumbnail?g.jsx(yo,{alt:"",src:`${e==null?void 0:e.thumbnail}?thumbnail=80x80`,objectFit:"cover",className:"h-full w-100"}):g.jsx(va,{app:t,iconFit:"ratio",size:"80",variant:"rounded"})}),g.jsxs("div",{className:"text-truncate",children:[g.jsx(Jt.Title,{children:e==null?void 0:e.name}),g.jsx(Jt.Text,{children:g.jsx("em",{children:r})})]})]}),g.jsxs(Jt.Footer,{children:[g.jsxs("div",{className:"d-inline-flex align-items-center gap-8 text-truncate",children:[h?g.jsx(tc,{alt:(e==null?void 0:e.creatorName)||"",size:"xs",src:h,variant:"circle",width:"24",height:"24"}):g.jsx(xC,{}),g.jsx(Jt.Text,{children:e==null?void 0:e.creatorName})]}),g.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[b&&g.jsx(uo,{message:E("tooltip.shared",{ns:P}),placement:"top",children:g.jsx(jT,{width:16,height:16})}),_&&g.jsx(uo,{message:E("tooltip.public",{ns:P}),placement:"top",children:g.jsx(NT,{width:16,height:16})})]})]})]})})})};N8.displayName="ResourceCard";const pme=({data:t,fetchNextPage:e})=>{const{currentApp:r}=vt(),{t:n}=we(),{fromNow:i}=PL(),s=Rr(),o=Eh(),a=Im(),{setSelectedResources:l,setResourceIds:u,openResource:c,setResourceIsTrash:h}=nr(),f=wa(),m=d5({from:{opacity:0},to:{opacity:1}}),v=s.pagination.startIdx+s.pagination.pageSize<(s.pagination.maxIdx||0),x=T.useCallback(()=>{e()},[]),b=E=>{f?(h(!0),u([E.id]),l([E])):c(E)};async function _(E){if(o.includes(E.id)){u(o.filter(A=>A!==E.id)),l(a.filter(A=>A.id!==E.id));return}u([...o,E.id]),l([...a,E])}const w=Pe("grid ps-0 list-unstyled");return g.jsxs(Me.Fragment,{children:[g.jsx(Il.ul,{className:w,children:t==null?void 0:t.pages.map((E,A)=>g.jsx(Me.Fragment,{children:E.resources.map(P=>{const{id:I,updatedAt:M}=P,N=i(M);return g.jsx(Il.li,{className:"g-col-4",style:{position:"relative",...m},children:g.jsx(N8,{app:r,resource:P,time:N,isSelectable:!0,isSelected:o.includes(P.id),onClick:z=>{z.stopPropagation(),b(P)},onSelect:()=>_(P)})},I)})},A))}),v&&g.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:g.jsx(st,{type:"button",color:"secondary",variant:"filled",onClick:x,children:n("explorer.see.more")})})]})},mme=Object.freeze(Object.defineProperty({__proto__:null,default:pme},Symbol.toStringTag,{value:"Module"}));function gme({edit:t,onSuccess:e,onClose:r}){var E;const n=tx(),i=ba(),s=_pe(),o=Spe(),a=t?(E=n[0])==null?void 0:E.name:void 0,{reset:l,register:u,handleSubmit:c,setFocus:h,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v}}=kT({mode:"onChange",values:{name:a||""}}),x=T.useId(),b=async function({name:A}){var P;try{if(t){const I=(P=n[0])==null?void 0:P.parentId,N=n[0].id;await o.mutate({folderId:N,parentId:I,name:A}),l(),e==null||e()}else{const I=(i==null?void 0:i.id)||Er.DEFAULT;await s.mutate({name:A,parentId:I}),l(),e==null||e()}}catch(I){console.error(I)}};function _(){l(),r()}return{formId:`createModal_${x}`,errors:f,isSubmitting:m,isDirty:y,isValid:v,register:u,setFocus:h,handleSubmit:c,onCancel:_,onSubmit:b}}function vme({isOpen:t,edit:e,onSuccess:r,onCancel:n}){const{t:i}=we(),{isDirty:s,isValid:o,isSubmitting:a,formId:l,onSubmit:u,onCancel:c,handleSubmit:h,register:f,setFocus:m}=gme({edit:e,onSuccess:r,onClose:n});return T.useEffect(()=>{t&&m("name")},[t,m]),t?ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:c,id:"modal_"+l,children:[g.jsx(qe.Header,{onModalClose:c,children:i(e?"explorer.rename.folder":"explorer.create.folder")}),g.jsx(qe.Body,{children:g.jsx("form",{id:l,onSubmit:h(u),children:g.jsxs(kt,{id:"nameFolder",isRequired:!0,children:[g.jsx(Hi,{children:i("explorer.create.folder.name")}),g.jsx(Kn,{type:"text",...f("name",{required:!0,maxLength:60,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:i("explorer.create.folder.name"),size:"md","aria-required":!0,maxLength:60})]})})}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(st,{form:l,type:"submit",color:"primary",variant:"filled",disabled:!s||!o||a,children:i(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal")):null}const L8=Object.freeze(Object.defineProperty({__proto__:null,default:vme},Symbol.toStringTag,{value:"Module"})),yme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>j8),void 0));function xme(){const[t,e]=Am(),r=rr(m=>m.config),{appCode:n}=vt(),{t:i}=we(n),{clearSelectedItems:s,clearSelectedIds:o}=nr(),{data:a}=sx(r==null?void 0:r.actions),l=a==null?void 0:a.find(m=>m.id==="create"),u=ba(),c=Cpe(),h=Rr(),f=()=>{if(n=="scrapbook"){tpe({searchParams:h,folderId:u.id});return}s(),o(),e()};return l?g.jsxs(g.Fragment,{children:[g.jsx(st,{type:"button",color:"primary",variant:"filled",leftIcon:g.jsx(u1,{}),className:"ms-auto",onClick:f,children:i("explorer.create.title")}),g.jsx(T.Suspense,{fallback:g.jsx(hr,{}),children:t&&g.jsx(yme,{mode:"create",currentFolder:u,createResource:c,isOpen:t,onSuccess:e,onCancel:e,children:(m,y,v,x,b)=>n==="blog"&&zy("createPublic",a)&&g.jsx(v8,{appCode:n,isUpdating:y,resource:m,watch:v,setValue:x,register:b})})})]}):null}const bme=Object.freeze(Object.defineProperty({__proto__:null,default:xme},Symbol.toStringTag,{value:"Module"})),wme=()=>{const{theme:t}=xa(),[e]=Rn(),r=Xce(),n=`${e}/${t==null?void 0:t.bootstrapVersion}/image-library.svg`;return{libraryUrl:r,imageFullURL:n,handleClick:()=>{r&&(window.open(r,"_blank"),ke.data().trackAccessLibraryFromExplorer())}}},_me=()=>{const{libraryUrl:t,imageFullURL:e,handleClick:r}=wme(),{t:n}=we();return t&&g.jsxs("div",{className:"p-16",children:[g.jsx(yo,{width:"270",height:"140",loading:"lazy",className:"rounded",src:e,alt:n("explorer.libray.img.alt")}),g.jsx("p",{className:"m-8",children:n("explorer.libray.title")}),g.jsxs("button",{type:"button",onClick:r,rel:"noreferrer",className:"btn btn-ghost-primary d-inline-flex align-items-center gap-4 p-8",children:[g.jsx("span",{children:n("explorer.libray.btn")}),g.jsx(TS,{})]})]})},Sme=Object.freeze(Object.defineProperty({__proto__:null,default:_me},Symbol.toStringTag,{value:"Module"}));function Eme({roles:t,rights:e,action:r}){const[n,i]=T.useState(!1),{user:s}=_h(),o=wa();T.useEffect(()=>{u()},[t,e]);const a=async function(c){const h=c instanceof Array?c:[c];if(t instanceof Array){const f=await ke.rights().sessionHasAtLeastOneResourceRight(t,h);i(f)}else{const f=await ke.rights().sessionHasResourceRight(t,h);i(f)}},l=async function(c){if(t instanceof Array){const h=await ke.rights().sessionHasAtLeastOneResourceRightForEachList(t,c);i(h)}else{const h=await ke.rights().sessionHasResourceRightForEachList(t,c);i(h)}},u=async function(){var c,h,f;if(t===void 0){i(!0);return}if(o&&((h=(c=e[0])==null?void 0:c.trashedBy)!=null&&h.includes(s==null?void 0:s.userId))&&r==="restore"&&!((f=e[0])!=null&&f.trashed)){i(!0);return}if(e instanceof Array)if(e.length>0)if(typeof e[0]=="string")await a(e);else{const m=e.map(y=>y.rights);await l(m)}else i(!1);else typeof e=="string"?await a(e):await a(e.rights)};return{visible:n,refreshState:u}}function F8(){const[t,e]=T.useState(!1),[r,n]=T.useState("void"),[i,s]=T.useState(),o=rr(he=>he.config),a=ba(),l=Eh(),u=Im(),c=tx(),h=Sh(),f=wa(),m=xpe(),y=T8(),v=Rr(),x=wpe(),b=ix(),{openResource:_,printSelectedResource:w,openFolder:E,clearSelectedItems:A,clearSelectedIds:P}=nr(),{data:I}=sx(o==null?void 0:o.actions);T.useEffect(()=>{if(l.length===0&&h.length===0){e(!1);return}if(y){e(!1);return}if(b.isDrag){e(!1);return}e(!0)},[l,h]);async function M(he){var je;switch((je=document.getElementById("root"))==null||je.setAttribute("aria-hidden","true"),s(he),he.id){case Gr.OPEN:return l.length>0?_(u[0]):E({folder:c[0],folderId:c[0].id});case Gr.COPY:return xe();case Gr.MOVE:return n("move");case Gr.PRINT:return w();case Gr.DELETE:return n("delete");case Gr.RESTORE:return await j();case Gr.PUBLISH:return n("publish");case Gr.UPD_PROPS:case"edit":return Se();case Gr.SHARE:return n("share");case Gr.EXPORT:return n("export");default:throw Error(`Unknown action: ${he.id}`)}}function N(he){const je=l.length+h.length,$e=l.length===1||h.length===1,lt=je===1,Fe=h.length===0;switch(he.id){case Gr.OPEN:return lt;case Gr.MANAGE:return $e;case Gr.COPY:return $e&&Fe;case Gr.PUBLISH:return $e&&Fe;case Gr.UPD_PROPS:return $e&&Fe;case Gr.SHARE:return Fe&&$e;case"export":return $e&&Fe;case Gr.PRINT:return $e&&Fe;case"edit":return lt;default:return!0}}const z=()=>!0;async function j(){try{if(f)await m.mutate();else throw new Error("Cannot restore untrashed resources");H()}catch(he){console.error(he)}}function H(){var he;n("void"),i!=null&&i.id&&((he=document.getElementById(i==null?void 0:i.id))==null||he.focus())}const F=he=>()=>{r===he&&(H(),A(),P())},L=F("move"),O=F("move"),U=F("delete"),V=F("delete"),k=F("publish"),$=F("publish"),B=F("edit_folder"),X=F("edit_folder"),K=F("edit_resource"),Y=F("edit_resource"),re=F("share"),ue=F("share"),le=F("export"),ge=F("export");async function xe(){if(u&&u.length>0){const he=u[0];await x.mutate(he),A(),P()}}function Se(){if(l&&l.length>0){const he=u[0].assetId;(o==null?void 0:o.app)==="scrapbook"?rpe({searchParams:v,assetId:he}):n("edit_resource")}else n("edit_folder")}function Ce(he){return he.id==="edit"&&h.length>0?"explorer.rename":`explorer.actions.${he.id}`}return{onRestore:j,actions:f?o==null?void 0:o.trashActions:I,selectedElement:[...u,...c],currentFolderId:a==null?void 0:a.id,overrideLabel:Ce,handleClick:M,isActivable:f?z:N,isActionBarOpen:t,isMoveModalOpen:r==="move",onMoveCancel:L,onMoveSuccess:O,isDeleteModalOpen:r==="delete",onDeleteCancel:V,onDeleteSuccess:U,isPublishModalOpen:r==="publish",onPublishCancel:$,onPublishSuccess:k,isEditFolderOpen:r==="edit_folder",onEditFolderCancel:X,onEditFolderSuccess:B,isEditResourceOpen:r==="edit_resource",onEditResourceCancel:Y,onEditResourceSuccess:K,isShareResourceOpen:r==="share",onShareResourceCancel:ue,onShareResourceSuccess:re,isExportModalOpen:r==="export",onExportCancel:le,onExportSuccess:ge,onClearActionBar:H}}function Tme({resourceRights:t,roleExpected:e,action:r,children:n,renderWhenForbidden:i}){const{t:s}=we(),{overrideLabel:o}=F8(),{visible:a}=Eme({roles:e,rights:t,action:r==null?void 0:r.id}),{setResourceActionDisable:l}=nr(),u=wa();return a?g.jsx(g.Fragment,{children:n}):i?i():u&&!a?g.jsx(st,{type:"button",color:"primary",variant:"filled",onClick:()=>{l(!0)},children:s(o(r))}):g.jsx(g.Fragment,{})}const Cme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Bme),void 0)),Ame=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>j8),void 0)),Rme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>zme),void 0)),Pme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Gme),void 0)),Ime=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>L8),void 0)),Mme=T.lazy(async()=>await ur(()=>Promise.resolve().then(()=>Yme),void 0));function kme(){const{appCode:t}=vt(),{t:e}=we(),{actions:r,selectedElement:n,isMoveModalOpen:i,isDeleteModalOpen:s,isPublishModalOpen:o,isActionBarOpen:a,isEditFolderOpen:l,overrideLabel:u,onEditFolderCancel:c,onEditFolderSuccess:h,isEditResourceOpen:f,onEditResourceCancel:m,onEditResourceSuccess:y,isShareResourceOpen:v,onShareResourceCancel:x,onShareResourceSuccess:b,isExportModalOpen:_,onExportCancel:w,onExportSuccess:E,onMoveCancel:A,onMoveSuccess:P,onDeleteCancel:I,onDeleteSuccess:M,onPublishCancel:N,onPublishSuccess:z,isActivable:j,handleClick:H}=F8(),L=Im()[0],O=Epe(t),U=Tpe(t),V=dC(a,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return g.jsxs(g.Fragment,{children:[V((k,$)=>$&&g.jsx(Il.div,{className:"position-fixed bottom-0 start-0 end-0",style:{...k,zIndex:4},children:g.jsx(Mue,{children:r==null?void 0:r.filter(B=>B.available&&B.target==="actionbar").map(B=>j(B)&&g.jsx(Tme,{resourceRights:n,roleExpected:B.right,action:B,children:g.jsx(st,{id:B.id,type:"button",color:"primary",variant:"filled",onClick:()=>{H(B)},children:e(u(B))},B.id)},B.id))})})),g.jsxs(T.Suspense,{fallback:g.jsx(hr,{}),children:[i&&g.jsx(Pme,{isOpen:i,onCancel:A,onSuccess:P}),s&&g.jsx(Rme,{isOpen:s,onCancel:I,onSuccess:M}),o&&L&&g.jsx(Cme,{isOpen:o,resourceId:L.assetId,onCancel:N,onSuccess:z}),l&&g.jsx(Ime,{edit:!0,isOpen:l,onCancel:c,onSuccess:h}),f&&L&&g.jsx(Ame,{mode:"update",isOpen:f,resourceId:L.assetId,updateResource:U,onCancel:m,onSuccess:y,children:(k,$,B,X,K)=>t==="blog"&&zy("createPublic",r)&&g.jsx(v8,{appCode:t,isUpdating:$,resource:k,watch:B,setValue:X,register:K})}),v&&L&&g.jsx(Jhe,{isOpen:v,shareResource:O,shareOptions:{resourceCreatorId:L.creatorId,resourceId:L.assetId,resourceRights:L.rights},onCancel:x,onSuccess:b,children:t==="blog"?g.jsx(efe,{resourceId:L.assetId,updateResource:U}):null}),_&&L&&g.jsx(Mme,{isOpen:_,onCancel:w,onSuccess:E})]})]})}const Ome=Object.freeze(Object.defineProperty({__proto__:null,default:kme},Symbol.toStringTag,{value:"Module"}));function Dme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:e,id:"trash_action_disable_resource",children:[g.jsx(qe.Header,{onModalClose:()=>e(),children:r("explorer.trash.action.modal.title")}),g.jsx(qe.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.action.modal.text")})}),g.jsx(qe.Footer,{children:g.jsx(st,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Nme=Object.freeze(Object.defineProperty({__proto__:null,default:Dme},Symbol.toStringTag,{value:"Module"}));function Lme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:e,id:"trash_resource",children:[g.jsx(qe.Header,{onModalClose:()=>e(),children:r("explorer.trash.modal.title")}),g.jsx(qe.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.modal.text")})}),g.jsx(qe.Footer,{children:g.jsx(st,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Fme=Object.freeze(Object.defineProperty({__proto__:null,default:Lme},Symbol.toStringTag,{value:"Module"})),jme=Object.freeze(Object.defineProperty({__proto__:null,default:xle},Symbol.toStringTag,{value:"Module"})),j8=Object.freeze(Object.defineProperty({__proto__:null,default:Fhe},Symbol.toStringTag,{value:"Module"})),Bme=Object.freeze(Object.defineProperty({__proto__:null,default:Mhe},Symbol.toStringTag,{value:"Module"}));function Ume({onSuccess:t}){const e=bpe(),r=ype(),n=wa();async function i(){try{n?await e.mutate():await r.mutate(),t==null||t()}catch(s){console.error(s)}}return{isTrashFolder:n,onDelete:i}}function $me({isOpen:t,onSuccess:e=()=>({}),onCancel:r=()=>({})}){const{t:n}=we(),{isTrashFolder:i,onDelete:s}=Ume({onSuccess:e});return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:r,id:"deleteModal",children:[g.jsx(qe.Header,{onModalClose:r,children:n(i?"explorer.delete.title":"explorer.trash.title")}),g.jsx(qe.Body,{children:g.jsx("p",{className:"body",children:n(i?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:n("explorer.cancel")}),g.jsx(st,{color:"danger",onClick:s,type:"button",variant:"filled",children:n(i?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}const zme=Object.freeze(Object.defineProperty({__proto__:null,default:$me},Symbol.toStringTag,{value:"Module"}));function Hme({onSuccess:t}){const[e,r]=T.useState(),n=Zr(),i=M8(),s=tx(),o=Im(),a=fc(),{fetchTreeData:l}=nr();async function u(){try{if(!e)throw new Error("explorer.move.selection.empty");await i.mutate(e),await(t==null?void 0:t())}catch(h){console.error(h)}}const c=h=>{var m,y;const f=T2(a,h);for(const v of s)if(h===v.id||h===v.parentId||(m=v.childrenIds)!=null&&m.includes(h)||f.includes(v.id))return!1;for(const v of o)if(h===((v==null?void 0:v.folderIds)&&v.folderIds[0])||((y=v==null?void 0:v.folderIds)==null?void 0:y.length)===0&&h==="default")return!1;return!0};return{treeData:a,disableSubmit:!e,handleTreeItemSelect:h=>{c(h)?r(h):r(void 0)},handleOnTreeItemUnfold:h=>{var y,v;const f=qi(a,h),m=(y=f==null?void 0:f.children)==null?void 0:y.some(x=>{var b;return Array.isArray(x==null?void 0:x.children)&&((b=x.children)==null?void 0:b.length)>0});(v=f==null?void 0:f.children)==null||v.forEach(x=>{m||l(x.id,n)})},onMove:()=>u()}}function Vme({isOpen:t,onSuccess:e,onCancel:r}){const{appCode:n}=vt(),{t:i}=we(),{treeData:s,handleTreeItemSelect:o,handleOnTreeItemUnfold:a,onMove:l,disableSubmit:u}=Hme({onSuccess:e}),c={...s,name:i("explorer.filters.mine",{ns:n})};return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:r,id:"moveModal",children:[g.jsx(qe.Header,{onModalClose:r,children:i("explorer.move.title")}),g.jsx(qe.Subtitle,{children:i("explorer.move.subtitle")}),g.jsx(qe.Body,{children:g.jsx(hd,{data:c,onTreeItemClick:o,onTreeItemUnfold:a})}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(st,{color:"primary",onClick:l,type:"button",variant:"filled",disabled:u,children:i("explorer.move")})]})]}),document.getElementById("portal"))}const Gme=Object.freeze(Object.defineProperty({__proto__:null,default:Vme},Symbol.toStringTag,{value:"Module"})),Wme=t=>{const e=Im(),r=Rr(),n=Jr(),{t:i}=we();return{handleExportClick:()=>{e.length?(npe({searchParams:r,assetId:e[0].assetId}),t()):n.error(i("explorer.error.noResourceSelected"))}}};function Xme({isOpen:t,onSuccess:e,onCancel:r}){const{handleExportClick:n}=Wme(e),{t:i}=we();return ar.createPortal(g.jsxs(qe,{isOpen:t,onModalClose:r,id:"exportModal",children:[g.jsx(qe.Header,{onModalClose:r,children:i("explorer.export.title")}),g.jsxs(qe.Body,{children:[g.jsxs("ul",{children:[g.jsx("li",{children:i("explorer.export.body.info.1")}),g.jsx("li",{children:i("explorer.export.body.info.2")}),g.jsx("li",{children:i("explorer.export.body.info.3")})]}),g.jsx(Jo,{type:"warning",children:i("explorer.export.body.warning")})]}),g.jsxs(qe.Footer,{children:[g.jsx(st,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(st,{color:"primary",onClick:n,type:"button",variant:"filled",children:i("explorer.actions.export")})]})]}),document.getElementById("portal"))}const Yme=Object.freeze(Object.defineProperty({__proto__:null,default:Xme},Symbol.toStringTag,{value:"Module"}))});export default qme();
|
package/dist/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ode-explorer= 08/11/2024
|
|
1
|
+
ode-explorer= 08/11/2024 18:20:06
|
package/lib/FoldersList.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as t, jsxs as N } from "react/jsx-runtime";
|
|
|
2
2
|
import { useBreakpoint as R, Card as S, useScrollToTop as k, useOdeClient as w } from "@edifice-ui/react";
|
|
3
3
|
import { useSpring as $, animated as v } from "@react-spring/web";
|
|
4
4
|
import { useQueryClient as j } from "@tanstack/react-query";
|
|
5
|
-
import { o as C, s as
|
|
5
|
+
import { o as C, s as z, j as A, k as B, a as E } from "./index2.js";
|
|
6
6
|
import { useState as q, useId as L, useEffect as M } from "react";
|
|
7
7
|
import { useDroppable as P, useDraggable as Q } from "@dnd-kit/core";
|
|
8
8
|
import { Files as G } from "@edifice-ui/icons";
|
|
@@ -19,7 +19,7 @@ const O = ({
|
|
|
19
19
|
const [o, a] = q(!1), p = L(), {
|
|
20
20
|
lg: F
|
|
21
21
|
} = R(), {
|
|
22
|
-
setNodeRef:
|
|
22
|
+
setNodeRef: y
|
|
23
23
|
} = P({
|
|
24
24
|
id: p,
|
|
25
25
|
data: {
|
|
@@ -29,7 +29,7 @@ const O = ({
|
|
|
29
29
|
accepts: ["folder", "resource"]
|
|
30
30
|
}
|
|
31
31
|
}), {
|
|
32
|
-
attributes:
|
|
32
|
+
attributes: I,
|
|
33
33
|
listeners: u,
|
|
34
34
|
setNodeRef: g,
|
|
35
35
|
transform: e
|
|
@@ -40,17 +40,16 @@ const O = ({
|
|
|
40
40
|
type: "folder"
|
|
41
41
|
},
|
|
42
42
|
disabled: !F
|
|
43
|
-
}), s = C(), d =
|
|
44
|
-
g(n),
|
|
43
|
+
}), s = C(), d = z(), h = (n) => {
|
|
44
|
+
g(n), y(n);
|
|
45
45
|
}, f = d.overId === l, T = !d.canMove && d.isTreeview ? "no-drop" : o ? "grabbing" : "default", x = {
|
|
46
46
|
transform: `translate3d(${((e == null ? void 0 : e.x) ?? 0) / 1}px, ${((e == null ? void 0 : e.y) ?? 0) / 1}px, 0)`,
|
|
47
|
-
touchAction: "none",
|
|
48
47
|
cursor: T
|
|
49
48
|
};
|
|
50
49
|
return M(() => {
|
|
51
50
|
const n = s.elementDrag === l;
|
|
52
51
|
a(n);
|
|
53
|
-
}, [s]), /* @__PURE__ */ t("div", { ref:
|
|
52
|
+
}, [s]), /* @__PURE__ */ t("div", { ref: h, ...u, ...I, style: {
|
|
54
53
|
...x
|
|
55
54
|
}, children: o ? /* @__PURE__ */ t(H, { name: c, app: r, type: "folder" }) : /* @__PURE__ */ t(S, { app: r, isSelectable: !o && m, isSelected: !o && i || f && o, isFocused: f, onClick: D, onSelect: b, children: (n) => /* @__PURE__ */ N(S.Body, { children: [
|
|
56
55
|
/* @__PURE__ */ t(G, { width: "48", height: "48", className: `color-app-${n}` }),
|
|
@@ -62,7 +61,7 @@ const ee = ({
|
|
|
62
61
|
data: r
|
|
63
62
|
}) => {
|
|
64
63
|
var u, g;
|
|
65
|
-
const c = j(), l =
|
|
64
|
+
const c = j(), l = A(), i = B(), m = C(), D = k(), {
|
|
66
65
|
currentApp: b
|
|
67
66
|
} = w(), {
|
|
68
67
|
setSelectedFolders: o,
|
|
@@ -72,14 +71,14 @@ const ee = ({
|
|
|
72
71
|
function F(e) {
|
|
73
72
|
i.includes(e.id) ? (a(i.filter((s) => s !== e.id)), o(l.filter((s) => s.id !== e.id))) : (a([e.id, ...i]), o([e, ...l]));
|
|
74
73
|
}
|
|
75
|
-
function
|
|
74
|
+
function y(e) {
|
|
76
75
|
D(), p({
|
|
77
76
|
folder: e,
|
|
78
77
|
folderId: e.id,
|
|
79
78
|
queryClient: c
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
|
-
const
|
|
81
|
+
const I = $({
|
|
83
82
|
from: {
|
|
84
83
|
opacity: 0
|
|
85
84
|
},
|
|
@@ -91,12 +90,12 @@ const ee = ({
|
|
|
91
90
|
const {
|
|
92
91
|
id: s,
|
|
93
92
|
name: d
|
|
94
|
-
} = e,
|
|
95
|
-
return /* @__PURE__ */ t(v.li, { className: `g-col-4 ${
|
|
93
|
+
} = e, h = m.elementDrag === s;
|
|
94
|
+
return /* @__PURE__ */ t(v.li, { className: `g-col-4 ${h ? "z-2000" : "z-1"}`, style: {
|
|
96
95
|
position: "relative",
|
|
97
|
-
...
|
|
96
|
+
...I
|
|
98
97
|
}, children: /* @__PURE__ */ t(O, { name: d, idFolder: s, app: b, isSelected: i.includes(e.id), onClick: (f) => {
|
|
99
|
-
f.stopPropagation(),
|
|
98
|
+
f.stopPropagation(), y(e);
|
|
100
99
|
}, onSelect: () => F(e) }) }, s);
|
|
101
100
|
}) }) : null;
|
|
102
101
|
};
|
package/lib/ResourcesList.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { useBreakpoint as G, Card as r, Image as L, AppIcon as U, Avatar as q, Tooltip as
|
|
4
|
-
import { useSpring as Q, animated as
|
|
2
|
+
import O, { useState as B, useEffect as M, useCallback as E } from "react";
|
|
3
|
+
import { useBreakpoint as G, Card as r, Image as L, AppIcon as U, Avatar as q, Tooltip as P, useOdeClient as H, useDate as J, Button as K } from "@edifice-ui/react";
|
|
4
|
+
import { useSpring as Q, animated as w } from "@react-spring/web";
|
|
5
5
|
import V from "clsx";
|
|
6
|
-
import { useTranslation as
|
|
6
|
+
import { useTranslation as A } from "react-i18next";
|
|
7
7
|
import { f as z, o as W, e as X, h as Y, i as Z, a as _ } from "./index2.js";
|
|
8
8
|
import { useDraggable as tt } from "@dnd-kit/core";
|
|
9
9
|
import { Users as et, Globe as it } from "@edifice-ui/icons";
|
|
@@ -13,8 +13,8 @@ const $ = ({
|
|
|
13
13
|
app: l,
|
|
14
14
|
resource: t,
|
|
15
15
|
time: x,
|
|
16
|
-
isSelected:
|
|
17
|
-
isSelectable:
|
|
16
|
+
isSelected: b = !1,
|
|
17
|
+
isSelectable: u = !0,
|
|
18
18
|
onClick: m,
|
|
19
19
|
onSelect: c
|
|
20
20
|
}) => {
|
|
@@ -42,18 +42,17 @@ const $ = ({
|
|
|
42
42
|
disabled: !!p || !R
|
|
43
43
|
}), S = I(t), N = t == null ? void 0 : t.public, f = W(), {
|
|
44
44
|
t: i
|
|
45
|
-
} =
|
|
45
|
+
} = A(), d = {
|
|
46
46
|
position: s ? "absolute" : "relative",
|
|
47
47
|
zIndex: s ? 2e3 : 1,
|
|
48
|
-
transform: `translate3d(${((n == null ? void 0 : n.x) ?? 0) / 1}px, ${((n == null ? void 0 : n.y) ?? 0) / 1}px, 0)
|
|
49
|
-
touchAction: "none"
|
|
48
|
+
transform: `translate3d(${((n == null ? void 0 : n.x) ?? 0) / 1}px, ${((n == null ? void 0 : n.y) ?? 0) / 1}px, 0)`
|
|
50
49
|
};
|
|
51
50
|
return M(() => {
|
|
52
51
|
const a = f.elementDrag === t.id;
|
|
53
52
|
h(a);
|
|
54
53
|
}, [f]), /* @__PURE__ */ e("div", { ref: y, ...C, ...v, style: {
|
|
55
54
|
...d
|
|
56
|
-
}, children: s ? /* @__PURE__ */ e(st, { app: l, type: "resource", name: t == null ? void 0 : t.name }) : /* @__PURE__ */ e(r, { app: l, isSelected: !s &&
|
|
55
|
+
}, children: s ? /* @__PURE__ */ e(st, { app: l, type: "resource", name: t == null ? void 0 : t.name }) : /* @__PURE__ */ e(r, { app: l, isSelected: !s && b, isSelectable: !s && u, onClick: m, onSelect: c, children: (a) => /* @__PURE__ */ o(j, { children: [
|
|
57
56
|
/* @__PURE__ */ o(r.Body, { children: [
|
|
58
57
|
/* @__PURE__ */ e("div", { className: "card-image medium", children: t != null && t.thumbnail ? /* @__PURE__ */ e(L, { alt: "", src: `${t == null ? void 0 : t.thumbnail}?thumbnail=80x80`, objectFit: "cover", className: "h-full w-100" }) : /* @__PURE__ */ e(U, { app: l, iconFit: "ratio", size: "80", variant: "rounded" }) }),
|
|
59
58
|
/* @__PURE__ */ o("div", { className: "text-truncate", children: [
|
|
@@ -67,10 +66,10 @@ const $ = ({
|
|
|
67
66
|
/* @__PURE__ */ e(r.Text, { children: t == null ? void 0 : t.creatorName })
|
|
68
67
|
] }),
|
|
69
68
|
/* @__PURE__ */ o("div", { className: "d-inline-flex align-items-center gap-8", children: [
|
|
70
|
-
S && /* @__PURE__ */ e(
|
|
69
|
+
S && /* @__PURE__ */ e(P, { message: i("tooltip.shared", {
|
|
71
70
|
ns: a
|
|
72
71
|
}), placement: "top", children: /* @__PURE__ */ e(et, { width: 16, height: 16 }) }),
|
|
73
|
-
N && /* @__PURE__ */ e(
|
|
72
|
+
N && /* @__PURE__ */ e(P, { message: i("tooltip.public", {
|
|
74
73
|
ns: a
|
|
75
74
|
}), placement: "top", children: /* @__PURE__ */ e(it, { width: 16, height: 16 }) })
|
|
76
75
|
] })
|
|
@@ -85,9 +84,9 @@ const xt = ({
|
|
|
85
84
|
const {
|
|
86
85
|
currentApp: x
|
|
87
86
|
} = H(), {
|
|
88
|
-
t:
|
|
89
|
-
} =
|
|
90
|
-
fromNow:
|
|
87
|
+
t: b
|
|
88
|
+
} = A(), {
|
|
89
|
+
fromNow: u
|
|
91
90
|
} = J(), m = X(), c = Y(), s = Z(), {
|
|
92
91
|
setSelectedResources: h,
|
|
93
92
|
setResourceIds: p,
|
|
@@ -113,20 +112,20 @@ const xt = ({
|
|
|
113
112
|
p([...c, i.id]), h([...s, i]);
|
|
114
113
|
}
|
|
115
114
|
const f = V("grid ps-0 list-unstyled");
|
|
116
|
-
return /* @__PURE__ */ o(
|
|
117
|
-
/* @__PURE__ */ e(
|
|
115
|
+
return /* @__PURE__ */ o(O.Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ e(w.ul, { className: f, children: l == null ? void 0 : l.pages.map((i, d) => /* @__PURE__ */ e(O.Fragment, { children: i.resources.map((a) => {
|
|
118
117
|
const {
|
|
119
118
|
id: D,
|
|
120
119
|
updatedAt: F
|
|
121
|
-
} = a, k =
|
|
122
|
-
return /* @__PURE__ */ e(
|
|
120
|
+
} = a, k = u(F);
|
|
121
|
+
return /* @__PURE__ */ e(w.li, { className: "g-col-4", style: {
|
|
123
122
|
position: "relative",
|
|
124
123
|
...v
|
|
125
124
|
}, children: /* @__PURE__ */ e($, { app: x, resource: a, time: k, isSelectable: !0, isSelected: c.includes(a.id), onClick: (T) => {
|
|
126
125
|
T.stopPropagation(), S(a);
|
|
127
126
|
}, onSelect: () => N(a) }) }, D);
|
|
128
127
|
}) }, d)) }),
|
|
129
|
-
y && /* @__PURE__ */ e("div", { className: "d-grid gap-2 col-4 mx-auto my-24", children: /* @__PURE__ */ e(K, { type: "button", color: "secondary", variant: "filled", onClick: n, children:
|
|
128
|
+
y && /* @__PURE__ */ e("div", { className: "d-grid gap-2 col-4 mx-auto my-24", children: /* @__PURE__ */ e(K, { type: "button", color: "secondary", variant: "filled", onClick: n, children: b("explorer.see.more") }) })
|
|
130
129
|
] });
|
|
131
130
|
};
|
|
132
131
|
export {
|