@shopify/cli
Version:
A CLI tool to build for the Shopify platform
2 lines (1 loc) • 2.42 kB
JavaScript
import{n as c,o as m}from"./chunk-CERXUPGC.js";import{g as F}from"./chunk-VPRTJUIN.js";F();F();F();function o(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var S=/^[\uD800-\uDBFF][\uDC00-\uDFFF]$/,B=["\x1B","\x9B"],E=e=>`${B[0]}[${e}m`,y=(e,t,a)=>{let i=[];e=[...e];for(let f of e){let s=f;f.includes(";")&&(f=f.split(";")[0][0]+"0");let r=m.codes.get(Number.parseInt(f,10));if(r){let n=e.indexOf(r.toString());n===-1?i.push(E(t?r:s)):e.splice(n,1)}else if(t){i.push(E(0));break}else i.push(E(s))}if(t&&(i=i.filter((f,s)=>i.indexOf(f)===s),a!==void 0)){let f=E(m.codes.get(Number.parseInt(a,10)));i=i.reduce((s,r)=>r===f?[r,...s]:[...s,r],[])}return i.join("")};function p(e,t,a){let i=[...e],f=[],s=typeof a=="number"?a:i.length,r=!1,n,u=0,l="";for(let[h,x]of i.entries()){let b=!1;if(B.includes(x)){let A=/\d[^m]*/.exec(e.slice(h,h+18));n=A&&A.length>0?A[0]:void 0,u<s&&(r=!0,n!==void 0&&f.push(n))}else r&&x==="m"&&(r=!1,b=!0);if(!r&&!b&&u++,!S.test(x)&&o(x.codePointAt())&&(u++,typeof a!="number"&&s++),u>t&&u<=s)l+=x;else if(u===t&&!r&&n!==void 0)l=y(f);else if(u>=s){l+=y(f,!0,n);break}}return l}function g(e,t,a){if(e.charAt(t)===" ")return t;let i=a?1:-1;for(let f=0;f<=3;f++){let s=t+f*i;if(e.charAt(s)===" ")return s}return t}function C(e,t,a={}){let{position:i="end",space:f=!1,preferTruncationOnSpace:s=!1}=a,{truncationCharacter:r="\u2026"}=a;if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof t}`);if(t<1)return"";if(t===1)return r;let n=c(e);if(n<=t)return e;if(i==="start"){if(s){let u=g(e,n-t+1,!0);return r+p(e,u,n).trim()}return f===!0&&(r+=" "),r+p(e,n-t+c(r),n)}if(i==="middle"){f===!0&&(r=` ${r} `);let u=Math.floor(t/2);if(s){let l=g(e,u),h=g(e,n-(t-u)+1,!0);return p(e,0,l)+r+p(e,h,n).trim()}return p(e,0,u)+r+p(e,n-(t-u)+c(r),n)}if(i==="end"){if(s){let u=g(e,t-1);return p(e,0,u)+r}return f===!0&&(r=` ${r}`),p(e,0,t-c(r))+r}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${i}`)}export{o as a,C as b};