UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 586 B
import{copy as e}from"../../libs/i18n/copy.mjs";const t=async(t,n)=>{if(t===null)return{error:void 0,data:null};let r;try{r=new URL(t instanceof URL?t.toString():t)}catch{return{error:{type:`basic`,message:e(`server:core.documents.preview.url.invalid.message`),status:400},data:void 0}}return r.protocol!==`http:`&&r.protocol!==`https:`?{error:{type:`basic`,message:e(`server:core.documents.preview.url.invalid.message`),status:400},data:void 0}:(r.searchParams.set(`preview`,n),{error:void 0,data:r.toString()})};export{t as default}; //# sourceMappingURL=normalize-preview-url.mjs.map