@ienlab/cloud-functions-library 1.0.0-dev.14 → 1.0.0-dev.15
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/dist/index.js +1 -1
- package/dist/index.mjs +566 -13
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("firebase-admin/firestore"),t=require("firebase-functions/v2/https");var n=[`ko`,`en`],r=null;function i(e){r=e}var a={get(e,t=`ko`){let i=r?.();return e[n.includes(i)?i:t]??e[t]},ko(e){return e.ko}};function o(e){return{...e.data(),id:e.id}}function s(e,t,n){let r=e.headers.origin;return r&&n.includes(r)&&(t.set(`Access-Control-Allow-Origin`,r),t.set(`Vary`,`Origin`)),t.set(`Access-Control-Allow-Methods`,`POST, OPTIONS`),t.set(`Access-Control-Allow-Headers`,`Content-Type, Authorization`),e.method===`OPTIONS`?(t.status(204).send(),!1):e.method===`POST`?!0:(t.status(405).send({error:`Method Not Allowed`}),!1)}var c=()=>({updateAt:e.FieldValue.serverTimestamp(),deletedAt:e.FieldValue.serverTimestamp()}),l=()=>({updateAt:e.FieldValue.serverTimestamp(),deletedAt:null});function u(e){let{spaUrl:n,defaultOG:r,resolvers:i,region:a=`asia-northeast3`}=e,o=null,s=0;function c(){let e=Date.now();return(!o||e-s>18e5)&&(s=e,o=fetch(n,{signal:AbortSignal.timeout(5e3)}).then(async e=>{if(!e.ok)throw o=null,s=0,Error(`Failed to fetch template: ${e.status}`);return e.text()}).catch(e=>{throw o=null,s=0,e})),o}function l(e){return e?String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`):``}function u(e,t,n,r){let i=l(r),a=RegExp(`(<meta\\s+[^>]*${t}=["']${n}["'][^>]*>)`,`gi`),o=!1,s=e.replace(a,e=>(o=!0,/\bcontent=/i.test(e)?e.replace(/\bcontent=(["'])(.*?)\1/i,`content=$1${i}$1`):e.replace(/(\/?>)$/,` content="${i}"$1`)));if(!o){let e=`<meta ${t}="${n}" content="${i}">`;return s.replace(/(<\/head>)/i,`${e}\n$1`)}return s}function d(e,t,n,r){let i=l(t),a=e;return a=/<title>.*<\/title>/i.test(a)?a.replace(/(<title>)[^<]*(<\/title>)/i,`$1${i}$2`):a.replace(/(<\/head>)/i,`<title>${i}</title>\n$1`),a=u(a,`name`,`description`,n),a=u(a,`property`,`og:title`,t),a=u(a,`property`,`og:description`,n),a=u(a,`property`,`og:image`,r),a=u(a,`property`,`og:type`,`website`),a=u(a,`name`,`twitter:card`,`summary_large_image`),a=u(a,`name`,`twitter:title`,t),a=u(a,`name`,`twitter:description`,n),a=u(a,`name`,`twitter:image`,r),a}return(0,t.onRequest)({region:a},async(e,t)=>{let a=Date.now(),o=e.path,s=new URL(e.url,n),l=s.searchParams;try{let n=r;for(let t of i){let r=o.match(t.pattern);if(!r)continue;let i=r[1]??r[0];try{let a=await t.resolve(i,{req:e,pathname:o,searchParams:l,match:r});if(a){n=a;break}}catch(e){console.error(`[SSRDynamicOG] Failed to resolve "${o}${s.search}" with pattern ${t.pattern}:`,e)}}let u=d(await c(),n.title,n.description,n.image);console.log(`[SSRDynamicOG] ${o}${s.search} → ${n.title} (${Date.now()-a}ms)`),t.setHeader(`Content-Type`,`text/html; charset=utf-8`),t.status(200).send(u)}catch(e){console.error(`[SSRDynamicOG] error:`,e),t.redirect(302,n)}})}exports.Localized=a,exports.SUPPORTED_LOCALES=n,exports.applyCors=s,exports.createSSRDynamicOG=u,exports.del=c,exports.setLocalizedLocaleResolver=i,exports.snapshotToData=o,exports.undel=l;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("firebase-admin/firestore"),u=require("firebase-functions/v2/https");var d=[`ko`,`en`],f=null;function p(e){f=e}var m={get(e,t=`ko`){let n=f?.();return e[d.includes(n)?n:t]??e[t]},ko(e){return e.ko}};function h(e){return{...e.data(),id:e.id}}function g(e,t,n){let r=e.headers.origin;return r&&n.includes(r)&&(t.set(`Access-Control-Allow-Origin`,r),t.set(`Vary`,`Origin`)),t.set(`Access-Control-Allow-Methods`,`POST, OPTIONS`),t.set(`Access-Control-Allow-Headers`,`Content-Type, Authorization`),e.method===`OPTIONS`?(t.status(204).send(),!1):e.method===`POST`?!0:(t.status(405).send({error:`Method Not Allowed`}),!1)}var _=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),v=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(_()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_ko=r(n.dayjs)})(e,(function(e){"use strict";function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`ko`,weekdays:`일요일_월요일_화요일_수요일_목요일_금요일_토요일`.split(`_`),weekdaysShort:`일_월_화_수_목_금_토`.split(`_`),weekdaysMin:`일_월_화_수_목_금_토`.split(`_`),months:`1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월`.split(`_`),monthsShort:`1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월`.split(`_`),ordinal:function(e){return e+`일`},formats:{LT:`A h:mm`,LTS:`A h:mm:ss`,L:`YYYY.MM.DD.`,LL:`YYYY년 MMMM D일`,LLL:`YYYY년 MMMM D일 A h:mm`,LLLL:`YYYY년 MMMM D일 dddd A h:mm`,l:`YYYY.MM.DD.`,ll:`YYYY년 MMMM D일`,lll:`YYYY년 MMMM D일 A h:mm`,llll:`YYYY년 MMMM D일 dddd A h:mm`},meridiem:function(e){return e<12?`오전`:`오후`},relativeTime:{future:`%s 후`,past:`%s 전`,s:`몇 초`,m:`1분`,mm:`%d분`,h:`한 시간`,hh:`%d시간`,d:`하루`,dd:`%d일`,M:`한 달`,MM:`%d달`,y:`일 년`,yy:`%d년`}};return n.default.locale(r,null,!0),r}))})),y=c(_());v();var b={ko:{date_format:{default:`YYYY년 M월 D일 dddd`,no_year:`M월 D일 dddd`,no_year_short:`M월 D일`,short:`YYYY년 M월 D일`},date_time_format:{default:{no_sec:`YYYY년 M월 D일 A h:mm`,sec:`YYYY년 M월 D일 A h:mm:ss`},no_year:{no_sec:`M월 D일 A h:mm`,sec:`M월 D일 A h:mm:ss`,short:{no_sec:`M월 D일 A h:mm`,sec:`M월 D일 A h:mm:ss`}},short:{no_sec:`YYYY년 M월 D일 A h:mm`,sec:`YYYY년 M월 D일 A h:mm:ss`}},time_format:{apm:`A`,f12:{no_sec:`A h:mm`,sec:`A h:mm:ss`},f12_no_apm:{no_sec:`h:mm`,sec:`h:mm:ss`},f24:{no_sec:`HH:mm`,sec:`HH:mm:ss`},f24_short:{no_sec:`H:mm`,sec:`H:mm:ss`}}},en:{date_format:{default:`dddd, MMMM D, YYYY`,no_year:`dddd, MMMM D`,no_year_short:`MMM D`,short:`MMM D, YYYY`},date_time_format:{default:{no_sec:`MMMM D, YYYY, h:mm A`,sec:`MMMM D, YYYY, h:mm:ss A`},no_year:{no_sec:`MMM D, h:mm A`,sec:`MMM D, h:mm:ss A`,short:{no_sec:`MMM D, h:mm A`,sec:`MMM D, h:mm:ss A`}},short:{no_sec:`MMM D, YYYY h:mm A`,sec:`MMM D, YYYY h:mm:ss A`}},time_format:{apm:`A`,f12:{no_sec:`h:mm A`,sec:`h:mm:ss A`},f12_no_apm:{no_sec:`h:mm`,sec:`h:mm:ss`},f24:{no_sec:`HH:mm`,sec:`HH:mm:ss`},f24_short:{no_sec:`H:mm`,sec:`H:mm:ss`}}}};function x(e,t,n=`ko`){let r=e instanceof Date?(0,y.default)(e):e;if(!e||!r.isValid())return``;let i=n===`en`||n===`ko`?n:`ko`;return r.locale(i).format(t)}function S(e=`ko`){let t=e===`en`||e===`ko`?e:`ko`,n=b[t].date_format;return{dateFormat:e=>x(e,n.default,t),dateFormatNoYear:e=>x(e,n.no_year,t),dateFormatShort:e=>x(e,n.short,t),dateFormatNoYearShort:e=>x(e,n.no_year_short,t)}}function C(e){return e===`en`||e===`ko`?e:`ko`}function w(e=`ko`){let t=C(e),n=b[t].date_time_format;return{dateTimeFormat:(e,r=!1)=>x(e,r?n.default.sec:n.default.no_sec,t),dateTimeFormatShort:(e,r=!1)=>x(e,r?n.short.sec:n.short.no_sec,t),dateTimeFormatNoYear:(e,r=!1)=>x(e,r?n.no_year.sec:n.no_year.no_sec,t),dateTimeFormatNoYearShort:(e,r=!1)=>x(e,r?n.no_year.short.sec:n.no_year.short.no_sec,t)}}var T={ko:{day:`일`,hour:{default:`시간`,short:`시간`},minute:{default:`분`,short:`분`},zero:{default:`0분`,short:`0분`}},en:{day:`d`,hour:{default:`hr`,short:`h`},minute:{default:`min`,short:`m`},zero:{default:`0min`,short:`0m`}}};function E(e){return e===`en`||e===`ko`?e:`ko`}function D(e=`ko`){let t=E(e),n=b[t].time_format;return{timeFormat24:(e,r=!1)=>x(e,r?n.f24.sec:n.f24.no_sec,t),timeFormat24Short:(e,r=!1)=>x(e,r?n.f24_short.sec:n.f24_short.no_sec,t),timeFormat12:(e,r=!1)=>x(e,r?n.f12.sec:n.f12.no_sec,t),timeFormat12NoApm:(e,r=!1)=>x(e,r?n.f12_no_apm.sec:n.f12_no_apm.no_sec,t),apmFormat:e=>x(e,n.apm,t)}}function O(e=`ko`){let t=T[E(e)];function n(e){if(isNaN(e)||!isFinite(e))return{day:0,hour:0,minute:0};let t=Math.round(e*60);return{day:Math.floor(t/86400),hour:Math.floor(t%86400/3600),minute:Math.floor(t%3600/60)}}return{minFormat:e=>{let{day:r,hour:i,minute:a}=n(e),o=[];return r!==0&&o.push(`${r}${t.day}`),i!==0&&o.push(`${i}${t.hour.default}`),a!==0&&o.push(`${a}${t.minute.default}`),o.length===0&&o.push(t.zero.default),o.join(` `)},minFormatShort:e=>{let{day:r,hour:i,minute:a}=n(e),o=[];return r!==0&&o.push(`${r}${t.day}`),i!==0&&o.push(`${i}${t.hour.short}`),a!==0&&o.push(`${a}${t.minute.short}`),o.length===0&&o.push(t.zero.short),o.join(` `)}}}var k=()=>({updateAt:l.FieldValue.serverTimestamp(),deletedAt:l.FieldValue.serverTimestamp()}),A=()=>({updateAt:l.FieldValue.serverTimestamp(),deletedAt:null});function j(e){let{spaUrl:t,defaultOG:n,resolvers:r,region:i=`asia-northeast3`}=e,a=null,o=0;function s(){let e=Date.now();return(!a||e-o>18e5)&&(o=e,a=fetch(t,{signal:AbortSignal.timeout(5e3)}).then(async e=>{if(!e.ok)throw a=null,o=0,Error(`Failed to fetch template: ${e.status}`);return e.text()}).catch(e=>{throw a=null,o=0,e})),a}function c(e){return e?String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`):``}function l(e,t,n,r){let i=c(r),a=RegExp(`(<meta\\s+[^>]*${t}=["']${n}["'][^>]*>)`,`gi`),o=!1,s=e.replace(a,e=>(o=!0,/\bcontent=/i.test(e)?e.replace(/\bcontent=(["'])(.*?)\1/i,`content=$1${i}$1`):e.replace(/(\/?>)$/,` content="${i}"$1`)));if(!o){let e=`<meta ${t}="${n}" content="${i}">`;return s.replace(/(<\/head>)/i,`${e}\n$1`)}return s}function d(e,t,n,r){let i=c(t),a=e;return a=/<title>.*<\/title>/i.test(a)?a.replace(/(<title>)[^<]*(<\/title>)/i,`$1${i}$2`):a.replace(/(<\/head>)/i,`<title>${i}</title>\n$1`),a=l(a,`name`,`description`,n),a=l(a,`property`,`og:title`,t),a=l(a,`property`,`og:description`,n),a=l(a,`property`,`og:image`,r),a=l(a,`property`,`og:type`,`website`),a=l(a,`name`,`twitter:card`,`summary_large_image`),a=l(a,`name`,`twitter:title`,t),a=l(a,`name`,`twitter:description`,n),a=l(a,`name`,`twitter:image`,r),a}return(0,u.onRequest)({region:i},async(e,i)=>{let a=Date.now(),o=e.path,c=new URL(e.url,t),l=c.searchParams;try{let t=n;for(let n of r){let r=o.match(n.pattern);if(!r)continue;let i=r[1]??r[0];try{let a=await n.resolve(i,{req:e,pathname:o,searchParams:l,match:r});if(a){t=a;break}}catch(e){console.error(`[SSRDynamicOG] Failed to resolve "${o}${c.search}" with pattern ${n.pattern}:`,e)}}let u=d(await s(),t.title,t.description,t.image);console.log(`[SSRDynamicOG] ${o}${c.search} → ${t.title} (${Date.now()-a}ms)`),i.setHeader(`Content-Type`,`text/html; charset=utf-8`),i.status(200).send(u)}catch(e){console.error(`[SSRDynamicOG] error:`,e),i.redirect(302,t)}})}exports.DATE_TIME_FORMATS=b,exports.Localized=m,exports.SUPPORTED_LOCALES=d,exports.applyCors=g,exports.createDateFormatters=S,exports.createDateTimeFormatters=w,exports.createDurationFormatter=O,exports.createSSRDynamicOG=j,exports.createTimeFormatters=D,exports.del=k,exports.formatBaseDateTime=x,exports.setLocalizedLocaleResolver=p,exports.snapshotToData=h,exports.undel=A;
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { FieldValue as e } from "firebase-admin/firestore";
|
|
2
2
|
import { onRequest as t } from "firebase-functions/v2/https";
|
|
3
|
-
//#region
|
|
4
|
-
var n =
|
|
5
|
-
function
|
|
6
|
-
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var n = Object.create, r = Object.defineProperty, i = Object.getOwnPropertyDescriptor, a = Object.getOwnPropertyNames, o = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty, c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), l = (e, t, n, o) => {
|
|
5
|
+
if (t && typeof t == "object" || typeof t == "function") for (var c = a(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !s.call(e, d) && d !== n && r(e, d, {
|
|
6
|
+
get: ((e) => t[e]).bind(null, d),
|
|
7
|
+
enumerable: !(o = i(t, d)) || o.enumerable
|
|
8
|
+
});
|
|
9
|
+
return e;
|
|
10
|
+
}, u = (e, t, i) => (i = e == null ? {} : n(o(e)), l(t || !e || !e.__esModule ? r(i, "default", {
|
|
11
|
+
value: e,
|
|
12
|
+
enumerable: !0
|
|
13
|
+
}) : i, e)), d = ["ko", "en"], f = null;
|
|
14
|
+
function p(e) {
|
|
15
|
+
f = e;
|
|
7
16
|
}
|
|
8
|
-
var
|
|
17
|
+
var m = {
|
|
9
18
|
get(e, t = "ko") {
|
|
10
|
-
let
|
|
11
|
-
return e[
|
|
19
|
+
let n = f?.();
|
|
20
|
+
return e[d.includes(n) ? n : t] ?? e[t];
|
|
12
21
|
},
|
|
13
22
|
ko(e) {
|
|
14
23
|
return e.ko;
|
|
@@ -16,7 +25,7 @@ var a = {
|
|
|
16
25
|
};
|
|
17
26
|
//#endregion
|
|
18
27
|
//#region src/utils/firestore.ts
|
|
19
|
-
function
|
|
28
|
+
function h(e) {
|
|
20
29
|
return {
|
|
21
30
|
...e.data(),
|
|
22
31
|
id: e.id
|
|
@@ -24,22 +33,566 @@ function o(e) {
|
|
|
24
33
|
}
|
|
25
34
|
//#endregion
|
|
26
35
|
//#region src/utils/cors.ts
|
|
27
|
-
function
|
|
36
|
+
function g(e, t, n) {
|
|
28
37
|
let r = e.headers.origin;
|
|
29
38
|
return r && n.includes(r) && (t.set("Access-Control-Allow-Origin", r), t.set("Vary", "Origin")), t.set("Access-Control-Allow-Methods", "POST, OPTIONS"), t.set("Access-Control-Allow-Headers", "Content-Type, Authorization"), e.method === "OPTIONS" ? (t.status(204).send(), !1) : e.method === "POST" ? !0 : (t.status(405).send({ error: "Method Not Allowed" }), !1);
|
|
30
39
|
}
|
|
31
40
|
//#endregion
|
|
41
|
+
//#region node_modules/dayjs/dayjs.min.js
|
|
42
|
+
var _ = /* @__PURE__ */ c(((e, t) => {
|
|
43
|
+
(function(n, r) {
|
|
44
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
|
|
45
|
+
})(e, (function() {
|
|
46
|
+
var e = 1e3, t = 6e4, n = 36e5, r = "millisecond", i = "second", a = "minute", o = "hour", s = "day", c = "week", l = "month", u = "quarter", d = "year", f = "date", p = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, h = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, g = {
|
|
47
|
+
name: "en",
|
|
48
|
+
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
|
|
49
|
+
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
|
|
50
|
+
ordinal: function(e) {
|
|
51
|
+
var t = [
|
|
52
|
+
"th",
|
|
53
|
+
"st",
|
|
54
|
+
"nd",
|
|
55
|
+
"rd"
|
|
56
|
+
], n = e % 100;
|
|
57
|
+
return "[" + e + (t[(n - 20) % 10] || t[n] || t[0]) + "]";
|
|
58
|
+
}
|
|
59
|
+
}, _ = function(e, t, n) {
|
|
60
|
+
var r = String(e);
|
|
61
|
+
return !r || r.length >= t ? e : "" + Array(t + 1 - r.length).join(n) + e;
|
|
62
|
+
}, v = {
|
|
63
|
+
s: _,
|
|
64
|
+
z: function(e) {
|
|
65
|
+
var t = -e.utcOffset(), n = Math.abs(t), r = Math.floor(n / 60), i = n % 60;
|
|
66
|
+
return (t <= 0 ? "+" : "-") + _(r, 2, "0") + ":" + _(i, 2, "0");
|
|
67
|
+
},
|
|
68
|
+
m: function e(t, n) {
|
|
69
|
+
if (t.date() < n.date()) return -e(n, t);
|
|
70
|
+
var r = 12 * (n.year() - t.year()) + (n.month() - t.month()), i = t.clone().add(r, l), a = n - i < 0, o = t.clone().add(r + (a ? -1 : 1), l);
|
|
71
|
+
return +(-(r + (n - i) / (a ? i - o : o - i)) || 0);
|
|
72
|
+
},
|
|
73
|
+
a: function(e) {
|
|
74
|
+
return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
|
|
75
|
+
},
|
|
76
|
+
p: function(e) {
|
|
77
|
+
return {
|
|
78
|
+
M: l,
|
|
79
|
+
y: d,
|
|
80
|
+
w: c,
|
|
81
|
+
d: s,
|
|
82
|
+
D: f,
|
|
83
|
+
h: o,
|
|
84
|
+
m: a,
|
|
85
|
+
s: i,
|
|
86
|
+
ms: r,
|
|
87
|
+
Q: u
|
|
88
|
+
}[e] || String(e || "").toLowerCase().replace(/s$/, "");
|
|
89
|
+
},
|
|
90
|
+
u: function(e) {
|
|
91
|
+
return e === void 0;
|
|
92
|
+
}
|
|
93
|
+
}, y = "en", b = {};
|
|
94
|
+
b[y] = g;
|
|
95
|
+
var x = "$isDayjsObject", S = function(e) {
|
|
96
|
+
return e instanceof E || !(!e || !e[x]);
|
|
97
|
+
}, C = function e(t, n, r) {
|
|
98
|
+
var i;
|
|
99
|
+
if (!t) return y;
|
|
100
|
+
if (typeof t == "string") {
|
|
101
|
+
var a = t.toLowerCase();
|
|
102
|
+
b[a] && (i = a), n && (b[a] = n, i = a);
|
|
103
|
+
var o = t.split("-");
|
|
104
|
+
if (!i && o.length > 1) return e(o[0]);
|
|
105
|
+
} else {
|
|
106
|
+
var s = t.name;
|
|
107
|
+
b[s] = t, i = s;
|
|
108
|
+
}
|
|
109
|
+
return !r && i && (y = i), i || !r && y;
|
|
110
|
+
}, w = function(e, t) {
|
|
111
|
+
if (S(e)) return e.clone();
|
|
112
|
+
var n = typeof t == "object" ? t : {};
|
|
113
|
+
return n.date = e, n.args = arguments, new E(n);
|
|
114
|
+
}, T = v;
|
|
115
|
+
T.l = C, T.i = S, T.w = function(e, t) {
|
|
116
|
+
return w(e, {
|
|
117
|
+
locale: t.$L,
|
|
118
|
+
utc: t.$u,
|
|
119
|
+
x: t.$x,
|
|
120
|
+
$offset: t.$offset
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var E = function() {
|
|
124
|
+
function g(e) {
|
|
125
|
+
this.$L = C(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[x] = !0;
|
|
126
|
+
}
|
|
127
|
+
var _ = g.prototype;
|
|
128
|
+
return _.parse = function(e) {
|
|
129
|
+
this.$d = function(e) {
|
|
130
|
+
var t = e.date, n = e.utc;
|
|
131
|
+
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
132
|
+
if (T.u(t)) return /* @__PURE__ */ new Date();
|
|
133
|
+
if (t instanceof Date) return new Date(t);
|
|
134
|
+
if (typeof t == "string" && !/Z$/i.test(t)) {
|
|
135
|
+
var r = t.match(m);
|
|
136
|
+
if (r) {
|
|
137
|
+
var i = r[2] - 1 || 0, a = (r[7] || "0").substring(0, 3);
|
|
138
|
+
return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return new Date(t);
|
|
142
|
+
}(e), this.init();
|
|
143
|
+
}, _.init = function() {
|
|
144
|
+
var e = this.$d;
|
|
145
|
+
this.$y = e.getFullYear(), this.$M = e.getMonth(), this.$D = e.getDate(), this.$W = e.getDay(), this.$H = e.getHours(), this.$m = e.getMinutes(), this.$s = e.getSeconds(), this.$ms = e.getMilliseconds();
|
|
146
|
+
}, _.$utils = function() {
|
|
147
|
+
return T;
|
|
148
|
+
}, _.isValid = function() {
|
|
149
|
+
return this.$d.toString() !== p;
|
|
150
|
+
}, _.isSame = function(e, t) {
|
|
151
|
+
var n = w(e);
|
|
152
|
+
return this.startOf(t) <= n && n <= this.endOf(t);
|
|
153
|
+
}, _.isAfter = function(e, t) {
|
|
154
|
+
return w(e) < this.startOf(t);
|
|
155
|
+
}, _.isBefore = function(e, t) {
|
|
156
|
+
return this.endOf(t) < w(e);
|
|
157
|
+
}, _.$g = function(e, t, n) {
|
|
158
|
+
return T.u(e) ? this[t] : this.set(n, e);
|
|
159
|
+
}, _.unix = function() {
|
|
160
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
161
|
+
}, _.valueOf = function() {
|
|
162
|
+
return this.$d.getTime();
|
|
163
|
+
}, _.startOf = function(e, t) {
|
|
164
|
+
var n = this, r = !!T.u(t) || t, u = T.p(e), p = function(e, t) {
|
|
165
|
+
var i = T.w(n.$u ? Date.UTC(n.$y, t, e) : new Date(n.$y, t, e), n);
|
|
166
|
+
return r ? i : i.endOf(s);
|
|
167
|
+
}, m = function(e, t) {
|
|
168
|
+
return T.w(n.toDate()[e].apply(n.toDate("s"), (r ? [
|
|
169
|
+
0,
|
|
170
|
+
0,
|
|
171
|
+
0,
|
|
172
|
+
0
|
|
173
|
+
] : [
|
|
174
|
+
23,
|
|
175
|
+
59,
|
|
176
|
+
59,
|
|
177
|
+
999
|
|
178
|
+
]).slice(t)), n);
|
|
179
|
+
}, h = this.$W, g = this.$M, _ = this.$D, v = "set" + (this.$u ? "UTC" : "");
|
|
180
|
+
switch (u) {
|
|
181
|
+
case d: return r ? p(1, 0) : p(31, 11);
|
|
182
|
+
case l: return r ? p(1, g) : p(0, g + 1);
|
|
183
|
+
case c:
|
|
184
|
+
var y = this.$locale().weekStart || 0, b = (h < y ? h + 7 : h) - y;
|
|
185
|
+
return p(r ? _ - b : _ + (6 - b), g);
|
|
186
|
+
case s:
|
|
187
|
+
case f: return m(v + "Hours", 0);
|
|
188
|
+
case o: return m(v + "Minutes", 1);
|
|
189
|
+
case a: return m(v + "Seconds", 2);
|
|
190
|
+
case i: return m(v + "Milliseconds", 3);
|
|
191
|
+
default: return this.clone();
|
|
192
|
+
}
|
|
193
|
+
}, _.endOf = function(e) {
|
|
194
|
+
return this.startOf(e, !1);
|
|
195
|
+
}, _.$set = function(e, t) {
|
|
196
|
+
var n, c = T.p(e), u = "set" + (this.$u ? "UTC" : ""), p = (n = {}, n[s] = u + "Date", n[f] = u + "Date", n[l] = u + "Month", n[d] = u + "FullYear", n[o] = u + "Hours", n[a] = u + "Minutes", n[i] = u + "Seconds", n[r] = u + "Milliseconds", n)[c], m = c === s ? this.$D + (t - this.$W) : t;
|
|
197
|
+
if (c === l || c === d) {
|
|
198
|
+
var h = this.clone().set(f, 1);
|
|
199
|
+
h.$d[p](m), h.init(), this.$d = h.set(f, Math.min(this.$D, h.daysInMonth())).$d;
|
|
200
|
+
} else p && this.$d[p](m);
|
|
201
|
+
return this.init(), this;
|
|
202
|
+
}, _.set = function(e, t) {
|
|
203
|
+
return this.clone().$set(e, t);
|
|
204
|
+
}, _.get = function(e) {
|
|
205
|
+
return this[T.p(e)]();
|
|
206
|
+
}, _.add = function(r, u) {
|
|
207
|
+
var f, p = this;
|
|
208
|
+
r = Number(r);
|
|
209
|
+
var m = T.p(u), h = function(e) {
|
|
210
|
+
var t = w(p);
|
|
211
|
+
return T.w(t.date(t.date() + Math.round(e * r)), p);
|
|
212
|
+
};
|
|
213
|
+
if (m === l) return this.set(l, this.$M + r);
|
|
214
|
+
if (m === d) return this.set(d, this.$y + r);
|
|
215
|
+
if (m === s) return h(1);
|
|
216
|
+
if (m === c) return h(7);
|
|
217
|
+
var g = (f = {}, f[a] = t, f[o] = n, f[i] = e, f)[m] || 1, _ = this.$d.getTime() + r * g;
|
|
218
|
+
return T.w(_, this);
|
|
219
|
+
}, _.subtract = function(e, t) {
|
|
220
|
+
return this.add(-1 * e, t);
|
|
221
|
+
}, _.format = function(e) {
|
|
222
|
+
var t = this, n = this.$locale();
|
|
223
|
+
if (!this.isValid()) return n.invalidDate || p;
|
|
224
|
+
var r = e || "YYYY-MM-DDTHH:mm:ssZ", i = T.z(this), a = this.$H, o = this.$m, s = this.$M, c = n.weekdays, l = n.months, u = n.meridiem, d = function(e, n, i, a) {
|
|
225
|
+
return e && (e[n] || e(t, r)) || i[n].slice(0, a);
|
|
226
|
+
}, f = function(e) {
|
|
227
|
+
return T.s(a % 12 || 12, e, "0");
|
|
228
|
+
}, m = u || function(e, t, n) {
|
|
229
|
+
var r = e < 12 ? "AM" : "PM";
|
|
230
|
+
return n ? r.toLowerCase() : r;
|
|
231
|
+
};
|
|
232
|
+
return r.replace(h, (function(e, r) {
|
|
233
|
+
return r || function(e) {
|
|
234
|
+
switch (e) {
|
|
235
|
+
case "YY": return String(t.$y).slice(-2);
|
|
236
|
+
case "YYYY": return T.s(t.$y, 4, "0");
|
|
237
|
+
case "M": return s + 1;
|
|
238
|
+
case "MM": return T.s(s + 1, 2, "0");
|
|
239
|
+
case "MMM": return d(n.monthsShort, s, l, 3);
|
|
240
|
+
case "MMMM": return d(l, s);
|
|
241
|
+
case "D": return t.$D;
|
|
242
|
+
case "DD": return T.s(t.$D, 2, "0");
|
|
243
|
+
case "d": return String(t.$W);
|
|
244
|
+
case "dd": return d(n.weekdaysMin, t.$W, c, 2);
|
|
245
|
+
case "ddd": return d(n.weekdaysShort, t.$W, c, 3);
|
|
246
|
+
case "dddd": return c[t.$W];
|
|
247
|
+
case "H": return String(a);
|
|
248
|
+
case "HH": return T.s(a, 2, "0");
|
|
249
|
+
case "h": return f(1);
|
|
250
|
+
case "hh": return f(2);
|
|
251
|
+
case "a": return m(a, o, !0);
|
|
252
|
+
case "A": return m(a, o, !1);
|
|
253
|
+
case "m": return String(o);
|
|
254
|
+
case "mm": return T.s(o, 2, "0");
|
|
255
|
+
case "s": return String(t.$s);
|
|
256
|
+
case "ss": return T.s(t.$s, 2, "0");
|
|
257
|
+
case "SSS": return T.s(t.$ms, 3, "0");
|
|
258
|
+
case "Z": return i;
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}(e) || i.replace(":", "");
|
|
262
|
+
}));
|
|
263
|
+
}, _.utcOffset = function() {
|
|
264
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
265
|
+
}, _.diff = function(r, f, p) {
|
|
266
|
+
var m, h = this, g = T.p(f), _ = w(r), v = (_.utcOffset() - this.utcOffset()) * t, y = this - _, b = function() {
|
|
267
|
+
return T.m(h, _);
|
|
268
|
+
};
|
|
269
|
+
switch (g) {
|
|
270
|
+
case d:
|
|
271
|
+
m = b() / 12;
|
|
272
|
+
break;
|
|
273
|
+
case l:
|
|
274
|
+
m = b();
|
|
275
|
+
break;
|
|
276
|
+
case u:
|
|
277
|
+
m = b() / 3;
|
|
278
|
+
break;
|
|
279
|
+
case c:
|
|
280
|
+
m = (y - v) / 6048e5;
|
|
281
|
+
break;
|
|
282
|
+
case s:
|
|
283
|
+
m = (y - v) / 864e5;
|
|
284
|
+
break;
|
|
285
|
+
case o:
|
|
286
|
+
m = y / n;
|
|
287
|
+
break;
|
|
288
|
+
case a:
|
|
289
|
+
m = y / t;
|
|
290
|
+
break;
|
|
291
|
+
case i:
|
|
292
|
+
m = y / e;
|
|
293
|
+
break;
|
|
294
|
+
default: m = y;
|
|
295
|
+
}
|
|
296
|
+
return p ? m : T.a(m);
|
|
297
|
+
}, _.daysInMonth = function() {
|
|
298
|
+
return this.endOf(l).$D;
|
|
299
|
+
}, _.$locale = function() {
|
|
300
|
+
return b[this.$L];
|
|
301
|
+
}, _.locale = function(e, t) {
|
|
302
|
+
if (!e) return this.$L;
|
|
303
|
+
var n = this.clone(), r = C(e, t, !0);
|
|
304
|
+
return r && (n.$L = r), n;
|
|
305
|
+
}, _.clone = function() {
|
|
306
|
+
return T.w(this.$d, this);
|
|
307
|
+
}, _.toDate = function() {
|
|
308
|
+
return new Date(this.valueOf());
|
|
309
|
+
}, _.toJSON = function() {
|
|
310
|
+
return this.isValid() ? this.toISOString() : null;
|
|
311
|
+
}, _.toISOString = function() {
|
|
312
|
+
return this.$d.toISOString();
|
|
313
|
+
}, _.toString = function() {
|
|
314
|
+
return this.$d.toUTCString();
|
|
315
|
+
}, g;
|
|
316
|
+
}(), D = E.prototype;
|
|
317
|
+
return w.prototype = D, [
|
|
318
|
+
["$ms", r],
|
|
319
|
+
["$s", i],
|
|
320
|
+
["$m", a],
|
|
321
|
+
["$H", o],
|
|
322
|
+
["$W", s],
|
|
323
|
+
["$M", l],
|
|
324
|
+
["$y", d],
|
|
325
|
+
["$D", f]
|
|
326
|
+
].forEach((function(e) {
|
|
327
|
+
D[e[1]] = function(t) {
|
|
328
|
+
return this.$g(t, e[0], e[1]);
|
|
329
|
+
};
|
|
330
|
+
})), w.extend = function(e, t) {
|
|
331
|
+
return e.$i ||= (e(t, E, w), !0), w;
|
|
332
|
+
}, w.locale = C, w.isDayjs = S, w.unix = function(e) {
|
|
333
|
+
return w(1e3 * e);
|
|
334
|
+
}, w.en = b[y], w.Ls = b, w.p = {}, w;
|
|
335
|
+
}));
|
|
336
|
+
})), v = /* @__PURE__ */ c(((e, t) => {
|
|
337
|
+
(function(n, r) {
|
|
338
|
+
typeof e == "object" && t !== void 0 ? t.exports = r(_()) : typeof define == "function" && define.amd ? define(["dayjs"], r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_locale_ko = r(n.dayjs);
|
|
339
|
+
})(e, (function(e) {
|
|
340
|
+
function t(e) {
|
|
341
|
+
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
342
|
+
}
|
|
343
|
+
var n = t(e), r = {
|
|
344
|
+
name: "ko",
|
|
345
|
+
weekdays: "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),
|
|
346
|
+
weekdaysShort: "일_월_화_수_목_금_토".split("_"),
|
|
347
|
+
weekdaysMin: "일_월_화_수_목_금_토".split("_"),
|
|
348
|
+
months: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
|
|
349
|
+
monthsShort: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
|
|
350
|
+
ordinal: function(e) {
|
|
351
|
+
return e + "일";
|
|
352
|
+
},
|
|
353
|
+
formats: {
|
|
354
|
+
LT: "A h:mm",
|
|
355
|
+
LTS: "A h:mm:ss",
|
|
356
|
+
L: "YYYY.MM.DD.",
|
|
357
|
+
LL: "YYYY년 MMMM D일",
|
|
358
|
+
LLL: "YYYY년 MMMM D일 A h:mm",
|
|
359
|
+
LLLL: "YYYY년 MMMM D일 dddd A h:mm",
|
|
360
|
+
l: "YYYY.MM.DD.",
|
|
361
|
+
ll: "YYYY년 MMMM D일",
|
|
362
|
+
lll: "YYYY년 MMMM D일 A h:mm",
|
|
363
|
+
llll: "YYYY년 MMMM D일 dddd A h:mm"
|
|
364
|
+
},
|
|
365
|
+
meridiem: function(e) {
|
|
366
|
+
return e < 12 ? "오전" : "오후";
|
|
367
|
+
},
|
|
368
|
+
relativeTime: {
|
|
369
|
+
future: "%s 후",
|
|
370
|
+
past: "%s 전",
|
|
371
|
+
s: "몇 초",
|
|
372
|
+
m: "1분",
|
|
373
|
+
mm: "%d분",
|
|
374
|
+
h: "한 시간",
|
|
375
|
+
hh: "%d시간",
|
|
376
|
+
d: "하루",
|
|
377
|
+
dd: "%d일",
|
|
378
|
+
M: "한 달",
|
|
379
|
+
MM: "%d달",
|
|
380
|
+
y: "일 년",
|
|
381
|
+
yy: "%d년"
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
return n.default.locale(r, null, !0), r;
|
|
385
|
+
}));
|
|
386
|
+
})), y = /* @__PURE__ */ u(_());
|
|
387
|
+
v();
|
|
388
|
+
var b = {
|
|
389
|
+
ko: {
|
|
390
|
+
date_format: {
|
|
391
|
+
default: "YYYY년 M월 D일 dddd",
|
|
392
|
+
no_year: "M월 D일 dddd",
|
|
393
|
+
no_year_short: "M월 D일",
|
|
394
|
+
short: "YYYY년 M월 D일"
|
|
395
|
+
},
|
|
396
|
+
date_time_format: {
|
|
397
|
+
default: {
|
|
398
|
+
no_sec: "YYYY년 M월 D일 A h:mm",
|
|
399
|
+
sec: "YYYY년 M월 D일 A h:mm:ss"
|
|
400
|
+
},
|
|
401
|
+
no_year: {
|
|
402
|
+
no_sec: "M월 D일 A h:mm",
|
|
403
|
+
sec: "M월 D일 A h:mm:ss",
|
|
404
|
+
short: {
|
|
405
|
+
no_sec: "M월 D일 A h:mm",
|
|
406
|
+
sec: "M월 D일 A h:mm:ss"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
short: {
|
|
410
|
+
no_sec: "YYYY년 M월 D일 A h:mm",
|
|
411
|
+
sec: "YYYY년 M월 D일 A h:mm:ss"
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
time_format: {
|
|
415
|
+
apm: "A",
|
|
416
|
+
f12: {
|
|
417
|
+
no_sec: "A h:mm",
|
|
418
|
+
sec: "A h:mm:ss"
|
|
419
|
+
},
|
|
420
|
+
f12_no_apm: {
|
|
421
|
+
no_sec: "h:mm",
|
|
422
|
+
sec: "h:mm:ss"
|
|
423
|
+
},
|
|
424
|
+
f24: {
|
|
425
|
+
no_sec: "HH:mm",
|
|
426
|
+
sec: "HH:mm:ss"
|
|
427
|
+
},
|
|
428
|
+
f24_short: {
|
|
429
|
+
no_sec: "H:mm",
|
|
430
|
+
sec: "H:mm:ss"
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
en: {
|
|
435
|
+
date_format: {
|
|
436
|
+
default: "dddd, MMMM D, YYYY",
|
|
437
|
+
no_year: "dddd, MMMM D",
|
|
438
|
+
no_year_short: "MMM D",
|
|
439
|
+
short: "MMM D, YYYY"
|
|
440
|
+
},
|
|
441
|
+
date_time_format: {
|
|
442
|
+
default: {
|
|
443
|
+
no_sec: "MMMM D, YYYY, h:mm A",
|
|
444
|
+
sec: "MMMM D, YYYY, h:mm:ss A"
|
|
445
|
+
},
|
|
446
|
+
no_year: {
|
|
447
|
+
no_sec: "MMM D, h:mm A",
|
|
448
|
+
sec: "MMM D, h:mm:ss A",
|
|
449
|
+
short: {
|
|
450
|
+
no_sec: "MMM D, h:mm A",
|
|
451
|
+
sec: "MMM D, h:mm:ss A"
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
short: {
|
|
455
|
+
no_sec: "MMM D, YYYY h:mm A",
|
|
456
|
+
sec: "MMM D, YYYY h:mm:ss A"
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
time_format: {
|
|
460
|
+
apm: "A",
|
|
461
|
+
f12: {
|
|
462
|
+
no_sec: "h:mm A",
|
|
463
|
+
sec: "h:mm:ss A"
|
|
464
|
+
},
|
|
465
|
+
f12_no_apm: {
|
|
466
|
+
no_sec: "h:mm",
|
|
467
|
+
sec: "h:mm:ss"
|
|
468
|
+
},
|
|
469
|
+
f24: {
|
|
470
|
+
no_sec: "HH:mm",
|
|
471
|
+
sec: "HH:mm:ss"
|
|
472
|
+
},
|
|
473
|
+
f24_short: {
|
|
474
|
+
no_sec: "H:mm",
|
|
475
|
+
sec: "H:mm:ss"
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
function x(e, t, n = "ko") {
|
|
481
|
+
let r = e instanceof Date ? (0, y.default)(e) : e;
|
|
482
|
+
if (!e || !r.isValid()) return "";
|
|
483
|
+
let i = n === "en" || n === "ko" ? n : "ko";
|
|
484
|
+
return r.locale(i).format(t);
|
|
485
|
+
}
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/utils/datetime/date.ts
|
|
488
|
+
function S(e = "ko") {
|
|
489
|
+
let t = e === "en" || e === "ko" ? e : "ko", n = b[t].date_format;
|
|
490
|
+
return {
|
|
491
|
+
dateFormat: (e) => x(e, n.default, t),
|
|
492
|
+
dateFormatNoYear: (e) => x(e, n.no_year, t),
|
|
493
|
+
dateFormatShort: (e) => x(e, n.short, t),
|
|
494
|
+
dateFormatNoYearShort: (e) => x(e, n.no_year_short, t)
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/utils/datetime/datetime.ts
|
|
499
|
+
function C(e) {
|
|
500
|
+
return e === "en" || e === "ko" ? e : "ko";
|
|
501
|
+
}
|
|
502
|
+
function w(e = "ko") {
|
|
503
|
+
let t = C(e), n = b[t].date_time_format;
|
|
504
|
+
return {
|
|
505
|
+
dateTimeFormat: (e, r = !1) => x(e, r ? n.default.sec : n.default.no_sec, t),
|
|
506
|
+
dateTimeFormatShort: (e, r = !1) => x(e, r ? n.short.sec : n.short.no_sec, t),
|
|
507
|
+
dateTimeFormatNoYear: (e, r = !1) => x(e, r ? n.no_year.sec : n.no_year.no_sec, t),
|
|
508
|
+
dateTimeFormatNoYearShort: (e, r = !1) => x(e, r ? n.no_year.short.sec : n.no_year.short.no_sec, t)
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/utils/datetime/time.ts
|
|
513
|
+
var T = {
|
|
514
|
+
ko: {
|
|
515
|
+
day: "일",
|
|
516
|
+
hour: {
|
|
517
|
+
default: "시간",
|
|
518
|
+
short: "시간"
|
|
519
|
+
},
|
|
520
|
+
minute: {
|
|
521
|
+
default: "분",
|
|
522
|
+
short: "분"
|
|
523
|
+
},
|
|
524
|
+
zero: {
|
|
525
|
+
default: "0분",
|
|
526
|
+
short: "0분"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
en: {
|
|
530
|
+
day: "d",
|
|
531
|
+
hour: {
|
|
532
|
+
default: "hr",
|
|
533
|
+
short: "h"
|
|
534
|
+
},
|
|
535
|
+
minute: {
|
|
536
|
+
default: "min",
|
|
537
|
+
short: "m"
|
|
538
|
+
},
|
|
539
|
+
zero: {
|
|
540
|
+
default: "0min",
|
|
541
|
+
short: "0m"
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
function E(e) {
|
|
546
|
+
return e === "en" || e === "ko" ? e : "ko";
|
|
547
|
+
}
|
|
548
|
+
function D(e = "ko") {
|
|
549
|
+
let t = E(e), n = b[t].time_format;
|
|
550
|
+
return {
|
|
551
|
+
timeFormat24: (e, r = !1) => x(e, r ? n.f24.sec : n.f24.no_sec, t),
|
|
552
|
+
timeFormat24Short: (e, r = !1) => x(e, r ? n.f24_short.sec : n.f24_short.no_sec, t),
|
|
553
|
+
timeFormat12: (e, r = !1) => x(e, r ? n.f12.sec : n.f12.no_sec, t),
|
|
554
|
+
timeFormat12NoApm: (e, r = !1) => x(e, r ? n.f12_no_apm.sec : n.f12_no_apm.no_sec, t),
|
|
555
|
+
apmFormat: (e) => x(e, n.apm, t)
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
function O(e = "ko") {
|
|
559
|
+
let t = T[E(e)];
|
|
560
|
+
function n(e) {
|
|
561
|
+
if (isNaN(e) || !isFinite(e)) return {
|
|
562
|
+
day: 0,
|
|
563
|
+
hour: 0,
|
|
564
|
+
minute: 0
|
|
565
|
+
};
|
|
566
|
+
let t = Math.round(e * 60);
|
|
567
|
+
return {
|
|
568
|
+
day: Math.floor(t / 86400),
|
|
569
|
+
hour: Math.floor(t % 86400 / 3600),
|
|
570
|
+
minute: Math.floor(t % 3600 / 60)
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
minFormat: (e) => {
|
|
575
|
+
let { day: r, hour: i, minute: a } = n(e), o = [];
|
|
576
|
+
return r !== 0 && o.push(`${r}${t.day}`), i !== 0 && o.push(`${i}${t.hour.default}`), a !== 0 && o.push(`${a}${t.minute.default}`), o.length === 0 && o.push(t.zero.default), o.join(" ");
|
|
577
|
+
},
|
|
578
|
+
minFormatShort: (e) => {
|
|
579
|
+
let { day: r, hour: i, minute: a } = n(e), o = [];
|
|
580
|
+
return r !== 0 && o.push(`${r}${t.day}`), i !== 0 && o.push(`${i}${t.hour.short}`), a !== 0 && o.push(`${a}${t.minute.short}`), o.length === 0 && o.push(t.zero.short), o.join(" ");
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
//#endregion
|
|
32
585
|
//#region src/constant/firestore.ts
|
|
33
|
-
var
|
|
586
|
+
var k = () => ({
|
|
34
587
|
updateAt: e.serverTimestamp(),
|
|
35
588
|
deletedAt: e.serverTimestamp()
|
|
36
|
-
}),
|
|
589
|
+
}), A = () => ({
|
|
37
590
|
updateAt: e.serverTimestamp(),
|
|
38
591
|
deletedAt: null
|
|
39
592
|
});
|
|
40
593
|
//#endregion
|
|
41
594
|
//#region src/handlers/ssr-dynamic-og.ts
|
|
42
|
-
function
|
|
595
|
+
function j(e) {
|
|
43
596
|
let { spaUrl: n, defaultOG: r, resolvers: i, region: a = "asia-northeast3" } = e, o = null, s = 0;
|
|
44
597
|
function c() {
|
|
45
598
|
let e = Date.now();
|
|
@@ -96,4 +649,4 @@ function u(e) {
|
|
|
96
649
|
});
|
|
97
650
|
}
|
|
98
651
|
//#endregion
|
|
99
|
-
export {
|
|
652
|
+
export { b as DATE_TIME_FORMATS, m as Localized, d as SUPPORTED_LOCALES, g as applyCors, S as createDateFormatters, w as createDateTimeFormatters, O as createDurationFormatter, j as createSSRDynamicOG, D as createTimeFormatters, k as del, x as formatBaseDateTime, p as setLocalizedLocaleResolver, h as snapshotToData, A as undel };
|
package/dist/utils/index.d.ts
CHANGED