PageSourceSearch

https://murf.ai/static/js/9483.7ab0f109.chunk.js

js murf.ai collected 2026-10-01 08:36:16 UTC 140,307 bytes, 5 lines download raw bytes

1"use strict";
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94164360-f721-5fca-aab2-149088ca5182")}catch(e){}}();
3(self.webpackChunkmurf_web=self.webpackChunkmurf_web||[]).push([[9483],{89483:(e,o,t)=>{t.r(o),t.d(o,{default:()=>Xo});var n=t(65043),i=t(96385),l=t(36664),a=t(96778),r=t(96679),s=t(62351),d=t(14556),c=t(91688),u=t(57546),m=t(72128),p=t(10881);const v=function(){const e=(0,c.useHistory)(),o=(0,d.wA)(),{updateFolderId:t}=(0,s.A)(),i=(0,d.d4)((e=>{var o;return null!==(o=e.userState.activeWorkspaceId)&&void 0!==o?o:(0,m.Cu)()})),l=(0,d.d4)((e=>e.userState.workspaces)),a=(0,d.d4)((e=>e.userState.apiStatus)),{query:r}=(0,u.A)(),v=(0,n.useMemo)((()=>r.get("folderId")),[r]),h=(0,n.useMemo)((()=>r.get("workspaceId")),[r]);(0,n.useEffect)((()=>{!v&&i&&t({folderId:m.Kj,customWorkspace:i})}),[t,v,i]),(0,n.useEffect)((()=>{var n,r;"DONE"===a&&h&&i!==h&&null!==l&&void 0!==l&&null!==(n=l.map((e=>e.workspaceId)))&&void 0!==n&&n.includes(h)?((0,m.Ut)({workspaceId:h}),o(p.b_.actions.updateActiveWorkspaceId({activeWorkspaceId:h})),t({folderId:null!==v&&void 0!==v?v:m.Kj,customWorkspace:h})):"DONE"!==a||!h||null!==l&&void 0!==l&&null!==(r=l.map((e=>e.workspaceId)))&&void 0!==r&&r.includes(h)||e.push("/404")}),[o,i,h,l,e,v,t,a])};var h=t(18150),j=t(25078);const g=[{folderId:1,name:"Alpha",noOfProjects:2,noOfMembers:7},{folderId:2,name:"Bravo",noOfProjects:1,noOfMembers:3},{folderId:3,name:"A very long and dumb name because why not",noOfProjects:99,noOfMembers:88},{folderId:4,name:"Alpha",noOfProjects:2,noOfMembers:7},{folderId:5,name:"Bravo",noOfProjects:1,noOfMembers:3},{folderId:6,name:"A very long and dumb name because why not",noOfProjects:120,noOfMembers:88}],x=[{projectId:1,name:"Proj 1",type:"VIDEO",thumbUrl:"https://murf.ai/public-assets/home/apex_wild_adventure_mike.jpg",duration:"4:00",owner:"John Doe",createdMinutesAgo:364215},{projectId:2,name:"Proj 2",type:"IMAGE",thumbUrl:"https://murf.ai/public-assets/home/time_management-ethan.jpg",duration:"4:00",owner:"John Doe",createdMinutesAgo:364215},{projectId:3,name:"Proj 3",type:"AUDIO",thumbUrl:"https://murf.ai/public-assets/home/mental_health_podcast_brianna.jpg",duration:"4:00",owner:"John Doe",createdMinutesAgo:364215},{projectId:4,name:"Proj 1",type:"VIDEO",thumbUrl:"https://murf.ai/public-assets/home/watermark_app_stampit_mike.jpg",duration:"4:00",owner:"John Doe",createdMinutesAgo:364215},{projectId:5,name:"Proj 2",type:"IMAGE",thumbUrl:"https://murf.ai/public-assets/new-home/murf-upload-slides.svg",duration:"4:00",owner:"John Doe",createdMinutesAgo:364215},{projectId:6,name:"Toooooooooo long of a project name",type:"AUDIO",thumbUrl:"https://murf.ai/public-assets/new-home/murf-upload-slides.svg",duration:"4:00",owner:"John Doe",createdMinutesAgo:364215}];var f=t(97950),b=t(24682),N=t(95827),A=t(49026),_=t(45350),y=t(55911),S=t(4142),w=t(70579);const I="ASC",P="DESC",E=2,C=0,T=1,R={[I]:"arrow-up",[P]:"arrow-down"},k=e=>{let{viewType:o,mode:t,updateItemList:i,sortingOptions:l=null,sortingOptionsInListView:a=null,sortBy:r,setSortBy:s,sortValue:d,setSortValue:c,sortMode:u,setSortMode:m}=e;const p=l,[v,h]=(0,n.useState)(!1);return o===T?t===E?null:(0,w.jsx)(w.Fragment,{children:null!==a&&void 0!==a&&a.length?null===a||void 0===a?void 0:a.map((e=>(0,w.jsx)(b.$n,{tabIndex:"0",small:!0,minimal:!0,id:r,alignText:y.C.LEFT,className:"font-12 text-muted",onClick:()=>(e=>{var o,t,n,l,a;null!==(null===(o=p[e])||void 0===o?void 0:o.value)&&i(null===(l=p[e])||void 0===l?void 0:l.value,null===(a=p[e])||void 0===a?void 0:a.order),s(e),m(null===(t=p[e])||void 0===t?void 0:t.order),c(null===(n=p[e])||void 0===n?void 0:n.value)})(((e,o,t)=>{let n=e;return n===t?n=o:n===o&&(n=e),n})(e.asc,e.desc,r)),rightIcon:(0,w.jsx)(b.In,{className:"text-black",icon:r.startsWith(e.asc)&&R[u],"aria-hidden":"true"}),children:e.label}))):null}):o===C?(0,w.jsxs)(b.AM,{isOpen:v,onClose:()=>{h(!1)},minimal:!0,children:[(0,w.jsx)(b.$n,{tabIndex:"0",minimal:!0,onClick:()=>h(!0),id:r,small:!0,style:{whiteSpace:"nowrap"},icon:(0,w.jsx)("span",{className:"material-icons-round md-16","aria-hidden":"true",children:"sort"}),className:"font-weight-500 studio__content__projects__heading__sort-text",children:r||"Sort"}),(0,w.jsx)(S.A,{items:Object.keys(p).map((e=>{var o;return null!==(o=p[e])&&void 0!==o&&o.hidden?null:p[e]})),onClick:e=>{var o;null!==(null===(o=e)||void 0===o?void 0:o.value)&&(null===i||void 0===i||i(null===o||void 0===o?void 0:o.value,null===o||void 0===o?void 0:o.order)),s(o.name),m(null===o||void 0===o?void 0:o.order),c(null===o||void 0===o?void 0:o.value),h(!1)},focusId:r})]}):null};var O=t(52271),D=t(93076),L=t(38846);const F={NORMAL:1,TRASH:2,ROOTS:3},M={name:{name:"Name ( A-Z )",value:"name",order:I,icon:(0,w.jsx)("span",{class:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})},nameDesc:{name:"Name ( Z-A )",value:"name",order:P,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},createdMinutesAgo:{name:"Created On ( Latest first )",value:"createdAt",order:P,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},createdMinutesAgoDesc:{name:"Created On ( Oldest first )",value:"createdAt",order:I,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})},modifiedMinutesAgo:{name:"Modified On ( Oldest first )",value:"modifiedAt",order:I,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},modifiedMinutesAgoDesc:{name:"Modified On ( Latest first )",value:"modifiedAt",order:P,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})}},$="name";const U=function(e){let{folders:o,isSubFolder:t=!1,handleFolderClick:l,allowSort:a=!0,mode:c=F.NORMAL,label:u}=e;const p=(0,d.wA)(),{bulkSelectedFolders:v,processedTree:h,bulkSelectedSubFolders:j}=(0,d.d4)((e=>e.studioHomeState)),{folderIdFromParams:g}=(0,s.A)(),{getPermissions:x}
3=(0,_.S)(),f=D.km.BULK_ACTION_LIMIT,N=h[g],[y,S]=(0,n.useState)(!0),[I,P]=(0,n.useState)(null===M||void 0===M?void 0:M[$].order),[E,T]=(0,n.useState)(null===M||void 0===M?void 0:M[$].value),[R,U]=(0,n.useState)(null===M||void 0===M?void 0:M[$].name),B=(0,n.useMemo)((()=>null===o||void 0===o?void 0:o.sort((0,r.WJs)(E,I))),[o,E,I]);let H=B.map((e=>null===e||void 0===e?void 0:e.id));const K=(0,n.useMemo)((()=>{let e=[];return e=(null===N||void 0===N?void 0:N.id)===i.KQ.EXPLORER?H.filter((e=>{const{DELETE:o}=x({accessList:A.Mf,resource:h[e]});return"WFRoot"!==e&&o&&e!==m.pd&&e!==m.SM})):g===i.KQ.TRASH?H:H.filter((e=>{var o;const{EDIT_FOLDER_CONTENT:t}=x({accessList:A.Mf,resource:null!==(o=h[null===N||void 0===N?void 0:N.rootFolder])&&void 0!==o?o:N});return t})),e}),[N,H,g,h,x]),W=null===K||void 0===K?void 0:K.slice(0,f),G=(null===K||void 0===K?void 0:K.length)>=0,J=e=>{const o=e?j:v;return(null===K||void 0===K?void 0:K.length)>0&&o.length>0&&o.every((e=>null===K||void 0===K?void 0:K.includes(e)))&&W.length===o.length},V=J(!1),Y=J(!0);(0,n.useEffect)((()=>{p(O.A.actions.setBulkFolderCheckBoxState(V)),p(O.A.actions.setBulkSubFolderCheckBoxState(Y))}),[V,Y,p]);const z=(e,o)=>{t?(0===j.length&&p(O.A.actions.setBulkMoveState("subfolders")),p(O.A.actions.toggleSelectAllSubFolders({folders:e,isSelected:o,limit:f}))):(0===v.length&&p(O.A.actions.setBulkMoveState("folders")),p(O.A.actions.toggleSelectAllFolders({folders:e,isSelected:o,limit:f}))),o&&(0,r.ENR)(D.No.BULK_ACTION_CLICKED,{"Entry Point":"Select All","File Type":"Folder"})},Q=(null===o||void 0===o?void 0:o.length)>f,q=(0,w.jsx)("div",{role:"presentation",onKeyDown:e=>{if((0,r.gJ$)(e)){e.preventDefault();z(W,t?!Y:!V)}},children:(0,w.jsx)(b.Sc,{id:t?"bulk-subfolder-checkbox":"bulk-folder-checkbox",inline:!0,style:{margin:0,color:"rgba(29, 17, 54, 1)",fontWeight:"500",width:"100px",paddingLeft:"40px"},checked:t?Y:V,onChange:e=>z(W,e.target.checked),label:"Select All"})});return(0,w.jsxs)("div",{className:"d-flex flex-column mb-5",children:[(0,w.jsxs)("div",{className:"d-flex align-items-center mb-3 studio__content__folders__heading "+(y?"":"studio__content__folders__heading--collapsed"),children:[(0,w.jsx)(b.$n,{minimal:!0,small:!0,style:{whiteSpace:"nowrap"},icon:y?(0,w.jsx)("span",{className:"material-icons-round md-24","aria-hidden":"true",children:"arrow_drop_down"}):(0,w.jsx)("span",{className:"material-icons-round md-24",children:"arrow_drop_up"}),onClick:function(){S(!y)},className:"font-weight-500 mr-2 studio__content__folders__heading__button-text studio__content__projects__main-heading__button-text",children:u?`${u} (${null===o||void 0===o?void 0:o.length})`:`${t?"Sub ":""}Folders (${null===o||void 0===o?void 0:o.length})`}),(0,w.jsx)("div",{className:"studio__content__folders__heading__divider mr-2"}),G&&0!==(null===K||void 0===K?void 0:K.length)&&(Q?(0,w.jsx)(b.m_,{content:`First ${f} items will be selected.`,intent:L.J.NONE,position:"top",children:q}):q),a&&(0,w.jsx)(k,{mode:c,viewType:C,sortingOptions:M,defaultState:$,itemList:o,sortBy:R,setSortBy:U,sortValue:E,setSortValue:T,sortMode:I,setSortMode:P},"SORT_FOLDER")]}),(0,w.jsx)(b.SD,{isOpen:y,children:B.length?(0,w.jsx)("div",{className:"studio__content__folders",children:B.map((e=>(0,w.jsx)(te,{folder:e,onClick:l,isRootFolder:null!==(null===e||void 0===e?void 0:e.rootFolder)&&void 0!==(null===e||void 0===e?void 0:e.rootFolder),isSubFolder:t,rootFolder:null!==e&&void 0!==e&&e.rootFolder?h[null===e||void 0===e?void 0:e.rootFolder]:h[null===e||void 0===e?void 0:e.id],mode:c},null===e||void 0===e?void 0:e.id)))}):(0,w.jsx)("div",{className:"w-100 mt-3 text-center text-muted font-14 font-weight-600",children:`No ${t?"Sub":""}Folders`})})]})};var B=t(3067),H=t(62058),K=t(42324),W=t(53428),G=t(61608),J=t(37939),V=t(76607),Y=t(52348),z=t(39878),Q=t(10909),q=t(55293);const X=[{name:"Open",value:"open",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"folder"}),ariaLabel:"Open folder"},{name:"Rename",value:"rename",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_rename_outline"}),ariaLabel:"Rename folder"},{name:"Move",value:"move",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_move"}),ariaLabel:"Move folder",divider:(0,w.jsx)(b.cG,{})},{name:"Export Projects",value:"export_projects",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"file_download"}),ariaLabel:"Export projects"},{name:"Delete",value:"delete",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete folder",intent:"danger"}],Z=[{name:"Delete",value:"perm_delete",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete Permanently",intent:"danger"},{name:"Restore",value:"restore",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"restore_from_trash"}),ariaLabel:"Restore folder"}],ee=[{name:"Open",value:"open_root",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"folder"}),ariaLabel:"Open root folder"},{name:"View Details",value:"view_details",icon:(0,w.jsx)("span",{className:"material-icons-outlined md-16 studio-image-menu-icon","aria-hidden":"true",children:"info"}),ariaLabel:"View details"},{name:"Rename",value:"rename_root",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_rename_outline"}),ariaLabel:"Rename root folder"},{name:"Share",value:"share_root",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"share"}),ariaLabel:"Share root folder",divider:(0,w.jsx)(b.cG,{})},{name:"Export Projects",value:"export_projects",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"file_download"}),ariaLabel:"Export projects"},{name:"Delete",value:"delete_root",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete root folder",intent:"danger"}],oe=e=>{let{lastBulkSelectedFolder:o,bulkSelectedFolders:t}=e;return(0,w.jsxs)("div",{className:"drag-container",children:[(0,w.jsx)("div",{className:"drag-container__background"}),(0,w.jsx)("span",{className:"material-icons-round md-20 text-murf-yellow mr-2","aria-hidden":"true",children:"folder"}),(0,w.jsx)("span",{className:"drag-container__text",children:null===o||void 0===o?void 0:o.name}),(0,w.jsx)("div",{className:"drag-container__badge",children:null===t||void 0===t?void 0:t.length})]})},te=e=>{var o;let{folder:t,onClick:l,className:a,isSubFolder:c=!1,rootFolder:u=null,mode:p=F.NORMAL}=e;const v=(0,d.wA)(),{updateFolderId:h}=(0,s.A)(),j=(0,n.useContext)(J.l7),{bulkFolderMoveState:g,bulkProjectMoveState:x,processedTree:y,bulkSubFolderMoveState:I,subFolderDragState:P,ProjectDragState:E,draggedSubFolder:C}=(0,d.d4)((e=>e.studioHomeState)),{bulkSelectedFolders:T,bulkSelectedProjects:R,bulkSelectedSubFolders:k}=(0,d.d4)((e=>e.studioHomeState)),L=D.km.BULK_ACTION_LIMIT,M=y[T[T.length-1]],[$,U]=(0,n.use
3State)(!1),{checkForFolderErrorAndCallback:te}=(0,G.A)(),[ne,ie]=(0,n.useState)(!1),[le,ae]=(0,n.useState)(!1),re=(0,n.useRef)(null),se=c?k.some((e=>e===(null===t||void 0===t?void 0:t.id))):T.some((e=>e===(null===t||void 0===t?void 0:t.id))),de=!(null!==t&&void 0!==t&&t.rootFolder),[ce,ue]=(0,n.useState)(!1),{getPermissions:me}=(0,_.S)(),{DELETE:pe,EDIT:ve,EDIT_FOLDER_CONTENT:he,SHARE:je}=me({accessList:A.Mf,resource:u}),ge=me({accessList:A.zw}),xe=(0,d.d4)((e=>{var o;return null!==(o=e.userState.activeWorkspaceId)&&void 0!==o?o:(0,m.Cu)()})),fe=(0,d.d4)((e=>{var o;return null===(o=e.studioHomeState.workspaces[xe])||void 0===o?void 0:o.bulkExportEnabled})),be=ge.VIEW,Ne=(0,d.d4)((e=>e.dialogState.bulkExportTaskData)),Ae=(null===Ne||void 0===Ne?void 0:Ne.status)===r.ZQ0.QUEUED,{findProjectParentId:_e}=(0,V.A)(),{folderIdFromParams:ye}=(0,s.A)(),Se=me({accessList:A.YG}),we=(0,d.d4)((e=>e.dialogState.bulkDuplicateTaskData)),Ie=!(ye===i.KQ.TEMPLATES||ye===i.KQ.SEARCH_RESULTS||ye===i.KQ.SHARED_WITH_ME)&&(ye===i.KQ.TRASH?Se.DELETE:de?pe:he),Pe=(null===t||void 0===t?void 0:t.id)!==m.pd&&(null===t||void 0===t?void 0:t.id)!==m.SM,Ee=he&&ye!==i.KQ.SEARCH_RESULTS&&ye!==i.KQ.TRASH&&!de,Ce=(0,n.useMemo)((()=>{const e=o=>{var t;const n=y[o];if(!n)return 0;let i=(null===(t=n.projects)||void 0===t?void 0:t.length)||0;if(n.childFolders)for(const l of n.childFolders)i+=e(l);return i};return e(null===t||void 0===t?void 0:t.id)}),[y,null===t||void 0===t?void 0:t.id]),Te=e=>{e.preventDefault(),e.stopPropagation(),U(!$)},Re=e=>e.filter((e=>"export_projects"!==e.value||be&&fe)),ke=p===F.NORMAL?Re(X):p===F.ROOTS?Re(ee):Z,Oe=(e,o)=>{c?(0===k.length&&(v(O.A.actions.setBulkMoveState("subfolders")),(0,r.ENR)(D.No.BULK_ACTION_CLICKED,{"Entry Point":"Item Icon","File Type":"Folder"})),v(O.A.actions.updateBulkSubFolders({folderId:e,isChecked:o}))):(0===T.length&&(v(O.A.actions.setBulkMoveState("folders")),(0,r.ENR)(D.No.BULK_ACTION_CLICKED,{"Entry Point":"Item Icon","File Type":"Folder"})),v(O.A.actions.updateBulkFolders({folderId:e,isChecked:o})))};const De=function(){let{manageProjectId:e,callCount:o=0,customCurrentFolderVersion:n=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=null===t||void 0===t?void 0:t.id,a=ye&&ye!==i.KQ.SEARCH_RESULTS?y[ye]:y[_e({projectIdToFind:e})];if(a.id!==l){if(l){var s;const i=null!==(s=y[l])&&void 0!==s&&s.rootFolder?y[l].rootFolder:l;v(O.A.actions.moveProject({oldFolder:a.id,newFolder:l,projectId:e})),v(O.A.actions.removeAllBulkprojects()),function(e){let{projectId:o,newParentRootFolder:n,customCurrentFolderVersion:i,folderFromTree:l}=e;return new Promise(((e,a)=>{var r;const s=null===t||void 0===t?void 0:t.id,d=null!==l&&void 0!==l&&l.rootFolder?l.rootFolder:null===l||void 0===l?void 0:l.id,c=null!==i&&void 0!==i?i:null===(r=y[d])||void 0===r?void 0:r.folderVersion;if(d)if(d!==n){const t={authUser:j,folderId:d,folderVersion:c,contentToMove:o,destinationRootFolderId:n,destinationSubFolderId:s};v(x?(0,W.Jo)(t):(0,W.rD)(t)).then((o=>{var t;null!==o&&void 0!==o&&null!==(t=o.meta)&&void 0!==t&&t.rejectedWithValue?a(o.payload.data):e(o.payload.data)})).catch((e=>{a(e)}))}else{const t={};x?R.forEach((e=>{t[e]=s})):t[o]=s;const i={contentIdToParentFolderId:t};v((0,W.bO)({authUser:j,folderId:n,currentVersion:c,folder:i})).then((o=>{var t;null!==o&&void 0!==o&&null!==(t=o.meta)&&void 0!==t&&t.rejectedWithValue?a(o.payload.data):e(o.payload.data)})).catch((e=>a(e)))}else a("Error")}))}({projectId:e,newParentRootFolder:i,customCurrentFolderVersion:n,folderFromTree:a}).then((e=>{(0,r.ENR)(D.No.BULK_ACTION_SUCCESS,{"File Type":"Project","No of files":x?R.length:1,"Action Type":"Drag & Drop",Action:"Move"}),(0,Y.Te)((x?`${R.length} ${(0,r.vVM)(R.length,"Project")}`:"1 Project")+" Moved Successfully")})).catch((async t=>{(!await te((null===t||void 0===t?void 0:t.message)===D.MR,{folderId:null!==a&&void 0!==a&&a.rootFolder?a.rootFolder:null===a||void 0===a?void 0:a.id},(e=>{var t,n,i,l;null!==(t=e.payload)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&n.folderVersion&&o<2&&De({callCount:o+1,customCurrentFolderVersion:null===(i=e.payload)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.folderVersion})}))||o>=2)&&(v(O.A.actions.moveProject({oldFolder:l,newFolder:a.id,projectId:e})),(0,r.ENR)(D.No.BULK_ACTION_FAILED,{"File Type":"Project","No of files":x?R.length:1,"Action Type":"Drag & Drop",Action:"Move"}),(0,Y.Qg)(`Could not move ${(0,r.vVM)(R.length,"project")}.Please try again.`))}))}}else(0,Y.I9)("Cannot move into the same folder.Please choose another destination")};const Le=()=>{(Ie&&Pe||!g&&!I)&&(c?se||k.length!==L:se||!g||T.length!==L)&&(g||I||x?Oe(null===t||void 0===t?void 0:t.id,!se):l(null===t||void 0===t?void 0:t.id))};return(0,w.jsxs)("span",{tabIndex:"0",className:`${a} d-flex justify-content-between align-items-center studio__content__folders__folder-card cursor-pointer  ${(ne||le||se)&&Ie?"studio__content__folders__folder-card--bulk-selected":""} ${ce?"studio__content__folders__folder-card--card-hovered":""}\n      `,draggable:Ee,onDragOver:e=>{(E||P)&&C!==(null===t||void 0===t?void 0:t.id)&&(e.preventDefault(),ue(!0))},onDragLeave:e=>{(E||P)&&C!==(null===t||void 0===t?void 0:t.id)&&(e.preventDefault(),ue(!1))},onDragStart:e=>{g&&!se&&v(O.A.actions.removeAllBulkfolders()),e.dataTransfer.setData("text/plain",JSON.stringify(t)),v(O.A.actions.setSubFolderDragState(!0)),v(O.A.actions.setDraggedSubFolder(null===t||void 0===t?void 0:t.id));const o=document.createElement("div");o.style.position="absolute",o.style.top="-9999px",document.body.appendChild(o),re.current=o,f.render((0,w.jsx)(oe,{lastBulkSelectedFolder:M,bulkSelectedFolders:T}),re.current),g&&se&&e.dataTransfer.setDragImage(re.current.firstChild,0,32)},onDragEnd:e=>{e.preventDefault(),v(O.A.actions.setSubFolderDragState(!1)),re.current&&(f.unmountComponentAtNode(re.current),document.body.removeChild(re.current),re.current=null)},onClick:Le,onMouseEnter:()=>{Ie&&ie(!0)},onMouseLeave:()=>{Ie&&ie(!1)},onKeyDown:e=>{e.stopPropagation(),e.key===H.mu.Enter&&Le()},onDrop:e=>{if(e.preventDefault(),E){v(O.A.actions.setProjectDragState(!1));const o=e.dataTransfer.getData("text/plain");ue(!1);const t=JSON.parse(o);t.hasOwnProperty("projectId")&&(x?De({manageProjectId:R}):(v(O.A.actions.setFocusId(null===t||void 0===t?void 0:t.projectId)),De({manageProjectId:null===t||void 0===t?void 0:t.projectId})),(0,r.ENR)(D.No.BULK_ACTION_START,{"File Type":"Project","No of files":x?R.length:1,"Action Type":"Drag & Drop",Action:"Move"}))}if(P){var o;ue(!1),(0,r.ENR)(D.No.BULK_ACTION_START,{"File Type":"Folder","No of files":g?T.length:1,"Action Type":"Drag & Drop",Action:"Move"}),v(O.A.actions.setSubFolderDragState(!1)),v(O.A.actions.setDraggedSubFolder(null));const h=e.dataTransfer.getData("text/plain"),x=JSON.parse(h);if(g&&T.includes(null===t||void 0===t?void 0:t.id))return void(0,Y.I9)("Cannot move into the same folder.Please choose another destination");if((null===x||void 0===x?void 0:x.id)!==(null===t||void 0===t?void 0:t.id)&&(null===(o=y[null===x||void 0===x?void 0:x.id])||void 0===o?void 0:o.parentFolderId)!==(null===t||void 0===t?void 0:t.id)){var n,i;const e=y[null===(n=y[null===x||void 0===x?void 0:x.id])||void 0===n?void 0:n.rootFolder],o=y[null===t||void 0===t?void 0:t.rootFolder],h=(null===e||void 0===e?void 0:e.id)!==(null===o||void 0===o?void 0:o.id);let f,b,N,A,_=[];var l,a,s,d,c,u,m,p;if(g)f={ids:T,parentFolderId:null===t||void 0===t?void 0:t.id,rootFolder:null===o||void 0===o?void 0:o.id},b={ids:T,parentFolderId:null!==(l=null===t||void 0===t?void 0:t.parentFolderId)&&void 0!==l?l:null===t||void 0===t?void 0:t.id,rootFolder:null!==(a=null===t||void 0===t?void 0:t.rootFolder)&&void 0!==a?a:null===t||void 0===t?void 0:t.id},_=T,N=O.A.actions.updateFolders({newFolderDetails:f,oldParentFolderId:null===(s=y[null===x||void 0===x?void 0:x.id])||void 0===s?void 0:s.parentFolderId}),A=O.A.actions.updateFolders({newFolderDetails:b,oldParentFolderId:null===t||void 0===t?void 0:t.id}),v(O.A.actions.removeAllBulkfolders());else f={id:null===x||void 0===x?void 0:x.id,name:null!==(d=null===x||void 0===x?void 0:x.label)&&void 0!==d?d:x.name,parentFolderId:null===t||void 0===t?void 0:t.id,rootFolder:null===o||void 0===o?void 0:o.id},b={id:null===x||void 0===x?void 0:x.id,name:null!==(c=null===x||void 0===x?void 0:x.label)&&void 0!==c?c:x.name,parentFolderId:null===(u=y[null===x||void 0===x?void 0:x.id])||void 0===u?void 0:u.parentFolderId,rootFolder:null===e||void 0===e?void 0:e.id},_=[null===x||void 0===x?void 0:x.id],N=O.A.actions.updateFolder({newFolder:f,oldParentFolderId:null===(m=y[null===x||void 0===x?void 0:x.id])||void 0===m?void 0:m.parentFolderId}),A=O.A.actions.updateFolder({newFolder:b,oldParentFolderId:null===(p=f)||void 0===p?void 0:p.parentFolderId});v(N),function(e){let{subFolderIds:o,sourceFolder:t,destinationFolder:n,currentParentFolder:i,newParentRootFolder:l,acrossRootFolder:a}=e;return new Promise(((e,s)=>{let d={};(null===o||void 0===o?void 0:o.length)>1?o.forEach((e=>{d[e]=null===n||void 0===n?void 0:n.id})):d[null===t||void 0===t?void 0:t.id]=null===n||void 0===n?void 0:n.id;const c={contentIdToParentFolderId:d},u=null===i||void 0===i?void 0:i.folderVersion;a||v((0,W.bO)({authUser:j,folderId:null===l||void 0===l?void 0:l.id,currentVersion:u,folder:c})).then((o=>{var t,n,i;null!==(t=o.meta)&&void 0!==t&&t.rejectedWithValue?null!==o&&void 0!==o&&null!==(n=o.payload)&&void 0!==n&&null!==(i=n.data)&&void 0!==i&&i.message?s(o.payload.data):s(o.payload.error):(e(o.payload.data),(0,Y.Te)((g?`${T.length} ${(0,r.vVM)(T.length,"Folder")}`:"1 Folder")+" Moved Successfully")),e(o.data),(0,r.ENR)(D.No.BULK_ACTION_SUCCESS,{"File Type":"Folder","No of files":g?T.length:1,"Action Type":"Drag & Drop",Action:"Move"})})).catch((e=>{(0,r.ENR)(D.No.BULK_ACTION_FAILED,{"File Type":"Folder","No of files":g?T.length:1,"Action Type":"Drag & Drop",Action:"Move"}),s(e)}))}))}({subFolderIds:_,sourceFolder:x,newParentRootFolder:o,customCurrentFolderVersion:null===(i=y[null===e||void 0===e?void 0:e.id])||void 0===i?void 0:i.folderVersion,currentParentFolder:e,destinationFolder:t,acrossRootFolder:h}).catch((e=>{(0,Y.Qg)(`Could not move ${(0,r.vVM)(_.length,"Folder")}. Please try again.`),v(A)}))}}},children:[(0,w.jsxs)("div",{className:"d-flex align-items-center",children:[(0,w.jsx)("div",{children:(0,B.U)({...t,public:null!==(o=null===t||void 0===t?void 0:t.public)&&void 0!==o?o:null===u||void 0===u?void 0:u.public,isChildFolder:!de},void 0,void 0,!0,c)}),(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"d-flex flex-column mb-2",children:[(0,w.jsx)(b.EY,{ellipsize:!0,style:{maxWidth:(0,r.a8N
3)(g||I||ne||le?100:120)},className:"font-weight-500 font-16 studio__content__folders__folder-card--folder-name "+(null!==t&&void 0!==t&&t.public||!de?"":"pt-1"),children:(null===t||void 0===t?void 0:t.name)||"Untitled"}),(0,w.jsxs)(q.A,{fontSize:11,className:"text-gray2",children:[Ce," ",(0,r.vVM)(Ce,"Project")]})]}),(0,w.jsx)("div",{tabIndex:g||I?-1:0,"aria-hidden":g||I?"true":"false",onFocus:()=>{Ie&&ae(!0)},onBlur:()=>{Ie&&ae(!1)},onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),e.stopPropagation(),Oe(null===t||void 0===t?void 0:t.id,!se))},children:!P&&Pe&&(Ie?(ne||le||(c?I:g))&&(0,w.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,w.jsx)(b.Sc,{className:"studio__content__folders__folder-card--check-box "+(ne||g||I?"":"highlight-focus"),checked:se,onChange:e=>Oe(null===t||void 0===t?void 0:t.id,e.target.checked),disabled:c?!se&&k.length===L:!se&&g&&T.length===L,labelElement:null,"aria-label":"bulk select folder checkbox"})}):(c?I:g)?(0,w.jsx)("div",{className:"studio__content__folders__folder-card--lock",children:(0,w.jsx)("span",{class:"material-icons-round md-20 text-gray2 mt-1",children:"lock"})}):null)})]})]}),(0,w.jsxs)(b.AM,{minimal:!0,position:b.$x.BOTTOM_RIGHT,isOpen:$,onClose:()=>U(!1),children:[(0,w.jsx)(b.$n,{id:null===t||void 0===t?void 0:t.id,small:!0,className:"ml-0 project-card__more-button",icon:(0,w.jsx)("span",{className:"material-icons-round text-dark-gray5 md-16","aria-hidden":"true",children:"more_vert"}),onClick:Te,onKeyDown:e=>{e.key===H.mu.Enter&&Te(e)},position:N.yX.BOTTOM,"aria-label":"More options"}),(0,w.jsx)(S.A,{focusId:null===t||void 0===t?void 0:t.id,onClick:e=>(e=>{switch(U(!1),e){case"open":case"open_root":return(0,r.ENR)(D.No.OPEN_FOLDER,{"Entry Point":"Folder Menu","Folder Type":de?"Root Folder":"Sub Folder"}),void h({folderId:null===t||void 0===t?void 0:t.id});case"rename":case"rename_root":case"view_details":return de?(v(K.A.actions.setManageRootFolderDrawerData(t)),v(K.A.actions.setManageRootFolderDrawer(!0)),v(K.A.actions.setRootFolderUsersDrawer(z.EK.DETAILS))):(v(K.A.actions.setManageSubFolderDialogData(t)),v(K.A.actions.setManageSubFolderDialog(!0))),void(0,r.Yum)(null===t||void 0===t?void 0:t.id);case"move":return v(K.A.actions.setManageSubFolderDialog(!0)),v(K.A.actions.setManageSubFolderDialogData(t)),void v(K.A.actions.setFolderOperationParentId(null===t||void 0===t?void 0:t.id));case"share_root":return void(de&&(localStorage.setItem(D.gi.SHARE_FOLDER_SOURCE,"Folder Menu"),(0,r.ENR)(D.No.SHARE_FOLDER_POPUP,{"Invite Source":"Folder",mode:"Invitation","Entry Point":"Folder Menu"}),v(K.A.actions.setManageRootFolderDrawerData(t)),v(K.A.actions.setManageRootFolderDrawer(!0)),v(K.A.actions.setRootFolderUsersDrawer(z.EK.SHARE))));case"details_root":return void(de&&(v(K.A.actions.setManageRootFolderDrawerData(t)),v(K.A.actions.setFolderDetailsDrawer(!0)),v(K.A.actions.setManageRootFolderDrawer(!0)),v(K.A.actions.setRootFolderUsersDrawer(z.EK.DETAILS))));case"export_projects":const e=[null===t||void 0===t?void 0:t.id];return Ce>500?void(0,Y.I9)((0,w.jsxs)("div",{className:"d-flex flex-column gap-1 text-left",children:[(0,w.jsxs)(q.A,{fontSize:14,weight:400,className:"text-dark-gray1",children:["Selection too large to export (",Ce," ",(0,r.vVM)(Ce,"project"),")"]}),(0,w.jsx)(q.A,{fontSize:11,className:"text-gray1",children:"Deselect some projects or export in smaller batches (<500)"})]}),5e4,null,"warning"):(v(K.A.actions.setBulkExportData({projects:(0,Q.K)(e,y),folders:de?[null===t||void 0===t?void 0:t.id]:[],subFolders:de?[null===t||void 0===t?void 0:t.id]:[],level:"Folder",exportEntryPoint:"Folder Menu"})),void v(K.A.actions.toggleBulkExportDialog(!0)));case"delete":case"delete_root":return we.destinationFolder===(null===t||void 0===t?void 0:t.id)?void(0,Y.I9)("Projects are being duplicated to this folder."):(v(K.A.actions.setFolderOperationFolderId(null===t||void 0===t?void 0:t.id)),v(K.A.actions.setDeleteFolderDialog(!0)),void(0,r.Yum)(null===t||void 0===t?void 0:t.id));case"restore":return v(K.A.actions.setFolderOperationFolderId(null===t||void 0===t?void 0:t.id)),v(K.A.actions.setRestoreFolderDialog(!0)),!Se.RESTORE;case"perm_delete":return v(K.A.actions.setFolderOperationFolderId(null===t||void 0===t?void 0:t.id)),v(K.A.actions.setIsPermanentDelete(!0)),v(K.A.actions.setDeleteFolderDialog(!0)),!Se.DELET
3E;default:return!1}})(e.value),items:ke.map((e=>{const o=(e=>{let{value:o}=e;switch(o){case"rename":case"move":case"duplicate":case"rename_root":return de?!ve:!he;case"delete":return!he;case"delete_root":return!pe;case"restore":return!Se.RESTORE;case"perm_delete":return!Se.DELETE;case"share_root":return!je;case"export_projects":return Ae||0===Ce;default:return!1}})({value:e.value}),t="export_projects"===e.value&&o&&Ae;return{...e,disabled:o,disabledTooltip:t?"Please wait until the current download finishes":void 0}})),className:"p-1"})]})]})},ne=e=>{let{className:o}=e;return(0,w.jsxs)("div",{className:`${o} d-flex flex-column`,role:"status","aria-busy":"true","aria-live":"polite",children:[(0,w.jsx)("div",{className:`w-25 mb-3 studio__content__projects__heading studio__content__projects__heading--skeleton ${j.w24}`,"aria-hidden":"true",children:"Folders (5)"}),(0,w.jsx)("div",{className:"studio__content__folders","aria-hidden":"true",children:g.map(((e,o)=>(0,w.jsx)(te,{folder:e,className:`${j.w24} studio__content__folders__folder-card--skeleton`},o)))})]})};var ie=t(98139),le=t.n(ie);const ae=e=>{let{projectView:o=i.mM.CARD,className:t}=e;const n=[...Array(6).keys()];return(0,w.jsxs)("div",{className:`${t} d-flex flex-column`,role:"status","aria-busy":"true","aria-live":"polite",children:[(0,w.jsx)("div",{className:`w-25 mb-3 studio__content__projects__heading studio__content__projects__heading--skeleton ${j.w24}`,"aria-hidden":"true",children:"Projects (5)"}),(0,w.jsx)("div",{"aria-hidden":"true",children:o===i.mM.CARD?(0,w.jsx)("div",{className:"studio__content__projects__cards ",children:n.map(((e,o)=>(0,w.jsx)("div",{className:le()("project-card--skeleton rounded",j.w24),children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0})},o)))}):n.map(((e,o)=>(0,w.jsx)("div",{className:le()("w-100 h-36 p-2 mb-2 rounded",j.w24)},o)))})]})};var re=t(39502),se=t(10964),de=t(99843),ce=t(46335),ue=t(22044);const me=[{name:"Open",value:"open",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"file_open"}),ariaLabel:"Open project"},{name:"Open in new tab",value:"open_in_new",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"open_in_new"}),ariaLabel:"Open project in new tab"},{name:"Rename",value:"rename",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_rename_outline"}),ariaLabel:"Rename project"},{name:"Share",value:"share",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"share"}),ariaLabel:"Share project"},{name:"View Details",value:"details",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"info"}),ariaLabel:"Project Details"},{name:"Move",value:"move",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_move"}),ariaLabel:"Move project",divider:(0,w.jsx)(b.cG,{})},{name:"Duplicate",value:"duplicate",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"content_copy"}),ariaLabel:"Duplicate project"},{name:"Delete",value:"delete",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete project",intent:"danger"}],pe=[{name:"Delete",value:"perm_delete",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete project permanently",intent:"danger"},{name:"Restore",value:"restore",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"restore_from_trash"}),ariaLabel:"Restore project"}],ve=e=>{let{lastBulkSelectedProject:o,bulkSelectedProjects:t}=e;return(0,w.jsxs)("div",{className:"drag-container",children:[(0,w.jsx)("div",{className:"drag-container__background"}),(0,w.jsx)("img",{src:(0,r.ye6)("murf-icon-rebranded.svg"),alt:"murf icon 
3waves",className:"drag-container__icon"}),(0,w.jsx)("span",{className:"drag-container__text",children:null===o||void 0===o?void 0:o.projectName}),(0,w.jsx)("div",{className:"drag-container__badge",children:null===t||void 0===t?void 0:t.length})]})},he=e=>{var o,t;let{project:l,getInfoContent:a=!1,canSelect:p=!1,children:v=null,className:h,linkToProject:j=!0,onCardClick:g=()=>{},parentFolder:x=null,mode:y,disableEdit:I=!1,handleDelete:P=()=>{},handleRestore:E=()=>{},label:C}=e;const[T,R]=(0,n.useState)(!1),[k,L]=(0,n.useState)(null),[F,M]=(0,n.useState)(!1),[$,U]=(0,n.useState)(!1),{folderIdFromParams:B}=(0,s.A)(),W=(0,c.useHistory)(),G=(0,n.useRef)(null),{selectedProjects:J}=(0,d.d4)((e=>e.studioHomeState)),{bulkSelectedProjects:V,projects:z,ProjectDragState:Q,subFolderDragState:q}=(0,d.d4)((e=>e.studioHomeState)),X=z[V[V.length-1]],Z=V.some((e=>e===(null===l||void 0===l?void 0:l.projectId)))&&"Recent Projects"!==C,ee=D.km.BULK_ACTION_LIMIT,{bulkProjectMoveState:oe,bulkFolderMoveState:te,bulkSubFolderMoveState:ne}=(0,d.d4)((e=>e.studioHomeState)),ie=(0,d.wA)(),{query:le}=(0,u.A)(),{activeWorkspaceId:ae}=(0,d.d4)((e=>e.userState)),he=null!==ae&&void 0!==ae?ae:(0,m.Cu)(),{isPricingV2User:je}=(0,se.A)(),{getPermissions:ge}=(0,_.S)(),{EDIT_PROJECT:xe,SHARE_PROJECT:fe,DUPLICATE_PROJECT:Ne}=ge({accessList:A.Mf}),Ae=xe&&!(B===i.KQ.TEMPLATES||"Recent Projects"===C||B===i.KQ.SEARCH_RESULTS||B===i.KQ.SHARED_WITH_ME),_e=xe&&!(B===i.KQ.TEMPLATES||B===i.KQ.TRASH||B===i.KQ.SHARED_WITH_ME||"Recent Projects"===C),{totalProjects:ye}=(0,ce.A)(),{limits:{maxTotalProjects:Se}}=(0,ue.A)(),we=ye>Se,{USE:Ie}=ge({accessList:A.BA}),{DELETE:Pe,RESTORE:Ee}=ge({accessList:A.YG}),{canCreateProject:Ce}=(0,de.Ay)(),Te=null===J||void 0===J?void 0:J.includes(null===l||void 0===l?void 0:l.projectId),Re=y===be.TRASH?pe:me,ke=e=>{let{value:o}=e;switch(o){case"duplicate":return!Ne||we;case"rename":case"move":return!xe||I||we;case"delete":return!xe||I;case"share":return!fe;case"perm_delete":return!Pe;case"restore":return!Ee;default:return!1}},Oe=e=>{R(!1);const o=null!==l&&void 0!==l&&l.recentProjectId?l.recentProjectId:null===l||void 0===l?void 0:l.projectId;switch(e){case"open":return void(0,r.ooL)(W,`/studio/project/2/${null===l||void 0===l?void 0:l.projectId}?workspaceId=${he}`)();case"open_in_new":return void(0,r.iDi)(`/studio/project/2/${null===l||void 0===l?void 0:l.projectId}?workspaceId=${he}`)();case"rename":return ie(K.A.actions.setManageProjectId(null===l||void 0===l?void 0:l.projectId)),ie(O.A.actions.setFocusId(o)),void ie(K.A.actions.setEditProjectNameDialog(!0));case"move":return ie(K.A.actions.setManageProjectId(null===l||void 0===l?void 0:l.projectId)),ie(K.A.actions.setMoveProjectDialog(!0)),void ie(O.A.actions.setFocusId(o));case"duplicate":return void(Ce()?(0,d.vA)((()=>{ie(K.A.actions.setManageProjectId(null===l||void 0===l?void 0:l.projectId)),ie(K.A.actions.setManageProjectName(null===l||void 0===l?void 0:l.projectName)),ie(K.A.actions.setDuplicateProjectDialog(!0)),ie(K.A.actions.setMoveProjectDialog(!0)),ie(O.A.actions.setFocusId(o))})):ie(K.A.actions.setUpgradePrompt({open:!0,type:de.K7.ProjectLimitReached})));case"share":return void(l?!je()||je()&&Ie?(ie(K.A.actions.setManageProjectId(l.projectId)),ie(K.A.actions.setProjectUsersDrawer(re.r.SHARE)),localStorage.setItem(D.gi.SHARE_PROJECT_SOURCE,"Studio Home"),ie(O.A.actions.setFocusId(o))):ie(K.A.actions.setUpgradePrompt({open:!0,type:de.K7.UnlockCollaboration})):((0,Y.Qg)("Could not share project. Please try again."),ie(O.A.actions.setFocusId(o))));case"details":return void(l?(ie(K.A.actions.setManageProjectId(l.projectId)),ie(K.A.actions.setProjectUsersDrawer(re.r.DETAILS)),ie(O.A.actions.setFocusId(o))):((0,Y.Qg)("Could not share project. Please try again."),ie(O.A.actions.setFocusId(o))));case"delete":return void(0,d.vA)((()=>{ie(K.A.actions.setManageProjectId(null===l||void 0===l?void 0:l.projectId)),ie(K.A.actions.setDeleteProjectDialog(!0)),ie(O.A.actions.setFocusId(o))}));case"perm_delete":return void P(l.projectId);case"restore":return void E(l.projectId)}},De=(e,o)=>{0===V.length&&(ie(O.A.actions.setBulkMoveState("projects")),(0,r.ENR)(D.No.BULK_ACTION_CLICKED,{"Entry Point":"Item Icon","File Type":"Project"})),ie(O.A.actions.updateBulkProjects({projectId:e,isChecked:o}))},Le=e=>{ie(Te?O.A.actions.popSelectedProject(null===l||void 0===l?void 0:l.projectId):O.A.actions.upsertSelectedProject(null===l||void 0===l?void 0:l.projectId))},Fe=e=>{if(e.stopPropagation(),(!oe||Ae)&&(Z||V.length!==ee))if(oe||te||ne)De(null===l||void 0===l?void 0:l.projectId,!Z);else if("SEARCH_RESULTS"===B&&(0,r.ENR)(D.No.SEARCH_FINISHED,{"Entry Point":"See all",Type:"Project"}),y!==be.TRASH)if(j)if(null!==J&&void 0!==J&&J.length)e.preventDefault(),Le();else{const o=le.get("qState");e.preventDefault(),(0,r.ooL)(W,`/studio/project${l.v2Project?"/2":""}/${l.projectId}?workspaceId=${he}&${null!==o&&void 0!==o&&o.length?`qState=${o}`:""}`)()}else e.preventDefault(),g()};return(0,w.jsxs)("a",{href:oe||te||ne||j?"#":null,draggable:_e,tabIndex:"0",className:`project-card ${F||$||Z?"project-card--bulkselected":""} ${Te?"project-card--selected":""} ${null!==h&&void 0!==h?h:""} ${Q||q?"project-card--blurred":""}`,onFocus:()=>{Ae&&U(!0)},onBlur:()=>{Ae&&U(!1)},onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),e.stopPropagation(),Fe(e))},onClick:Fe,onMouseEnter:()=>{Ae&&M(!0)},onMouseLeave:()=>{Ae&&M(!1)},onDragStart:e=>{oe&&!Z&&ie(O.A.actions.removeAllBulkprojects()),e.dataTransfer.setData("text/plain",JSON.stringify(l)),ie(O.A.actions.setProjectDragState(!0));const o=document.createElement("div");o.style.position="absolute",o.style.top="-9999px",document.body.appendChild(o),G.current=o,f.render((0,w.jsx)(ve,{lastBulkSelectedProject:X,bulkSelectedProjects:V}),G.current),oe&&Z&&e.dataTransfer.setDragImage(G.current.firstChild,0,32)},onDragEnd:e=>{e.preventDefault(),ie(O.A.actions.setProjectDragState(!1)),G.current&&(f.unmountComponentAtNode(G.current),document.body.removeChild(G.current),G.current=null)},id:null===l||void 0===l?void 0:l.projectId,children:[(0,w.jsxs)("div",{className:"project-card__content",children:[(()=>{switch(null===l||void 0===l?void 0:l.type){case"VIDEO":case"IMAGE":return(0,w.jsx)(w.Fragment,{children:k?(0,w.jsx)("img",{className:"fit-image",alt:"",src:(0,r.ye6)("murf-icon-rebranded.svg"),draggable:!1}):(0,w.jsx)("img",{draggable:!1,style:{width:"100%",objectFit:"cover",backgroundPositionY:0,height:"100%"},className:"project-card__image",src:null===l||void 0===l?void 0:l.thumbUrl,alt:"",onError:()=>L(!0)})});case"AUDIO":return(0,w.jsx)("span",{className:"material-icons-round md-48 text-white","aria-hidden":"true",children:"music_note"});default:return null!==l&&void 0!==l&&l.thumbUrl&&!k?(0,w.jsx)("img",{draggable:!1,style:{width:"100%",objectFit:"cover",backgroundPositionY:0,height:"100%"},className:"project-card__image",src:null===l||void 0===l?void 0:l.thumbUrl,alt:"",onError:()=>L(!0)}):(0,w.jsx)("img",{draggable:!1,style:{width:"50%",objectFit:"cover",backgroundPositionY:0,height:"100%"},className:"project-card__image bnw opacity-2",src:(0,r.ye6)("murf-icon-rebranded.svg"),alt:"",onError:()=>L(!0)})}})(),v&&(0,w.jsx)(w.Fragment,{children:(0,w.jsx)("div",{role:"img","aria-label":"",style:{width:"100%",objectFit:"cover",backgroundPositionY:0,height:"100%"},className:"position-absolute h-100 project-card__image project-card__image--masked",children:v})}),p&&(0,w.jsx)("div",{className:`project-card__content__checkbox ${Te||J.length?"project-card__content__checkbox--active":""} `,children:(0,w.jsx)(b.Sc,{checked:Te,onChange:Le,className:"mf-checkbox",onKeyDown:e=>{e.key===H.mu.Enter&&Le()}})}),(a||(null===l||void 0===l?void 0:l.duration))&&(0,w.jsx)("div",{className:"project-card__content__info-container",children:a?a():null===l||void 0===l?void 0:l.duration})]}),(0,w.jsxs)("div",{className:"project-card__footer "+(F||$||Z?"project-card__footer-bulkselected":""),children:[(0,w.jsxs)("div",{className:"d-flex align-items-center",style:{maxHeight:"90%"},children:[!Q&&Ae&&(F||$||oe)?(0,w.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,w.jsx)(b.Sc,{className:"project-card__footer__check-box","aria-label":"bulk select project checkbox",checked:Z,disabled:!Z&&V.length>=ee,onChange:e=>{e.stopPropagation(),De(null===l||void 0===l?void 0:l.projectId,e.target.checked)},onClick:e=>{e.stopPropagation()},onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),e.stopPropagation(),De(null===l||void 0===l?void 0:l.projectId,!Z))}})}):(0,w.jsx)("img",{src:(0,r.ye6)("murf-icon-rebranded.svg"),alt:"murf icon 
3waves",className:"project-card__footer__icon",tabIndex:"0"}),(0,w.jsx)(b.EY,{ellipsize:!0,className:"line-height-reset font-14",title:null!==(o=null===l||void 0===l?void 0:l.projectName)&&void 0!==o?o:"Untitled",style:{maxWidth:(0,r.a8N)(150)},children:null!==(t=null===l||void 0===l?void 0:l.projectName)&&void 0!==t?t:"Untitled"})]}),j?(0,w.jsxs)(b.AM,{minimal:!0,position:b.$x.BOTTOM_RIGHT,isOpen:T,onClose:()=>R(!1),popoverClassName:"rounded-2 popover-rounded-2",children:[(0,w.jsx)(b.$n,{id:null!==l&&void 0!==l&&l.recentProjectId?l.recentProjectId:null===l||void 0===l?void 0:l.projectId,small:!0,className:"button-icon-center project-card__more-button",icon:(0,w.jsx)("span",{className:"material-icons-round text-dark-gray5 md-16","aria-hidden":"true",children:"more_vert"}),onKeyDown:e=>{e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),R(!T)},position:N.yX.BOTTOM,"aria-label":"More options"}),(0,w.jsx)(S.A,{focusId:null!==l&&void 0!==l&&l.recentProjectId?l.recentProjectId:null===l||void 0===l?void 0:l.projectId,className:"rounded-2 p-1",menuClassName:"remove-anchor-underline",items:!!Re.length&&Re.filter((e=>!(!l.v2Project&&"duplicate"===e.value))).map((e=>({...e,disabled:ke({value:e.value})}))),onClick:(e,o)=>{ke({value:e.value})?o.stopPropagation():(Oe(e.value),R(!1))}})]}):""]})]})},je=[{name:"Open",value:"open",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"file_open"}),ariaLabel:"Open project"},{name:"Open in new tab",value:"open_in_new",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"open_in_new"}),ariaLabel:"Open project in new tab"},{name:"Rename",value:"rename",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_rename_outline"}),ariaLabel:"Rename project"},{name:"Share",value:"share",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"share"}),ariaLabel:"Share project"},{name:"Move",value:"move",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"drive_file_move"}),ariaLabel:"Move project",divider:(0,w.jsx)(b.cG,{})},{name:"Duplicate",value:"duplicate",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"content_copy"}),ariaLabel:"Duplicate project"},{name:"Delete",value:"delete",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete project",intent:"danger"}],ge=[{name:"Delete",value:"perm_delete",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"delete"}),ariaLabel:"Delete project permanently",intent:"danger"},{name:"Restore",value:"restore",icon:(0,w.jsx)("span",{className:"material-icons-round md-16 studio-image-menu-icon","aria-hidden":"true",children:"restore_from_trash"}),ariaLabel:"Restore project"}],xe=e=>{var o,t;let{project:i,isTemplate:l=!1,children:a=null,className:u,linkToProject:p=!0,onCardClick:v=()=>{},parentFolder:h=null,mode:j,disableEdit:g=!1,handleDelete:x=()=>{},handleRestore:f=()=>{},label:y}=e;const[I,P]=(0,n.useState)(!1),[E,C]=(0,n.useState)(!1),{selectedProjects:T}=(0,d.d4)((e=>e.studioHomeState)),R=(0,d.wA)(),{folderIdFromParams:k}=(0,s.A)(),[L,F]=(0,n.useState)(!1),{bulkSelectedProjects:M,bulkFolderMoveState:$,bulkSubFolderMoveState:U}=(0,d.d4)((e=>e.studioHomeState)),B=D.km.BULK_ACTION_LIMIT,H=M.some((e=>e===(null===i||void 0===i?void 0:i.projectId)))&&"Recent Projects"!==y,{bulkProjectMoveState:W}=(0,d.d4)((e=>e.studioHomeState)),G=new Date(null===i||void 0===i?void 0:i.createdAt),J=null!==i&&void 0!==i&&i.modifiedAt?new Date(i.modifiedAt):"",V=e=>e?e.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}):"",{getPermissions:z}=(0,_.S)(),{EDIT_PROJECT:Q,SHARE_PROJECT:q}=z({accessList:A.Mf,resource:h}),X=Q&&!("TEMPLATES"===k||"Recent Projects"===y||"SEARCH_RESULTS"===k||"SHARED_WITH_ME"===k),{DELETE:Z,RESTORE:ee}=z({accessList:A.YG}),{activeWorkspaceId:oe}=(0,d.d4)((e=>e.userState)),te=null!==oe&&void 0!==oe?oe:(0,m.Cu)(),ne=(0,c.useHistory)(),ie=null===T||void 0===T?void 0:T.includes(null===i||void 0===i?void 0:i.projectId),le=j===be.TRASH?ge:je,ae=e=>{let{value:o}=e;switch(o){case"rename":case"move":case"duplicate":case"delete":return!Q||g;
3case"share":return!q;case"perm_delete":return!Z;case"restore":return!ee;default:return!1}},se=(e,o)=>{0===M.length&&(R(O.A.actions.setBulkMoveState("projects")),(0,r.ENR)(D.No.BULK_ACTION_CLICKED,{"Entry Point":"Item Icon","File Type":"Project"})),R(O.A.actions.updateBulkProjects({projectId:e,isChecked:o}))};return(0,w.jsxs)("a",{href:W||$||U||p?"#":null,className:`w-100 p-2 mb-2 project-list-item ${ie?"project-list-item--selected":""} ${l?"project-list-item--template":""} ${null!==u&&void 0!==u?u:""}${L||H?"project-list-item__bulk-selected":""}`,onClick:e=>{e.stopPropagation(),W&&!X||(H||M.length!==B)&&(W||$||U?se(null===i||void 0===i?void 0:i.projectId,!H):("SEARCH_RESULTS"===k&&(0,r.ENR)(D.No.SEARCH_FINISHED,{"Entry Point":"See all",Type:"Project"}),j!==be.TRASH&&(p?null!==T&&void 0!==T&&T.length?(e.preventDefault(),R(ie?O.A.actions.popSelectedProject(null===i||void 0===i?void 0:i.projectId):O.A.actions.upsertSelectedProject(null===i||void 0===i?void 0:i.projectId))):(e.preventDefault(),(0,r.ooL)(ne,`/studio/project${i.v2Project?"/2":""}/${i.projectId}?workspaceId=${te}`)()):e.preventDefault())))},onMouseEnter:()=>{X&&F(!0)},onMouseLeave:()=>{X&&F(!1)},children:[X&&(L||W)&&(0,w.jsx)("div",{onClick:e=>e.stopPropagation(),style:{position:"absolute"},children:(0,w.jsx)(b.Sc,{className:"project-list-item__check-box",checked:H,onChange:e=>{e.stopPropagation(),se(null===i||void 0===i?void 0:i.projectId,e.target.checked)},onClick:e=>{e.stopPropagation()},disabled:!H&&M.length>=B})}),(0,w.jsxs)("div",{className:"d-flex align-items-center "+(W?"ml-4":""),children:[!l&&(0,w.jsx)("div",{style:{width:"16px"}}),(0,w.jsxs)("div",{className:"project-list-item__thumbnail",children:[(()=>{switch(null===i||void 0===i?void 0:i.type){case"VIDEO":case"IMAGE":return(0,w.jsx)(w.Fragment,{children:E?(0,w.jsx)("img",{className:"fit-image bnw",alt:i.projectName||"",src:(0,r.ye6)("murf-icon-rebranded.svg"),draggable:!1}):(0,w.jsx)("img",{draggable:!1,src:null===i||void 0===i?void 0:i.thumbUrl,alt:(null===i||void 0===i?void 0:i.name)||"",className:"project-list-item__thumbnail__image",onError:()=>C(!0)})});case"AUDIO":return(0,w.jsx)("span",{className:"material-icons-round md-48 text-white",children:"music_note"});default:return null!==i&&void 0!==i&&i.thumbUrl&&!E?(0,w.jsx)("img",{draggable:!1,src:null===i||void 0===i?void 0:i.thumbUrl,alt:(null===i||void 0===i?void 0:i.name)||"",className:"project-list-item__thumbnail__image",onError:()=>C(!0)}):(0,w.jsx)("img",{src:(0,r.ye6)("murf-icon-rebranded.svg"),style:{width:"100%",objectFit:"cover",backgroundPositionY:0},draggable:!1,alt:(null===i||void 0===i?void 0:i.name)||"",className:"project-list-item__thumbnail__image bnw opacity-2",onError:()=>C(!0)})}})(),(0,w.jsx)("div",{className:"project-list-item__thumbnail__icon"})]})]}),(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{className:"font-14",children:null!==(o=null===i||void 0===i?void 0:i.projectName)&&void 0!==o?o:"Untitled"}),(0,w.jsx)("div",{className:"font-12 text-muted",children:null!==(t=null===i||void 0===i?void 0:i.duration)&&void 0!==t?t:""})]}),!l&&!a&&(0,w.jsx)("div",{className:"text-muted font-12 px-3",children:`${V(G)}`}),!l&&!a&&(0,w.jsx)("div",{className:"text-muted font-12 px-3",children:`${V(J)}`}),a&&(0,w.jsx)("div",{style:{justifySelf:"end"},children:a}),!a&&(0,w.jsx)("div",{style:{justifySelf:"end"},children:(0,w.jsxs)(b.AM,{minimal:!0,position:b.$x.BOTTOM,isOpen:I,onClose:()=>{P(!1),(0,r.Yum)(null!==i&&void 0!==i&&i.recentProjectId?i.recentProjectId:null===i||void 0===i?void 0:i.projectId)},children:[(0,w.jsx)(b.$n,{small:!0,id:null!==i&&void 0!==i&&i.recentProjectId?i.recentProjectId:null===i||void 0===i?void 0:i.projectId,className:"editor-button ml-0",icon:(0,w.jsx)("span",{className:"material-icons-round text-dark-gray5 md-16","aria-hidden":"true",children:"more_vert"}),onClick:e=>{e.preventDefault(),e.stopPropagation(),P(!I)},position:N.yX.BOTTOM,"aria-label":"More options"}),(0,w.jsx)(S.A,{items:le.map((e=>({...e,disabled:ae({value:e.value})}))),onClick:e=>(e=>{switch(P(!1),e){case"open":return void(0,r.ooL)(ne,`/studio/project/2/${null===i||void 0===i?void 0:i.projectId}?workspaceId=${te}`)();case"open_in_new":return void(0,r.iDi)(`/studio/project/2/${null===i||void 0===i?void 0:i.projectId}?workspaceId=${te}`)();case"rename":return R(K.A.actions.setManageProjectId(i.projectId)),void R(K.A.actions.setEditProjectNameDialog(!0));case"move":return R(K.A.actions.setManageProjectId(i.projectId)),void R(K.A.actions.setMoveProjectDialog(!0));case"duplicate":return R(K.A.actions.setManageProjectId(i.projectId)),R(K.A.actions.setManageProjectName(i.projectName)),R(K.A.actions.setDuplicateProjectDialog(!0)),void R(K.A.actions.setMoveProjectDialog(!0));case"share":return void(i?(R(K.A.actions.setManageProjectId(i.projectId)),R(K.A.actions.setProjectUsersDrawer(re.r.SHARE)),localStorage.setItem(D.gi.SHARE_PROJECT_SOURCE,"Project List Item")):(0,Y.Qg)("Could not share project. Please try again."));case"delete":return R(K.A.actions.setManageProjectId(null===i||void 0===i?void 0:i.projectId)),void R(K.A.actions.setDeleteProjectDialog(!0));case"perm_delete":return void x(i.projectId);case"restore":return void f(i.projectId)}})(e.value)})]})})]})};var fe=t(28017);const be={NORMAL:1,TRASH:2},Ne="createdMinutesAgo",Ae={projectName:{name:"Name ( A-Z )",value:"projectName",order:I,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},projectNameDesc:{name:"Name ( Z-A )",value:"projectName",order:P,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})},createdMinutesAgo:{name:"Created On ( Latest first )",value:"createdAt",order:I,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},createdMinutesAgoDesc:{name:"Created On ( Oldest first )",value:"createdAt",order:P,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})},modifiedMinutesAgo:{name:"Modified On ( Oldest first )",value:"modifiedAt",order:I,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},modifiedMinutesAgoDesc:{name:"Modified On ( Latest first )",value:"modifiedAt",order:P,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})},projectOwner:{name:"Owner",order:I,value:"projectOwner",hidden:!0,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_upward_alt"})},projectOwnerDesc:{name:"Owner",order:P,value:"projectOwner",hidden:!0,icon:(0,w.jsx)("span",{className:"material-icons-round text-gray1 md-18 w-40 px-2","aria-hidden":"true",children:"arrow_downward_alt"})}},_e=[{asc:"createdMinutesAgo",desc:"createdMinutesAgoDesc",label:"Created"}];const ye=function(e){var o,t;let{label:l=null,projects:a,isRecent:c=!1,allowSort:u=!0,mode:m=be.NORMAL,disableEdit:p=!1,handleDelete:v=()=>{},handleRestore:h=()=>{}}=e;
3const[j,g]=(0,n.useState)(!0),[x,f]=(0,n.useState)(null===Ae||void 0===Ae?void 0:Ae[Ne].order),[N,y]=(0,n.useState)(null===Ae||void 0===Ae?void 0:Ae[Ne].value),[S,I]=(0,n.useState)(null===Ae||void 0===Ae?void 0:Ae[Ne].name),P=(0,d.wA)(),{getPermissions:E}=(0,_.S)(),{EDIT_PROJECT:C}=E({accessList:A.Mf}),T=C,R=D.km.BULK_ACTION_LIMIT,{projectView:F,projects:M,processedTree:$,bulkSelectedProjects:U}=(0,d.d4)((e=>e.studioHomeState)),{folderIdFromParams:B}=(0,s.A)(),H=$?null!==(o=null===(t=$[B])||void 0===t?void 0:t.rootFolder)&&void 0!==o?o:B:null,K=H?$[H]:null,W=(0,n.useMemo)((()=>{var e,o,t,n;return null!==(e=c?null===a||void 0===a||null===(o=a.filter((e=>M[e])))||void 0===o||null===(t=o.map((e=>({...M[e],recentProjectId:`recent-${e}`}))))||void 0===t||null===(n=t.reverse())||void 0===n?void 0:n.slice(0,4):null===a||void 0===a?void 0:a.map((e=>M[e])).filter(Boolean).sort((0,r.WJs)(N,x,"createdAt"===N?-1:1)))&&void 0!==e?e:[]}),[c,a,N,x,M]),G=W.slice(0,R).map((e=>null===e||void 0===e?void 0:e.projectId)),{canCreateProject:J}=(0,de.Ay)(),V=(e,o,t)=>!!(e&&o&&t)&&(0!==e.length&&0!==o.length&&(o.every((o=>e.includes(o)))&&t.length===o.length)),Y=V(a,U,G);(0,n.useEffect)((()=>{P(O.A.actions.setBulkProjectCheckBoxState(Y))}),[Y,P]);const z=(e,o)=>{0===U.length&&P(O.A.actions.setBulkMoveState("projects")),P(O.A.actions.toggleSelectAllProjects({projects:e,isSelected:o,limit:R})),o&&(0,r.ENR)(D.No.BULK_ACTION_CLICKED,{"Entry Point":"Select All","File Type":"Project"})},Q=(null===W||void 0===W?void 0:W.length)>R,q=(0,w.jsx)("div",{role:"presentation",onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),z(G,!V(a,U,G)))},children:(0,w.jsx)(b.Sc,{id:"bulk-project-checkbox",inline:!0,style:{color:fe.T.common.black,fontWeight:"500",width:"100px",paddingLeft:"40px"},checked:V(a,U,G),onChange:e=>z(G,e.target.checked),label:"Select All",className:"m-0",role:"checkbox",tabIndex:"0"})});return(0,w.jsxs)("div",{className:"d-flex flex-column studio__content__projects__wrapper",children:[(0,w.jsxs)("div",{className:"mb-2 studio__content__projects__heading "+(j?"":"studio__content__projects__heading--collapsed"),children:[(0,w.jsxs)("div",{className:"d-flex align-items-center",children:[(0,w.jsx)(b.$n,{minimal:!0,small:!0,style:{whiteSpace:"nowrap"},icon:j?(0,w.jsx)("span",{className:"material-icons-round md-24","aria-label":"Expanded",children:"arrow_drop_down"}):(0,w.jsx)("span",{className:"material-icons-round md-24","aria-label":"Collapsed",children:"arrow_drop_up"}),onClick:function(){g(!j)},className:"font-weight-500 font-22 mr-2 studio__content__projects__heading__button-text studio__content__projects__main-heading__button-text ",children:`${l||"Projects"} ${c?"":`(${(null===W||void 0===W?void 0:W.length)||0})`}`}),(0,w.jsx)("div",{className:"studio__content__projects__heading__divider mr-2"}),T&&!c&&Array.isArray(a)&&(null===W||void 0===W?void 0:W.length)>0&&(Q?(0,w.jsx)(b.m_,{content:`First ${R} items will be selected.`,intent:L.J.NONE,position:"top",children:q}):q),u&&F===i.mM.CARD&&(0,w.jsx)(k,{mode:m,viewType:F,defaultState:Ne,sortingOptions:Ae,sortBy:S,setSortBy:I,sortValue:N,setSortValue:y,sortMode:x,setSortMode:f},"SORT_PROJECT_CARDS")]}),(0,w.jsx)("div",{}),F===i.mM.LIST&&m!==be.TRASH&&(0,w.jsx)(k,{mode:m,viewType:F,defaultState:Ne,sortingOptions:Ae,sortingOptionsInListView:_e,sortBy:S,setSortBy:I,sortValue:N,setSortValue:y,sortMode:x,setSortMode:f},"SORT_PROJECT_LIST"),F===i.mM.LIST&&m!==be.TRASH&&(0,w.jsx)("div",{className:"text-muted",children:"Last Modified"}),(0,w.jsx)("div",{})]}),(0,w.jsx)(b.SD,{isOpen:j,children:W.length>0?(0,w.jsx)("div",{className:"studio__content__projects",children:F===i.mM.CARD?(0,w.jsx)("div",{className:"studio__content__projects__cards "+(c?"studio__content__projects__cards--recent":""),children:W.filter((e=>!!e)).map((e=>M&&(0,w.jsx)(he,{project:e,parentFolder:K,linkToProject:m!==be.TRASH,mode:m,handleDelete:v,handleRestore:h,disableEdit:p,label:l,children:m===be.TRASH&&(0,w.jsxs)("div",{className:"d-flex gap-2",children:[(0,w.jsx)(b.$n,{intent:L.J.DANGER,text:"Delete",small:!0,className:"mb-1",onClick:()=>v(e.projectId)}),J()&&(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Restore",small:!0,onClick:()=>h(e.projectId)})]})},null===e||void 0===e?void 0:e.projectId)))}):W.map((e=>
3M&&(0,w.jsx)(xe,{project:e,parentFolder:K,linkToProject:m!==be.TRASH,mode:m,disableEdit:p,label:l,children:m===be.TRASH&&(0,w.jsxs)("div",{className:"d-flex",children:[(0,w.jsx)(b.$n,{intent:L.J.DANGER,text:"Delete",onClick:()=>v(e.projectId),small:!0,className:"mr-1"}),J()&&(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Restore",small:!0,onClick:()=>h(e.projectId)})]})},null===e||void 0===e?void 0:e.projectId)))}):(0,w.jsx)("div",{className:"w-100 mt-3 text-center text-muted font-14 font-weight-600",children:"No Projects"})})]})};var Se=t(86289),we=t(64208),Ie=t(69864);const Pe="You don't have permissions to perform this action",Ee="You can only create 1 folder in Free plan",Ce=e=>{let{label:o,cardLabel:t,cardIcon:n,cardImage:i,cardOnClick:l,showTooltip:a=!1,tooltipProps:r=null,...s}=e;return(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)("div",{style:{width:"240px"},className:"text-gray1 font-14 font-rubik mb-3",children:o}),(0,w.jsx)(we.A,{label:t,icon:n,image:i,onClick:l,...s,showTooltip:a,tooltipProps:r})]})},Te=e=>{let{className:o}=e;const t=(0,d.wA)(),{getPermissions:n}=(0,_.S)(),{CREATE_PROJECT:i,CREATE_ROOT:l}=n({accessList:A.Mf}),a=n({accessList:A.o4}),s=(0,d.d4)((e=>e.userState.activeWorkspaceId)),c=(0,d.d4)((e=>{var o;return null===(o=e.studioHomeState.workspaces[s])||void 0===o?void 0:o.roleType})),u=(0,d.d4)((e=>e.userState.pricingPlan)),m=(0,d.d4)((e=>e.studioHomeState.rootFolders));const p=(a&&void 0!==a?Object.keys(a).filter((e=>a[e])):[]).length,{canCreateProject:v,canInviteUsers:h}=(0,de.Ay)();return(0,w.jsxs)("div",{className:`d-flex flex-column font-rubik getting-started-section ${o}`,children:[(0,w.jsx)("div",{className:"font-24 font-weight-500 mb-2",children:"Getting Started"}),(0,w.jsxs)("div",{className:"d-flex align-items-center studio__empty-state__cards",children:[(0,w.jsx)(Ce,{label:"You are just few minutes away from creating a stunning voiceover.",cardLabel:"Create Project",cardIcon:"add_circle",disabled:!i,cardOnClick:function(){v()?(t(K.A.actions.setCreateProjectOverlay(!0)),(0,r.ENR)(D.No.CREATE_PROJECT_START,{"Entry Point":"getting_started"}),(0,r.GYB)(Ie.F6.EVENT_NAME)):t(K.A.actions.setUpgradePrompt({open:!0,type:de.K7.ProjectLimitReached}))},showTooltip:!i,tooltipProps:{content:Pe}}),(0,w.jsx)(Ce,{label:"Start by creating a folder. Folders are great way to organise your work.",cardLabel:"Create Folder",cardIcon:"create_new_folder",cardOnClick:function(){(0,r.ENR)(D.No.CREATE_FOLDER_START,{"Folder Type":"Root Folder","Entry Point":"getting_started"}),t(K.A.actions.setManageRootFolderDrawer(!0))},disabled:!l||(null===u||void 0===u?void 0:u.includes("FREE"))&&(null===m||void 0===m?void 0:m.length)>=2,showTooltip:!l||(null===u||void 0===u?void 0:u.includes("FREE"))&&(null===m||void 0===m?void 0:m.length)>=2,tooltipProps:{content:u.includes("FREE")&&(null===m||void 0===m?void 0:m.length)>=2?Ee:Pe}}),(0,w.jsx)(Ce,{label:"Add teammates to your workspace for faster collaboration & feedback",cardLabel:"Invite Teammates",cardIcon:"person_add",disabled:!p,cardOnClick:function(){h()?((0,r.ENR)(D.No.INVITE_USER_POPUP,{"Invite Source":"folder",Mode:"Invitation","Inviter Role":c,"Entry Point":"getting_started"}),localStorage.setItem(D.gi.INVITE_USER_SOURCE,"getting_started"),t(K.A.actions.setInviteUserDialog(!0))):t(K.A.actions.setUpgradePrompt({open:!0,type:de.K7.UnlockCollaboration}))},showTooltip:!p,tooltipProps:{content:Pe}})]})]})},Re=()=>{var e,o;const{projectView:t,processedTree:i,allRootFoldersApiStatus:c,allProjectsApiStatus:u,recentProjects:p,trash:j,rootFolders:g,projects:x}=(0,d.d4)((e=>e.studioHomeState)),f=(0,d.wA)(),{folderIdFromParams:b,updateFolderId:N}=(0,s.A)(),A=j?j.projects:[],_=null===p||void 0===p?void 0:p.filter((e=>!(null!==A&&void 0!==A&&A.includes(e))));v();const y=b===m.Kj,S=(0,d.d4)((e=>b?e.studioHomeState.processedTree[b]:e.studioHomeState.processedTree[m.Kj])),I=null===S||void 0===S?void 0:S.projects,P=null===S||void 0===S||null===(e=S.childFolders)||void 0===e?void 0:e.map((e=>i[e])),E=null===g||void 0===g?void 0:g.filter((e=>e!==m.Kj&&e!==m.mD)).map((e=>i[e])),C=(0,d.d4)((e=>e.studioHomeState.globalFilterMode)),T=null===C||void 0===C?void 0:C.active,R=(e,o,t)=>{const{type:n,data:i}=o;if(!Array.isArray(e))return[];const l="Modified date"===n?"modifiedAt":"createdAt",a=e=>{if(!e)return null;const o=new Date(e);return o.setHours(0,0,0,0),o};if(null!==i&&void 0!==i&&i.date){const o=a(i.date);return o?e.filter((e=>{const n=t(e,l);if(!n)return!1;const i=a(n);return i&&i<=o})).sort(((e,o)=>(a(t(e,l))||0)-(a(t(o,l))||0))):e}if(null!==i&&void 0!==i&&i.days){const o=i.days.match(/\d+/),n=o?parseInt(o[0],10):NaN;if(isNaN(n))return console.error("Invalid days format in data:",i.days),e;const r=a(new Date),s=new Date(r);return s.setDate(r.getDate()-n),e.filter((e=>{const o=t(e,l);if(!o)return!1;const n=a(o);return n&&n>=s&&n<=r})).sort(((e,o)=>(a(t(e,l))||0)-(a(t(o,l))||0)))}return e},k=(0,n.useMemo)((()=>{const e=y?E:P;if(null===C||void 0===C||!C.active)return e;const o=e.map((e=>null===e||void 0===e?void 0:e.id));let t=R(o,C,((e,o)=>{var t,n;return null!==(t=null===(n=i[e])||void 0===n?void 0:n[o])&&void 0!==t?t:null}));return t.map((e=>
3i[e])).filter(Boolean)}),[C,P,E,y,i]),L=(0,n.useMemo)((()=>null!==C&&void 0!==C&&C.active?R(I,C,((e,o)=>{var t,n;return null!==(t=null===(n=x[e])||void 0===n?void 0:n[o])&&void 0!==t?t:null})):I),[C,I,x]);function M(e){(0,r.ENR)(D.No.OPEN_FOLDER,{"Entry Point":"Explorer Breadcrumbs","Folder Type":null!==e&&void 0!==e&&e.startsWith("WF")?"Root Folder":"Sub Folder"}),N({folderId:e})}const $=c===r.dOd.success,B=c===r.dOd.error,H=u===r.dOd.success,K=u===r.dOd.error;return(0,w.jsx)(w.Fragment,{children:$&&!S?(0,w.jsx)(h.A,{title:"Folder not found",description:"Please make sure you are in the correct workspace and have permissions to view the folder",icon:l.Knk}):B||K?(0,w.jsx)(h.A,{title:"Could not load your data",description:"Please try again.",icon:l.Knk}):!H||!$||P.length||I.length||y&&E.length?(0,w.jsxs)("div",{className:"d-flex flex-column",children:[y&&$&&!T&&(0,w.jsx)(Te,{className:"mb-4"}),(0,w.jsx)("div",{className:"mb-4",children:(0,w.jsx)(Se.P,{currentFolderId:b,isLoading:!$,onBreadcrumbClick:M})}),T&&(0,w.jsxs)("div",{className:"mb-4 global-filter-card",children:[(0,w.jsxs)("div",{children:["Created date"===C.type?"Created On Or Before":"Modified On Or Before",":"," ",(null===(o=C.data.date)||void 0===o?void 0:o.toLocaleDateString())||C.data.days]}),(0,w.jsx)("span",{className:"material-icons-round cursor-pointer md-20",onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),f(O.A.actions.resetGlobalFilterMode()))},tabIndex:"0","aria-label":"Reset global filter",onClick:()=>f(O.A.actions.resetGlobalFilterMode()),children:"close"})]}),y&&$&&H&&_.length>0&&!T&&(0,w.jsx)(ye,{label:"Recent Projects",isRecent:!0,projects:_,allowSort:!1}),$&&(k.length||y&&E.length)?(0,w.jsx)(U,{folders:k,handleFolderClick:e=>{(0,r.ENR)(D.No.OPEN_FOLDER,{"Entry Point":"Folder Explorer","Folder Type":null!==e&&void 0!==e&&e.startsWith("WF")?"Root Folder":"Sub Folder"}),N({folderId:e})},mode:y?F.ROOTS:F.NORMAL,label:T?"Relevant Folders":null}):!$&&(0,w.jsx)(ne,{className:"mb-5"}),$&&H?L.length>0&&(0,w.jsx)(ye,{projects:L,label:T?"Relevant Projects":null}):(0,w.jsx)(ae,{projectView:t})]}):(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)("div",{className:"mb-4",children:(0,w.jsx)(Se.P,{currentFolderId:b,isLoading:!$,onBreadcrumbClick:M})}),(0,w.jsx)(a.A,{folder:S})]})})};var ke=t(29313);const Oe=e=>{let{projectView:o=i.mM.CARD}=e;return(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)("div",{className:`w-25 mb-3 studio__content__projects__heading ${j.w24}`,children:"Templates (5)"}),(0,w.jsx)("div",{children:o===i.mM.CARD?(0,w.jsx)("div",{className:"studio__content__projects__cards",children:x.map(((e,o)=>(0,w.jsx)(he,{project:e,canSelect:!1,className:j.w24,isTemplate:!0,children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0})},o)))}):x.map(((e,o)=>(0,w.jsx)(xe,{project:e,isTemplate:!0,className:j.w24,children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0})},o)))})]})},De=()=>{const{projectView:e}=(0,d.d4)((e=>e.studioHomeState)),o=(0,d.d4)((e=>e.clonable.apiStatus)),t=(0,d.d4)((e=>e.clonable.clonableProjects)),a=(0,d.wA)(),s=(0,n.useContext)(J.l7),{getPermissions:c}=(0,_.S)(),{CLONE:u}=c({accessList:A.Ul}),{canCreateProject:m}=(0,de.Ay)();(0,n.useEffect)((()=>{t||"IDLE"!==o||a((0,ke.$m)({authUser:s}))}),[t,o,s,a]);const p=(0,n.useMemo)((()=>{var e;return t&&null!==(e=Object.values(t))&&void 0!==e&&e.length?Object.values(t).reduce(((e,o)=>{var t;return e+(null!==(t=null===o||void 0===o?void 0:o.length)&&void 0!==t?t:0)}),0):0}),[t]),v=e=>{let{projectToClone:o}=e;u?m()?((0,r.ENR)(D.No.TEMPLATE_SELECT,{Type:null===o||void 0===o?void 0:o.category}),localStorage.setItem(D.gi.TEMPLATE_TYPE,JSON.stringify(null===o||void 0===o?void 0:o.category)),o?(0,d.vA)((()=>{a(K.A.actions.setManageProjectId(o.projectId)),a(K.A.actions.setManageProjectName(o.projectName)),a(K.A.actions.setCloneProjectWorkspaceId(o.uid)),a(K.A.actions.setCloneProjectDialog(!0))})):(0,Y.Qg)("Project cloning failed. Please try again.")):a(K.A.actions.setUpgradePrompt({open:!0,type:de.K7.ProjectLimitReached})):(0,Y.I9)("You don't have access to clone a template.")};return(0,w.jsx)(w.Fragment,{children:"DONE"!==o?(0,w.jsx)(Oe,{project
3View:e}):t&&p?(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)("div",{className:"mb-3 studio__content__projects__heading",children:(0,w.jsx)("div",{className:"d-flex align-items-center",children:(0,w.jsx)("div",{children:`Templates (${null!==p&&void 0!==p?p:0})`})})}),(0,w.jsx)("div",{className:"studio__content__projects",children:Object.keys(t).map(((o,n)=>{var l,a;return(0,w.jsxs)("div",{className:"mb-3",children:[(0,w.jsx)("div",{className:"font-12 mb-2",children:o}),e===i.mM.CARD?(0,w.jsx)("div",{className:"studio__content__projects__cards",children:null===(l=t[o])||void 0===l?void 0:l.map(((e,o)=>(0,w.jsx)(he,{project:e,canSelect:!1,linkToProject:!1,onCardClick:()=>v({projectToClone:e}),children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0,onClick:()=>v({projectToClone:e})})},`${null===e||void 0===e?void 0:e.projectName} - ${o}`)))}):null===(a=t[o])||void 0===a?void 0:a.map(((e,o)=>(0,w.jsx)(xe,{project:e,isTemplate:!0,linkToProject:!1,children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0,onClick:()=>v({projectToClone:e})})},`${null===e||void 0===e?void 0:e.projectName} - ${o}`)))]},`${o}-${n}`)}))})]}):(0,w.jsx)(b.IU,{icon:l.Knk,title:"No templates found"})})},Le=e=>{let{projectView:o=i.mM.CARD}=e;return(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)("div",{className:`w-25 mb-3 studio__content__projects__heading ${j.w24}`,children:"Trash (5)"}),(0,w.jsx)("div",{children:o===i.mM.CARD?(0,w.jsx)("div",{className:"studio__content__projects__cards",children:x.map(((e,o)=>(0,w.jsx)(he,{project:e,canSelect:!1,className:j.w24,isTemplate:!0,children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0})},o)))}):x.map(((e,o)=>(0,w.jsx)(xe,{project:e,isTemplate:!0,className:j.w24,children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,text:"Clone",small:!0})},o)))})]})};var Fe=t(49019),Me=t(50712);const $e=()=>{var e;const[o,t]=(0,n.useState)(r.dOd.idle),i=(0,d.wA)(),{trashApiStatus:a,projects:s,trashEnabled:c}=(0,d.d4)((e=>e.studioHomeState)),u=(0,d.d4)((e=>e.userState.limits.trashSupported)),p=(0,d.d4)((e=>e.studioHomeState.globalFilterMode)),v=(0,d.d4)((e=>e.studioHomeState.trash)),j=null===v||void 0===v?void 0:v.contents,g=(0,d.d4)((e=>e.userState)),x=(0,n.useContext)(J.l7),{getPermissions:f}=(0,_.S)(),{VIEW:N}=f({accessList:A.YG}),y=Object.keys((null===v||void 0===v?void 0:v.contents)||{}).filter((e=>v.rootFolderList.some((o=>o.folderId===e)))),S=Object.keys((null===v||void 0===v?void 0:v.contents)||{}).filter((e=>{var o,t;return"WFTrash"===(null===(o=v.folderIdToContentsMap)||void 0===o||null===(t=o[e])||void 0===t?void 0:t.parentFolderId)})),I=null===y||void 0===y?void 0:y.map((e=>({...j[e],id:e}))),P=null===S||void 0===S?void 0:S.map((e=>({...j[e],id:e}))),E=j?null===(e=j[m.mD])||void 0===e?void 0:e.projects:[],C=j?null===E||void 0===E?void 0:E.map((e=>s[e])):[];(0,n.useEffect)((()=>{x&&null!==x&&void 0!==x&&x.getIdToken&&a===r.dOd.idle&&u&&N&&(t(r.dOd.loading),i((0,W.LK)({authUser:x})).then((()=>{t(r.dOd.success)})).catch((()=>{t(r.dOd.error)})))}),[x,g,i,a,u,N]),(0,n.useEffect)((()=>{p.active&&i(O.A.actions.resetGlobalFilterMode())}),[i,p]);return(0,w.jsxs)("div",{className:"font-rubik",children:[o!==r.dOd.loading&&(!(null===I||void 0===I||!I.length)||!(null===C||void 0===C||!C.length)||!(null===P||void 0===P||!P.length))&&c&&(0,w.jsx)(b.Pq,{intent:"warning",icon:"warning-sign",className:"mb-3",children:"Projects in Trash will be permanently deleted after 30 days from the date of deletion."}),o===r.dOd.loading?(0,w.jsx)(Le,{}):u?N?null!==I&&void 0!==I&&I.length||null!==C&&void 0!==C&&C.length||null!==P&&void 0!==P&&P.length?(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)("div",{className:"mb-3 studio__content__projects__heading",children:(0,w.jsx)("div",{className:"d-flex align-items-center",children:(0,w.jsx)("div",{className:"font-20 font-weight-500",children:"Trash"})})}),(0,w.jsx)("div",{children:(0,w.jsx)(U,{folders:I,handleFolderClick:()=>{},mode:F.TRASH})}),(0,w.jsx)("div",{children:(0,w.jsx)(U,{folders:P,handleFolderClick:()=>{},mode:F.TRASH,isSubFolder:!0})}),(0,w.jsx)("div",{children:(0,w.jsx)(ye,{projects:E,mode:be.TRASH,handleDelete:function(e){i(K.A.actions.setDeleteProjectDialog(!0)),i(K.A.actions.setIsPermanentDelete(!0)),i(K.A.actions.setManageProjectId(e))},handleRestore:function(e){i(K.A.actions.setRestoreProjectDialog(!0)),i(K.A.actions.setManageProjectId(e))}})})]}):(0,w.jsx)(h.A,{title:"Trash is empty",description:"Your deleted projects and folders will appear here.",icon:l.Knk}):(0,w.jsx)(h.A,{title:"Access Denied",description:"Deleted projects can only be restored by administrators."}):(0,w.jsx)(h.A,{title:"Your Trash folder is empty.",description:"Deletion Recovery feature is not available in the free plan. Upgrade to a PRO plan or anything higher to enable this feature.",icon:l.Knk,action:(0,w.jsx)(b.$n,{onClick:e=>{e.preventDefault(),i(Me.Ay.actions.open(!0)),Fe.ReactGA.event({category:D.YM.CATEGORY_PROJECT,action:D.YM.ACTION_UPGRADE,label:`USER-${null===x||void 0===x?void 0:x.email}`})},text:"Upgrade",intent:L.J.PRIMARY,className:"mb-2"})})]})},Ue=()=>{var e,o;
3const{projectView:t,allProjectsApiStatus:i,projects:a,sharedProjects:s}=(0,d.d4)((e=>e.studioHomeState)),c=(0,d.wA)(),u=s?null===(e=Object.keys(s))||void 0===e?void 0:e.length:0,m=(0,d.d4)((e=>e.studioHomeState.globalFilterMode)),p=null===m||void 0===m?void 0:m.active,h=(0,n.useMemo)((()=>null!==m&&void 0!==m&&m.active?((e,o,t)=>{const{type:n,data:i}=o;if(!Array.isArray(e))return[];const l="Modified date"===n?"modifiedAt":"createdAt",a=e=>{if(!e)return null;const o=new Date(e);return o.setHours(0,0,0,0),o};if(null!==i&&void 0!==i&&i.date){const o=a(i.date);return o?e.filter((e=>{const n=t(e,l);if(!n)return!1;const i=a(n);return i&&i<=o})).sort(((e,o)=>(a(t(e,l))||0)-(a(t(o,l))||0))):e}if(null!==i&&void 0!==i&&i.days){const o=i.days.match(/\d+/),n=o?parseInt(o[0],10):NaN;if(isNaN(n))return console.error("Invalid days format in data:",i.days),e;const r=a(new Date),s=new Date(r);return s.setDate(r.getDate()-n),e.filter((e=>{const o=t(e,l);if(!o)return!1;const n=a(o);return n&&n>=s&&n<=r})).sort(((e,o)=>(a(t(e,l))||0)-(a(t(o,l))||0)))}return e})(Object.keys(s),m,((e,o)=>{var t,n;return null!==(t=null===(n=a[e])||void 0===n?void 0:n[o])&&void 0!==t?t:null})):Object.keys(null!==s&&void 0!==s?s:{})),[m,s,a]);return v(),(0,w.jsx)(w.Fragment,{children:i===r.dOd.loading?(0,w.jsx)(Oe,{projectView:t}):s&&u>0?(0,w.jsxs)("div",{className:"d-flex flex-column",children:[p&&(0,w.jsxs)("div",{className:"mb-4 global-filter-card",children:[(0,w.jsxs)("div",{children:["Created date"===m.type?"Created On Or Before":"Modified On Or Before",":"," ",(null===(o=m.data.date)||void 0===o?void 0:o.toLocaleDateString())||m.data.days]}),(0,w.jsx)(b.In,{icon:"cross",className:"cursor-pointer",onClick:()=>c(O.A.actions.resetGlobalFilterMode())})]}),(0,w.jsx)(ye,{projects:h,disableEdit:!0})]}):(0,w.jsx)(b.IU,{icon:l.Knk,title:"This folder is empty"})})};var Be=t(35323);const He=()=>{var e,o,t;const l=(0,d.wA)(),{searchInputValue:a,searchedProjects:c,searchedFolders:u,projectView:m,projects:p,processedTree:v}=(0,d.d4)((e=>e.studioHomeState)),h=(0,Be.W6)(),[j,g]=(0,n.useState)(!0),[x,f]=(0,n.useState)(!0),{folderIdFromParams:N,updateFolderId:A}=(0,s.A)(),_=v?null!==(e=null===(o=v[N])||void 0===o?void 0:o.rootFolder)&&void 0!==e?e:N:null,y=_?v[_]:null,S=(0,d.d4)((e=>e.studioHomeState.globalFilterMode)),I=S.active,P=(e,o,t)=>{const{type:n,data:i}=o||{};if(!Array.isArray(e))return[];if(!i)return e;const l="Modified date"===n?"modifiedAt":"createdAt",a=e=>{if(!e)return null;const o=new Date(e);return o.setHours(0,0,0,0),o};if(null!==i&&void 0!==i&&i.date){const o=a(i.date);return o?e.filter((e=>{const n=t(e,l);if(!n)return!1;const i=a(n);return i&&i<=o})):e}if(null!==i&&void 0!==i&&i.days){const o=i.days.match(/\d+/),n=o?parseInt(o[0],10):NaN;if(isNaN(n))return console.error("Invalid days format in data:",i.days),e;const r=a(new Date),s=new Date(r);return s.setDate(r.getDate()-n),e.filter((e=>{const o=t(e,l);if(!o)return!1;const n=a(o);return n&&n>=s&&n<=r}))}return e},E=(0,n.useMemo)((()=>{if(!S.active)return u;const e=null===u||void 0===u?void 0:u.map((e=>e.id)),o=P(e,S,((e,o)=>{var t,n;return null!==(t=null===(n=v[e])||void 0===n?void 0:n[o])&&void 0!==t?t:null}));return null===o||void 0===o?void 0:o.map((e=>v[e]))}),[S,u,v]),C=(0,n.useMemo)((()=>{if(!S.active)return c;const e=null===c||void 0===c?void 0:c.map((e=>e.projectId)),o=P(e,S,((e,o)=>{var t,n;return null!==(t=null===(n=p[e])||void 0===n?void 0:n[o])&&void 0!==t?t:null}));return null===o||void 0===o?void 0:o.map((e=>p[e]))}),[S,c,p]);function T(e){l(K.A.actions.setDeleteProjectDialog(!0)),l(K.A.actions.setIsPermanentDelete(!0)),l(K.A.actions.setManageProjectId(e))}function R(e){l(K.A.actions.setRestoreProjectDialog(!0)),l(K.A.actions.setManageProjectId(e))}const k=e=>{(0,r.ENR)(D.No.SEARCH_FINISHED,{"Entry Point":"See all",Type:"WFRoot"===N?"Home":"SHARED_WITH_ME"===N?"Shared With Me":"WF"===N.substring(0,2)?"Folder":"sub-folder"}),(0,r.ENR)(D.No.OPEN_FOLDER,{"Entry Point":"Folder Explorer","Folder Type":null!==e&&void 0!==e&&e.startsWith("WF")?"Root Folder":"Sub Folder"}),A({folderId:e})};return(0,n.useEffect)((()=>{""===a&&(0,r.ENR)(D.No.SEARCH_STARTED,{"Entry Point":"See all"})}),[a]),(0,w.jsxs)("div",{style:{height:"80%"},children:[(0,w.jsxs)("div",{onClick:()=>h.goBack(),tabIndex:"0",onKeyDown:e=>{(0,r.gJ$)(e)&&h.goBack()},className:"d-flex gap-2 align-items-center cursor-pointer",style:{width:"fit-content"},children:[(0,w.jsx)(b.In,{icon:"arrow-left",size:18}),(0,w.jsx)("div",{children:"Back"})]}),a.length?(0,w.jsxs)("div",{className:"font-18 mt-4",children:["Search Results for",(0,w.jsxs)("strong",{children:[' "',a.length?a:"",'"']})]}):(0,w.jsx)("div",{className:"font-18 mt-4",children:"Search Results"}),I&&(0,w.jsxs)("div",{className:"mb-4 mt-4 global-filter-card",children:[(0,w.jsxs)("div",{children:["Created date"===S.type?"Created On Or Before":"Modified On Or Before",":"," ",(null===(t=S.data.date)||void 0===t?void 0:t.toLocaleDateString())||S.data.days]}),(0,w.jsx)(b.In,{icon:"cross",className:"cursor-pointer",onClick:()=>l(O.A.actions.resetGlobalFilterMode())})]}),(!!C.length||!!E.length)&&(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"d-flex align-items-center mt-5",children:[(0,w.jsx)(b.$n,{minimal:!0,small:!0,style:{whiteSpace:"nowrap"},icon:x?(0,w.jsx)("span",{className:"material-icons-round md-24","aria-hidden":"true",children:"arrow_drop_down"}):(0,w.jsx)("span",{className:"material-icons-round md-24","aria-hidden":"true",children:"arrow_drop_up"}),onClick:()=>{f(!x)},className:"font-weight-500 font-22 mr-2 studio__content__folders__heading__button-text",children:`Relevant Folders (${null===E||void 0===E?void 0:E.length})`}),(0,w.jsx)("div",{className:"studio__content__folders__heading__divider mr-2"})]}),(0,w.jsx)(b.SD,{isOpen:x,children:E.length?(0,w.jsx)("div",{className:"studio__content__folders mt-2",children:E.map((e=>(0,w.jsx)(te,{folder:e,onClick:k,isRootFolder:null!==(null===e||void 0===e?void 0:e.rootFolder)&&void 0!==(null===e||void 0===e?void 0:e.rootFolder),rootFolder:null!==e&&void 0!==e&&e.rootFolder?v[null===e||void 0===e?void 0:e.rootFolder]:v[null===e||void 0===e?void 0:e.id]},null===e||void 0===e?void 0:e.id)))}):a?(0,w.jsxs)("div",{className:"w-100 mt-3 text-center font-22 font-weight-500",children:['No folders found matching "',a,'"']}):(0,w.jsx)("div",{className:"w-100 mt-3 text-center font-22 font-weight-500",children:"No folders found"})}),(0,w.jsxs)("div",{className:"d-flex mt-5 align-items-center",children:[(0,w.jsx)(b.$n,{minimal:!0,small:!0,style:{whiteSpace:"nowrap"},icon:j?(0,w.jsx)("span",{className:"material-icons-round md-24","aria-hidden":"true",children:"arrow_drop_down"}):(0,w.jsx)("span",{className:"material-icons-round md-24","aria-hidden":"true",children:"arrow_drop_up"}),onClick:()=>{g(!j)},className:"font-weight-500 mr-2 font-22 studio__content__projects__heading__button-text",children:`Relevant Projects (${null===C||void 0===C?void 0:C.length})`}),(0,w.jsx)("div",{className:"studio__content__folders__heading__divider mr-2"})]}),(0,w.jsx)("div",{className:"d-flex flex-column studio__content__projects__wrapper",children:(0,w.jsx)(b.SD,{isOpen:j,children:C.length>0?(0,w.jsx)("div",{className:"studio__content__projects",children:m===i.mM.CARD?(0,w.jsx)("div",{className:"studio__content__projects__cards mt-2",children:C.filter((e=>!!e)).map((e=>(0,w.jsx)(he,{project:e,parentFolder:y,handleDelete:T,handleRestore:R,disableEdit:!1},null===e||void 0===e?void 0:e.projectId)))}):C.map((e=>(0,w.jsx)(xe,{project:e,parentFolder:y,disableEdit:!1},null===e||void 0===e?void 0:e.projectId)))}):a?(0,w.jsxs)("div",{className:"w-100 mt-3 text-center text-muted font-14 font-weight-600",children:['No Projects found matching "',a,'"']}):(0,w.jsx)("div",{className:"w-100 mt-3 text-center text-muted font-14 font-weight-600",children:"No Projects found"})})})]}),!C.length&&!E.length&&(0,w.jsxs)("div",{style:{height:"100%",borderRadius:"8px",padding:"4px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,w.jsx)("img",{src:(0,r.$8G)("illustrations/empty-search-result.svg"),alt:"search",width:"200"}),a?(0,w.jsxs)("div",{style:{marginTop:"40px"},children:['No results were found for "',(0,w.jsx)("strong",{children:a}),'"']}):(0,w.jsx)("div",{style:{marginTop:"40px"},children:"No results found"}),(0,w.jsx)(b.$n,{onClick:()=>h.goBack(),className:"mt-3",intent:"primary",outlined:!0,children:"Go Back"})]})]})};var Ke=t(52407),We=(t(77475),t(62123)),Ge=t(12798),Je=t(30808);const Ve=()=>{const e=(0,d.wA)(),o=(0,n.useContext)(J.l7),t=(0,d.d4)((e=>e.pronunciationLibrary.allLibraries)),i=(0,d.d4)((e=>e.userVoices.voicesApiStatus)),l=(0,d.d4)((e=>e.userState.activeWorkspaceId)),a=(0,d.d4)((e=>{var o,t;return null===(o=e.studioHomeState.workspaces)||void 0===o||null===(t=o[l])||void 0===t?void 0:t.pronunciationLibraryEnabled}));(0,n.useEffect)((()=>{i&&i!==r.dOd.idle&&i!==r.dOd.error||e((0,ke.je)({authUser:o}))}),[o,e,i]);
3return{allLibraries:t.data,isLoading:t.isFetchingData,fetchAllLibraryData:()=>{null!==o&&void 0!==o&&o.getIdToken&&a&&(t.isFetchingData||e(Je.q.fetchAllPronunciationLibrary({authUser:o})))}}},Ye=()=>(0,w.jsx)("div",{className:"pronunciation-library-empty",children:(0,w.jsxs)("div",{className:"d-flex flex-column gap-4",children:[(0,w.jsx)(q.A,{tag:"h5",children:"How it works?"}),(0,w.jsx)("div",{className:"pronunciation-library-init-container",children:[{imgUrl:(0,r.jbv)("pronunciation-library-init-1.svg"),description:"Start by creating a list of words with their correct pronunciations"},{imgUrl:(0,r.jbv)("pronunciation-library-init-2.svg"),description:"Apply lists to folders based on your use case"},{imgUrl:(0,r.jbv)("pronunciation-library-init-3.svg"),description:"Projects within the folder will follow the pronunciations defined in the list"}].map(((e,o)=>(0,w.jsxs)(n.Fragment,{children:[(0,w.jsxs)("div",{className:"d-flex flex-column text-left gap-4",children:[(0,w.jsx)("div",{className:"text-center",style:{height:"140px"},children:(0,w.jsx)("img",{src:e.imgUrl,alt:"illustration"})}),(0,w.jsx)(q.A,{className:"text-center",children:e.description})]},o),o<2&&(0,w.jsx)(b.cG,{style:{margin:0}})]},o)))})]})}),ze=()=>{const e=(0,n.useContext)(J.l7),o=(0,d.wA)(),t=(0,d.d4)((e=>e.pronunciationLibrary.currentPronunciationLibrary)),i=null===t||void 0===t?void 0:t.libraryId;return{...t,updateAppliedToFoldersList:t=>{let{folders:n,libraryId:i,onSuccess:l,onError:a}=t;o(Je.q.updateLibrary({authUser:e,payload:{libraryId:i,appliedTo:n}})).unwrap().then((()=>{o((0,W.Np)({authUser:e})),l&&l()})).catch((()=>{a&&a()}))},updateLibraryAccessLevel:t=>{(0,r.ENR)(D.No.PRONUNCIATION_LIBRARY_PERMISSION_CHANGED,{Permission:"ADMIN"===t?"Only Admins":"EDITOR"===t?"Admins and Editors":t}),o(Je.q.updateLibrary({authUser:e,payload:{libraryId:i,accessLevel:t}}))}}},Qe=e=>{let{isOpen:o,handleClose:t,currentLibraryId:i,alreadyAppliedTo:l=[]}=e;const a=(0,d.d4)((e=>e.userState.activeWorkspaceId)),s=(0,d.d4)((e=>{var o;return null===(o=e.studioHomeState.workspaces[a])||void 0===o?void 0:o.displayName})),c=(0,d.d4)((e=>e.studioHomeState.processedTree)),u=(0,d.d4)((e=>
3e.pronunciationLibrary.allLibraries.data)),[p,v]=(0,n.useState)(!1),{updateAppliedToFoldersList:h}=ze(),j=(0,n.useMemo)((()=>{if(!c)return[];let e=Object.values(c);return e=e.filter((e=>![m.Kj,m.pd].includes(e.id)&&!e.rootFolder)).sort(((e,o)=>e.name.localeCompare(o.name))),e}),[c]),[g,x]=(0,n.useState)(l||[]),f=(0,n.useMemo)((()=>{if(!g&&!l)return!0;if((null===g||void 0===g?void 0:g.length)!==(null===l||void 0===l?void 0:l.length))return!1;const e=[...g].sort(),o=[...l].sort();return e.every(((e,t)=>e===o[t]))}),[g,l]),N=e=>{var o;return null===u||void 0===u||null===(o=u[e])||void 0===o?void 0:o.name};return(0,w.jsxs)(b.lG,{className:"pb-0 overflow-hidden",isOpen:o,onClose:t,style:{maxWidth:"600px"},isCloseButtonShown:!0,canEscapeKeyClose:!0,onOpened:()=>{(0,r.ENR)(D.No.APPLY_PRONUNCIATION_LIST_START,{})},title:(0,w.jsxs)("div",{children:[(0,w.jsx)(q.A,{fontSize:18,color:fe.T.common.black,weight:500,children:"Select locations to apply the list"}),(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],weight:400,children:"Any projects in those folders will automatically use the listed pronunciations"})]}),children:[(0,w.jsxs)("div",{className:"library-apply-to-dialog__body",children:[(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],weight:400,children:"Workspace"}),(0,w.jsxs)("div",{className:"library-apply-to__list-items with-border",children:[(0,w.jsx)("span",{className:"material-icons-round md-16",children:"home"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.common.black,children:s})]}),null!==j&&void 0!==j&&j.length?(0,w.jsx)("div",{className:"library-apply-to__folder-list-wrapper",children:j.map((e=>e.appliedPronunciationLibrary&&e.appliedPronunciationLibrary!==i?(0,w.jsxs)("div",{className:"library-apply-to__list-items",children:[(0,w.jsx)("span",{className:"material-icons-round md-20 text-gray2",children:"folder"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.common.black,children:e.name}),(0,w.jsxs)("div",{className:"ml-auto library-apply-to-chip",children:[(0,w.jsx)("span",{className:"material-icons-round md-18 text-gray1",children:"list"}),(0,w.jsx)("p",{children:N(e.appliedPronunciationLibrary)})]})]},e.id):(0,w.jsx)(b.Sc,{alignIndicator:y.C.RIGHT,checked:g.includes(e.id),onChange:()=>{return o=e.id,void(g.includes(o)?x((e=>e.filter((e=>e!==o)))):x((e=>[...e,o])));var o},labelElement:(0,w.jsxs)("div",{className:"library-apply-to__list-items",children:[(0,w.jsx)("span",{className:"material-icons-round md-20 text-gray2",children:"folder"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.common.black,children:e.name})]},e.id)},e.id)))}):(0,w.jsxs)(b.Pq,{className:"library-apply-to__folder-list-wrapper d-flex px-4",icon:"",intent:L.J.WARNING,children:[(0,w.jsx)("span",{className:"material-icons-round md-28 text-orange1 mt-2",children:"warning"}),(0,w.jsx)(q.A,{className:"ml-3 text-muted",fontSize:14,weight:"400",lineHeight:20,children:"There are no folders in this workspace. Create a folder first to apply a Pronunciation Library"})]})]}),(0,w.jsx)("div",{className:"library-apply-to-dialog__footer",children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,onClick:()=>{var e;v(!0);const o=null===u||void 0===u||null===(e=u[i])||void 0===e?void 0:e.accessLevel;(0,r.ENR)(D.No.PRONUNCIATION_LIST_APPLIED,{Permission:"EDITOR"===o?"Admins and Editors":"ADMIN"===o?"Admins only":o,"Folder IDs":g}),h({libraryId:i,folders:g,onError:()=>{v(!1),(0,Y.Qg)("Failed to apply pronunciations to folders")},onSuccess:()=>{v(!1),(0,Y.Te)("Pronunciations applied to folders successfully"),t()}})},disabled:f||p,loading:p,children:"Apply Now"})})]})};var qe=t(82367);const Xe=e=>{let{libraryId:o,handleLibrarySelectionToggle:t,isSelected:i,setShowApplyToForListId:l,redirectToLibrary:a}=e;const s=(0,d.d4)((e=>e.pronunciationLibrary.allLibraries.data)),c=(0,d.d4)((e=>e.userVoices.gen2LocaleData)),{name:u,appliedTo:m,localesIncluded:p,pronunciationCount:v}=null===s||void 0===s?void 0:s[o],{canApplyList:h,hasEditAccessToList:j}=(0,qe.A)({libraryId:o}),g=e=>{e.preventDefault(),e.stopPropagation(),a(o)},x=(0,n.useMemo)((()=>j?v?"":"No Pronunciations in the library to apply.":"You don't have edit access to this library"),[j,v]);return(0,w.jsxs)("div",{className:"library-list-item",onClick:g,role:"listitem",children:[(0,w.jsxs)("div",{className:"d-flex",children:[(0,w.jsx)(b.Sc,{checked:i,inline:!0,className:"mb-0 mr-0 py-2 align-items-center d-inline-flex",onChange:e=>{e.stopPropagation(),t(o)},disabled:!j,"aria-label":`Select Library: ${u}`,tabIndex:0,onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),e.stopPropagation(),t(o))}}),(0,w.jsxs)("div",{className:"d-flex gap-1 align-items-center justify-content-center",style:{maxWidth:"30ch"},children:[j?null:(0,w.jsx)("span",{className:"material-icons-round md-18",children:"lock"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,lineHeight:20,color:fe.T.common.black,"aria-label":`Library Name: ${u}`,children:u})]})]}),(0,w.jsx)("div",{children:null!==p&&void 0!==p&&p.length?(0,w.jsx)("div",{className:"locale-flag-container",children:null===p||void 0===p?void 0:p.map((e=>{var o;return(0,w.jsx)("img",{src:(0,r.rrQ)(`${(null===(o=c[e])||void 0===o?void 0:o.flagName)||"globe"}.svg`),alt:e,className:"locale-flag",tabIndex:-1,title:c[e]?`${c[e].language} - ${c[e].accent}`:""},e)}))}):"-"}),(0,w.jsxs)("div",{className:"d-flex gap-2",children:[(0,w.jsx)("img",{src:(0,r.ye6)("folder-opened.svg"),alt:"folder-opened"}),(0,w.jsxs)(q.A,{fontSize:14,weight:400,"aria-label":`Applied to: ${(null===m||void 0===m?void 0:m.length)||0} ${1===(null===m||void 0===m?void 0:m.length)?"Folder":"Folders"}`,children:[(null===m||void 0===m?void 0:m.length)||0," ",1===(null===m||void 0===m?void 0:m.length)?"Folder":"Folders"]})]}),(0,w.jsx)(q.A,{tag:"p",fontSize:18,weight:600,"aria-label":`Number of pronunciations: ${v}`,children:v}),(0,w.jsxs)("div",{className:"d-flex justify-content-end gap-2",children:[(0,w.jsx)(b.m_,{disabled:h,content:x,children:(0,w.jsx)(b.$n,{onClick:e=>
3{e.stopPropagation(),l(o)},intent:fe.y["Button-GrayBg"],small:!0,disabled:!h,"aria-label":`Apply ${u} to root folders`,children:"Apply"})}),(0,w.jsx)(b.$n,{style:{padding:"8px"},"aria-label":`Redirect to ${u}`,icon:(0,w.jsx)("span",{className:"material-icons-round text-primary md-18",children:"chevron_right"}),onClick:g})]})]},o)},Ze=e=>{let{actionItem:o}=e;const t=(0,d.wA)(),i=(0,n.useContext)(J.l7),l=(0,d.d4)((e=>e.pronunciationLibrary.allLibraries.data)),a=(0,c.useHistory)(),s=(0,d.d4)((e=>e.userState.activeWorkspaceId)),{activeWorkspaceData:u}=(0,ce.A)(),[m,p]=(0,n.useState)(null),v=e=>{(0,r.ENR)(D.No.PRONUNCIATION_LIST_OPENED,{"Entry point":"Pronunciation Library"}),a.push(`/studio/pronunciation-library/${e}?workspaceId=${s}`)},[h,g]=(0,n.useState)([]),[x,f]=(0,n.useState)(!1),[N,A]=(0,n.useState)(!1),_=e=>{g((o=>o.includes(e)?o.filter((o=>o!==e)):[...o,e]))},y=(0,n.useMemo)((()=>[{icon:(0,w.jsx)("span",{className:"material-icons-round md-16",children:"home"}),text:(0,w.jsx)("span",{style:{whiteSpace:"nowrap"},children:null===u||void 0===u?void 0:u.displayName}),id:"workspace-crumb",onClick:()=>{(0,r.ooL)(a,`${r.kLh}?workspaceId=${null===u||void 0===u?void 0:u.workspaceId}&folderId=WFRoot`)()}},{icon:(0,w.jsx)("span",{className:"material-icons-round md-16",children:"library_books"}),text:(0,w.jsx)("span",{style:{whiteSpace:"nowrap"},children:"Pronunciation Library"}),id:"pronunciation-library"}]),[null===u||void 0===u?void 0:u.displayName,null===u||void 0===u?void 0:u.workspaceId,a]),S=(0,n.useMemo)((()=>l?Object.keys(l).sort(((e,o)=>l[e].name.localeCompare(l[o].name))):[]),[l]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:"pronunciation-library-lists-container",children:[(0,w.jsx)(b.BI,{className:"library-breadcrumbs mb-3",items:y,breadcrumbRenderer:e=>{let{text:o,...t}=e;return(0,w.jsx)(b.Qp,{...t,text:(0,w.jsx)(b.EY,{ellipsize:!0,className:j.KJG,color:fe.T.grey[2],children:o}),intent:L.J.PRIMARY})},role:"navigation"}),(0,w.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,w.jsx)(q.A,{tag:"h5",fontSize:16,weight:500,color:fe.T.common.black,children:"Pronunciation Libraries"}),o]}),(0,w.jsxs)("div",{className:"pronunciation-library-lists",role:"list",children:[(0,w.jsxs)("div",{className:"library-list-item-header-sticky",children:[(0,w.jsxs)("div",{className:"library-list-item library-list-item-header",style:{color:fe.T.grey[1]},children:[(0,w.jsx)(q.A,{tag:"p",fontSize:14,"aria-label":"Library Name",children:"Name"}),(0,w.jsx)(q.A,{tag:"p",fontSize:14,"aria-label":"Locales included",children:"Locales included"}),(0,w.jsx)(q.A,{tag:"p",fontSize:14,"aria-label":"Applied to",children:"Applied to"}),(0,w.jsx)(q.A,{tag:"p",fontSize:14,"aria-label":"Number of pronunciations",children:"No. of pronunciations"})]}),null!==h&&void 0!==h&&h.length?(0,w.jsx)("div",{className:"library-list-item-selected",style:{gridTemplateColumns:"1fr"},children:(0,w.jsxs)("div",{className:"list-container-selected-list",children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{className:"material-icons-outlined text-primary font-weight-600 md-18 my-auto",children:"check_circle"}),(0,w.jsxs)(q.A,{fontSize:16,weight:500,children:[null===h||void 0===h?void 0:h.length," selected"]})]}),(0,w.jsx)("div",{children:(0,w.jsx)(b.$n,{intent:L.J.DANGER,outlined:!0,small:!0,onClick:()=>{f(!0),(0,r.ENR)(D.No.PRONUNCIATION_LIBRARY_DELETE_START,{})},"aria-label":`Delete ${null===h||void 0===h?void 0:h.length} ${1===(null===h||void 0===h?void 0:h.length)?"Library":"Libraries"}`,children:"Delete"})})]})}):null]}),S?S.map((e=>(0,w.jsx)(Xe,{libraryId:e,redirectToLibrary:v,handleLibrarySelectionToggle:_,setShowApplyToForListId:p,isSelected:null===h||void 0===h?void 0:h.includes(e)},e))):null]})]}),m?(0,w.jsx)(Qe,{isOpen:!0,currentLibraryId:m,handleClose:()=>p(null),alreadyAppliedTo:l[m].appliedTo||[]}):null,x?(0,w.jsx)(b.lG,{className:"pb-0 overflow-hidden",isOpen:x,onClose:()=>{f(!1),g([])},style:{maxWidth:"60vw"},isCloseButtonShown:!0,canEscapeKeyClose:!0,"aria-label":"Are you sure you want to delete these Pronunciation lists?",children:(0,w.jsxs)("div",{className:"create-pronunciation-library-body",children:[(0,w.jsxs)("div",{className:"d-flex gap-1 flex-column",children:[(0,w.jsx)(q.A,{fontSize:18,weight:500,children:"Are you sure you want to delete these Pronunciation lists?"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,children:"Lists will be removed from projects where they are applied"})]}),(0,w.jsxs)("div",{className:"d-flex gap-2",children:[(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,onClick:()=>{var e;null!==(e=h)&&void 0!==e&&e.length&&(A(!0),t(Je.q.deleteLibraryBulk({authUser:i,payload:e})).unwrap().then((()=>{g([]),A(!1),f(!1)})).catch((()=>{A(!1),(0,Y.Qg)("Unable to remove list at the moment")}))),(0,r.ENR)(D.No.PRONUNCIATION_LIBRARY_DELETE_SUCCESS,{})},loading:N,children:"Yes, Confirm"}),(0,w.jsx)(b.$n,{intent:L.J.NONE,outlined:!0,onClick:()=>{f(!1),g([])},disabled:N,"aria-label":"Cancel and close dialog",children:"Cancel"})]})]})}):null]})};var eo=t(1675),oo=t(67495);const to=e=>{let{setShowCreateLibraryPopup:o,canCreateList:t}=e;return(0,w.jsx)("div",{children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,icon:(0,w.jsx)("span",{className:"material-icons-round md-18",children:"add_circle"}),onClick:()=>{(0,r.ENR)(D.No.PRONUNCIATION_LIST_START,{"Entry point":"Pronunciation Library"}),o(!0)},disabled:!t,children:"Create New List"})})},no=()=>{var e,o;const{triggerCalendlyWebhook:t}=(0,eo.A)(),i=(0,d.wA)(),{setShowCreateLibraryPopup:l}=(0,Ge.A)(),{isLoading:a,allLibraries:s,fetchAllLibraryData:c}=Ve(),u=(0,d.d4)((e=>e.studioHomeState.workspaceStateApiStatus)),m=(0,n.useContext)(J.l7),{canCreateList:p}=(0,qe.A)({}),{userEnrichDetails:v}=(0,d.d4)((e=>e.userState));(0,n.useEffect)((()=>{c()}),[]);const h=(0,d.d4)((e=>{var o;return null===(o=e.userState)||void 0===o?void 0:o.activeWorkspaceId})),j=(0,d.d4)((e=>{var o,t;return null===(o=e.studioHomeState.workspaces)||void 0===o||null===(t=o[h])||void 0===t?void 0:t.pronunciationLibraryEnabled}));return u===r.dOd.loading?(0,w.jsx)(oo.A,{fullscreen:!0}):(0,w.jsxs)("div",{className:"pronunciation-library-container",style:{minHeight:"80%"},children:[s&&null!==(e=Object.keys(s))&&void 0!==e&&e.length?null:(0,w.jsxs)("div",{className:"pronunciation-library-callout d-flex gap-3",children:[(0,w.jsx)("img",{src:(0,r.jbv)("list-tasks.svg"),alt:"Pronunciation Library",style:{height:"100px"}}),(0,w.jsxs)("div",{className:"d-flex flex-column gap-4",children:[(0,w.jsx)(q.A,{tag:"h6",children:j?(0,w.jsxs)(w.Fragment,{children:["Kick off by creating",(0,w.jsx)("br",{}),"your very first Pronunciation List"]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(q.A,{tag:"h5",fontSize:16,weight:500,color:fe.T.common.black,style:{marginBottom:"4px"},children:"Pronunciation Library is an Enterprise only feature"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.grey[1],children:"Upgrade plan to use this feature"})]})}),j?(0,w.jsx)(to,{canCreateList:p,setShowCreateLibraryPopup:l}):(0,w.jsx)("div",{children:(0,w.jsx)(b.Aj,{intent:fe.y["Brand-Gradient-Primary"],onClick:()=>{t("Pronunciation Library"),Fe.ReactGA.event({category:D.YM.CATEGORY_NAVIGATE,action:D.YM.ACTION_CLICK,label:"Pronunciation Library"}),!((null===v||void 0===v?void 0:v.employeeSize)>=500)||null!==v&&void 0!==v&&v.isEducational?(0,r.gPR)(null===m||void 0===m?void 0:m.email)?i(K.A.actions.toggleStudioContactSalesDialog(!0)):window.open("https://murf.ai/enterprise?src=pronunciation-library","_blank"):i(O.A.actions.setCalendlyConfig({open:!0,utm_source:"studio",utm_medium:"contact_sales",utm_campaign:"pricing"}))},children:"Contact Sales"})})]})]}),a?(0,w.jsx)(b.y$,{}):s&&Object.keys(s).length?(0,w.jsx)(Ze,{actionItem:s&&null!==(o=Object.keys(s))&&void 0!==o&&o.length?(0,w.jsx)(to,{canCreateList:p,setShowCreateLibraryPopup:l}):null}):(0,w.jsx)(Ye,{}),(0,w.jsx)(We.A,{entryPoint:"Pronunciation Library"})]})},io=()=>{const{folderIdFromParams:e}=(0,s.A)(),o=(0,d.d4)((e=>e.userState.apiStatus));return(0,w.jsx)("div",{className:"h-100 font-rubik",children:(()=>
3{if("DONE"!==o)return(0,w.jsx)(Ke.A,{});switch(e){case i.KQ.TEMPLATES:return(0,w.jsx)(De,{});case i.KQ.TRASH:return(0,w.jsx)($e,{});case i.KQ.SHARED_WITH_ME:return(0,w.jsx)(Ue,{});case i.KQ.SEARCH_RESULTS:return(0,w.jsx)(He,{});case i.KQ.PRONUNCIATION_LIBRARY:return(0,w.jsx)(no,{});default:return(0,w.jsx)(Re,{})}})()})};var lo=t(15744);const ao=e=>{let{authUser:o}=e;const t=(0,c.useHistory)(),i=(0,d.d4)((e=>e.userState)),l=(0,d.d4)((e=>e.userState.apiStatus));(0,n.useEffect)((()=>{if(!o||"DONE"!==l)return;if((0,r.KRr)(o))return void t.push("/user/onboarding");const e=(null===i||void 0===i?void 0:i.createdAt)<1684328016200;if(o&&i&&i.autoCreateProject&&!i.firstName){if(e)return;t.push("/user/onboarding")}}),[i,o,t,l])},ro=()=>{const e=(0,d.wA)(),o=(0,d.d4)((e=>e.dialogState.newStudioHomeDialog)),t=[{label:"Organise",text:"Create folders and organise your projects in a way that suits your workflow best.",src:(0,r.jbv)("organise-new-studio-home.svg"),alt:"folder with files popping out of it"},{label:"Collaborate",text:"Invite your team to collaborate on projects with ease and share feedback instantly.",src:(0,r.jbv)("collaborate-new-studio-home.svg"),alt:"folder with multiple user avatars on it"},{label:"Access Control",text:"Assign and manage roles of your team members for relevant access to projects and folders.",src:(0,r.jbv)("access-control-new-studio-home.svg"),alt:"file with a lock on it"}],n=()=>{e(K.A.actions.toggleNewStudioHomeDialog(!1))};return(0,w.jsxs)(b.lG,{onClose:n,isOpen:o,className:"new-studio-home-dialog p-3",children:[(0,w.jsx)(b.$n,{onClick:n,className:"button-icon-center close-button align-self-end",small:!0,children:(0,w.jsx)("span",{className:"material-icons-round md-18",children:"close"})}),(0,w.jsxs)("div",{className:"p-3",children:[(0,w.jsx)("div",{className:"d-flex justify-content-between",children:(0,w.jsxs)("div",{children:[(0,w.jsx)(q.A,{tag:"h1",children:"Introducing the New studio home \ud83c\udf89"}),(0,w.jsx)(q.A,{children:"Experience fast collaboration and organization with the new Studio Home - making work a breeze."})]})}),(0,w.jsx)("div",{className:"d-flex w-100 justify-content-between my-4 mb-5",children:t.map(((e,o)=>(0,w.jsxs)("div",{className:"d-flex flex-column new-studio-home-dialog__item justify-content-start",children:[(0,w.jsx)("img",{src:e.src,alt:e.alt}),(0,w.jsx)(q.A,{className:"mt-3 mb-2",tag:"h4",children:e.label}),(0,w.jsx)(q.A,{className:"item-subtitle",fontSize:14,children:e.text})]},o)))}),(0,w.jsx)(b.$n,{large:!0,onClick:n,intent:L.J.PRIMARY,children:"Continue"}),(0,w.jsx)(b.$n,{large:!0,onClick:()=>{window.open("https://murf.ai/docs/studio-home-2/","_blank")},className:"ml-3",outlined:!0,children:"Learn More"})]})]})},so={AUTO_CREATE_PROJECT:{role:{allow:{[r.yd8.ENTERPRISE]:[A.gg.OWNER],[r.yd8.PRO]:[A.gg.OWNER],[r.yd8.TEAM]:[A.gg.OWNER],[r.yd8.BASIC]:[A.gg.OWNER],[r.yd8.FREE]:[A.gg.OWNER]}}}},co=e=>{var o;let{authUser:t,studioHomeVersion:i=2}=e;const[l,a]=(0,n.useState)(!1),s=(0,c.useHistory)(),{apiStatus:u,signedUpFromMobile:v}=(0,d.d4)((e=>e.userState)),h=(0,d.d4)((e=>e.userState.studioHomeUser)),{activeWorkspaceId:j}=(0,d.d4)((e=>e.userState)),g=(0,d.wA)(),x=(0,d.d4)((e=>e.userState.autoCreateProject)),f=(0,d.d4)((e=>e.userState.firstName)),b=(0,d.d4)((e=>e.studioHomeState.workspaceStateApiStatus)),{getPermissions:N}=(0,_.S)(),{AUTO_CREATE_PROJECT:A}=N({accessList:so}),y=null!==(o=JSON.parse(localStorage.getItem(r.wIh)))&&void 0!==o?o:void 0,{currentWorkspace:S}=(0,ce.A)(),w=(0,n.useRef)(S);(0,n.useEffect)((()=>{w.current=S}),[S]);const I=(0,n.useCallback)((e=>{var o,t;(0,r.ENR)(D.No.CREATE_PROJECT_SUCCESS,{type:"Auto","Project Type":"Start Blank","Voice Model Version":null===(o=w.current)||void 0===o?void 0:o.gen2ModelEnabled}),(0,r.ENR)(D.No.OPEN_PROJECT,{"Project Type":"Auto",Type:"Start Blank","Voice Model Version":null!==(t=w.current)&&void 0!==t&&t.gen2ModelEnabled?"Gen 2":"Gen 1","Rich Text Enabled":null===e||void 0===e?void 0:e.richTextEnabled})}),[]),P=(0,n.useCallback)((e=>{localStorage.setItem(D.Hw.timelineCollapse,!0),localStorage.setItem(D.Hw.panelCollapse,!0),e&&s.push(`/studio/project${e.v2Project?"/2":""}/${e.projectId}?workspaceId=${j}`)}),[s,j]),E=(0,n.useCallback)((e=>{var o;let{autoCreateProject:n=!0}=e;g((0,ke.sw)({authUser:t,projectName:"Untitled Project",autoCreate:n,folderId:m.Kj,subFolderId:m.Kj,gen2ModelEnabled:null===(o=w.current)||void 0===o?void 0:o.gen2ModelEnabled})).then((e=>{var o;const t=null!==(o=e.payload.project)&&void 0!==o?o:void 0;if(!t)return(0,Y.Qg)("Project Creation Failed"),void s.push(r.kLh);h&&g(O.A.actions.addProject({folderId:m.Kj,newProjectId:t.projectId})),n&&g(p.b_.actions.resetAutoCreate()),I(t),P(t)}))}),[t,g,s,P,h]);return(0,n.useEffect)((()=>{var e;"DONE"===u||b===r.dOd.success?(null!==(e=window)&&void 0!==e&&e.mobileCheck()?v&&"DONE"===u?s.push(`${r.AGX}/${r.A6M}
3`):(0,r.HlG)():a(!1),y?s.push(y.inviteLink):"DONE"===u&&x&&f&&A&&(!h||b===r.dOd.success)&&(2===i?h:!h)&&(a(!0),E({autoCreateProject:!0}))):a(!0)}),[x,u,g,f,E,A,b,h,i,y]),{loading:l}};var uo=t(52936),mo=t(73299),po=t(21178),vo=t(87202),ho=t(79358),jo=t(16454);const go=()=>{(0,d.d4)((e=>{var o;return null===e||void 0===e||null===(o=e.dialogState)||void 0===o?void 0:o.gen2Dialog})),(0,d.d4)((e=>{var o;return null===(o=e.userState)||void 0===o?void 0:o.gen2BannerVisited}));const{gen2ModelEnabled:e}=(0,ce.A)(),o=(0,d.d4)((e=>{var o;return null!==(o=e.userState.activeWorkspaceId)&&void 0!==o?o:(0,m.Cu)()})),{activeWorkspaceData:t}=(0,ce.A)(),[i,l]=(0,n.useState)(!1),[a,s]=(0,n.useState)(e),c=(0,d.wA)(),u=(0,n.useContext)(J.l7),{getPermissions:p}=(0,_.S)(),v=p({accessList:jo.L}),h=async()=>{try{if("SUCCESS"!==(await ho.JM.toggleGen2ModelWorkspace(u,a)).data.responseCode)throw new Error("Error while changing model");c(O.A.actions.setGen2ModelWorkspace({currentWorkspaceId:o,gen2ModelEnabled:a}))}catch(e){(0,Y.Qg)("Error while changing model")}};return(0,n.useEffect)((()=>{s(e)}),[e]),(0,w.jsxs)(b.lG,{isOpen:!1,className:"p-0 gen2-new-model-dialog",onOpened:()=>{(0,r.ENR)(D.No.NEW_MODEL_POPUP_SHOWN)},usePortal:!0,children:[(0,w.jsx)("div",{className:le()(j.sar,"my-3 mx-auto"),children:(0,w.jsx)("img",{src:(0,r.jbv)("gen2-banner.png"),alt:"Gen 2 feature",className:"gen2-illustration"})}),(0,w.jsxs)("div",{className:le()("d-flex border-top m-0 p-3 justify-content-between",j.DBf),children:[(0,w.jsx)(b.$n,{className:"px-3 py-2",small:!0,text:"Close",outlined:!0,onClick:async()=>{(0,r.ENR)(D.No.CLOSE_NEW_MODEL_POPUP),c(K.A.actions.setGen2BannerVisited(!1)),a!==e&&v.GEN2_TOGGLE&&await h(),await ho.JM.gen2BannerVisited(u)}}),(0,w.jsxs)("div",{className:"d-flex justify-content-end w-100",children:[v.GEN2_TOGGLE&&(0,w.jsx)(b.dO,{checked:a,label:"Set Gen 2 as default for new projects",onChange:()=>s(!a),className:"m-0 d-flex flex-center"}),(0,w.jsx)("div",{className:j.Nu2,children:(0,w.jsx)(b.$n,{intent:"primary",onClick:async()=>{l(!0),(0,r.ENR)(D.No.TRY_NEW_MODEL,{"Set as default":a?"true":"false","Voice Model Version":"Gen 2"}),a!==e&&v.GEN2_TOGGLE&&await h(),await ho.JM.gen2BannerVisited(u),l(!1),c(K.A.actions.setGen2BannerVisited(!1)),setTimeout((()=>{c(K.A.actions.setCreateProjectOverlay(!0))}),500)},loading:i,children:"Try Gen 2"})})]})]})]})};var xo=t(99276);const fo=()=>{const{libraryId:e}=(0,Be.g)(),o=(0,n.useContext)(J.l7),t=(0,d.wA)(),{activeWorkspaceData:i}=(0,ce.A)(),l=(0,Be.W6)(),a=(0,d.d4)((e=>e.pronunciationLibrary.currentPronunciationLibrary)),[s,c]=(0,n.useState)(!1),[u,m]=(0,n.useState)(!1);(0,n.useEffect)((()=>{null===o||void 0===o||!o.getIdToken||null!==a&&void 0!==a&&a.isFetchingData||(e&&(null===a||void 0===a?void 0:a.libraryId)!==e?(0,d.vA)((()=>{t(xo.A.actions.setIsFetchingPronunciations(!0)),t(Je.q.fetchLibraryDetails({authUser:o,payload:{libraryId:e}})).unwrap().then((()=>{t(Je.q.fetchLibraryPronunciations({authUser:o,payload:{libraryId:e}}))}))})):a&&!a.isFetchingPronunciations&&a.pronunciationCount&&!a.pronunciations&&t(Je.q.fetchLibraryPronunciations({authUser:o,payload:{libraryId:e}})))}),[t,a,e,o]);const p=(0,n.useMemo)((()=>{const e=[{icon:(0,w.jsx)("span",{className:"material-icons-round md-16","aria-hidden":"true",children:"home"}),text:(0,w.jsx)("span",{style:{whiteSpace:"nowrap"},children:null===i||void 0===i?void 0:i.displayName}),id:"workspace-crumb",onClick:()=>{(0,r.ooL)(l,`${r.kLh}?workspaceId=${null===i||void 0===i?void 0:i.workspaceId}&folderId=WFRoot`)()}},{icon:(0,w.jsx)("span",{className:"material-icons-round md-16","aria-hidden":"true",children:"library_books"}),text:(0,w.jsx)("span",{style:{whiteSpace:"nowrap"},children:"Pronunciation Library"}),onClick:()=>{(0,r.ENR)(D.No.PRONUNCIATION_LIBRARY_START,{"Entry point":"Pronunciation Library BreadCrumb"}),(0,r.ooL)(l,`${r.kLh}/pronunciation-library?workspaceId=${null===i||void 0===i?void 0:i.workspaceId}`)()}}];if(!a)return e;const{name:o}=a;return[...e,{icon:(0,w.jsx)("span",{className:"material-icons-round md-16","aria-hidden":"true",children:"notes"}),text:(0,w.jsx)("span",{style:{whiteSpace:"nowrap"},children:o}),id:`library-crumb-${o}`}]}),[null===i||void 0===i?void 0:i.displayName,null===i||void 0===i?void 0:i.workspaceId,a,l]);return{...a,breadcrumbs:p,handleEditPronunciationLibrary:()=>{const{setShowCreateLibraryPopup:o,setTitle:n,setDescription:i,setLibraryIdToEdit:l}=xo.A.actions,{name:r,description:s}=a;t(n(r)),t(i(s)),t(o(!0)),t(l(e))},handleRemovePronunciation:n=>{let{pronunciations:i,onSuccess:l,onError:a}=n;null!==i&&void 0!==i&&i.length&&(m(!0),t(Je.q.deleteLibraryPronunciations({authUser:o,payload:{libraryId:e,body:i}})).unwrap().then((()=>{m(!1),c(!1),(0,Y.Te)("Pronunciations removed successfully"),l&&l()})).catch((()=>{m(!1),(0,Y.Qg)("Failed to remove pronunciations"),a&&a()})))},showRemovePronunciationConfirmation:s,setShowRemovePronunciationConfirmation:c,isDeleting:u}};var bo=t(34805),No=t(41839),Ao=t(83243),_o=t(54524);const yo=(e,o)=>{let{handleClick:t,modifiers:n}=o;return n.matchesPredicate?(0,w.jsx)(b.Dr,{active:n.active,icon:(0,w.jsx)(_o.A,{className:"mr-2",locale:e.locale,style:{height:18,width:18},alt:e.name||"earth outlined"}),onClick:e=>{e.stopPropagation(),t(e)},onKeyDown:e=>{e.stopPropagation(),(0,r.gJ$)(e)&&t(e)},text:e.name+(null!==e&&void 0!==e&&e.accent?` - ${e.accent}`:"")},e.name+e.locale):null},So=e=>{let{items:o,itemsParentRef:t,renderItem:n}=e;const i=o.map(n).filter((e=>null!=e));return(0,w.jsx)(b.W1,{ulRef:t,className:"voice-selector-filters__lang-filter",children:i})},wo=e=>{let{activeLocale:o,setActiveLocale:t}=e;const i=(0,d.wA)(),l=(0,n.useContext)(J.l7),{voiceGroups:a,voicesApiStatus:s}=(0,d.d4)((e=>e.userVoices)),c=(0,n.useMemo)((()=>
3{if(null!==a&&void 0!==a&&a.length){const e={};return a.forEach((o=>{o.locale&&!e[o.locale]&&(e[o.locale]={name:o.language,locale:o.locale,accent:o.accent})})),Object.values(e)}return[]}),[a]);return(0,n.useEffect)((()=>{s&&![r.dOd.error,r.dOd.idle].includes(s)||i((0,ke.je)({authUser:l}))}),[s,l,i]),(0,w.jsx)(No.A,{className:"w-100 d-flex",role:"presentation",children:(0,w.jsx)(Ao.l,{activeItem:o,itemPredicate:(e,o)=>{var t;return null!==o&&void 0!==o&&o.name?(null===o||void 0===o||null===(t=o.name)||void 0===t?void 0:t.toLowerCase().indexOf(e.toLowerCase()))>=0:o.toLowerCase().indexOf(e.toLowerCase())>=0},items:[...c],itemRenderer:yo,itemListRenderer:So,onItemSelect:e=>{t(e)},resetOnQuery:!1,className:"w-100 d-flex lang-selector",popoverProps:{popoverClassName:"pronunciation-search-lang-list",minimal:!0},children:(0,w.jsxs)("div",{className:"w-100 d-flex gap-1 align-items-center",role:"presentation",children:[(0,w.jsx)(_o.A,{locale:o.locale,style:{height:(0,r.a8N)(20),width:(0,r.a8N)(20)},alt:(null===o||void 0===o?void 0:o.name)||"earth outlined"}),(0,w.jsx)("div",{style:{flexGrow:1,width:"100%"},children:(0,w.jsx)(q.A,{children:null!==o&&void 0!==o&&o.locale?`${o.name} ${(null===o||void 0===o?void 0:o.accent)||""}`:"All Languages"})}),(0,w.jsx)(b.Aj,{small:!0,text:null,rightIcon:"caret-down",minimal:!0,alignText:y.C.LEFT,fill:!0,className:"py-0 px-2 lang-list-item-button","aria-label":"Select language dropdow filter "+(null!==o&&void 0!==o&&o.name?`Selected language is ${null===o||void 0===o?void 0:o.name}`:""),onKeyDown:e=>{(0,r.gJ$)(e)&&(e.preventDefault(),e.stopPropagation(),t(o))}})]})})})};var Io=t(47916),Po=t(35110),Eo=t(12603),Co=t(18385),To=t(77999),Ro=t(29898),ko=t(89315),Oo=t(39177),Do=t(94483),Lo=t(80821);const Fo=e=>{let{libraryId:o,buttonProps:t,postAddToLib:i,children:l}=e;const{selectedPronunList:r,setSelectedPronunList:s}=(0,Co.A)(),{addPronunInLibBulk:d,doesWordExists:c}=(0,Oo.A)(),{hasEditAccessToList:u}=(0,qe.A)({libraryId:o}),[m,p]=(0,n.useState)(!1),[v,h]=(0,n.useState)(!1),{conflictsData:j,checkForConflicts:g,setConflictsData:x}=(0,Lo.A)(),f=e=>{p(!0),d({libraryId:o,pronuns:e,onSuccess:()=>{p(!1),s([]),i&&i()},onError:()=>p(!1)})},N=()=>{g({selectedPronunList:r,isUpdating:Boolean(1===(null===r||void 0===r?void 0:r.length)&&c(r[0].word))})?h(!0):f(r)};return(0,n.useEffect)((()=>()=>{p(!1)}),[]),null!==r&&void 0!==r&&r.length?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(b.m_,{disabled:u,content:a.$.NO_PERMISSIONS,usePortal:!1,children:l?n.cloneElement(l,{onClick:N,loading:m,disabled:!u}):(0,w.jsx)(b.$n,{small:!0,text:1===(null===r||void 0===r?void 0:r.length)&&c(r[0].word)?"Update in the List":"Add to list",className:"mr-2",onClick:N,disabled:!u,intent:L.J.PRIMARY,loading:m,...t})}),v?(0,w.jsx)(Do.A,{isOpen:v,onClose:()=>h(!1),handleConflictCancel:()=>{h(!1),s([]),x(null),i&&i()},handleSkipAndConfirm:()=>{const e=r.filter((e=>!j.keys.includes(e.word)));s(e),f(e),h(!1)},conflictsData:j,entryPoint:"Add existing"}):null]}):null},Mo=e=>{let{headline:o,caption:t}=e;const{libraryId:i}=(0,c.useParams)(),{status:l}=(0,d.d4)((e=>e.pronunciationLibrary.managerDialog)),[a,s]=(0,n.useState)(!1);(0,To.A)();const{hasEditAccessToList:u}=(0,qe.A)({libraryId:i}),{pronunciationManager:m,handleClose:p,setSearchTerm:v,isTeamsUser:j,selectedTab:g,setSelectedTab:x,selectedPronunList:f,setSelectedPronunList:N,collaborationNotAllowed:A,openUpgradeForCollab:_,filteredPronunList:y,arePronunciationsPresent:S}=(0,Co.A)(),{renderPronunciationActions:I,doesWordExists:P,doesPronunciationExists:E}=(0,Oo.A)(),C=(0,n.useMemo)((()=>{if(!y)return[];return Object.keys(y).sort(((e,o)=>null!==e&&void 0!==e&&e.length?null!==o&&void 0!==o&&o.length?e.localeCompare(o):-1:1))}),[y]);return(0,n.useEffect)((()=>()=>{s(!1)}),[]),(0,n.useEffect)((()=>{!a||null!==f&&void 0!==f&&f.length||s(!1)}),[null===f||void 0===f?void 0:f.length,a]),(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)(b._s,{size:"542px",hasBackdrop:!1,isOpen:m,onClose:p,children:[(0,w.jsxs)("div",{className:"pt-3 px-4 d-flex flex-column",children:[(0,w.jsx)(Ro.A,{headline:o,caption:t,handleClose:p}),(0,w.jsx)(ko.A,{placeholder:"Search pronunciations",onChange:e=>v(e.target.value)}),j?(0,w.jsxs)(b.tU,{id:"pronunciation-tabs",selectedTabId:g,onChange:e=>{N([]),x(e),s(!1)},className:"pl-3",children:[(0,w.jsx)(b.oz,{id:Io.BL.ALL,title:(0,w.jsx)("span",{className:"font-14",children:"All"})}),(0,w.jsx)(b.oz,{id:Io.BL.PERSONAL,title:(0,w.jsx)("span",{className:"font-14",children:"Personal"})}),(0,w.jsx)(b.oz,{id:Io.BL.TEAM,title:(0,w.jsx)("span",{className:"font-14",children:"Team"})})]}):null]}),(0,w.jsx)(b.cG,{className:"mt-0"}),(null===f||void 0===f?void 0:f.length)>0?(0,w.jsxs)("div",{className:"d-flex justify-content-between align-items-center px-4 mt-2",children:[(0,w.jsx)(b.EY,{children:`${null===f||void 0===f?void 0:f.length} selected`}),(0,w.jsx)("div",{children:(0,w.jsx)(Fo,{hasEditAccessToList:u,libraryId:i,postAddToLib:()=>{s(!1)}})})]}):null,(0,w.jsxs)("div",{className:"px-4 mt-3 overflow-auto",style:{paddingBottom:"4rem"},children:[A?(0,w.jsx)(Eo.A,{rootClass:"mx-5",column:!0,title:"Unlock collaboration",bottomSubTitle:"Get features like Sharing, Inviting and Commenting. For Enterprise plans only",primaryButtonText:de.Px.UpgradePlan,illustration:de.KJ,handlePrimaryClick:_,featureSource:D.V9.TEAM_PRONUNCIATION}):null,(l!==r.dOd.loading||y&&0!==(null===y||void 0===y?void 0:y.length))&&l!==r.dOd.loading?l===r.dOd.error?(0,w.jsx)(h.A,{}):S?(0,w.jsxs)(n.Fragment,{children:[l===r.dOd.loading&&(0,w.jsxs)("div",{className:"d-flex justify-content-center align-items-center mb-4",children:[(0,w.jsx)(b.EY,{className:"download-manager__muted-text font-14 text-center mr-2",children:"Checking for updates"}),(0,w.jsx)(b.y$,{size:18})]}),(0,w.jsx)("div",{className:"flex-start flex-row mt-1",children:(0,w.jsx)(b.Sc,{label:(0,w.jsx)(q.A,{fontSize:12,weight:500,children:"Select all"}),className:"d-flex align-items-center checkbox-border-fix",checked:a,onClick:()=>{(()=>{let e=y;const o=Object.values(e).flat();N(a?[]:o.filter((e=>!P(e.word)||!E({word:e.word,pronun:e.alternate}))))})(),s((e=>!e))}})}),null===C||void 0===C?void 0:C.map((e=>{var o,t;return(null===(o=y[e])||void 0===o?void 0:o.length)>0&&(0,w.jsx)(Po.A,{lang:e,pronuns:null===y||void 0===y||null===(t=y[e])||void 0===t?void 0:t.map((e=>{const o=E({word:e.word,pronun:e.alternate});return{...e,disabled:o}}
3)),libraryId:i,renderActions:e=>I({...e,libraryId:i,preAddToLib:()=>{(0,r.ENR)(D.No.PRONUNCIATION_ADDED_TO_LIBRARY,{Section:"Existing Pronunciations",Locale:e.locale,Type:g===Io.BL.PERSONAL?"Personal":g,"Entry point":"Add existing"})}})},e)}))]}):(0,w.jsx)(h.A,{title:"No pronunciations found",description:"",icon:"folder-open"}):(0,w.jsx)("div",{className:"h-100 w-100 mt-5 min-vh-50",role:"progressbar",children:(0,w.jsx)(b.y$,{})})]})]})})},$o=(0,n.memo)(Mo);var Uo=t(69073),Bo=t(64162),Ho=t(36252);const Ko=e=>{let{libraryId:o,word:t,locale:i,onClose:l,defaultIpa:a="",defaultAlternate:s="",isUpdating:c=!1}=e;const u=(0,d.d4)((e=>e.userVoices.gen2LocaleData)),m=null===u||void 0===u?void 0:u[i],[p,v]=(0,n.useState)({name:null===m||void 0===m?void 0:m.language,locale:i,accent:null===m||void 0===m?void 0:m.accent}),[h,j]=(0,n.useState)(a),[g,x]=(0,n.useState)(s),[f,N]=(0,n.useState)(!1),{addPronunInLib:A}=(0,Oo.A)(),_=()=>{l()},y=(0,n.useMemo)((()=>{var e,o;return null===p||void 0===p||!p.locale||!(null!==h&&void 0!==h&&null!==(e=h.trim())&&void 0!==e&&e.length)&&!(null!==g&&void 0!==g&&null!==(o=g.trim())&&void 0!==o&&o.length)}),[h,g,p]);return(0,w.jsxs)(b.lG,{className:"p-0 bg-white pronunciation-dialog custom-pronunciation-dialog",isOpen:!0,onClose:_,autoFocus:!0,usePortal:!0,isCloseButtonShown:!0,children:[(0,w.jsxs)("div",{style:{padding:"20px 16px",display:"flex",flexDirection:"column",gap:12},children:[(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)(q.A,{fontSize:22,weight:500,children:t}),(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.grey[2],children:"Creating custom pronunciation"})]}),(0,w.jsx)(b.cG,{style:{margin:0,borderColor:fe.T.grey.light[1]}}),(0,w.jsxs)("div",{className:"d-flex flex-column gap-2",children:[(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.grey[2],children:"Locale"}),(0,w.jsx)(wo,{activeLocale:p,setActiveLocale:v})]})]}),(0,w.jsx)("div",{style:{padding:24,backgroundColor:fe.T.grey.light[5]},children:(0,w.jsxs)("div",{style:{padding:24,backgroundColor:fe.T.common.white,borderRadius:8,border:`1px solid ${fe.T.grey.light[4]}`},children:[(0,w.jsx)(b.MG,{fill:!0,className:"bp3-v2-input mb-2",placeholder:"Enter alternate spellings here",name:"alt",spellCheck:!1,value:g,onChange:e=>{x(e.target.value),null!==h&&void 0!==h&&h.length&&j("")},rightElement:(0,w.jsx)(Ho.A,{pronun:{word:t,ipa:"",alternate:g,sayAs:!0,locale:p.locale},buttonProps:{disabled:!t||!(null!==g&&void 0!==g&&g.trim().length)},entryPoint:"Pronunciation Library",pronunType:"Alternate Spelling"},g+p.locale)}),(0,w.jsx)(q.A,{tag:"label",fontSize:12,children:'Spell it how it sounds. Eg. "finaans" for "finance"'}),(0,w.jsx)(q.A,{fontSize:13,className:"text-center mt-2 mb-2",children:"OR"}),(0,w.jsx)(b.MG,{value:h,onChange:e=>{j(e.target.value),null!==g&&void 0!==g&&g.length&&x("")},className:"bp3-v2-input mb-2",placeholder:'Enter "IPA"',name:"ipa",spellCheck:!1,rightElement:(0,w.jsx)(Ho.A,{pronun:{word:t,ipa:"",alternate:h,sayAs:!1,locale:p.locale},buttonProps:{disabled:!t||!(null!==h&&void 0!==h&&h.trim().length)},entryPoint:"Pronunciation Library",pronunType:"IPA"},h+p.locale)})]})}),(0,w.jsx)("div",{className:"footer",children:(0,w.jsxs)(b.$n,{intent:L.J.PRIMARY,onClick:()=>{if(y)return;const e=Boolean(null===g||void 0===g?void 0:g.length);N(!0),c?(0,r.ENR)(D.No.PRONUNCIATION_EDIT_SUCCESS,{Locale:p.locale,"Entry point":"Pronunciation Library",Type:e?"Alternate Spelling":"IPA"}):(0,r.ENR)(D.No.PRONUNCIATION_ADDED_TO_LIBRARY,{Section:"Custom",Locale:p.locale,Type:e?"Alternate Spelling":"IPA","Entry point":"Search Bar"}),A({pronun:{word:t,alternate:g||h,sayAs:e},libraryId:o,locale:p.locale,onSuccess:()=>{_(),N(!1)},onError:()=>{N(!1)}})},disabled:y,loading:f,children:[c?"Update":"Add","\xa0 Pronunciation"]})})]})},Wo=e=>{let{libraryId:o}=e;
3const t=(0,d.wA)(),[i,l]=(0,n.useState)({name:"English",locale:"en_US",accent:"US & Canada"}),[a,s]=(0,n.useState)(""),[c,u]=(0,n.useState)({}),[m,p]=(0,n.useState)(!1),[v,h]=(0,n.useState)(!1),{renderPronunciationActions:j,getSuggestions:g,doesWordExists:x,doesPronunciationExists:f}=(0,Oo.A)();return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:"pro-lib-search-container",children:[(0,w.jsxs)("div",{className:"pro-lib-search-section bg-white search-pronunciation",role:"searchbox","aria-label":"Search or add words",children:[(0,w.jsx)(Uo.b,{className:"text-muted",items:c?[c]:[],query:a,inputProps:{placeholder:"Search or add words",className:"search-pronunciation-input",role:"search",autoFocus:!0},popoverProps:{minimal:!0,matchTargetWidth:!0,popoverClassName:a?"pronunciation-suggest-popover":"hide-dot-popover",targetClassName:"search-pronunciation-input",usePortal:!1,autoFocus:Boolean(a)},onQueryChange:e=>{s(e),g({query:e,locale:null===i||void 0===i?void 0:i.locale,setSearchResults:u,setIsSearching:p})},itemPredicate:(e,o,t)=>{},noResults:(0,w.jsx)(w.Fragment,{}),itemRenderer:(e,t)=>{var n,l,d;return(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{className:"d-flex justify-content-between align-items-center bg-white",style:{zIndex:1},children:[(0,w.jsx)(q.A,{fontSize:16,weight:600,children:"Search Results"}),(0,w.jsx)(b.$n,{icon:(0,w.jsx)("span",{className:"material-icons-outlined md-18",children:"add_circle_outline"}),intent:fe.y["Button-GrayBg"],small:!0,onClick:()=>{h(!0)},disabled:x(a),children:"Create Custom Pronunciation"})]}),(0,w.jsxs)("div",{className:"d-flex flex-column gap-4 mt-4 overflow-y-auto pronunciation-suggest-popover-section-wrapper",children:[(0,w.jsxs)("div",{className:"pronunciation-suggest-popover-section",children:[(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],className:"mb-1",children:"Existing pronunciations"}),null!==(n=e.existingPronunciations)&&void 0!==n&&n.length?(0,w.jsx)(w.Fragment,{children:null===(l=e.existingPronunciations)||void 0===l?void 0:l.map(((e,t)=>(0,w.jsx)(Bo.A,{pronun:e,disabled:f({word:e.word,pronun:e.alternate}),showCheckBox:!1,renderActions:e=>j({...e,libraryId:o,preAddToLib:()=>{(0,r.ENR)(D.No.PRONUNCIATION_ADDED_TO_LIBRARY,{Section:"Existing Pronunciations",Locale:i.locale,Type:"Personal","Entry point":"Search Bar"})},onAddPronun:()=>{s(""),u({})}})},t)))}):(0,w.jsxs)("div",{className:"pronunciation-suggest-empty",children:[(0,w.jsx)("img",{src:(0,r.ye6)("pronunciation.svg"),alt:"pronunciation",className:"hw-16"}),(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],children:m?"Searching...":"No existing pronunciations"})]})]}),(0,w.jsxs)("div",{className:"pronunciation-suggest-popover-section",children:[(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],children:"Smart suggestions"}),null!==(d=e.smartSuggestions)&&void 0!==d&&d.length?e.smartSuggestions.map(((e,t)=>(0,w.jsx)(Bo.A,{pronun:e,showCheckBox:!1,renderActions:e=>j({...e,locale:e.locale||(null===i||void 0===i?void 0:i.locale),libraryId:o,preAddToLib:()=>{(0,r.ENR)(D.No.PRONUNCIATION_ADDED_TO_LIBRARY,{Section:"Smart Suggestions",Locale:i.locale,Type:"Smart","Entry point":"Search Bar"})},onAddPronun:()=>{s(""),u({})}})},t+e.word))):(0,w.jsxs)("div",{className:"pronunciation-suggest-empty",children:[(0,w.jsx)("img",{src:(0,r.ye6)("pronunciation.svg"),alt:"pronunciation",className:"hw-16"}),(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],children:m?"Searching...":"No smart suggestions"})]})]})]})]},"-")},inputValueRenderer:e=>console.log("inputValueRenderer",e),itemListPredicate:(e,o)=>o}),(0,w.jsx)(wo,{activeLocale:i,setActiveLocale:e=>{l(e),a&&g({query:a,locale:e,setSearchResults:u,setIsSearching:p})}})]}),(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",justifyContent:"space-between"},children:[(0,w.jsx)("div",{style:{flexGrow:1,display:"flex",justifyContent:"center"},children:(0,w.jsx)(b.cG,{style:{margin:0,borderColor:fe.T.grey.light[1]}})}),(0,w.jsx)(q.A,{children:"OR"}),(0,w.jsx)("div",{style:{flexGrow:1,display:"flex",justifyContent:"center"},children:(0,w.jsx)(b.cG,{style:{margin:0,borderColor:fe.T.grey.light[1]}})})]}),(0,w.jsxs)("div",{className:"pro-lib-search-section",style:{border:`1px dashed ${fe.T.grey.light[1]}
3`,maxWidth:(0,r.a8N)(300)},children:[(0,w.jsxs)(q.A,{fontSize:14,color:fe.T.grey[2],weight:400,tap:"p",children:["Looking for pronunciations that",(0,w.jsx)("br",{}),"already exist?"]}),(0,w.jsx)(b.$n,{icon:(0,w.jsx)("span",{className:"material-icons-outlined md-18","aria-hidden":"true",children:"add_circle_outline"}),intent:fe.y["Button-GrayBg"],onClick:()=>{t(bo.A.actions.togglePronunciationManager(!0))},children:"Add from existing pronunciations"})]})]}),(0,w.jsx)($o,{headline:"Pronunciations across projects",caption:"Find all pronunciations across lists and libraries"}),v?(0,w.jsx)(Ko,{libraryId:o,word:a,locale:null===i||void 0===i?void 0:i.locale,onClose:()=>{h(!1),s(""),u({})}}):null]})},Go=e=>{let{isOpen:o,onClose:t,pronunList:n=[],postConfirm:i,onCancel:l}=e;const{handleRemovePronunciation:a,isDeleting:s,name:d}=fo();return(0,w.jsx)(b.lG,{className:"pb-0 overflow-hidden",isOpen:o,onClose:t,style:{maxWidth:"60vw"},isCloseButtonShown:!0,canEscapeKeyClose:!0,children:(0,w.jsxs)("div",{className:"create-pronunciation-library-body",children:[(0,w.jsxs)("div",{className:"d-flex gap-1 flex-column",children:[(0,w.jsxs)(q.A,{fontSize:18,weight:500,children:["Are you sure you want to make edits to ",d,"?"]}),(0,w.jsx)(q.A,{fontSize:14,weight:400,children:"All projects inside the applied folders will reflect the changes"})]}),(0,w.jsxs)("div",{className:"d-flex gap-2",children:[(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,onClick:()=>{a({pronunciations:n,onSuccess:i}),(0,r.ENR)(D.No.PRONUNCIATION_DELETE_SUCCESS,{"Entry point":"Pronunciation Library"})},loading:s,children:"Yes, Confirm"}),(0,w.jsx)(b.$n,{intent:L.J.NONE,outlined:!0,onClick:l,disabled:s,children:"Cancel"})]})]})})},Jo=e=>{let{pronun:o,libraryId:t}=e;
3const[i,l]=(0,n.useState)(!1),[a,s]=(0,n.useState)(!1),[d,c]=(0,n.useState)(!1),{hasEditAccessToList:u}=(0,qe.A)({libraryId:t}),m=()=>{s(!0),l(!1),(0,r.ENR)(D.No.PRONUNCIATION_EDIT_START,{Locale:o.locale,"Entry point":"Pronunciation Library"})},p=()=>{c(!0),l(!1),(0,r.ENR)(D.No.PRONUNCIATION_DELETE_START,{"Entry point":"Pronunciation Library"})},v=()=>c(!1);return t&&o&&u?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(b.AM,{interactionKind:b.Ez.CLICK,isOpen:i,minimal:!0,onClose:()=>{a||d||l(!1)},children:[(0,w.jsx)(b.$n,{className:"button-icon-center project-card__more-button",minimal:!0,onKeyDown:e=>{e.stopPropagation()},icon:(0,w.jsx)("span",{className:"material-icons-round text-dark-gray5 md-16","aria-hidden":"true",children:"more_vert"}),"aria-label":"More options",onClick:e=>{null===e||void 0===e||e.stopPropagation(),u&&l((e=>!e))},style:{padding:"0.5rem"},disabled:!u}),(0,w.jsxs)(b.W1,{onClick:e=>e.stopPropagation(),role:"menu","aria-label":"Pronunciation Actions",children:[(0,w.jsx)(b.Dr,{text:"Edit","aria-label":"Edit Pronunciation",onClick:m,onKeyDown:e=>{(0,r.gJ$)(e)&&m()},role:"menuitem"}),(0,w.jsx)(b.cG,{}),(0,w.jsx)(b.Dr,{text:"Remove from List","aria-label":"Remove Pronunciation from List",onClick:p,onKeyDown:e=>{(0,r.gJ$)(e)&&p()},role:"menuitem"})]})]}),a?(0,w.jsx)(Ko,{libraryId:t,word:o.word,locale:o.locale,onClose:()=>{s(!1)},defaultAlternate:o.sayAs?o.alternate:"",defaultIpa:o.sayAs?"":o.alternate,isUpdating:!0}):null,d?(0,w.jsx)(Go,{isOpen:d,onClose:v,onCancel:v,postConfirm:v,pronunList:[o.word]}):null]}):null},Vo=e=>{let{pronunciations:o={},isLoading:t=!1,showRemovePronunciationConfirmation:i,selectedPronunciations:l,setSelectedPronunciations:a,libraryId:s}=e;const c=e=>{let{pronun:o}=e;return(0,w.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"d-flex align-items-center justify-content-between gap-1",children:[(0,w.jsx)(Ho.A,{pronun:o,entryPoint:"Pronunciation Library",pronunType:"Library Pronunciation"}),(0,w.jsx)(Jo,{pronun:o,libraryId:s})]})},{canCreateList:u,hasEditAccessToList:m}=(0,qe.A)({libraryId:s}),{gen2LocaleData:p,voicesApiStatus:v}=(0,d.d4)((e=>e.userVoices)),[h,j]=(0,n.useState)(!1),g=Object.keys(o),x=(0,n.useMemo)((()=>g.filter((e=>{var t;return null===(t=Object.values(o[e]))||void 0===t?void 0:t.length}))),[o,g]),f=(0,n.useMemo)((()=>{var e;return!o||0===(null===(e=Object.values(o).flat())||void 0===e?void 0:e.length)}),[o]),{setWordToPronunciationMap:N,setShowCreateLibraryPopup:A}=(0,Ge.A)(),_=e=>{var o;let t=null===(o=p[e])||void 0===o?void 0:o.language;var n,i;t?null!==(n=p[e])&&void 0!==n&&n.accent&&(t+=` \u2022 ${null===(i=p[e])||void 0===i?void 0:i.accent}`):t=v===r.dOd.loading?"Loading...":"Custom";return t},y=e=>{if(u||m)if(l.some((o=>(0,Io.p5)(e,o)))){const o=l.filter((o=>!(0,Io.p5)(o,e)));a(o),null!==o&&void 0!==o&&o.length||!h||j(!1)}else a((o=>[...o,e]))};return(0,w.jsxs)("div",{className:"d-flex gap-3 flex-column",children:[(0,w.jsx)(q.A,{tag:"h5",fontSize:16,role:"heading",children:"Pronunciations in the list"}),t?(0,w.jsx)(b.y$,{"aria-label":"loading pronunciations"}):f?(0,w.jsxs)("div",{className:"empty-pronunciation-list",children:[(0,w.jsx)("img",{src:(0,r.ye6)("pronunciation.svg"),alt:"pronunciation",style:{color:fe.T.grey.light[4],height:40,width:40,filter:"opacity(0.5)"}}),(0,w.jsx)(q.A,{tag:"p",fontSize:14,color:fe.T.grey[2],children:"Your list seems empty"})]}):(0,w.jsxs)("div",{className:"pronunciations-list-container",children:[u?(0,w.jsx)("div",{className:"flex-start flex-row",children:(0,w.jsx)("div",{tabIndex:-1,onKeyDown:e=>{if((0,r.gJ$)(e)){e.preventDefault();const t=!h;j(t),a(t?Object.values(o).flat():[])}},children:(0,w.jsx)(b.Sc,{checked:h,label:(0,w.jsx)(q.A,{fontSize:12,weight:500,children:"Select all"}),className:"d-flex align-items-center checkbox-border-fix",onChange:e=>{const t=e.target.checked;j(t),a(t?Object.values(o).flat():[])}})})}):null,null!==l&&void 0!==l&&l.length?(0,w.jsxs)("div",{className:"list-container-selected-list",children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{className:"material-icons-outlined text-primary font-weight-600 md-18 my-auto","aria-hidden":"true",children:"check_circle"}),(0,w.jsxs)(q.A,{fontSize:16,weight:500,children:[null===l||void 0===l?void 0:l.length," selected"]})]}),(0,w.jsxs)("div",{children:[m?(0,w.jsx)(b.$n,{intent:L.J.DANGER,outlined:!0,small:!0,onClick:()=>
3{i(!0),(0,r.ENR)(D.No.PRONUNCIATION_DELETE_START,{"Entry point":"Pronunciation Library"})},children:"Remove"}):null,(0,w.jsx)(b.$n,{intent:L.J.NONE,outlined:!0,small:!0,onClick:()=>{const e={};l.forEach((t=>{var n,i;const l=null===(n=o[t.locale])||void 0===n||null===(i=n.filter((e=>(0,Io.p5)(e,t))))||void 0===i?void 0:i[0];l&&(e[t.word]={locale:l.locale,alternate:l.alternate,word:l.word,sayAs:l.sayAs})})),N(e),(0,r.ENR)(D.No.PRONUNCIATION_LIST_START,{"Entry point":"From a list"}),A(!0)},disabled:!u,children:"Create a new list"})]})]}):null,(0,w.jsx)("div",{role:"main",className:"d-flex flex-column gap-2",children:x.map(((e,t)=>{return(0,w.jsxs)("fieldset",{id:`pronunciation-list-${e}`,role:"region","aria-label":`Pronunciations for ${_(e)}`,children:[(0,w.jsx)("legend",{children:(0,w.jsx)(q.A,{fontSize:14,color:fe.T.grey[2],tag:"h4",children:_(e)})}),(0,w.jsx)("div",{"aria-label":`Pronunciations for ${_(e)}`,children:(n=Object.values(o[e]),[...n||[]].sort(((e,o)=>e.word.localeCompare(o.word)))).map(((e,o)=>(0,w.jsx)("div",{children:(0,w.jsx)(Bo.A,{pronun:e,renderActions:c,onSelect:y,isSelected:l.some((o=>(0,Io.p5)(o,e))),showCheckBox:u||m},`${null===e||void 0===e?void 0:e.alternate}-${o}`)},`${null===e||void 0===e?void 0:e.alternate}-${o}`)))})]},e);var n}))})]})]})},Yo=()=>{const{breadcrumbs:e,name:o,description:t,libraryId:i,handleEditPronunciationLibrary:l,isFetchingData:a,isFetchingPronunciations:r,pronunciations:s,showRemovePronunciationConfirmation:d,setShowRemovePronunciationConfirmation:c}=fo(),{hasEditAccessToList:u}=(0,qe.A)({libraryId:i}),[m,p]=(0,n.useState)([]);return(0,n.useEffect)((()=>()=>{p([])}),[i]),a?(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(b.y$,{})}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{role:"navigation",children:(0,w.jsx)(b.BI,{className:"library-breadcrumbs",items:e,breadcrumbRenderer:e=>{let{text:o,...t}=e;return(0,w.jsx)(b.Qp,{...t,text:(0,w.jsx)(b.EY,{ellipsize:!0,className:j.KJG,color:fe.T.grey[2],children:o}),intent:L.J.PRIMARY})}})}),(0,w.jsxs)("div",{className:"library-details",children:[(0,w.jsxs)("div",{className:"library-details-view",role:"definition",children:[(0,w.jsx)(q.A,{tag:"h3",fontSize:22,color:fe.T.common.black,children:o}),(0,w.jsx)(q.A,{tag:"p",fontSize:14,color:fe.T.grey[2],style:{wordBreak:"break-all"},children:t})]}),u?(0,w.jsx)(b.$n,{intent:L.J.NONE,style:{color:fe.T.blue[3],fontSize:14,fontWeight:500},onClick:l,children:"Edit details"}):null]}),u&&(0,w.jsx)(Wo,{libraryId:i}),(0,w.jsx)(b.cG,{style:{margin:0,borderColor:fe.T.grey.light[1]}}),(0,w.jsx)(Vo,{pronunciations:s,isLoading:r||a,libraryName:o,showRemovePronunciationConfirmation:c,selectedPronunciations:m,setSelectedPronunciations:p,libraryId:i}),d?(0,w.jsx)(Go,{isOpen:d,onClose:()=>c(!1),onCancel:()=>{c(!1)},postConfirm:()=>{p([]),c(!1)},pronunList:m.map((e=>e.word))}):null,(0,w.jsx)(We.A,{entryPoint:"From a list"})]})};var zo=t(86814);const Qo=()=>{var e;const{appliedTo:o,accessLevel:t,libraryId:i,updateLibraryAccessLevel:l,pronunciationCount:a}=ze(),{hasEditAccessToList:s,canApplyList:c}=(0,qe.A)({libraryId:i}
3),[u,m]=(0,n.useState)(t),[p,v]=(0,n.useState)(!1),{processedTree:h,allRootFoldersApiStatus:j}=(0,d.d4)((e=>e.studioHomeState)),[g,x]=(0,n.useState)(!1),f=(0,n.useMemo)((()=>o&&h?o.map((e=>{var o;return null!==(o=h[e])&&void 0!==o&&o.name?h[e]:null})).filter(Boolean):[]),[h,o]);(0,n.useEffect)((()=>{!u&&t&&m(t)}),[t,u,m]),(0,n.useEffect)((()=>{null!==o&&void 0!==o&&o.length&&((null===o||void 0===o?void 0:o.length)<=5?x(!0):x(!1))}),[o]);const A=e=>{e.preventDefault(),e.stopPropagation(),v(!0)},_=(0,n.useMemo)((()=>s?a?"":"No Pronunciations in the library to apply.":"You don't have edit access to this library"),[s,a]);return j!==r.dOd.success?(0,w.jsxs)("div",{className:"d-flex flex-column gap-3 w-100",children:[(0,w.jsx)(zo.Skeleton,{height:80,className:"mb-2"}),(0,w.jsx)(zo.Skeleton,{height:36,className:"mb-2"})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:"d-flex flex-column gap-3 w-100",role:"complementary","aria-label":"Settings for library",children:[null!==f&&void 0!==f&&f.length?(0,w.jsx)(w.Fragment,{children:(0,w.jsxs)("div",{className:"w-100",children:[(0,w.jsxs)("div",{className:"d-flex justify-content-between align-items-center gap-1 mb-2 ",children:[(0,w.jsx)(q.A,{children:"Applied to"}),s?(0,w.jsx)(b.Aj,{text:"Change",minimal:!0,small:!0,onClick:A,intent:L.J.PRIMARY}):null]}),(0,w.jsxs)("div",{className:"pro-lib-applied-to-container",children:[null===(e=g?f:[...f].slice(0,4))||void 0===e?void 0:e.map((e=>(0,w.jsxs)("div",{className:"d-flex align-items-center justify-content-start",children:[null!==e&&void 0!==e&&e.public?(0,w.jsx)("span",{className:"material-icons-round md-20 text-gray2 mr-2",children:"folder"}):(0,w.jsx)("img",{src:(0,r.ye6)("private-folder-closed.svg"),alt:"private",className:"mr-2",style:{height:20,width:20}}),(0,w.jsxs)(q.A,{tag:"p",fontSize:14,color:fe.T.common.black,children:[null===e||void 0===e?void 0:e.name," "]})]},e.folderId))),(null===f||void 0===f?void 0:f.length)>4&&(0,w.jsx)("div",{className:"d-flex align-items-center justify-content-center",children:(0,w.jsx)("a",{href:"/",onClick:e=>{e.stopPropagation(),e.preventDefault(),x((e=>!e))},children:g?"Show less":`+${f.length-4} More`})})]})]})}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(q.A,{tag:"p",fontSize:14,color:fe.T.grey[2],children:"Select folders to apply the list. Any new projects in those folders will automatically use it."}),(0,w.jsx)(b.m_,{disabled:c,position:N.yX.BOTTOM,content:_,className:"w-100",targetClassName:"w-100",children:(0,w.jsx)(b.$n,{intent:L.J.PRIMARY,className:"w-100",fill:!0,small:!0,onClick:A,disabled:!c,children:"Apply"})})]}),(0,w.jsx)(b.cG,{style:{margin:0,borderWidth:2,borderColor:"#1114190D"}}),(0,w.jsxs)("div",{className:"d-flex flex-column",children:[(0,w.jsx)(q.A,{fontSize:16,weight:600,color:fe.T.common.black,children:"Set Permissions"}),(0,w.jsx)(q.A,{fontSize:14,weight:400,color:fe.T.grey[2],style:{marginTop:2},children:"Manage who can contribute to this list"}),(0,w.jsxs)(b.z6,{onChange:e=>{m(e.target.value)},selectedValue:u,className:"mt-2",disabled:!s,children:[(0,w.jsx)(b.sx,{className:"mb-0 py-2 pr-2",label:"Only Admins",value:"ADMIN"}),(0,w.jsx)(b.sx,{className:"mb-0 py-2 pr-2",label:"Admins and Editors",value:"EDITOR"})]}),u!==t?(0,w.jsxs)("div",{className:"d-flex gap-2 justify-content-end mt-2",children:[(0,w.jsx)(b.$n,{small:!0,intent:L.J.NONE,outlined:!0,onClick:()=>m(t),children:"Cancel"}),(0,w.jsx)(b.$n,{small:!0,intent:L.J.PRIMARY,onClick:()=>l(u),children:"Save"})]}):null]})]}),(0,w.jsx)(Qe,{isOpen:p,handleClose:()=>{v(!1)},currentLibraryId:i,alreadyAppliedTo:o||[]})]})},qo=()=>{const e=(0,d.d4)((e=>{var o;return null===(o=e.pronunciationLibrary.currentPronunciationLibrary)||void 0===o?void 0:o.isFetchingData})),o=(0,d.d4)((e=>{var o;return null===(o=e.pronunciationLibrary.currentPronunciationLibrary)||void 0===o?void 0:o.libraryId}));return(0,w.jsxs)("div",{className:"pro-lib-details-wrapper",children:[(0,w.jsx)("div",{className:"pro-lib-details-container",children:(0,w.jsx)("div",{role:"main",children:(0,w.jsx)(Yo,{})})}),!e&&o?(0,w.jsx)("div",{className:"pro-lib-details-sidebar",children:(0,w.jsx)(Qo,{})}):null]})},Xo=()=>{const e=(0,d.wA)(),o=(0,n.useContext)(J.l7),{path:t}=(0,c.useRouteMatch)(),l=(0,c.useHistory)(),{updateUserLimits:a}=(0,ce.A)(),u=(0,d.d4)((e=>{var o;return null!==(o=e.userState.activeWorkspaceId)&&void 0!==o?o:(0,m.Cu)()})),{workspaceIdFromParams:p}=(0,s.A)(),v=(0,d.d4)((e=>{var o;return u?null===(o=e.studioHomeState.workspaces)||void 0===o?void 0:o[u]:null})),h=(0,d.d4)((e=>e.studioHomeState.workspaceStateApiStatus)),j=(0,d.d4)((e=>e.studioHomeState.allRootFoldersApiStatus)),g=(0,d.d4)((e=>e.studioHomeState.processedTree)),x=(0,d.d4)((e=>{var o,t;return null===(o=e.studioHomeState.workspaces)||void 0===o||null===(t=o[u])||void 0===t?void 0:t.pronunciationLibraryEnabled}));(0,po.A)();const f=(0,d.d4)((e=>e.userState.createdAt)),N=(0,d.d4)((e=>e.userState.apiStatus)),_=(0,d.d4)((e=>e.userState.studioHomeUser)),y=(0,d.d4)((e=>e.userState.autoCreateProject)),S=(0,d.d4)((e=>e.userState.pricingPlan));ao({authUser:o});const{loading:I}=co({authUser:o,studioHomeVersion:2});(0,mo.A)(),(0,vo.A)();const P=(0,n.useCallback)((e=>{let{workspaceData:o}=e;if(null!==o&&void 0!==o&&o.users&&Object.keys(o.users).length>1){const e=Object.values(o.users).filter((e=>e.role.role===A.gg.OWNER)).length,a=Object.values(o.users).filter((e=>e.role.role===A.gg.EDITOR)).length,s=Object.values(o.users).filter((e=>e.role.role===A.gg.ADMIN)).length,d=Object.values(o.users).filter((e=>e.role.role===A.gg.VIEWER)).length,c=Object.values(o.pendingInvitationMap).length,m=Object.values(o.users).find((e=>e.role.role===A.gg.OWNER));var t,n,i,l;if(uo.A.__loaded)uo.A.add_group("workspace_id",u),uo.A.get_group("workspace_id",u).set({"Workspace Name":o.workspaceName,"No of users":null!==(t=null===(n=Object.keys(o.users))||void 0===n?void 0:n.length)&&void 0!==t?t:0,"No of Editors":a,"No of Viewers":d,"No of Admins":s,"No of Owners":e,"No of Invited Users":c,Plan:o.effectivePricingPlan,"Plan Type":(0,r.MhL)(null===o||void 0===o?void 0:o.effectivePricingPlan)||"N/A","Owner Email"
3:(null===m||void 0===m?void 0:m.email)||"N/A","Email Domain":(0,r.gPR)(null===m||void 0===m?void 0:m.email)||"N/A","Email Type":(0,r.gPR)(null===m||void 0===m?void 0:m.email)?"Business":"Personal","Bill Cycle End":null===o||void 0===o?void 0:o.renewsOn,"Plan VGT Consumed":(null===o||void 0===o?void 0:o.audioRenderSeconds)||void 0,"Plan VGT Allotted":(null===o||void 0===o||null===(i=o.limits)||void 0===i?void 0:i.maxTotalAudioSeconds)+(null===o||void 0===o||null===(l=o.limits)||void 0===l?void 0:l.additionalSeconds)||void 0,"Additional VGT Consumed":(null===o||void 0===o?void 0:o.additionalUsedSeconds)||void 0})}var a,s;null!==uo.A&&void 0!==uo.A&&uo.A.__loaded&&(null===uo.A||void 0===uo.A||null===(a=uo.A.people)||void 0===a||null===(s=a.set)||void 0===s||s.call(a,{"Active Workspace Id":u}))}),[u]);return(0,n.useEffect)((()=>{"DONE"===N&&h!==r.dOd.loading&&u&&o&&null!==o&&void 0!==o&&o.getIdToken&&_&&(p&&u!==p&&(0,m.Ut)({workspaceId:p}),null!==v&&void 0!==v&&v.users||e((0,W.cz)({authUser:o,workspaceId:u})).then((e=>{var o,t;a({newWorkspaceData:e.payload.workspace}),P({workspaceData:e.payload.workspace}),(0,m.mN)({plan:null===e||void 0===e||null===(o=e.payload)||void 0===o||null===(t=o.workspace)||void 0===t?void 0:t.pricingPlan})})),j!==r.dOd.loading&&g&&0===Object.keys(g).length&&(e((0,W.Np)({authUser:o})),e((0,W.LK)({authUser:o})),e((0,W.C8)({authUser:o}))),x&&e(Je.q.fetchAllPronunciationLibrary({authUser:o})))}),[x,v,N,u,o,h,e,a,P,_,j,g,p]),(0,n.useEffect)((()=>{"DONE"!==N||_||(0,r.ooL)(l,"/studio")()}),[N,_,l]),(0,n.useEffect)((()=>{if(S&&!y&&f<1681291470683){let o=S.split("_")[0],t=localStorage.getItem(D.iE.NEW_STUDIO_HOME_DIALOG);"FREE"!==o||t||(e(K.A.actions.toggleNewStudioHomeDialog(!0)),localStorage.setItem(D.iE.NEW_STUDIO_HOME_DIALOG,"true"))}}),[S,e]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(lo.A,{}),I?(0,w.jsx)("div",{className:"full-viewport flex-center",children:(0,w.jsx)(b.y$,{size:20})}):(0,w.jsxs)(n.Fragment,{children:[(0,w.jsxs)(i.Ay,{children:[(0,w.jsxs)(c.Switch,{children:[(0,w.jsx)(c.Route,{exact:!0,path:`${t}/pronunciation-library/:libraryId`,component:qo}),(0,w.jsx)(c.Route,{exact:!0,path:`${t}/pronunciation-library`,component:no}),(0,w.jsx)(c.Route,{path:"*",component:io})]}),(0,w.jsx)(go,{})]}),(0,w.jsx)(ro,{})]})]})}}}]);
4//# sourceMappingURL=9483.7ab0f109.chunk.js.map
5//# debugId=94164360-f721-5fca-aab2-149088ca5182

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.