import{DateFormat as e,TimeFormat as a}from"./formats.js";const s=new Map,t=/%?([dfFghHKmMstyz])\1*|\\.|(["'])[^\\x02]+\2|[^dfFghHKmMstyz\\'"]+/g;export function gcxDateTimeFormatToLuxonFormat(c,r=!1){let y;switch(c){case e.DATE_SHORT:y="D";break;case e.DATE_LONG:y="DDD";break;case e.TIME_SHORT:case a.TIME_SHORT:y="t";break;case e.TIME_LONG:case a.TIME_LONG:y="tt";break;case e.DATE_TIME_SHORT:y="ff";break;case e.DATE_TIME_LONG:y="DDD t";break;case e.FULL:y="DDDD t";break;case"εσρι M/d/yyyy h:mm tt":y="D t";break;case"εσρι M/d/yyyy H:mm":y="D T";break;case"εσρι M/d/yyyy h:mm:ss tt":y="D tt";break;case"εσρι M/d/yyyy H:mm:ss":y="D TT";break;case"εσρι MMMM d yyyy h:mm tt":y="DDD t";break;case"εσρι MMMM d yyyy H:mm":y="DDD T";break;case"εσρι MMMM d yyyy h:mm:ss tt":y="DDD tt";break;case"εσρι MMMM d yyyy H:mm:ss":y="DDD TT";break;case"εσρι H:mm":y="T";break;case"εσρι H:mm:ss":y="TT";break;case e.ISO_8601:case a.ISO_8601:return r?"yyyy-MM-dd":"ISO-8601";default:y=function(e){if(s.has(e))return s.get(e);const a=e.match(t);let c="";if(null==a)return c;for(let e of a)switch(e.startsWith("%")&&(e=e.slice(1)),e[0]){case"y":e.length<=2?c+="yy":c+="yyyy";break;case"d":e.length<=2?c+=e:c+="ddd"===e?"ccc":"cccc";break;case"f":case"F":c+=Array(3-Math.min(3,e.length)+1).fill("u").join("");break;case"t":c+="a";break;case"z":c+="ZZ";break;case"M":c+=e.slice(0,4);break;case"h":case"H":case"m":case"s":c+=e.slice(0,2);break;case"g":c+="G";break;case"K":console.warn(`The "${e}" date format specifier is not supported.`);break;default:e.startsWith('"')||e.startsWith("'")?e=e.slice(1,-1):e.startsWith("\\")&&(e=e.slice(1)),c+=`'${e}'`}return s.set(e,c),c}(c)}return r?y.replace(/f/gi,"D").replace(/[tThH:msSuzZa]/g,"").trim():y}