import{parseUuid}from"../../common/utils/helpers.mjs";export async function fromUuid(e,{invalid:d=!1}={}){let t;const{collection:n,documentId:o,documentType:i,embedded:m}=parseUuid(e);for(t="CompendiumDocument"===n.name&&"Folder"===i?await n.getFolder(o,{strict:!0,dropInvalidEmbedded:!0}):await n.get(o,{strict:!0,dropInvalidEmbedded:!0});t&&m.length>1;){const[e,n]=m.splice(0,2);t=t.getEmbeddedDocument(e,n,{strict:!0,invalid:d}),t instanceof foundry.documents.BaseToken&&m.length&&await t.loadRelatedDocuments()}return t||null}