@sveltia/cms 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,6 +124,7 @@ While recreating all the features found in Netlify/Decap CMS is not our goal, we
124
124
  - Auto-saving a draft entry is not implemented yet.
125
125
  - Duplicating an entry is not implemented yet.
126
126
  - Accessibility support is limited.
127
+ - Assets cannot be previewed when using relative path per-entry media folders.
127
128
 
128
129
  ### Roadmap
129
130
 
@@ -217,7 +217,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
217
217
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
218
218
  `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var t;const r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){const s="end"in r.value?r.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){const s=e.items[e.items.length-2],i=(t=s==null?void 0:s.value)==null?void 0:t.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const s=!this.onKeyLine&&this.indent===e.indent&&r.sep;let i=[];if(s&&r.sep&&!r.value){const l=[];for(let o=0;o<r.sep.length;++o){const a=r.sep[o];switch(a.type){case"newline":l.push(o);break;case"space":break;case"comment":a.indent>e.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(i=r.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!er(r.start,"explicit-key-ind")?r.start.push(this.sourceToken):s||r.value?(i.push(this.sourceToken),e.items.push({start:i})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(er(r.start,"explicit-key-ind"))if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(er(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(G0(r.key)&&!er(r.sep,"newline")){const l=mi(r.start),o=r.key,a=r.sep;a.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:o,sep:a}]})}else i.length>0?r.sep=r.sep.concat(i,this.sourceToken):r.sep.push(this.sourceToken);else if(er(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{const l=mi(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):er(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);s||r.value?(e.items.push({start:i,key:l,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(l):(Object.assign(r,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(e);if(l){s&&l.type!=="block-seq"&&er(r.start,"explicit-key-ind")&&e.items.push({start:i}),this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var t;const r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){const s="end"in r.value?r.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){const s=e.items[e.items.length-2],i=(t=s==null?void 0:s.value)==null?void 0:t.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||er(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){const s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let t;do yield*this.pop(),t=this.peek(1);while(t&&t.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:s,sep:[]}):r.sep?this.stack.push(s):Object.assign(r,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):(yield*this.pop(),yield*this.step())}else{const t=this.peek(2);if(t.type==="block-map"&&(this.type==="map-value-ind"&&t.indent===e.indent||this.type==="newline"&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&t.type!=="flow-collection"){const s=Io(t),i=mi(s);ip(e);const l=e.end.splice(1,e.end.length);l.push(this.sourceToken);const o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
219
219
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
220
- `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const r=Io(e),t=mi(r);return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t}]}}case"map-value-ind":{this.onKeyLine=!0;const r=Io(e),t=mi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(t=>t.type==="newline"||t.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function W0(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new q0||null,prettyErrors:e}}function d3(n,e={}){const{lineCounter:r,prettyErrors:t}=W0(e),s=new $d(r==null?void 0:r.addNewLine),i=new vd(e),l=Array.from(i.compose(s.parse(n)));if(t&&r)for(const o of l)o.errors.forEach(da(n,r)),o.warnings.forEach(da(n,r));return l.length>0?l:Object.assign([],{empty:!0},i.streamInfo())}function K0(n,e={}){const{lineCounter:r,prettyErrors:t}=W0(e),s=new $d(r==null?void 0:r.addNewLine),i=new vd(e);let l=null;for(const o of i.compose(s.parse(n),!0,n.length))if(!l)l=o;else if(l.options.logLevel!=="silent"){l.errors.push(new Fs(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return t&&r&&(l.errors.forEach(da(n,r)),l.warnings.forEach(da(n,r))),l}function h3(n,e,r){let t;typeof e=="function"?t=e:r===void 0&&e&&typeof e=="object"&&(r=e);const s=K0(n,r);if(!s)return null;if(s.warnings.forEach(i=>p0(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:t},r))}function m3(n,e,r){let t=null;if(typeof e=="function"||Array.isArray(e)?t=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){const s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(n===void 0){const{keepUndefined:s}=r??e??{};if(!s)return}return new ol(n,t,r).toString(r)}const Zi=Object.freeze(Object.defineProperty({__proto__:null,Alias:xa,CST:c3,Composer:vd,Document:ol,Lexer:Y0,LineCounter:q0,Pair:rn,Parser:$d,Scalar:Ue,Schema:cc,YAMLError:yd,YAMLMap:On,YAMLParseError:Fs,YAMLSeq:ws,YAMLWarning:C0,isAlias:xs,isCollection:St,isDocument:nl,isMap:rl,isNode:Nt,isPair:kt,isScalar:pt,isSeq:sl,parse:h3,parseAllDocuments:d3,parseDocument:K0,stringify:m3,visit:bs,visitAsync:Qa},Symbol.toStringTag,{value:"Module"}));var mn=Yl;Yl.flatten=Yl;Yl.unflatten=J0;function Z0(n){return n&&n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function X0(n){return n}function Yl(n,e){e=e||{};const r=e.delimiter||".",t=e.maxDepth,s=e.transformKey||X0,i={};function l(o,a,c){c=c||1,Object.keys(o).forEach(function(u){const f=o[u],d=e.safe&&Array.isArray(f),h=Object.prototype.toString.call(f),p=Z0(f),g=h==="[object Object]"||h==="[object Array]",w=a?a+r+s(u):s(u);if(!d&&!p&&g&&Object.keys(f).length&&(!e.maxDepth||c<t))return l(f,w,c+1);i[w]=f})}return l(n),i}function J0(n,e){e=e||{};const r=e.delimiter||".",t=e.overwrite||!1,s=e.transformKey||X0,i={};if(Z0(n)||Object.prototype.toString.call(n)!=="[object Object]")return n;function o(u){const f=Number(u);return isNaN(f)||u.indexOf(".")!==-1||e.object?u:f}function a(u,f,d){return Object.keys(d).reduce(function(h,p){return h[u+r+p]=d[p],h},f)}function c(u){const f=Object.prototype.toString.call(u),d=f==="[object Array]",h=f==="[object Object]";if(u){if(d)return!u.length;if(h)return!Object.keys(u).length}else return!0}return n=Object.keys(n).reduce(function(u,f){const d=Object.prototype.toString.call(n[f]);return!(d==="[object Object]"||d==="[object Array]")||c(n[f])?(u[f]=n[f],u):a(f,u,Yl(n[f],e))},{}),Object.keys(n).forEach(function(u){const f=u.split(r).map(s);let d=o(f.shift()),h=o(f[0]),p=i;for(;h!==void 0;){if(d==="__proto__")return;const g=Object.prototype.toString.call(p[d]),w=g==="[object Object]"||g==="[object Array]";if(!t&&!w&&typeof p[d]<"u")return;(t&&!w||!t&&p[d]==null)&&(p[d]=typeof h=="number"&&!e.object?[]:{}),p=p[d],f.length>0&&(d=o(f.shift()),h=o(f[0]))}p[d]=J0(n[u],e)}),i}const ys=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),Q0=(n=1e3)=>new Promise(e=>{window.setTimeout(()=>{e()},n)}),cf=De(!1),Sd=De([]),$r=De([]),Et=De(),ds=De([]),p3=n=>{const e=re(ct);let r="single_file",t=[],s;(n==null?void 0:n.i18n)===!0&&ys(e==null?void 0:e.i18n)&&({structure:r="single_file",locales:t=[],default_locale:s=void 0}=e.i18n),ys(n==null?void 0:n.i18n)&&({structure:r="single_file",locales:t=[],default_locale:s=void 0}=n.i18n);const i=!!t.length;return{structure:r,hasLocales:i,locales:i?t:[],defaultLocale:i?s&&t.includes(s)?s:t[0]:void 0}},dr=n=>{const e=re(ct).collections.find(r=>r.name===n);return{...e,_i18n:p3(e)}},Ed=(n,e)=>re($r).find(r=>r.collectionName===n&&r.fileName===e),co=(n,e,r,t)=>{const s=dr(n),{fields:i}=e?s.files.find(({name:a})=>a===e):s,l=r.split(".");let o;return l.forEach((a,c)=>{if(c===0)o=i.find(({name:u})=>u===a);else if(o){const u=a.match(/^\d+$/),{field:f,fields:d,types:h,typeKey:p="type"}=o;f?o=f:d&&!u?o=d.find(({name:g})=>g===a):h&&u&&(o=h.find(({name:g})=>g===t[`${l.slice(0,c).join(".")}.${a}.${p}`]))}}),o},hc=n=>{const e=dr(n);if(!e)return[];const{filter:r,_i18n:{defaultLocale:t="default"}}=e;return re($r).filter(s=>{var i;return s.collectionName===n&&(!r||((i=s.locales[t])==null?void 0:i.content[r.field])===r.value)})},_3=n=>{const e=n.replace(re(ct).site_url,"");return re($r).filter(r=>{const{locales:t,collectionName:s,fileName:i}=r;return Object.values(t).some(({content:l})=>{const o=mn.flatten(l);return Object.entries(o).some(([a,c])=>{const u=co(s,i,a,o);return!u||!["image","file"].includes(u.widget)?!1:uo(c,r)===e})})})},x0=({date:n=new Date,timeZone:e=void 0}={})=>{const r={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"longOffset"};return Object.fromEntries(new Intl.DateTimeFormat("en-US",{...r,timeZone:e}).formatToParts(n).filter(({type:t})=>t in r).map(({type:t,value:s})=>[t,s]))},sn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),hs=n=>n.replace(/^\//,"").replace(/\/$/,""),Us=()=>window.crypto.randomUUID(),g3=async({items:n},{accept:e}={})=>{const r=e?e.trim().split(/,\s*/g):[],t=s=>new Promise(i=>{s.name.startsWith(".")?i(null):s.isFile?s.file(l=>{const o=!r.length||r.some(a=>{const[c,u]=a.split("/");return u==="*"?l.type.split("/")[0]===c:l.type===a});i(o?l:null)},()=>{i(null)}):s.createReader().readEntries(l=>{i(Promise.all(l.map(t)))})});return(await Promise.all([...n].map(s=>t(s.webkitGetAsEntry())))).flat(1e5).filter(Boolean).sort((s,i)=>s.name.localeCompare(i.name))},b3=async n=>{const e=new FileReader;return new Promise(r=>{e.onload=()=>{r(e.result)},e.readAsText(n)})},w3=async n=>{const e=new FileReader;return new Promise(r=>{e.onload=()=>{r(e.result)},e.readAsArrayBuffer(n)})},ma=async n=>{const e=await window.crypto.subtle.digest("SHA-1",await w3(n));return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")},ew=async n=>{const e=typeof n=="string"?new Blob([n],{type:"text/plain"}):n,r=new FileReader;return new Promise(t=>{r.onload=()=>{t(r.result)},r.readAsDataURL(e)})},y3=async n=>(await ew(n)).split(",")[1],Xi=n=>{const e=new Intl.NumberFormat(re(En)),r=1e3,t=r*1e3,s=t*1e3,i=s*1e3;return n<r?`${e.format(n)} bytes`:n<t?`${e.format(Number((n/r).toFixed(1)))} KB`:n<s?`${e.format(Number((n/t).toFixed(1)))} MB`:n<i?`${e.format(Number((n/s).toFixed(1)))} GB`:`${e.format(Number((n/i).toFixed(1)))} TB`},tw=(n,e)=>{if(!e.length)return n;const[,r,t]=n.match(/(.+)(?:\.([a-zA-Z0-9]+?))?$/),s=new RegExp(`^${sn(r)}(?:-(\\d+?))?${t?`\\.${t}`:""}$`),i=e.sort().findLast(l=>l.match(s));return i?`${r}-${Number(i.match(s)[1]||0)+1}${t?`.${t}`:""}`:n},uf=n=>{const e=n.split("/");return e.forEach((r,t)=>{if(r===".."){const s=e.findLastIndex((i,l)=>!!i&&l<t);s>-1&&(e[s]=null)}(r===".."||r===".")&&(e[t]=null)}),e.filter(Boolean).join("/")},nw=n=>{const{slug:{encoding:e="unicode",clean_accents:r=!1,sanitize_replacement:t="-"}={}}=re(ct);let s=n;return r&&(s=s.normalize("NFD").replace(/\p{Diacritic}/gu,"")),e==="ascii"?s=s.replaceAll(/[^\w-~]/g," "):s=s.replaceAll(/[^\p{L}\p{N}]/gu," "),s.toLocaleLowerCase().trim().replaceAll(/\s+/g,t)},ql=(n,{collection:e,content:r,currentSlug:t="",isMediaFolder:s=!1,entryFilePath:i=""})=>{const{name:l,identifier_field:o="title",folder:a}=e,c=x0(),u=n.replaceAll(/{{(.+?)}}/g,(f,d)=>{if(["year","month","day","hour","minute","second"].includes(d))return c[d];if(d==="slug"&&t)return t;if(d==="uuid")return Us();if(d==="uuid_short")return Us().split("-").pop();if(d==="uuid_shorter")return Us().split("-").shift();if(s){if(!i)return"";if(d==="dirname")return i.replace(a,"").split("/").slice(0,-1).join("/");if(d==="filename")return i.split("/").pop().split(".").shift();if(d==="extension")return i.split("/").pop().split(".").pop()}let h;return d.startsWith("fields.")?h=r[d.replace(/^fields\./,"")]:d==="slug"?h=r[o]||r.title||r.name||r.label:h=r[d],h=nw(h),!h&&d==="slug"?Us().split("-").pop():h});return t?u:tw(u,hc(l).map(f=>f.slug))},k3=(n,e)=>{const r=e==="image",t=r?new Image:document.createElement(e);return new Promise(s=>{const i=()=>{s({dimensions:e==="audio"?void 0:{width:r?t.naturalWidth:t.videoWidth,height:r?t.naturalHeight:t.videoHeight},duration:r?void 0:t.duration})};t.addEventListener(r?"load":"loadedmetadata",i,{once:!0}),t.src=n})},lp=n=>new Date(n*1e3).toISOString().substr(11,8),op=["image","video","audio","document","other"],ff={image:/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff|webp)$/i,video:/\.(?:avi|mp4|mpeg|ogv|ts|webm|3gp|3g2)$/i,audio:/\.(?:aac|midi?|mp3|opus|wav|weba)$/i,document:/\.(?:csv|docx?|odp|ods|odt|pdf|pptx?|rtf|xslx?)$/i},Mn=De([]),Sr=De([]),nr=De(),ms=De([]),Zs=De(),Ln=De({folder:null,files:[]}),v3=Sn([Ln],([n],e)=>{var r;e(!!((r=n.files)!=null&&r.length))}),$3=(n,e)=>{const{entryRelative:r,internalPath:t,publicPath:s}=re(Sr).findLast(i=>[null,n.name].includes(i.collectionName));if(r){const i=n.path?n.path.split("/").slice(0,-1).join("/"):".";return{internalAssetFolder:uf(ql(`${t}/${i}`,e)),publicAssetFolder:s.match(/^\.?$/)?s:uf(ql(s,e))}}return{internalAssetFolder:t,publicAssetFolder:s}},Td=n=>{var e;return((e=Object.entries(ff).find(([,r])=>n.match(r)))==null?void 0:e[0])||"other"},S3=(n,e)=>{if(!n.startsWith("/")){if(!e)return;const i=dr(e.collectionName),{_i18n:{defaultLocale:l="default"},public_folder:o}=i,{path:a,content:c}=e.locales[l],u=a.split("/").slice(0,-1).join("/"),f=o?ql(o,{collection:i,content:mn.flatten(c),currentSlug:e.slug,isMediaFolder:!0,entryFilePath:a}):".",d=uf(`${u}/${f}/${n}`);return re(Mn).find(h=>h.path===d)}const[,r,t]=n.match(/(.+?)\/([^/]+)$/)||[];if(!r)return;const{internalPath:s}=re(Sr).findLast(i=>i.publicPath===r)||{};if(s)return re(Mn).find(i=>i.path===`${s}/${t}`)},Rt=(n,{pathOnly:e=!1}={})=>{var o;if(!n)return;const r=(o=n.url)==null?void 0:o.startsWith("blob:");if(r&&!e)return n.url;const{publicPath:t,entryRelative:s}=re(Sr).find(({collectionName:a})=>a===n.collectionName)||re(Sr).find(({collectionName:a})=>a===null);if(s)return r?n.url:void 0;const i=e?"":re(ct).site_url||"",l=n.path.replace(n.folder,t);return`${i}${l}`},uo=(n,e)=>{if(n)return n.match(/^(?:https?|data):/)?n:Rt(S3(n,e))},E3=async n=>{const{kind:e}=n,r=Rt(n);let t,s;return["image","video","audio"].includes(e)&&r&&({dimensions:t,duration:s}=await k3(r,e)),{displayURL:r,dimensions:t,duration:s,usedEntries:_3(r)}},ct=De(),{DEV:rw,VITE_CONFIG_PORT:T3}={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1},A3=n=>{var e,r;if(!ys(n))throw new Error("parse_failed");if(!((e=n.collections)!=null&&e.length))throw new Error("no_collection");if(!((r=n.backend)!=null&&r.repo))throw new Error("no_backend");if(!n.media_folder)throw new Error("no_media_folder")},O3=async()=>{const{href:n="./config.yml"}=document.querySelector('link[type="text/yaml"][rel="cms-config-url"]')||{};let e,r;try{try{e=await fetch(n)}catch{throw new Error("fetch_failed")}if(!e.ok)throw new Error("fetch_failed");try{r=Zi.parse(await e.text())}catch{throw new Error("parse_failed")}A3(r),rw&&!r.site_url&&(r.site_url=`http://localhost:${T3||5174}`),ct.set(r)}catch(t){ct.set({error:t.message}),console.error(t)}};ct.subscribe(n=>{if(rw&&console.info("siteConfig",n),!n||n.error)return;const{media_folder:e,public_folder:r,collections:t}=n;Et.set(dr(t[0].name));const s=[...t.filter(({folder:u})=>!!u).map(({name:u,folder:f,extension:d,format:h,frontmatter_delimiter:p})=>({collectionName:u,folder:f,extension:d,format:h,frontmatterDelimiter:p})),...t.filter(({files:u})=>!!u).map(({name:u,files:f,extension:d,format:h,frontmatter_delimiter:p})=>f.map(({name:g,file:w})=>({collectionName:u,fileName:g,file:w,extension:d,format:h,frontmatterDelimiter:p}))).flat(1)],i=hs(e),l=r?`/${hs(r)}`:`/${i}`,o={collectionName:null,internalPath:i,publicPath:l,entryRelative:!1},a=t.map(u=>{const{name:f,folder:d,path:h}=u;if(!h)return null;let{media_folder:p="",public_folder:g=""}=u;const w=!(p&&(p.startsWith("/")||p.includes("{{media_folder}}")));return p=p.replace("{{media_folder}}",i),g=g.replace("{{public_folder}}",l),{collectionName:f,internalPath:hs(w?d:p),publicPath:g,entryRelative:w}}),c=[o,...a.filter(Boolean).sort((u,f)=>u.internalPath.localeCompare(f.internalPath))];Sd.set(s),Sr.set(c)});const $n=De(),L3=async n=>{const{site_domain:e=document.domain,base_url:r="https://api.netlify.com",auth_endpoint:t="auth"}=re(ct).backend,s=600,i=800,{availHeight:l,availWidth:o}=window.screen,a=l/2-i/2,c=o/2-s/2,u=window.open(`${r}/${t}?provider=${n}&site_id=${e}&scope=repo`,"auth",`width=${s},height=${i},top=${a},left=${c}`);return new Promise(f=>{const d=({origin:h,data:p})=>{if(h!==r||typeof p!="string")return;if(p===`authorizing:${n}`){u.postMessage(p,h);return}const[,g,w]=p.match(new RegExp(`^authorization:${n}:(success|error):(.+)`))||[];let b;try{b=w?JSON.parse(w):void 0}catch{}f(g==="success"&&ys(b)&&typeof b.token=="string"?b.token:null),window.removeEventListener("message",d),u.close()};window.addEventListener("message",d)})},N3="1.38.0",ke=SyntaxError,Mt=RangeError,Re=TypeError,Xt=Error,hn=void 0,Kr=typeof BigInt>"u"?hn:BigInt,Ad=RegExp,Od=WeakMap,sw=WeakMap.prototype.get,iw=WeakMap.prototype.set,In=Object.create,Oi=Number.isSafeInteger,Mr=Object.getOwnPropertyNames,Rn=Object.freeze,lw=Object.prototype.isPrototypeOf,vn=Object.seal?Object.preventExtensions(Object.create(null)):null,Ji=Function.prototype.bind,ap=RegExp.prototype.test,cp=RegExp.prototype.exec,Ld=Reflect.apply,df=Proxy,up=typeof Symbol>"u"?hn:Symbol.toStringTag,ow=Object.defineProperty,ps=Object.assign,Nd=Object,P3=Math.floor,Vs=Array.isArray,Qi=1/0,Pd=String.fromCharCode,pa=Array,Co=Object.prototype.hasOwnProperty,fp=Object.prototype.propertyIsEnumerable,ks=Function.prototype.apply;var aw=fp.call.bind(fp),ss=Nd.hasOwn||function(){return Co.bind?Co.call.bind(Co):function(e,r){return Co.call(e,r)}}(),cw=Nd.create;function dp(n){var e=cw(vn);return ss(n,"value")&&(e.value=n.value),ss(n,"writable")&&(e.writable=n.writable),ss(n,"get")&&(e.get=n.get),ss(n,"set")&&(e.set=n.set),ss(n,"enumerable")&&(e.enumerable=n.enumerable),ss(n,"configurable")&&(e.configurable=n.configurable),e}const I3=function(e,r){if(!r&&typeof e!="function"&&(r=e,e=In(vn)),ps)ps(e,r);else for(var t in r)ss(r,t)&&(e[t]=r[t]);if(e.default=e,typeof e=="function")e.prototype&&Rn(e.prototype);else if(up){var s=In(vn);s.value="Module",ow(e,up,s)}return Rn(e)};/*!@preserve@license
220
+ `,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const r=Io(e),t=mi(r);return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t}]}}case"map-value-ind":{this.onKeyLine=!0;const r=Io(e),t=mi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(t=>t.type==="newline"||t.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function W0(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new q0||null,prettyErrors:e}}function d3(n,e={}){const{lineCounter:r,prettyErrors:t}=W0(e),s=new $d(r==null?void 0:r.addNewLine),i=new vd(e),l=Array.from(i.compose(s.parse(n)));if(t&&r)for(const o of l)o.errors.forEach(da(n,r)),o.warnings.forEach(da(n,r));return l.length>0?l:Object.assign([],{empty:!0},i.streamInfo())}function K0(n,e={}){const{lineCounter:r,prettyErrors:t}=W0(e),s=new $d(r==null?void 0:r.addNewLine),i=new vd(e);let l=null;for(const o of i.compose(s.parse(n),!0,n.length))if(!l)l=o;else if(l.options.logLevel!=="silent"){l.errors.push(new Fs(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return t&&r&&(l.errors.forEach(da(n,r)),l.warnings.forEach(da(n,r))),l}function h3(n,e,r){let t;typeof e=="function"?t=e:r===void 0&&e&&typeof e=="object"&&(r=e);const s=K0(n,r);if(!s)return null;if(s.warnings.forEach(i=>p0(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:t},r))}function m3(n,e,r){let t=null;if(typeof e=="function"||Array.isArray(e)?t=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){const s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(n===void 0){const{keepUndefined:s}=r??e??{};if(!s)return}return new ol(n,t,r).toString(r)}const Zi=Object.freeze(Object.defineProperty({__proto__:null,Alias:xa,CST:c3,Composer:vd,Document:ol,Lexer:Y0,LineCounter:q0,Pair:rn,Parser:$d,Scalar:Ue,Schema:cc,YAMLError:yd,YAMLMap:On,YAMLParseError:Fs,YAMLSeq:ws,YAMLWarning:C0,isAlias:xs,isCollection:St,isDocument:nl,isMap:rl,isNode:Nt,isPair:kt,isScalar:pt,isSeq:sl,parse:h3,parseAllDocuments:d3,parseDocument:K0,stringify:m3,visit:bs,visitAsync:Qa},Symbol.toStringTag,{value:"Module"}));var mn=Yl;Yl.flatten=Yl;Yl.unflatten=J0;function Z0(n){return n&&n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function X0(n){return n}function Yl(n,e){e=e||{};const r=e.delimiter||".",t=e.maxDepth,s=e.transformKey||X0,i={};function l(o,a,c){c=c||1,Object.keys(o).forEach(function(u){const f=o[u],d=e.safe&&Array.isArray(f),h=Object.prototype.toString.call(f),p=Z0(f),g=h==="[object Object]"||h==="[object Array]",w=a?a+r+s(u):s(u);if(!d&&!p&&g&&Object.keys(f).length&&(!e.maxDepth||c<t))return l(f,w,c+1);i[w]=f})}return l(n),i}function J0(n,e){e=e||{};const r=e.delimiter||".",t=e.overwrite||!1,s=e.transformKey||X0,i={};if(Z0(n)||Object.prototype.toString.call(n)!=="[object Object]")return n;function o(u){const f=Number(u);return isNaN(f)||u.indexOf(".")!==-1||e.object?u:f}function a(u,f,d){return Object.keys(d).reduce(function(h,p){return h[u+r+p]=d[p],h},f)}function c(u){const f=Object.prototype.toString.call(u),d=f==="[object Array]",h=f==="[object Object]";if(u){if(d)return!u.length;if(h)return!Object.keys(u).length}else return!0}return n=Object.keys(n).reduce(function(u,f){const d=Object.prototype.toString.call(n[f]);return!(d==="[object Object]"||d==="[object Array]")||c(n[f])?(u[f]=n[f],u):a(f,u,Yl(n[f],e))},{}),Object.keys(n).forEach(function(u){const f=u.split(r).map(s);let d=o(f.shift()),h=o(f[0]),p=i;for(;h!==void 0;){if(d==="__proto__")return;const g=Object.prototype.toString.call(p[d]),w=g==="[object Object]"||g==="[object Array]";if(!t&&!w&&typeof p[d]<"u")return;(t&&!w||!t&&p[d]==null)&&(p[d]=typeof h=="number"&&!e.object?[]:{}),p=p[d],f.length>0&&(d=o(f.shift()),h=o(f[0]))}p[d]=J0(n[u],e)}),i}const ys=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),Q0=(n=1e3)=>new Promise(e=>{window.setTimeout(()=>{e()},n)}),cf=De(!1),Sd=De([]),$r=De([]),Et=De(),ds=De([]),p3=n=>{const e=re(ct);let r="single_file",t=[],s;(n==null?void 0:n.i18n)===!0&&ys(e==null?void 0:e.i18n)&&({structure:r="single_file",locales:t=[],default_locale:s=void 0}=e.i18n),ys(n==null?void 0:n.i18n)&&({structure:r="single_file",locales:t=[],default_locale:s=void 0}=n.i18n);const i=!!t.length;return{structure:r,hasLocales:i,locales:i?t:[],defaultLocale:i?s&&t.includes(s)?s:t[0]:void 0}},dr=n=>{const e=re(ct).collections.find(r=>r.name===n);return{...e,_i18n:p3(e)}},Ed=(n,e)=>re($r).find(r=>r.collectionName===n&&r.fileName===e),co=(n,e,r,t)=>{const s=dr(n),{fields:i}=e?s.files.find(({name:a})=>a===e):s,l=r.split(".");let o;return l.forEach((a,c)=>{if(c===0)o=i.find(({name:u})=>u===a);else if(o){const u=a.match(/^\d+$/),{field:f,fields:d,types:h,typeKey:p="type"}=o;f?o=f:d&&!u?o=d.find(({name:g})=>g===a):h&&u&&(o=h.find(({name:g})=>g===t[`${l.slice(0,c).join(".")}.${a}.${p}`]))}}),o},hc=n=>{const e=dr(n);if(!e)return[];const{filter:r,_i18n:{defaultLocale:t="default"}}=e;return re($r).filter(s=>{var i;return s.collectionName===n&&(!r||((i=s.locales[t])==null?void 0:i.content[r.field])===r.value)})},_3=n=>{const e=n.replace(re(ct).site_url,"");return re($r).filter(r=>{const{locales:t,collectionName:s,fileName:i}=r;return Object.values(t).some(({content:l})=>{const o=mn.flatten(l);return Object.entries(o).some(([a,c])=>{const u=co(s,i,a,o);return!u||!["image","file"].includes(u.widget)?!1:uo(c,r)===e})})})},x0=({date:n=new Date,timeZone:e=void 0}={})=>{const r={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"longOffset"};return Object.fromEntries(new Intl.DateTimeFormat("en-US",{...r,timeZone:e}).formatToParts(n).filter(({type:t})=>t in r).map(({type:t,value:s})=>[t,s]))},sn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),hs=n=>n.replace(/^\//,"").replace(/\/$/,""),Us=()=>window.crypto.randomUUID(),g3=async({items:n},{accept:e}={})=>{const r=e?e.trim().split(/,\s*/g):[],t=s=>new Promise(i=>{s.name.startsWith(".")?i(null):s.isFile?s.file(l=>{const o=!r.length||r.some(a=>{const[c,u]=a.split("/");return u==="*"?l.type.split("/")[0]===c:l.type===a});i(o?l:null)},()=>{i(null)}):s.createReader().readEntries(l=>{i(Promise.all(l.map(t)))})});return(await Promise.all([...n].map(s=>t(s.webkitGetAsEntry())))).flat(1e5).filter(Boolean).sort((s,i)=>s.name.localeCompare(i.name))},b3=async n=>{const e=new FileReader;return new Promise(r=>{e.onload=()=>{r(e.result)},e.readAsText(n)})},w3=async n=>{const e=new FileReader;return new Promise(r=>{e.onload=()=>{r(e.result)},e.readAsArrayBuffer(n)})},ma=async n=>{const e=await window.crypto.subtle.digest("SHA-1",await w3(n));return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")},ew=async n=>{const e=typeof n=="string"?new Blob([n],{type:"text/plain"}):n,r=new FileReader;return new Promise(t=>{r.onload=()=>{t(r.result)},r.readAsDataURL(e)})},y3=async n=>(await ew(n)).split(",")[1],Xi=n=>{const e=new Intl.NumberFormat(re(En)),r=1e3,t=r*1e3,s=t*1e3,i=s*1e3;return n<r?`${e.format(n)} bytes`:n<t?`${e.format(Number((n/r).toFixed(1)))} KB`:n<s?`${e.format(Number((n/t).toFixed(1)))} MB`:n<i?`${e.format(Number((n/s).toFixed(1)))} GB`:`${e.format(Number((n/i).toFixed(1)))} TB`},tw=(n,e)=>{if(!e.length)return n;const[,r,t]=n.match(/(.+)(?:\.([a-zA-Z0-9]+?))?$/),s=new RegExp(`^${sn(r)}(?:-(\\d+?))?${t?`\\.${t}`:""}$`),i=e.sort().findLast(l=>l.match(s));return i?`${r}-${Number(i.match(s)[1]||0)+1}${t?`.${t}`:""}`:n},uf=n=>{const e=n.split("/");return e.forEach((r,t)=>{if(r===".."){const s=e.findLastIndex((i,l)=>!!i&&l<t);s>-1&&(e[s]=null)}(r===".."||r===".")&&(e[t]=null)}),e.filter(Boolean).join("/")},nw=n=>{const{slug:{encoding:e="unicode",clean_accents:r=!1,sanitize_replacement:t="-"}={}}=re(ct);let s=n;return r&&(s=s.normalize("NFD").replace(/\p{Diacritic}/gu,"")),e==="ascii"?s=s.replaceAll(/[^\w-~]/g," "):s=s.replaceAll(/[^\p{L}\p{N}]/gu," "),s.toLocaleLowerCase().trim().replaceAll(/\s+/g,t)},ql=(n,{collection:e,content:r,currentSlug:t="",isMediaFolder:s=!1,entryFilePath:i=""})=>{const{name:l,identifier_field:o="title",folder:a}=e,c=x0(),u=n.replaceAll(/{{(.+?)}}/g,(f,d)=>{if(["year","month","day","hour","minute","second"].includes(d))return c[d];if(d==="slug"&&t)return t;if(d==="uuid")return Us();if(d==="uuid_short")return Us().split("-").pop();if(d==="uuid_shorter")return Us().split("-").shift();if(s){if(!i)return"";if(d==="dirname")return i.replace(a,"").split("/").slice(0,-1).join("/");if(d==="filename")return i.split("/").pop().split(".").shift();if(d==="extension")return i.split("/").pop().split(".").pop()}let h;return d.startsWith("fields.")?h=r[d.replace(/^fields\./,"")]:d==="slug"?h=r[o]||r.title||r.name||r.label:h=r[d],h=nw(h),!h&&d==="slug"?Us().split("-").pop():h});return t?u:tw(u,hc(l).map(f=>f.slug))},k3=(n,e)=>{const r=e==="image",t=r?new Image:document.createElement(e);return new Promise(s=>{const i=()=>{s({dimensions:e==="audio"?void 0:{width:r?t.naturalWidth:t.videoWidth,height:r?t.naturalHeight:t.videoHeight},duration:r?void 0:t.duration})};t.addEventListener(r?"load":"loadedmetadata",i,{once:!0}),t.src=n})},lp=n=>new Date(n*1e3).toISOString().substr(11,8),op=["image","video","audio","document","other"],ff={image:/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|tiff|webp)$/i,video:/\.(?:avi|mp4|mpeg|ogv|ts|webm|3gp|3g2)$/i,audio:/\.(?:aac|midi?|mp3|opus|wav|weba)$/i,document:/\.(?:csv|docx?|odp|ods|odt|pdf|pptx?|rtf|xslx?)$/i},Mn=De([]),Sr=De([]),nr=De(),ms=De([]),Zs=De(),Ln=De({folder:null,files:[]}),v3=Sn([Ln],([n],e)=>{var r;e(!!((r=n.files)!=null&&r.length))}),$3=(n,e)=>{const{entryRelative:r,internalPath:t,publicPath:s}=re(Sr).findLast(i=>[null,n.name].includes(i.collectionName));if(r){const i=n.path?n.path.split("/").slice(0,-1).join("/"):".";return{internalAssetFolder:uf(ql(`${t}/${i}`,e)),publicAssetFolder:s.match(/^\.?$/)?s:uf(ql(s,e))}}return{internalAssetFolder:t,publicAssetFolder:s}},Td=n=>{var e;return((e=Object.entries(ff).find(([,r])=>n.match(r)))==null?void 0:e[0])||"other"},S3=(n,e)=>{if(!n.startsWith("/")){if(!e)return;const i=dr(e.collectionName),{_i18n:{defaultLocale:l="default"},public_folder:o}=i,{path:a,content:c}=e.locales[l],u=a.split("/").slice(0,-1).join("/"),f=o?ql(o,{collection:i,content:mn.flatten(c),currentSlug:e.slug,isMediaFolder:!0,entryFilePath:a}):".",d=uf(`${u}/${f}/${n}`);return re(Mn).find(h=>h.path===d)}const[,r,t]=n.match(/(.+?)\/([^/]+)$/)||[];if(!r)return;const{internalPath:s}=re(Sr).findLast(i=>i.publicPath===r)||{};if(s)return re(Mn).find(i=>i.path===`${s}/${t}`)},Rt=(n,{pathOnly:e=!1}={})=>{var o;if(!n)return;const r=(o=n.url)==null?void 0:o.startsWith("blob:");if(r&&!e)return n.url;const{publicPath:t,entryRelative:s}=re(Sr).find(({collectionName:a})=>a===n.collectionName)||re(Sr).find(({collectionName:a})=>a===null);if(s)return r?n.url:void 0;const i=e?"":re(ct).site_url||"",l=n.path.replace(n.folder,t);return`${i}${l}`},uo=(n,e)=>{if(n)return n.match(/^(?:https?|data):/)?n:Rt(S3(n,e))},E3=async n=>{const{kind:e}=n,r=Rt(n);let t,s;return["image","video","audio"].includes(e)&&r&&({dimensions:t,duration:s}=await k3(r,e)),{displayURL:r,dimensions:t,duration:s,usedEntries:_3(r)}},ct=De(),{DEV:rw,VITE_CONFIG_PORT:T3}={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1},A3=n=>{var e,r;if(!ys(n))throw new Error("parse_failed");if(!((e=n.collections)!=null&&e.length))throw new Error("no_collection");if(!((r=n.backend)!=null&&r.repo))throw new Error("no_backend");if(!n.media_folder)throw new Error("no_media_folder")},O3=async()=>{const{href:n="./config.yml"}=document.querySelector('link[type="text/yaml"][rel="cms-config-url"]')||{};let e,r;try{try{e=await fetch(n)}catch{throw new Error("fetch_failed")}if(!e.ok)throw new Error("fetch_failed");try{r=Zi.parse(await e.text())}catch{throw new Error("parse_failed")}A3(r),rw&&!r.site_url&&(r.site_url=`http://localhost:${T3||5174}`),ct.set(r)}catch(t){ct.set({error:t.message}),console.error(t)}};ct.subscribe(n=>{if(rw&&console.info("siteConfig",n),!n||n.error)return;const{media_folder:e,public_folder:r,collections:t}=n;Et.set(dr(t[0].name));const s=[...t.filter(({folder:u})=>!!u).map(({name:u,folder:f,extension:d,format:h,frontmatter_delimiter:p})=>({collectionName:u,folder:f,extension:d,format:h,frontmatterDelimiter:p})),...t.filter(({files:u})=>!!u).map(({name:u,files:f,extension:d,format:h,frontmatter_delimiter:p})=>f.map(({name:g,file:w})=>({collectionName:u,fileName:g,file:w,extension:d,format:h,frontmatterDelimiter:p}))).flat(1)],i=hs(e),l=r?`/${hs(r)}`:`/${i}`,o={collectionName:null,internalPath:i,publicPath:l,entryRelative:!1},a=t.map(u=>{const{name:f,folder:d,path:h}=u;let{media_folder:p="",public_folder:g=""}=u;if(!h&&!p)return null;const w=!(p&&(p.startsWith("/")||p.includes("{{media_folder}}")));return p=p.replace("{{media_folder}}",i),g=g.replace("{{public_folder}}",l),{collectionName:f,internalPath:hs(w?d:p),publicPath:g,entryRelative:w}}),c=[o,...a.filter(Boolean).sort((u,f)=>u.internalPath.localeCompare(f.internalPath))];Sd.set(s),Sr.set(c)});const $n=De(),L3=async n=>{const{site_domain:e=document.domain,base_url:r="https://api.netlify.com",auth_endpoint:t="auth"}=re(ct).backend,s=600,i=800,{availHeight:l,availWidth:o}=window.screen,a=l/2-i/2,c=o/2-s/2,u=window.open(`${r}/${t}?provider=${n}&site_id=${e}&scope=repo`,"auth",`width=${s},height=${i},top=${a},left=${c}`);return new Promise(f=>{const d=({origin:h,data:p})=>{if(h!==r||typeof p!="string")return;if(p===`authorizing:${n}`){u.postMessage(p,h);return}const[,g,w]=p.match(new RegExp(`^authorization:${n}:(success|error):(.+)`))||[];let b;try{b=w?JSON.parse(w):void 0}catch{}f(g==="success"&&ys(b)&&typeof b.token=="string"?b.token:null),window.removeEventListener("message",d),u.close()};window.addEventListener("message",d)})},N3="1.38.0",ke=SyntaxError,Mt=RangeError,Re=TypeError,Xt=Error,hn=void 0,Kr=typeof BigInt>"u"?hn:BigInt,Ad=RegExp,Od=WeakMap,sw=WeakMap.prototype.get,iw=WeakMap.prototype.set,In=Object.create,Oi=Number.isSafeInteger,Mr=Object.getOwnPropertyNames,Rn=Object.freeze,lw=Object.prototype.isPrototypeOf,vn=Object.seal?Object.preventExtensions(Object.create(null)):null,Ji=Function.prototype.bind,ap=RegExp.prototype.test,cp=RegExp.prototype.exec,Ld=Reflect.apply,df=Proxy,up=typeof Symbol>"u"?hn:Symbol.toStringTag,ow=Object.defineProperty,ps=Object.assign,Nd=Object,P3=Math.floor,Vs=Array.isArray,Qi=1/0,Pd=String.fromCharCode,pa=Array,Co=Object.prototype.hasOwnProperty,fp=Object.prototype.propertyIsEnumerable,ks=Function.prototype.apply;var aw=fp.call.bind(fp),ss=Nd.hasOwn||function(){return Co.bind?Co.call.bind(Co):function(e,r){return Co.call(e,r)}}(),cw=Nd.create;function dp(n){var e=cw(vn);return ss(n,"value")&&(e.value=n.value),ss(n,"writable")&&(e.writable=n.writable),ss(n,"get")&&(e.get=n.get),ss(n,"set")&&(e.set=n.set),ss(n,"enumerable")&&(e.enumerable=n.enumerable),ss(n,"configurable")&&(e.configurable=n.configurable),e}const I3=function(e,r){if(!r&&typeof e!="function"&&(r=e,e=In(vn)),ps)ps(e,r);else for(var t in r)ss(r,t)&&(e[t]=r[t]);if(e.default=e,typeof e=="function")e.prototype&&Rn(e.prototype);else if(up){var s=In(vn);s.value="Module",ow(e,up,s)}return Rn(e)};/*!@preserve@license
221
221
  * 模块名称:j-regexp
222
222
  * 模块功能:可读性更好的正则表达式创建方式。从属于“简计划”。
223
223
       More readable way for creating RegExp. Belong to "Plan J".
@@ -387,7 +387,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
387
387
  `)?n.split(`
388
388
  `):n,e[0])}else{let r=e.length;if(r){const{raw:t}=n;for(n=t[r];r;)e[--r]+=t[r];n=e.join("")+n}else n=n.raw[0]}return Ct(n.includes(`
389
389
  `)?n.split(`
390
- `):n,Zn(null))},sO=new F4("utf-8",Zn({fatal:!0,ignoreBOM:!1})),Mo=n=>{if(R4(n)?n.length!==n.byteLength:!j4(n))throw Re("only Uint8Array or ArrayBuffer is acceptable");try{return sO.decode(n)}catch{throw Xt("A TOML doc must be a (ful-scalar) valid UTF-8 file, without any unknown code point.")}},Ro=n=>"byteLength"in n,{test:iO}=lt(/[\uD800-\uDFFF]/u),Au=n=>{if(dw(iO(n)))throw Xt("A TOML doc must be a (ful-scalar) valid UTF-8 file, without any uncoupled UCS-4 character code.")};let Ou=!1;const Cr=(n,e,r,t,s,i)=>{let l="";if(typeof n=="object"&&n){if(Vs(n))throw Re(xA(n)?"TOML.parse(array from TOML.stringify(,{newline?}))":"TOML.parse(array)");if(Ro(n))n=Mo(n);else{if(l=n.path,typeof l!="string")throw Re("TOML.parse(source.path)");const{data:f,require:d=typeof require=="function"?require:hn}=n;if(d){const{resolve:h}=d;if(h!=null){const{paths:p}=h;if(p!=null){const g=Ld(p,h,[""]);if(g!=null){const w=g[0];if(w!=null){const b=w.replace(/node_modules$/,"");if(b&&(l=d("path").resolve(b,l),typeof l!="string"))throw Re("TOML.parse(source.require('path').resolve)")}}}}if(f===hn){const p=d("fs").readFileSync(l);if(typeof p=="object"&&p&&Ro(p))n=Mo(p);else throw Re("TOML.parse(source.require('fs').readFileSync)")}else if(typeof f=="string")Au(n=f);else if(typeof f=="object"&&f&&Ro(f))n=Mo(f);else throw Re("TOML.parse(source.data)")}else{if(f===hn)throw Re("TOML.parse(source.data|source.require)");if(typeof f=="string")Au(n=f);else if(typeof f=="object"&&f&&Ro(f))n=Mo(f);else throw Re("TOML.parse(source.data)")}}}else if(typeof n=="string")Au(n);else throw Re("TOML.parse(source)");let o,a;if(typeof r=="object"&&r){if(t!==hn||s!==hn)throw Re("options mode ? args mode");o=r.joiner,t=r.bigint,a=r.keys,s=r.x,i=""}else o=r;let c,u;if(Ou)throw Xt("parsing during parsing.");Ou=!0;try{M4(e,o,t,a,s,i),i4(n,l),n&&n[0]==="\uFEFF"&&ie(Re("TOML content (string) should not start with BOM (U+FEFF)"+le(" at "))),c=AA(),u=C4()}finally{a4(),D4(),Ou=!1,dw()}return u&&u(),c},lO=ps((n,e,r,t,s)=>typeof e=="number"?Cr(n,e,r,t,s,",,"):Cr(n,1,e,r,t,","),{"1.0":(n,e,r,t)=>Cr(n,.1,e,r,t,","),1:(n,e,r,t)=>Cr(n,1,e,r,t,","),.5:(n,e,r,t)=>Cr(n,.5,e,r,t,","),.4:(n,e,r,t)=>Cr(n,.4,e,r,t,","),.3:(n,e,r,t)=>Cr(n,.3,e,r,t,","),.2:(n,e,r,t)=>Cr(n,.2,e,r,t,","),.1:(n,e,r,t)=>Cr(n,.1,e,r,t,",")}),Rf=I3({version:N3,parse:lO,stringify:eO,Section:x3,inline:X3,multiline:tO,basic:nO,literal:rO,commentFor:Na,commentForThis:Il,OffsetDateTime:zd,LocalDateTime:Hd,LocalDate:Vd,LocalTime:Yd,isInline:Dd,isSection:$l,Keys:Uw}),_y=n=>{const e=[],r=[];return n.forEach(t=>{const{path:s,name:i}=t,l=re(Sd).find(({folder:a,file:c})=>s.startsWith(a)||s===c),o=re(Sr).findLast(({internalPath:a})=>s.startsWith(a));l&&i.match(/\.(?:json|markdown|md|toml|ya?ml)$/i)&&e.push({...t,type:"entry",config:l}),o&&!i.startsWith("+")&&!e.find(a=>a.path===s)&&r.push({...t,type:"asset",config:o})}),{entryFiles:e,assetFiles:r}},gy=({format:n,extension:e})=>e||(n==="yml"||n==="yaml"?"yml":n==="toml"?"toml":n==="json"?"json":"md"),by=(n,e)=>typeof e=="string"&&e.trim()?[e,e]:Array.isArray(e)&&e.length===2?e:n==="json-frontmatter"?["{","}"]:n==="toml-frontmatter"?["+++","+++"]:["---","---"],oO=({text:n,path:e,config:{file:r,extension:t,format:s,frontmatterDelimiter:i}})=>{if(s||(s=t==="md"||e.endsWith(".md")?"yaml-frontmatter":t||(r==null?void 0:r.match(/\.([^.]+)$/)[1])),!s)return null;try{if(s.match(/^ya?ml$/)&&e.match(/\.ya?ml$/))return Zi.parse(n);if(s==="toml"&&e.match(/\.toml$/))return Rf.parse(n);if(s==="json"&&e.match(/\.json$/))return JSON.parse(n)}catch{return null}if(s.match(/^(?:(?:yaml|toml|json)-)?frontmatter$/)&&e.match(/\.(?:md|markdown)$/)){const[l,o]=by(s,i),[,a,c=""]=n.match(new RegExp(`^${sn(l)}\\n(.+?)\\n${sn(o)}(?:\\n(.+))?`,"ms"))||[];if(a&&(s==="frontmatter"||s==="yaml-frontmatter"))try{return{...Zi.parse(a),body:c}}catch{}if(a&&(s==="frontmatter"||s==="toml-frontmatter"))try{return{...Rf.parse(a),body:c}}catch{}if(a&&(s==="frontmatter"||s==="json-frontmatter"))try{return{...JSON.parse(a),body:c}}catch{}}return null},Up=({content:n,path:e,config:{extension:r,format:t,frontmatterDelimiter:s}})=>{n=JSON.parse(JSON.stringify(n)),t||(t=r==="md"||e.endsWith(".md")?"yaml-frontmatter":r||e.match(/\.([^.]+)$/)[1]);const i=()=>Zi.stringify(n,null,{lineWidth:0}).trim(),l=()=>Rf.stringify(n,{newline:`
390
+ `):n,Zn(null))},sO=new F4("utf-8",Zn({fatal:!0,ignoreBOM:!1})),Mo=n=>{if(R4(n)?n.length!==n.byteLength:!j4(n))throw Re("only Uint8Array or ArrayBuffer is acceptable");try{return sO.decode(n)}catch{throw Xt("A TOML doc must be a (ful-scalar) valid UTF-8 file, without any unknown code point.")}},Ro=n=>"byteLength"in n,{test:iO}=lt(/[\uD800-\uDFFF]/u),Au=n=>{if(dw(iO(n)))throw Xt("A TOML doc must be a (ful-scalar) valid UTF-8 file, without any uncoupled UCS-4 character code.")};let Ou=!1;const Cr=(n,e,r,t,s,i)=>{let l="";if(typeof n=="object"&&n){if(Vs(n))throw Re(xA(n)?"TOML.parse(array from TOML.stringify(,{newline?}))":"TOML.parse(array)");if(Ro(n))n=Mo(n);else{if(l=n.path,typeof l!="string")throw Re("TOML.parse(source.path)");const{data:f,require:d=typeof require=="function"?require:hn}=n;if(d){const{resolve:h}=d;if(h!=null){const{paths:p}=h;if(p!=null){const g=Ld(p,h,[""]);if(g!=null){const w=g[0];if(w!=null){const b=w.replace(/node_modules$/,"");if(b&&(l=d("path").resolve(b,l),typeof l!="string"))throw Re("TOML.parse(source.require('path').resolve)")}}}}if(f===hn){const p=d("fs").readFileSync(l);if(typeof p=="object"&&p&&Ro(p))n=Mo(p);else throw Re("TOML.parse(source.require('fs').readFileSync)")}else if(typeof f=="string")Au(n=f);else if(typeof f=="object"&&f&&Ro(f))n=Mo(f);else throw Re("TOML.parse(source.data)")}else{if(f===hn)throw Re("TOML.parse(source.data|source.require)");if(typeof f=="string")Au(n=f);else if(typeof f=="object"&&f&&Ro(f))n=Mo(f);else throw Re("TOML.parse(source.data)")}}}else if(typeof n=="string")Au(n);else throw Re("TOML.parse(source)");let o,a;if(typeof r=="object"&&r){if(t!==hn||s!==hn)throw Re("options mode ? args mode");o=r.joiner,t=r.bigint,a=r.keys,s=r.x,i=""}else o=r;let c,u;if(Ou)throw Xt("parsing during parsing.");Ou=!0;try{M4(e,o,t,a,s,i),i4(n,l),n&&n[0]==="\uFEFF"&&ie(Re("TOML content (string) should not start with BOM (U+FEFF)"+le(" at "))),c=AA(),u=C4()}finally{a4(),D4(),Ou=!1,dw()}return u&&u(),c},lO=ps((n,e,r,t,s)=>typeof e=="number"?Cr(n,e,r,t,s,",,"):Cr(n,1,e,r,t,","),{"1.0":(n,e,r,t)=>Cr(n,.1,e,r,t,","),1:(n,e,r,t)=>Cr(n,1,e,r,t,","),.5:(n,e,r,t)=>Cr(n,.5,e,r,t,","),.4:(n,e,r,t)=>Cr(n,.4,e,r,t,","),.3:(n,e,r,t)=>Cr(n,.3,e,r,t,","),.2:(n,e,r,t)=>Cr(n,.2,e,r,t,","),.1:(n,e,r,t)=>Cr(n,.1,e,r,t,",")}),Rf=I3({version:N3,parse:lO,stringify:eO,Section:x3,inline:X3,multiline:tO,basic:nO,literal:rO,commentFor:Na,commentForThis:Il,OffsetDateTime:zd,LocalDateTime:Hd,LocalDate:Vd,LocalTime:Yd,isInline:Dd,isSection:$l,Keys:Uw}),_y=n=>{const e=[],r=[];return n.forEach(t=>{const{path:s}=t,i=s.split("/").pop(),l=re(Sd).find(({folder:a,file:c})=>s.startsWith(a)||s===c),o=re(Sr).findLast(({internalPath:a})=>s.startsWith(a));l&&i.match(/\.(?:json|markdown|md|toml|ya?ml)$/i)&&e.push({...t,type:"entry",config:l}),o&&!i.startsWith("+")&&!e.find(a=>a.path===s)&&r.push({...t,type:"asset",config:o})}),{entryFiles:e,assetFiles:r}},gy=({format:n,extension:e})=>e||(n==="yml"||n==="yaml"?"yml":n==="toml"?"toml":n==="json"?"json":"md"),by=(n,e)=>typeof e=="string"&&e.trim()?[e,e]:Array.isArray(e)&&e.length===2?e:n==="json-frontmatter"?["{","}"]:n==="toml-frontmatter"?["+++","+++"]:["---","---"],oO=({text:n,path:e,config:{file:r,extension:t,format:s,frontmatterDelimiter:i}})=>{if(s||(s=t==="md"||e.endsWith(".md")?"yaml-frontmatter":t||(r==null?void 0:r.match(/\.([^.]+)$/)[1])),!s)return null;try{if(s.match(/^ya?ml$/)&&e.match(/\.ya?ml$/))return Zi.parse(n);if(s==="toml"&&e.match(/\.toml$/))return Rf.parse(n);if(s==="json"&&e.match(/\.json$/))return JSON.parse(n)}catch{return null}if(s.match(/^(?:(?:yaml|toml|json)-)?frontmatter$/)&&e.match(/\.(?:md|markdown)$/)){const[l,o]=by(s,i),[,a,c=""]=n.match(new RegExp(`^${sn(l)}\\n(.+?)\\n${sn(o)}(?:\\n(.+))?`,"ms"))||[];if(a&&(s==="frontmatter"||s==="yaml-frontmatter"))try{return{...Zi.parse(a),body:c}}catch{}if(a&&(s==="frontmatter"||s==="toml-frontmatter"))try{return{...Rf.parse(a),body:c}}catch{}if(a&&(s==="frontmatter"||s==="json-frontmatter"))try{return{...JSON.parse(a),body:c}}catch{}}return null},Up=({content:n,path:e,config:{extension:r,format:t,frontmatterDelimiter:s}})=>{n=JSON.parse(JSON.stringify(n)),t||(t=r==="md"||e.endsWith(".md")?"yaml-frontmatter":r||e.match(/\.([^.]+)$/)[1]);const i=()=>Zi.stringify(n,null,{lineWidth:0}).trim(),l=()=>Rf.stringify(n,{newline:`
391
391
  `}).trim(),o=()=>JSON.stringify(n,null,2).trim();try{if(t.match(/^ya?ml$/))return`${i()}
392
392
  `;if(t==="toml")return`${l()}
393
393
  `;if(t==="json")return`${o()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/cms",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {