Module 559095

1,771 characters · in 61bd1303c8f40f17.js
Dependencies
Required by (2)
Lazily required by (0)none
Requires (1)
Lazily requires (0)none
Source Raw
function(e,r,t){t.d(r,{Y_:()=>A,R9:()=>u,h4:()=>d,Mf:()=>f,ui:()=>m});var a,n,l=((a={}).TOP="top",a.BOTTOM="bottom",a.CENTER="center",a),i=t(754474),o=((n={}).STAPLE="staple",n.RAIL="rail",n.BORDER="border",n);let s="responsive",u={foreground:i.u.FRONT,background:i.u.BACK},c=new Set([o.STAPLE,o.RAIL,o.BORDER]),p=new Set([l.TOP,l.BOTTOM,l.CENTER]),d={wrong_part_count:"wrong filename format",invalid_index:"invalid index",invalid_type:`invalid type (expected: ${[...c].join(", ")})`,invalid_anchor:`invalid anchor (expected: ${[...p].join(", ")})`,invalid_responsive:`invalid suffix (expected '${s}')`,border_has_anchor:"border layers must omit the anchor"};function f(e){var r;let t=e.replace(/\.\w+$/,"").split("_");if(t.length<2||t.length>4)return{parsed:null,errorType:"wrong_part_count"};let[a,n,...i]=t;if(!/^\d+$/.test(a))return{parsed:null,errorType:"invalid_index"};if(!c.has(n))return{parsed:null,errorType:"invalid_type"};if(n===o.BORDER){if(i.length>0&&(r=i[0],p.has(r)))return{parsed:null,errorType:"border_has_anchor"};if(i.length>1)return{parsed:null,errorType:"wrong_part_count"};if(1===i.length&&i[0]!==s)return{parsed:null,errorType:"invalid_responsive"};let e=1===i.length;return{parsed:{index:Number(a),type:n,anchor:l.CENTER,responsive:e},errorType:null}}let u=i[0];if(null==u||!p.has(u))return{parsed:null,errorType:"invalid_anchor"};if(i.length>2)return{parsed:null,errorType:"wrong_part_count"};if(2===i.length&&i[1]!==s)return{parsed:null,errorType:"invalid_responsive"};let d=2===i.length||n===o.RAIL;return{parsed:{index:Number(a),type:n,anchor:u,responsive:d},errorType:null}}let v={[i.u.FRONT]:0,[i.u.BACK]:1};function m(e,r){let t=v[e.order]-v[r.order];return 0!==t?t:e.index-r.index}function A(e){return"preview"===e.replace(/\.\w+$/,"")}}