cici 0.4.2 → 0.4.3

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.
Files changed (63) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +13 -13
  3. package/.next/app-path-routes-manifest.json +1 -1
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/next-minimal-server.js.nft.json +1 -1
  6. package/.next/next-server.js.nft.json +1 -1
  7. package/.next/prerender-manifest.json +1 -1
  8. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/api/mile/prompts.body +1 -1
  10. package/.next/server/app/atom.xml.body +1 -1
  11. package/.next/server/app/blog/[id]/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/blog/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/editor/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/memos/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/rss.xml.body +1 -1
  18. package/.next/server/app/sitemap.xml/route.js +1 -1
  19. package/.next/server/app/sitemap.xml.body +5 -5
  20. package/.next/server/app/unavailable/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app-paths-manifest.json +8 -8
  22. package/.next/server/chunks/3607.js +1 -1
  23. package/.next/server/chunks/3844.js +1 -1
  24. package/.next/server/chunks/719.js +1 -1
  25. package/.next/server/chunks/9715.js +1 -1
  26. package/.next/server/functions-config-manifest.json +1 -1
  27. package/.next/server/pages/500.html +1 -1
  28. package/.next/server/pages-manifest.json +1 -1
  29. package/.next/server/server-reference-manifest.json +1 -1
  30. package/.next/standalone/.next/BUILD_ID +1 -1
  31. package/.next/standalone/.next/app-build-manifest.json +13 -13
  32. package/.next/standalone/.next/app-path-routes-manifest.json +1 -1
  33. package/.next/standalone/.next/build-manifest.json +2 -2
  34. package/.next/standalone/.next/prerender-manifest.json +1 -1
  35. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/api/mile/prompts.body +1 -1
  37. package/.next/standalone/.next/server/app/atom.xml.body +1 -1
  38. package/.next/standalone/.next/server/app/blog/[id]/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/blog/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/editor/page_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/memos/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/rss.xml.body +1 -1
  45. package/.next/standalone/.next/server/app/sitemap.xml/route.js +1 -1
  46. package/.next/standalone/.next/server/app/sitemap.xml.body +5 -5
  47. package/.next/standalone/.next/server/app/unavailable/page_client-reference-manifest.js +1 -1
  48. package/.next/standalone/.next/server/app-paths-manifest.json +8 -8
  49. package/.next/standalone/.next/server/chunks/3607.js +1 -1
  50. package/.next/standalone/.next/server/chunks/3844.js +1 -1
  51. package/.next/standalone/.next/server/chunks/719.js +1 -1
  52. package/.next/standalone/.next/server/chunks/9715.js +1 -1
  53. package/.next/standalone/.next/server/pages/500.html +1 -1
  54. package/.next/standalone/.next/server/pages-manifest.json +1 -1
  55. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  56. package/.next/standalone/package.json +1 -1
  57. package/.next/trace +120 -120
  58. package/README.md +77 -67
  59. package/package.json +1 -1
  60. /package/.next/standalone/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_buildManifest.js +0 -0
  61. /package/.next/standalone/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_ssgManifest.js +0 -0
  62. /package/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_buildManifest.js +0 -0
  63. /package/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_ssgManifest.js +0 -0
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "/_not-found/page": "app/_not-found/page.js",
3
- "/api/auth/[...nextauth]/route": "app/api/auth/[...nextauth]/route.js",
4
3
  "/api/blog/[id]/highlights/[hid]/comments/[cid]/reactions/route": "app/api/blog/[id]/highlights/[hid]/comments/[cid]/reactions/route.js",
5
- "/api/blog/[id]/highlights/[hid]/comments/[cid]/route": "app/api/blog/[id]/highlights/[hid]/comments/[cid]/route.js",
4
+ "/api/auth/[...nextauth]/route": "app/api/auth/[...nextauth]/route.js",
6
5
  "/api/blog/[id]/highlights/[hid]/replies/route": "app/api/blog/[id]/highlights/[hid]/replies/route.js",
6
+ "/api/blog/[id]/highlights/[hid]/comments/[cid]/route": "app/api/blog/[id]/highlights/[hid]/comments/[cid]/route.js",
7
7
  "/api/blog/[id]/highlights/[hid]/resolve/route": "app/api/blog/[id]/highlights/[hid]/resolve/route.js",
8
8
  "/api/blog/[id]/highlights/[hid]/route": "app/api/blog/[id]/highlights/[hid]/route.js",
9
9
  "/api/blog/[id]/highlights/route": "app/api/blog/[id]/highlights/route.js",
10
10
  "/api/webhooks/notification/route": "app/api/webhooks/notification/route.js",
11
- "/login/page": "app/login/page.js",
12
11
  "/favicon.ico/route": "app/favicon.ico/route.js",
12
+ "/login/page": "app/login/page.js",
13
13
  "/robots.txt/route": "app/robots.txt/route.js",
14
14
  "/unavailable/page": "app/unavailable/page.js",
15
15
  "/api/asset/[...path]/route": "app/api/asset/[...path]/route.js",
16
- "/api/upload/route": "app/api/upload/route.js",
17
16
  "/atom.xml/route": "app/atom.xml/route.js",
17
+ "/blog/page": "app/blog/page.js",
18
+ "/api/upload/route": "app/api/upload/route.js",
18
19
  "/api/mile/prompts/route": "app/api/mile/prompts/route.js",
19
20
  "/blog/[id]/page": "app/blog/[id]/page.js",
20
21
  "/editor/page": "app/editor/page.js",
21
- "/blog/page": "app/blog/page.js",
22
- "/memos/page": "app/memos/page.js",
23
22
  "/page": "app/page.js",
24
23
  "/rss.xml/route": "app/rss.xml/route.js",
25
- "/sitemap.xml/route": "app/sitemap.xml/route.js",
26
- "/api/graphql/route": "app/api/graphql/route.js"
24
+ "/memos/page": "app/memos/page.js",
25
+ "/api/graphql/route": "app/api/graphql/route.js",
26
+ "/sitemap.xml/route": "app/sitemap.xml/route.js"
27
27
  }
@@ -11,4 +11,4 @@ title: ${t}
11
11
  date: ${e}
12
12
  ${l}${a}${o}---
13
13
 
14
- ${r}`}function n(t){let e=t.match(/date:\s*(.+)/);return e?e[1]:void 0}function o(t){let e=t.match(/status:\s*(.+)/);return e?e[1].trim():void 0}r.d(e,{Mv:()=>o,X4:()=>s,gk:()=>i,xr:()=>n})},31470:(t,e,r)=>{r.d(e,{Bf:()=>s,CT:()=>o});let i="data",s={rootKeep:()=>".gitkeep",blogDir:()=>"blog",blogDirKeep:()=>"blog/.gitkeep",blogPost:t=>`blog/${t}.md`,blogFile:t=>`blog/${t}`,blogManifest:()=>"blog-manifest.json",memos:()=>"memos.json",likes:()=>"likes.json",siteConfig:()=>"site-config.json",highlightsDir:()=>"highlights",highlightsFile:t=>`highlights/${t}.json`},n=t=>`${i}/${t}`,o={root:()=>i,rootKeep:()=>n(s.rootKeep()),blogDir:()=>n(s.blogDir()),blogDirKeep:()=>n(s.blogDirKeep()),blogPost:t=>n(s.blogPost(t)),blogFile:t=>n(s.blogFile(t)),blogManifest:()=>n(s.blogManifest()),memos:()=>n(s.memos()),likes:()=>n(s.likes()),siteConfig:()=>n(s.siteConfig()),highlightsDir:()=>n(s.highlightsDir()),highlightsFile:t=>n(s.highlightsFile(t))}},82575:(t,e,r)=>{r.d(e,{I7:()=>f,XD:()=>p,CR:()=>y,Kx:()=>m,Ix:()=>w});var i=r(94545),s=r(31470);async function n(t,e,r){try{let n;let o=new i.v({auth:t}),{data:a}=await o.repos.getContent({owner:e,repo:r,path:s.CT.blogDir()});if(!Array.isArray(a)){console.error("Expected array of files but got:",typeof a);return}let l=a.filter(t=>"file"===t.type&&t.name.endsWith(".md")&&".gitkeep"!==t.name).map(t=>t.name).sort();try{let{data:t}=await o.repos.getContent({owner:e,repo:r,path:s.CT.blogManifest()});!Array.isArray(t)&&"sha"in t&&(n=t.sha)}catch(t){console.log("Blog manifest does not exist yet, will create it")}await o.repos.createOrUpdateFileContents({owner:e,repo:r,path:s.CT.blogManifest(),message:"Update blog manifest",content:Buffer.from(JSON.stringify({files:l},null,2)).toString("base64"),sha:n}),console.log("Blog manifest updated successfully with",l.length,"files")}catch(t){console.error("Failed to update blog manifest:",t)}}var o=r(42491),a=r(55315),l=r.n(a),c=r(45854);let u="cici";async function g(t,e,r){try{let{data:i}=await t.repos.get({owner:e,repo:r});if(!i.description){let{data:i}=await t.users.getAuthenticated(),s=i.login;await t.repos.update({owner:e,repo:r,description:`https://tinymind.me/${s}`}),console.log(`Updated repository description to https://tinymind.me/${s}`)}}catch(e){if((0,c.XD)(e))await t.repos.createForAuthenticatedUser({name:r,auto_init:!0}),console.log(`Created new repository: ${r}`);else throw e}try{let{data:i}=await t.repos.getContent({owner:e,repo:r,path:"README.md"});if(console.log("README content:",i),"content"in i){let s=Buffer.from(i.content,"base64").toString("utf-8");console.log("README Decoded content:",s.trim()),(""===s.trim()||"# tinymind-blog"===s.trim())&&(await t.repos.createOrUpdateFileContents({owner:e,repo:r,path:"README.md",message:"Update README.md with default content",content:Buffer.from("# cici Blog\n\nWrite blog posts and memos at https://tinymind.me with data stored on GitHub.").toString("base64"),sha:i.sha}),console.log("README.md updated with default content"))}}catch(i){if(i instanceof Error&&"status"in i&&404===i.status){let i=Buffer.from("Write blog posts and memos at https://tinymind.me with data stored on GitHub.").toString("base64");await t.repos.createOrUpdateFileContents({owner:e,repo:r,path:"README.md",message:"Initial commit: Add README.md",content:i})}else throw i}}async function d(t,e,r){try{await (0,c.QF)(t,e,r,s.CT.rootKeep(),"Initialize content directory",""),await (0,c.QF)(t,e,r,s.CT.blogDirKeep(),"Initialize blog directory",""),await (0,c.QF)(t,e,r,s.CT.memos(),"Initialize memos.json","[]")}catch(t){throw console.error("Error ensuring content structure:",t),t}}async function h(t,e,r){await g(t,e,r),await d(t,e,r)}async function f(t,e,r,i=[],a,l="published",u){let g=(0,c.Pe)(r),{owner:d,repo:f}=u??await (0,c.rP)(r);await h(g,d,f);let p=`${(0,o.gk)(t)}.md`,m=s.CT.blogFile(p),w=(0,o.X4)({title:t,date:new Date().toISOString(),content:e,status:l,location:a,discussions:i});await g.repos.createOrUpdateFileContents({owner:d,repo:f,path:m,message:`Add blog post: ${t}`,content:Buffer.from(w).toString("base64")}),await n(r,d,f)}async function p(t,e,r){if(console.log("Deleting blog post..."),!e)throw Error("Access token is required");let i=(0,c.Pe)(e);try{let{owner:o,repo:a}=r??await (0,c.rP)(e),l=decodeURIComponent(t),u=`${l}.md`,g=s.CT.blogFile(u);console.log(`Attempting to delete file: ${g}`);let d=await i.repos.getContent({owner:o,repo:a,path:g});if(Array.isArray(d.data)||!("sha"in d.data))throw Error("Unexpected response when fetching current blog post");await i.repos.deleteFile({owner:o,repo:a,path:g,message:"Delete blog post",sha:d.data.sha}),console.log("Blog post deleted successfully"),await n(e,o,a)}catch(t){throw console.error("Error deleting blog post:",t),t}}async function m(t,e,r,i,a=[],l,u,g){if(console.log("Updating blog post..."),!i)throw Error("Access token is required");let d=(0,c.Pe)(i);try{let{owner:h,repo:f}=g??await (0,c.rP)(i),{content:p,sha:m}=await (0,c.LK)(d,h,f,s.CT.blogPost(t)),w=(0,o.xr)(p)??new Date().toISOString(),y=void 0!==u?u:(0,o.Mv)(p)??"published",b=(0,o.X4)({title:e,date:w,content:r,status:y,location:l,discussions:a});await (0,c.gO)(d,h,f,s.CT.blogPost(t),"Update blog post",b,m),console.log("Blog post updated successfully"),await n(i,h,f)}catch(t){throw console.error("Error updating blog post:",t),t}}async function w(t,e,r){if(console.log("Uploading image..."),!e)throw Error("Access token is required");let i=(0,c.Pe)(e);console.log("Octokit instance created");try{let{owner:s,repo:n}=r??await (0,c.rP)(e);console.log("Repo info:",{owner:s,repo:n});let{data:o}=await i.repos.get({owner:s,repo:n}),a=o.default_branch;console.log("Default branch:",a),await h(i,s,n),console.log("GitHub structure initialized");let u=new Date().toISOString().split("T")[0],g=Date.now().toString(),d=l().extname(t.name),f=`${g}${d}`,p=`assets/images/${u}/${f}`;await (0,c.kP)(i,s,n,`assets/images/${u}`);let m=await (0,c.sT)(t),w=await i.repos.createOrUpdateFileContents({owner:s,repo:n,path:p,message:`Upload image: ${f}`,content:m});console.log(w),console.log("Image uploaded successfully");let y=w.data.content?.download_url;if(y){let t=y.split("/"),e=t[3],r=t[4],i=t.slice(6).join("/");return`https://github.com/${e}/${r}/blob/${a}/${i}?raw=true`}throw Error("Failed to get image URL")}catch(t){throw console.error("Error uploading image:",t),t}}async function y(t){let e,r;let i=null;if(t.length>40)try{i=(0,c.Pe)(t);let s=await (0,c.rP)(t);e=s.owner,r=s.repo}catch(i){console.error("Error getting authenticated user:",i),e=t,r=u}else e=t,r=u;let s=`https://github.com/${e}.png`,n=`https://github.com/${e}.png`,o=s,a=n;return i&&(o=await b(i,e,r,"assets/icon.jpg",s),a=await b(i,e,r,"assets/icon-144.jpg",n)),{iconPath:o,appleTouchIconPath:a}}async function b(t,e,r,i,s){try{return await t.repos.getContent({owner:e,repo:r,path:i}),`https://github.com/${e}/${r}/blob/main/${i}?raw=true`}catch(t){return console.warn(`No icon found in ${i}, using default:`,s),s}}},45854:(t,e,r)=>{r.d(e,{LK:()=>o,Pe:()=>s,QF:()=>g,XD:()=>u,gO:()=>a,kP:()=>l,rP:()=>n,sT:()=>c});var i=r(94545);function s(t){if(!t)throw Error("Access token is required");return new i.v({auth:t})}async function n(t){if(!t)throw Error("Access token is required");let e=s(t);try{let{data:t}=await e.users.getAuthenticated();return{owner:t.login,repo:"cici"}}catch(t){throw console.error("Error getting authenticated user:",t),Error("Failed to get authenticated user")}}async function o(t,e,r,i){let s=await t.repos.getContent({owner:e,repo:r,path:i});if(Array.isArray(s.data)||!("content"in s.data))throw Error("Unexpected response from GitHub API");return{content:Buffer.from(s.data.content,"base64").toString("utf-8"),sha:s.data.sha}}async function a(t,e,r,i,s,n,o){let a={owner:e,repo:r,path:i,message:s,content:Buffer.from(n).toString("base64")};o&&(a.sha=o),await t.repos.createOrUpdateFileContents(a)}async function l(t,e,r,i){try{await t.repos.getContent({owner:e,repo:r,path:i})}catch(s){if(s instanceof Error&&"status"in s&&404===s.status)await t.repos.createOrUpdateFileContents({owner:e,repo:r,path:`${i}/.gitkeep`,message:`Create directory: ${i}`,content:""});else throw s}}async function c(t){return new Promise((e,r)=>{let i=new FileReader;i.readAsDataURL(t),i.onload=()=>{"string"==typeof i.result?e(i.result.split(",")[1]):r(Error("Failed to convert file to base64"))},i.onerror=t=>r(t)})}function u(t){return t instanceof Error&&"status"in t&&404===t.status}async function g(t,e,r,i,s,n){try{await t.repos.getContent({owner:e,repo:r,path:i}),console.log(`File ${i} already exists.`)}catch(o){if(u(o)){console.log(`Creating file ${i}...`);try{await a(t,e,r,i,s,n),console.log(`File ${i} created successfully.`)}catch(t){throw console.error(`Error creating file ${i}:`,t),t}}else throw console.error(`Error checking file ${i}:`,o),o}}},54428:(t,e,r)=>{r.d(e,{Bi:()=>p,K4:()=>f,VD:()=>m});var i=r(92048),s=r(55315),n=r.n(s),o=r(94545),a=r(8502),l=r(31470),c=r(88069);let u=new Map;function g(t){return l.CT.highlightsFile(t)}function d(t){if(!t||0===t.length||t.length>200||t.includes("/")||t.includes("\\")||t.includes("\0")||t.includes("..")||t.startsWith("."))throw Error(`Invalid postId: ${t}`)}function h(t){if("object"==typeof t&&null!==t&&"status"in t){let e=t.status;return"number"==typeof e?e:void 0}}class f{constructor(t){this.rootDir=t}absPath(t){return n().join(this.rootDir,l.Bf.highlightsFile(t))}async load(t){d(t);try{let e=await i.promises.readFile(this.absPath(t),"utf-8");return{data:a.x.parse(JSON.parse(e)),sha:null}}catch(e){if("ENOENT"===e?.code)return{data:(0,a.Bk)(t),sha:null};throw e}}async save(t,e,r,s){d(t);let o=a.x.parse(e),l=this.absPath(t);return await i.promises.mkdir(n().dirname(l),{recursive:!0}),await i.promises.writeFile(l,JSON.stringify(o,null,2),"utf-8"),{sha:""}}}class p{constructor(t,e,r="cici"){this.octokit=t,this.owner=e,this.repo=r}async load(t){d(t);let e=u.get(t);if(e&&e.expiresAt>Date.now())return{data:e.data,sha:e.sha};let r=await this.readFile(t);if(!r){let e=(0,a.Bk)(t);return u.set(t,{data:e,sha:null,expiresAt:Date.now()+3e4}),{data:e,sha:null}}let i=a.x.parse(JSON.parse(r.content));return u.set(t,{data:i,sha:r.sha,expiresAt:Date.now()+3e4}),{data:i,sha:r.sha}}async save(t,e,r,i){d(t);let s=a.x.parse(e),n=Buffer.from(JSON.stringify(s,null,2)).toString("base64"),o=0,l=r;for(;o<3;)try{let e=await this.octokit.repos.createOrUpdateFileContents({owner:this.owner,repo:this.repo,path:g(t),message:i,content:n,...l?{sha:l}:{}}),r=e.data.content?.sha??"";return u.set(t,{data:s,sha:r,expiresAt:Date.now()+3e4}),{sha:r}}catch(r){let e=h(r);if(409===e||422===e){u.delete(t),o++;let e=await this.readFile(t);l=e?.sha??null;continue}throw r}throw Error("Save failed after 3 retries due to write contention")}async readFile(t){try{let e=(await this.octokit.repos.getContent({owner:this.owner,repo:this.repo,path:g(t)})).data;if(Array.isArray(e)||"file"!==e.type)return null;return{content:Buffer.from(e.content,"base64").toString("utf-8"),sha:e.sha}}catch(t){if(404===h(t))return null;throw t}}}function m(t={}){let e=(0,c.D)(t.ownerToken);if("local"===e.kind)return new f(e.dir);{let r=t.ownerToken??e.token??process.env.HIGHLIGHTS_GH_TOKEN;if(!r)throw Error("HIGHLIGHTS_GH_TOKEN not configured. Inline comments require a service token in production.");return new p(new o.v({auth:r}),e.owner,e.repo)}}},8502:(t,e,r)=>{r.d(e,{Bk:()=>u,Om:()=>s,x:()=>c});var i=r(4037);let s=i.Ry({startOffset:i.Rx().int().nonnegative(),endOffset:i.Rx().int().nonnegative(),exact:i.Z_().min(1).max(1e3),prefix:i.Z_().max(64),suffix:i.Z_().max(64)}).refine(t=>t.endOffset>=t.startOffset,{message:"endOffset must be >= startOffset"}),n=i.IM(i.Z_(),i.IX(i.Z_())),o=i.Km(["ios","android","web"]),a=i.Ry({id:i.Z_().min(1).max(64),parentId:i.Z_().min(1).max(64).nullable(),body:i.Z_().min(1).max(2e3),authorName:i.Z_().max(40).nullable(),fingerprint:i.Z_().min(1).max(128),country:i.Z_().max(8),platform:o,reactions:n,resolved:i.O7(),createdAt:i.Z_().datetime(),hidden:i.O7(),hiddenReason:i.Z_().max(200).optional()}),l=i.Ry({id:i.Z_().min(1).max(64),anchor:s,thread:i.IX(a).min(1),resolved:i.O7(),createdAt:i.Z_().datetime()}),c=i.Ry({postId:i.Z_().min(1),highlights:i.IX(l),schemaVersion:i.i0(1)});function u(t){return{postId:t,highlights:[],schemaVersion:1}}},81336:(t,e,r)=>{r.d(e,{T:()=>g,X:()=>u});var i=r(92048),s=r.n(i),n=r(55315),o=r.n(n),a=r(73194);let l={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".avif":"image/avif"};function c(){return o().join((0,a.$)(),"assets")}async function u(t,e){let r=function(t,e){let r=o().extname(t||"").toLowerCase();if(r&&l[r])return r;if(e){let t=`.${e.split("/")[1]||""}`.toLowerCase();if(l[t])return t}return r||".png"}(t.name,t.type),i=o().posix.join("images",e.date),n=`${e.id}${r}`,a=o().join(c(),i);s().mkdirSync(a,{recursive:!0});let u=Buffer.from(await t.arrayBuffer());return s().writeFileSync(o().join(a,n),u),`/api/asset/${i}/${n}`}function g(t){if(t.some(t=>!t||".."===t||t.includes("\0")||t.includes("/")||t.includes("\\")))return null;let e=c(),r=o().resolve(e,...t);if(r!==e&&!r.startsWith(e+o().sep)||!s().existsSync(r)||!s().statSync(r).isFile())return null;let i=o().extname(r).toLowerCase();return{body:s().readFileSync(r),contentType:l[i]??"application/octet-stream"}}},88069:(t,e,r)=>{r.d(e,{D:()=>o});var i=r(55315),s=r.n(i);let n="cici";function o(t){let e=process.env.CICI_DIR;if(e)return{kind:"local",dir:s().resolve(e)};let r=process.env.CICI_REPO;if(r){let[e,i]=r.split("/");if(!e)throw Error(`Invalid CICI_REPO "${r}" — expected "owner/name".`);return{kind:"github",owner:e,repo:i||n,token:process.env.CICI_TOKEN||t||void 0}}return{kind:"github",owner:process.env.GITHUB_USERNAME||"metrue",repo:n,token:t||void 0}}},73194:(t,e,r)=>{r.d(e,{$:()=>a,g:()=>o});var i=r(55315),s=r.n(i),n=r(88069);function o(){return"local"===(0,n.D)().kind}function a(){let t=process.env.CICI_DIR;return t?s().resolve(t):s().join(process.cwd(),"sample-content")}},63607:(t,e,r)=>{r.d(e,{VH:()=>T});var i=r(88069),s=r(81336),n=r(54428),o=r(92048),a=r.n(o),l=r(55315),c=r.n(l);function u(t){let{frontmatter:e}=function(t){let e=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);return e?{frontmatter:e[1],body:e[2].replace(/^\n/,"")}:{frontmatter:"",body:t}}(t),r=e.match(/title:[ \t]*(.+)/),i=e.match(/date:[ \t]*(.+)/),s=e.match(/latitude:[ \t]*(.+)/),n=e.match(/longitude:[ \t]*(.+)/),o=e.match(/city:[ \t]*(.+)/),a=e.match(/street:[ \t]*(.+)/),l=e.match(/status:[ \t]*(.+)/),c=e.match(/publishedAt:[ \t]*(.+)/),u=e.match(/lastModified:[ \t]*(.+)/),g=s?.[1]?.trim(),d=n?.[1]?.trim(),h=g?parseFloat(g):NaN,f=d?parseFloat(d):NaN;return{title:r?r[1].trim():"",date:i?i[1].trim():new Date().toISOString(),discussions:function(t){let e=[],r=t.match(/external_discussions:\s*\n([\s\S]*?)(?=\n\w|$)/);if(!r)return e;let i=r[1].split("\n").filter(t=>t.trim()),s={};for(let t of i)t.includes("platform:")?(s.platform&&s.url&&e.push(s),s={platform:t.split(":")[1].trim()}):t.includes("url:")&&s.platform&&(s.url=t.split("url:")[1].trim());return s.platform&&s.url&&e.push(s),e}(e),...g&&!isNaN(h)&&{latitude:h},...d&&!isNaN(f)&&{longitude:f},...o&&o[1].trim()&&{city:o[1].trim()},...a&&a[1].trim()&&{street:a[1].trim()},...l&&{status:l[1].trim()},...c&&{publishedAt:c[1].trim()},...u&&{lastModified:u[1].trim()}}}var g=r(31470),d=r(73194),h=r(42491);class f{abs(t){return c().join((0,d.$)(),t)}get dataDir(){return(0,d.$)()}get blogDir(){return this.abs(g.Bf.blogDir())}async getBlogPosts(t=!1){try{if(!a().existsSync(this.blogDir))return console.log("Blog directory does not exist, returning empty array"),[];let e=a().readdirSync(this.blogDir).filter(t=>t.endsWith(".md")&&".gitkeep"!==t),r=[];for(let t of e){let e=await this.getBlogPost(t);e&&r.push(e)}let i=r.sort((t,e)=>new Date(e.date).getTime()-new Date(t.date).getTime());if(t)return i;return i.filter(t=>"published"===t.status)}catch(t){return console.error("Error reading local blog posts:",t),[]}}async getBlogPost(t){try{let e=c().join(this.blogDir,t);if(!a().existsSync(e))return null;let r=a().readFileSync(e,"utf-8"),i=u(r),s=this.getFirstImageURLFrom(r);return{id:t.replace(".md",""),title:i.title||t.replace(".md",""),content:r,imageUrl:s,date:i.date?new Date(i.date).toISOString():new Date().toISOString(),discussions:i.discussions.length>0?i.discussions:void 0,latitude:i.latitude,longitude:i.longitude,city:i.city,street:i.street,status:i.status||"published",publishedAt:i.publishedAt||i.date,lastModified:i.lastModified||i.date||new Date().toISOString()}}catch(e){return console.error(`Error reading blog post ${t}:`,e),null}}async getMemos(){try{let t=this.abs(g.Bf.memos());if(!a().existsSync(t))return console.log("memos.json not found, returning empty array"),[];let e=a().readFileSync(t,"utf-8"),r=JSON.parse(e);return Array.isArray(r)?r:[]}catch(t){return console.error("Error reading local memos:",t),[]}}async getSiteConfig(){try{let t=a().readFileSync(this.abs(g.Bf.siteConfig()),"utf-8");return JSON.parse(t)}catch{return null}}async getLinks(){try{let t=this.abs(g.Bf.siteConfig());if(!a().existsSync(t))return{};let e=a().readFileSync(t,"utf-8");return JSON.parse(e).links||{}}catch(t){return console.warn("Error reading local site config:",t),{}}}async getLikes(){try{let t=this.abs(g.Bf.likes());if(!a().existsSync(t))return console.log("likes.json not found, returning empty object"),{};let e=a().readFileSync(t,"utf-8"),r=JSON.parse(e);return"object"==typeof r&&null!==r?r:{}}catch(t){return console.error("Error reading local likes:",t),{}}}async updateLikes(t){try{let e=this.abs(g.Bf.likes()),r=JSON.stringify(t,null,2);a().writeFileSync(e,r,"utf-8"),console.log("Updated local likes data")}catch(t){throw console.error("Error updating local likes:",t),Error("Failed to update local likes data")}}async createMemo(t){try{let e=await this.getMemos(),r=[t,...e],i=this.abs(g.Bf.memos()),s=JSON.stringify(r,null,2);return a().writeFileSync(i,s,"utf-8"),console.log("Created new memo locally"),t}catch(t){throw console.error("Error creating local memo:",t),Error("Failed to create memo locally")}}async createBlogPost(t){let e=(0,h.gk)(t.title),r=this.abs(g.Bf.blogFile(`${e}.md`)),i=(0,h.X4)({title:t.title,date:new Date().toISOString(),content:t.content,status:t.status,location:t.location,discussions:t.discussions});return a().mkdirSync(c().dirname(r),{recursive:!0}),a().writeFileSync(r,i,"utf-8"),e}async updateBlogPost(t,e){let r=this.abs(g.Bf.blogPost(t)),i="";try{i=a().readFileSync(r,"utf-8")}catch{}let s=(0,h.xr)(i)??new Date().toISOString(),n=void 0!==e.status?e.status:(0,h.Mv)(i)??"published",o=(0,h.X4)({title:e.title,date:s,content:e.content,status:n,location:e.location,discussions:e.discussions});return a().mkdirSync(c().dirname(r),{recursive:!0}),a().writeFileSync(r,o,"utf-8"),t}async deleteBlogPost(t){let e=this.abs(g.Bf.blogPost(t));try{a().unlinkSync(e)}catch(t){if(t?.code!=="ENOENT")throw t}}async updateMemo(t,e){let r=await this.getMemos(),i=r.findIndex(e=>e.id===t);if(-1===i)throw Error("Memo not found");let s={...r[i],content:e},n=r.map((t,e)=>e===i?s:t);return a().writeFileSync(this.abs(g.Bf.memos()),JSON.stringify(n,null,2),"utf-8"),s}async deleteMemo(t){let e=(await this.getMemos()).filter(e=>e.id!==t);a().writeFileSync(this.abs(g.Bf.memos()),JSON.stringify(e,null,2),"utf-8")}async getDrafts(){return(await this.getBlogPosts(!0)).filter(t=>"draft"===t.status)}async getAllBlogPosts(){return this.getBlogPosts(!0)}async checkRepositoryHealth(){return a().existsSync(this.dataDir)}getFirstImageURLFrom(t){let e=/(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/i.exec(t);if(e){let t=e[1];return t.startsWith("https://github")?`${t}?raw=true`:t}return null}}class p{constructor(t){this.dir=t,this.client=new f}get label(){return`local: ${this.dir}`}canWrite(){return!0}getBlogPosts(t){return this.client.getBlogPosts(t?.includeDrafts??!1)}async getBlogPost(t){return await this.client.getBlogPost(`${t}.md`)??void 0}getMemos(){return this.client.getMemos()}getLinks(){return this.client.getLinks()}getLikes(){return this.client.getLikes()}getSiteConfig(){return this.client.getSiteConfig()}createBlogPost(t){return this.client.createBlogPost(t)}updateBlogPost(t,e){return this.client.updateBlogPost(t,e)}deleteBlogPost(t){return this.client.deleteBlogPost(t)}createMemo(t){return this.client.createMemo(t)}updateMemo(t,e){return this.client.updateMemo(t,e)}deleteMemo(t){return this.client.deleteMemo(t)}updateLikes(t){return this.client.updateLikes(t)}uploadAsset(t){return(0,s.X)(t,{date:new Date().toISOString().split("T")[0],id:Date.now().toString()})}highlights(){return new n.K4(this.dir)}}var m=r(45854),w=r(82575),y=r(94545);let b=t=>{let e=/(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/i.exec(t);if(e){let t=e[1];return t.startsWith("https://github")?`${t}?raw=true`:t}return null};class k{constructor(t,e="cici"){this.accessToken=t,this.repo=e}async getSafeOwner(t){if(t&&"true"!==t)return t;if(this.accessToken)try{let t=new y.v({auth:this.accessToken}),{data:e}=await t.users.getAuthenticated();if(e.login&&"true"!==e.login)return e.login}catch(t){console.warn("Failed to get authenticated user:",t)}return process.env.GITHUB_USERNAME||"metrue"}async getBlogPosts(t,e=!1){let r=this.accessToken?new y.v({auth:this.accessToken}):new y.v,i=await this.getSafeOwner(t);try{let t=await r.repos.getContent({owner:i,repo:this.repo,path:g.CT.blogDir()});if(!Array.isArray(t.data))return console.warn("Unexpected response from GitHub API: data is not an array"),[];let s=(await Promise.all(t.data.filter(t=>"file"===t.type&&".gitkeep"!==t.name&&t.name.endsWith(".md")).map(async t=>this.getBlogPost(t.name,i)))).filter(t=>void 0!==t);if(e&&this.accessToken)return s;return s.filter(t=>"published"===t.status)}catch(t){if(console.error("Error fetching blog posts:",t),t instanceof Error&&"status"in t&&404===t.status)return console.log("Blog directory does not exist, returning empty array"),[];throw t}}async getBlogPost(t,e){let r=this.accessToken?new y.v({auth:this.accessToken}):new y.v,i=await this.getSafeOwner(e),s=await r.repos.getContent({owner:i,repo:this.repo,path:g.CT.blogFile(t)});if("content"in s.data){let e=Buffer.from(s.data.content,"base64").toString("utf-8"),r=u(e);return{id:t.replace(".md",""),title:r.title?decodeURIComponent(r.title):decodeURIComponent(t.replace(".md","")),content:e,imageUrl:b(e),date:r.date?new Date(r.date).toISOString():new Date().toISOString(),discussions:r.discussions.length>0?r.discussions:void 0,latitude:r.latitude,longitude:r.longitude,city:r.city,street:r.street,status:r.status||"published",publishedAt:r.publishedAt||r.date,lastModified:r.lastModified||r.date||new Date().toISOString()}}}async getMemos(t){let e=this.accessToken?new y.v({auth:this.accessToken}):new y.v,r=await this.getSafeOwner(t);try{let t=await e.repos.getContent({owner:r,repo:this.repo,path:g.CT.memos()});if(Array.isArray(t.data)||!("content"in t.data))return[];let i=Buffer.from(t.data.content,"base64").toString("utf-8");return JSON.parse(i)}catch(t){return console.error("Error fetching public memos:",t),[]}}async getLinks(t){let e=this.accessToken?new y.v({auth:this.accessToken}):new y.v,r=await this.getSafeOwner(t);try{let t=await e.repos.getContent({owner:r,repo:this.repo,path:g.CT.siteConfig()});if(Array.isArray(t.data)||!("content"in t.data))return{};let i=Buffer.from(t.data.content,"base64").toString("utf-8");return JSON.parse(i).links||{}}catch(t){return console.warn("Error fetching links:",t),{}}}async getLikes(t){let e=this.accessToken?new y.v({auth:this.accessToken}):new y.v,r=await this.getSafeOwner(t);try{let t=await e.repos.getContent({owner:r,repo:this.repo,path:g.CT.likes()});if(Array.isArray(t.data)||!("content"in t.data))return{};let i=Buffer.from(t.data.content,"base64").toString("utf-8");return JSON.parse(i)}catch(t){if(console.error("Error fetching likes:",t),t instanceof Error&&"status"in t&&404===t.status)return{};throw t}}async updateLikes(t,e){let r=new y.v({auth:this.accessToken}),i=await this.getSafeOwner(e);try{let e;try{let t=await r.repos.getContent({owner:i,repo:this.repo,path:g.CT.likes()});!Array.isArray(t.data)&&"sha"in t.data&&(e=t.data.sha)}catch(t){}await r.repos.createOrUpdateFileContents({owner:i,repo:this.repo,path:g.CT.likes(),message:`Update likes data - ${new Date().toISOString()}`,content:Buffer.from(JSON.stringify(t,null,2)).toString("base64"),...e&&{sha:e}})}catch(t){throw console.error("Error updating likes:",t),Error("Failed to update likes data")}}async getDrafts(t){return(await this.getBlogPosts(t,!0)).filter(t=>"draft"===t.status)}async getAllBlogPosts(t){return this.getBlogPosts(t,!0)}}let S=(t,e)=>new k(t,e),$=t=>{let e=/(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/i.exec(t);if(e){let t=e[1];return t.startsWith("https://github")?`${t}?raw=true`:t}return null};class C{constructor(t,e="cici"){this.owner=t,this.baseUrl=`https://raw.githubusercontent.com/${t}/${e}/main`}async getBlogPosts(t=!1){try{try{let e=await fetch(`${this.baseUrl}/${g.CT.blogManifest()}`);if(e.ok){let r=await e.json(),i=r.files||[...r.published||[],...r.drafts||[]],s=(await Promise.all(i.map(t=>this.getBlogPost(t)))).filter(t=>null!==t);if(t)return s;return s.filter(t=>"published"===t.status)}}catch{}return console.warn("Blog manifest not found, returning empty array"),[]}catch(t){throw console.error("Error fetching blog posts via raw URLs:",t),t}}async getBlogPost(t){try{let e=await fetch(`${this.baseUrl}/${g.CT.blogFile(t)}`);if(!e.ok){if(404===e.status)return null;throw Error(`HTTP ${e.status}: ${e.statusText}`)}let r=await e.text(),i=u(r);return{id:t.replace(".md",""),title:i.title?decodeURIComponent(i.title.trim()):decodeURIComponent(t.replace(".md","")),content:r,imageUrl:$(r),date:i.date?new Date(i.date.trim()).toISOString():new Date().toISOString(),discussions:i.discussions.length>0?i.discussions:void 0,latitude:i.latitude,longitude:i.longitude,city:i.city,street:i.street,status:i.status||"published",publishedAt:i.publishedAt||i.date,lastModified:i.lastModified||i.date||new Date().toISOString()}}catch(e){return console.error(`Error fetching blog post ${t}:`,e),null}}async getMemos(){try{let t=await fetch(`${this.baseUrl}/${g.CT.memos()}`);if(!t.ok){if(404===t.status)return console.log("memos.json not found, returning empty array"),[];throw Error(`HTTP ${t.status}: ${t.statusText}`)}let e=await t.json();return Array.isArray(e)?e:[]}catch(t){return console.error("Error fetching memos via raw URLs:",t),[]}}async getLinks(){try{let t=await fetch(`${this.baseUrl}/${g.CT.siteConfig()}`);if(!t.ok){if(404===t.status)return{};throw Error(`HTTP ${t.status}: ${t.statusText}`)}return(await t.json()).links||{}}catch(t){return console.warn("Error fetching links via raw URLs:",t),{}}}async getLikes(){try{let t=await fetch(`${this.baseUrl}/${g.CT.likes()}`);if(!t.ok){if(404===t.status)return console.log("likes.json not found, returning empty object"),{};throw Error(`HTTP ${t.status}: ${t.statusText}`)}let e=await t.json();return"object"==typeof e&&null!==e?e:{}}catch(t){return console.error("Error fetching likes via raw URLs:",t),{}}}async getDrafts(){return(await this.getBlogPosts(!0)).filter(t=>"draft"===t.status)}async getAllBlogPosts(){return this.getBlogPosts(!0)}async checkRepositoryHealth(){try{return(await fetch(`${this.baseUrl}/README.md`)).ok}catch{return!1}}}class B extends Error{constructor(t="This cici instance is read-only. Provide a token to enable editing."){super(t),this.name="ReadOnlyError"}}class E{constructor(t){this.owner=t.owner,this.repo=t.repo,this.token=t.token,this.reader=new C(t.owner,t.repo),this.apiReader=t.token?S(t.token,t.repo):void 0,this.target={owner:t.owner,repo:t.repo}}async fresh(t,e){if(this.apiReader)try{return await t(this.apiReader)}catch(t){console.warn("GitHub API read failed, falling back to raw URL:",t)}return e()}get label(){return`github: ${this.owner}/${this.repo}${this.token?"":" (read-only)"}`}canWrite(){return!!this.token}requireToken(){if(!this.token)throw new B;return this.token}writeOctokit(){return(0,m.Pe)(this.requireToken())}getBlogPosts(t){let e=t?.includeDrafts??!1;return this.fresh(t=>t.getBlogPosts(this.owner,e),()=>this.reader.getBlogPosts(e))}async getBlogPost(t){return await this.fresh(e=>e.getBlogPost(`${t}.md`,this.owner),()=>this.reader.getBlogPost(`${t}.md`))??void 0}getMemos(){return this.fresh(t=>t.getMemos(this.owner),()=>this.reader.getMemos())}getLinks(){return this.fresh(t=>t.getLinks(this.owner),()=>this.reader.getLinks())}getLikes(){return this.fresh(t=>t.getLikes(this.owner),()=>this.reader.getLikes())}async getSiteConfig(){if(this.token)try{let t=(0,m.Pe)(this.token),e=await t.repos.getContent({owner:this.owner,repo:this.repo,path:g.CT.siteConfig()});if(!Array.isArray(e.data)&&"content"in e.data){let t=Buffer.from(e.data.content,"base64").toString("utf-8");return JSON.parse(t)}}catch(t){console.warn("GitHub API site-config read failed, falling back to raw URL:",t)}try{let t=`https://raw.githubusercontent.com/${this.owner}/${this.repo}/main/${g.CT.siteConfig()}`,e=await fetch(t);if(!e.ok)return null;return await e.json()}catch{return null}}async createBlogPost(t){let e=this.requireToken();return await (0,w.I7)(t.title,t.content,e,t.discussions,t.location,t.status,this.target),(0,h.gk)(t.title)}async updateBlogPost(t,e){let r=this.requireToken();return await (0,w.Kx)(t,e.title,e.content,r,e.discussions,e.location,e.status,this.target),t}async deleteBlogPost(t){await (0,w.XD)(t,this.requireToken(),this.target)}async uploadAsset(t){return(0,w.Ix)(t,this.requireToken(),this.target)}async createMemo(t){let e=g.CT.memos(),{data:r,sha:i}=await this.getJsonFile(e),s=Array.isArray(r)?r:[];return await this.putFile(e,JSON.stringify([t,...s],null,2),`Add memo ${t.id}`,i),t}async updateMemo(t,e){let r=g.CT.memos(),{data:i,sha:s}=await this.getJsonFile(r),n=Array.isArray(i)?i:[],o=n.findIndex(e=>e.id===t);if(-1===o)throw Error("Memo not found");let a={...n[o],content:e},l=n.map((t,e)=>e===o?a:t);return await this.putFile(r,JSON.stringify(l,null,2),`Update memo ${t}`,s),a}async deleteMemo(t){let e=g.CT.memos(),{data:r,sha:i}=await this.getJsonFile(e),s=Array.isArray(r)?r:[];await this.putFile(e,JSON.stringify(s.filter(e=>e.id!==t),null,2),`Delete memo ${t}`,i)}async updateLikes(t){let e=g.CT.likes(),{sha:r}=await this.getJsonFile(e);await this.putFile(e,JSON.stringify(t,null,2),"Update likes",r)}highlights(){return new n.Bi((0,m.Pe)(this.token),this.owner,this.repo)}async getJsonFile(t){let e=this.writeOctokit();try{let r=await e.repos.getContent({owner:this.owner,repo:this.repo,path:t});if(Array.isArray(r.data)||!("content"in r.data))return{data:null};let i=Buffer.from(r.data.content,"base64").toString("utf-8");return{data:JSON.parse(i),sha:r.data.sha}}catch(t){if(t?.status===404)return{data:null};throw t}}putFile(t,e,r,i){return(0,m.gO)(this.writeOctokit(),this.owner,this.repo,t,r,e,i)}}function T(t){var e;return"local"===(e=(0,i.D)(t)).kind?new p(e.dir):new E({owner:e.owner,repo:e.repo,token:e.token})}}};
14
+ ${r}`}function n(t){let e=t.match(/date:\s*(.+)/);return e?e[1]:void 0}function o(t){let e=t.match(/status:\s*(.+)/);return e?e[1].trim():void 0}r.d(e,{Mv:()=>o,X4:()=>s,gk:()=>i,xr:()=>n})},31470:(t,e,r)=>{r.d(e,{Bf:()=>s,CT:()=>o});let i="data",s={rootKeep:()=>".gitkeep",blogDir:()=>"blog",blogDirKeep:()=>"blog/.gitkeep",blogPost:t=>`blog/${t}.md`,blogFile:t=>`blog/${t}`,blogManifest:()=>"blog-manifest.json",memos:()=>"memos.json",likes:()=>"likes.json",siteConfig:()=>"site-config.json",highlightsDir:()=>"highlights",highlightsFile:t=>`highlights/${t}.json`},n=t=>`${i}/${t}`,o={root:()=>i,rootKeep:()=>n(s.rootKeep()),blogDir:()=>n(s.blogDir()),blogDirKeep:()=>n(s.blogDirKeep()),blogPost:t=>n(s.blogPost(t)),blogFile:t=>n(s.blogFile(t)),blogManifest:()=>n(s.blogManifest()),memos:()=>n(s.memos()),likes:()=>n(s.likes()),siteConfig:()=>n(s.siteConfig()),highlightsDir:()=>n(s.highlightsDir()),highlightsFile:t=>n(s.highlightsFile(t))}},82575:(t,e,r)=>{r.d(e,{I7:()=>f,XD:()=>p,CR:()=>y,Kx:()=>m,Ix:()=>w});var i=r(94545),s=r(31470);async function n(t,e,r){try{let n;let o=new i.v({auth:t}),{data:a}=await o.repos.getContent({owner:e,repo:r,path:s.CT.blogDir()});if(!Array.isArray(a)){console.error("Expected array of files but got:",typeof a);return}let l=a.filter(t=>"file"===t.type&&t.name.endsWith(".md")&&".gitkeep"!==t.name).map(t=>t.name).sort();try{let{data:t}=await o.repos.getContent({owner:e,repo:r,path:s.CT.blogManifest()});!Array.isArray(t)&&"sha"in t&&(n=t.sha)}catch(t){console.log("Blog manifest does not exist yet, will create it")}await o.repos.createOrUpdateFileContents({owner:e,repo:r,path:s.CT.blogManifest(),message:"Update blog manifest",content:Buffer.from(JSON.stringify({files:l},null,2)).toString("base64"),sha:n}),console.log("Blog manifest updated successfully with",l.length,"files")}catch(t){console.error("Failed to update blog manifest:",t)}}var o=r(42491),a=r(55315),l=r.n(a),c=r(45854);let u="cici";async function g(t,e,r){try{let{data:i}=await t.repos.get({owner:e,repo:r});if(!i.description){let{data:i}=await t.users.getAuthenticated(),s=i.login;await t.repos.update({owner:e,repo:r,description:`https://tinymind.me/${s}`}),console.log(`Updated repository description to https://tinymind.me/${s}`)}}catch(e){if((0,c.XD)(e))await t.repos.createForAuthenticatedUser({name:r,auto_init:!0}),console.log(`Created new repository: ${r}`);else throw e}try{let{data:i}=await t.repos.getContent({owner:e,repo:r,path:"README.md"});if(console.log("README content:",i),"content"in i){let s=Buffer.from(i.content,"base64").toString("utf-8");console.log("README Decoded content:",s.trim()),(""===s.trim()||"# tinymind-blog"===s.trim())&&(await t.repos.createOrUpdateFileContents({owner:e,repo:r,path:"README.md",message:"Update README.md with default content",content:Buffer.from("# cici Blog\n\nWrite blog posts and memos at https://tinymind.me with data stored on GitHub.").toString("base64"),sha:i.sha}),console.log("README.md updated with default content"))}}catch(i){if(i instanceof Error&&"status"in i&&404===i.status){let i=Buffer.from("Write blog posts and memos at https://tinymind.me with data stored on GitHub.").toString("base64");await t.repos.createOrUpdateFileContents({owner:e,repo:r,path:"README.md",message:"Initial commit: Add README.md",content:i})}else throw i}}async function d(t,e,r){try{await (0,c.QF)(t,e,r,s.CT.rootKeep(),"Initialize content directory",""),await (0,c.QF)(t,e,r,s.CT.blogDirKeep(),"Initialize blog directory",""),await (0,c.QF)(t,e,r,s.CT.memos(),"Initialize memos.json","[]")}catch(t){throw console.error("Error ensuring content structure:",t),t}}async function h(t,e,r){await g(t,e,r),await d(t,e,r)}async function f(t,e,r,i=[],a,l="published",u){let g=(0,c.Pe)(r),{owner:d,repo:f}=u??await (0,c.rP)(r);await h(g,d,f);let p=`${(0,o.gk)(t)}.md`,m=s.CT.blogFile(p),w=(0,o.X4)({title:t,date:new Date().toISOString(),content:e,status:l,location:a,discussions:i});await g.repos.createOrUpdateFileContents({owner:d,repo:f,path:m,message:`Add blog post: ${t}`,content:Buffer.from(w).toString("base64")}),await n(r,d,f)}async function p(t,e,r){if(console.log("Deleting blog post..."),!e)throw Error("Access token is required");let i=(0,c.Pe)(e);try{let{owner:o,repo:a}=r??await (0,c.rP)(e),l=decodeURIComponent(t),u=`${l}.md`,g=s.CT.blogFile(u);console.log(`Attempting to delete file: ${g}`);let d=await i.repos.getContent({owner:o,repo:a,path:g});if(Array.isArray(d.data)||!("sha"in d.data))throw Error("Unexpected response when fetching current blog post");await i.repos.deleteFile({owner:o,repo:a,path:g,message:"Delete blog post",sha:d.data.sha}),console.log("Blog post deleted successfully"),await n(e,o,a)}catch(t){throw console.error("Error deleting blog post:",t),t}}async function m(t,e,r,i,a=[],l,u,g){if(console.log("Updating blog post..."),!i)throw Error("Access token is required");let d=(0,c.Pe)(i);try{let{owner:h,repo:f}=g??await (0,c.rP)(i),{content:p,sha:m}=await (0,c.LK)(d,h,f,s.CT.blogPost(t)),w=(0,o.xr)(p)??new Date().toISOString(),y=void 0!==u?u:(0,o.Mv)(p)??"published",b=(0,o.X4)({title:e,date:w,content:r,status:y,location:l,discussions:a});await (0,c.gO)(d,h,f,s.CT.blogPost(t),"Update blog post",b,m),console.log("Blog post updated successfully"),await n(i,h,f)}catch(t){throw console.error("Error updating blog post:",t),t}}async function w(t,e,r){if(console.log("Uploading image..."),!e)throw Error("Access token is required");let i=(0,c.Pe)(e);console.log("Octokit instance created");try{let{owner:s,repo:n}=r??await (0,c.rP)(e);console.log("Repo info:",{owner:s,repo:n});let{data:o}=await i.repos.get({owner:s,repo:n}),a=o.default_branch;console.log("Default branch:",a),await h(i,s,n),console.log("GitHub structure initialized");let u=new Date().toISOString().split("T")[0],g=Date.now().toString(),d=l().extname(t.name),f=`${g}${d}`,p=`assets/images/${u}/${f}`;await (0,c.kP)(i,s,n,`assets/images/${u}`);let m=await (0,c.sT)(t),w=await i.repos.createOrUpdateFileContents({owner:s,repo:n,path:p,message:`Upload image: ${f}`,content:m});console.log(w),console.log("Image uploaded successfully");let y=w.data.content?.download_url;if(y){let t=y.split("/"),e=t[3],r=t[4],i=t.slice(6).join("/");return`https://github.com/${e}/${r}/blob/${a}/${i}?raw=true`}throw Error("Failed to get image URL")}catch(t){throw console.error("Error uploading image:",t),t}}async function y(t){let e,r;let i=null;if(t.length>40)try{i=(0,c.Pe)(t);let s=await (0,c.rP)(t);e=s.owner,r=s.repo}catch(i){console.error("Error getting authenticated user:",i),e=t,r=u}else e=t,r=u;let s=`https://github.com/${e}.png`,n=`https://github.com/${e}.png`,o=s,a=n;return i&&(o=await b(i,e,r,"assets/icon.jpg",s),a=await b(i,e,r,"assets/icon-144.jpg",n)),{iconPath:o,appleTouchIconPath:a}}async function b(t,e,r,i,s){try{return await t.repos.getContent({owner:e,repo:r,path:i}),`https://github.com/${e}/${r}/blob/main/${i}?raw=true`}catch(t){return console.warn(`No icon found in ${i}, using default:`,s),s}}},45854:(t,e,r)=>{r.d(e,{LK:()=>o,Pe:()=>s,QF:()=>g,XD:()=>u,gO:()=>a,kP:()=>l,rP:()=>n,sT:()=>c});var i=r(94545);function s(t){if(!t)throw Error("Access token is required");return new i.v({auth:t})}async function n(t){if(!t)throw Error("Access token is required");let e=s(t);try{let{data:t}=await e.users.getAuthenticated();return{owner:t.login,repo:"cici"}}catch(t){throw console.error("Error getting authenticated user:",t),Error("Failed to get authenticated user")}}async function o(t,e,r,i){let s=await t.repos.getContent({owner:e,repo:r,path:i});if(Array.isArray(s.data)||!("content"in s.data))throw Error("Unexpected response from GitHub API");return{content:Buffer.from(s.data.content,"base64").toString("utf-8"),sha:s.data.sha}}async function a(t,e,r,i,s,n,o){let a={owner:e,repo:r,path:i,message:s,content:Buffer.from(n).toString("base64")};o&&(a.sha=o),await t.repos.createOrUpdateFileContents(a)}async function l(t,e,r,i){try{await t.repos.getContent({owner:e,repo:r,path:i})}catch(s){if(s instanceof Error&&"status"in s&&404===s.status)await t.repos.createOrUpdateFileContents({owner:e,repo:r,path:`${i}/.gitkeep`,message:`Create directory: ${i}`,content:""});else throw s}}async function c(t){return new Promise((e,r)=>{let i=new FileReader;i.readAsDataURL(t),i.onload=()=>{"string"==typeof i.result?e(i.result.split(",")[1]):r(Error("Failed to convert file to base64"))},i.onerror=t=>r(t)})}function u(t){return t instanceof Error&&"status"in t&&404===t.status}async function g(t,e,r,i,s,n){try{await t.repos.getContent({owner:e,repo:r,path:i}),console.log(`File ${i} already exists.`)}catch(o){if(u(o)){console.log(`Creating file ${i}...`);try{await a(t,e,r,i,s,n),console.log(`File ${i} created successfully.`)}catch(t){throw console.error(`Error creating file ${i}:`,t),t}}else throw console.error(`Error checking file ${i}:`,o),o}}},54428:(t,e,r)=>{r.d(e,{Bi:()=>p,K4:()=>f,VD:()=>m});var i=r(92048),s=r(55315),n=r.n(s),o=r(94545),a=r(8502),l=r(31470),c=r(88069);let u=new Map;function g(t){return l.CT.highlightsFile(t)}function d(t){if(!t||0===t.length||t.length>200||t.includes("/")||t.includes("\\")||t.includes("\0")||t.includes("..")||t.startsWith("."))throw Error(`Invalid postId: ${t}`)}function h(t){if("object"==typeof t&&null!==t&&"status"in t){let e=t.status;return"number"==typeof e?e:void 0}}class f{constructor(t){this.rootDir=t}absPath(t){return n().join(this.rootDir,l.Bf.highlightsFile(t))}async load(t){d(t);try{let e=await i.promises.readFile(this.absPath(t),"utf-8");return{data:a.x.parse(JSON.parse(e)),sha:null}}catch(e){if("ENOENT"===e?.code)return{data:(0,a.Bk)(t),sha:null};throw e}}async save(t,e,r,s){d(t);let o=a.x.parse(e),l=this.absPath(t);return await i.promises.mkdir(n().dirname(l),{recursive:!0}),await i.promises.writeFile(l,JSON.stringify(o,null,2),"utf-8"),{sha:""}}}class p{constructor(t,e,r="cici",i=!1){this.octokit=t,this.owner=e,this.repo=r,this.readOnly=i}async load(t){d(t);let e=u.get(t);if(e&&e.expiresAt>Date.now())return{data:e.data,sha:e.sha};let r=await this.readFile(t);if(!r){let e=(0,a.Bk)(t);return u.set(t,{data:e,sha:null,expiresAt:Date.now()+3e4}),{data:e,sha:null}}let i=a.x.parse(JSON.parse(r.content));return u.set(t,{data:i,sha:r.sha,expiresAt:Date.now()+3e4}),{data:i,sha:r.sha}}async save(t,e,r,i){if(d(t),this.readOnly)throw Error("Highlights are read-only: no write token available. Sign in as the repo owner to add or moderate inline comments.");let s=a.x.parse(e),n=Buffer.from(JSON.stringify(s,null,2)).toString("base64"),o=0,l=r;for(;o<3;)try{let e=await this.octokit.repos.createOrUpdateFileContents({owner:this.owner,repo:this.repo,path:g(t),message:i,content:n,...l?{sha:l}:{}}),r=e.data.content?.sha??"";return u.set(t,{data:s,sha:r,expiresAt:Date.now()+3e4}),{sha:r}}catch(r){let e=h(r);if(409===e||422===e){u.delete(t),o++;let e=await this.readFile(t);l=e?.sha??null;continue}throw r}throw Error("Save failed after 3 retries due to write contention")}async readFile(t){try{let e=(await this.octokit.repos.getContent({owner:this.owner,repo:this.repo,path:g(t)})).data;if(Array.isArray(e)||"file"!==e.type)return null;return{content:Buffer.from(e.content,"base64").toString("utf-8"),sha:e.sha}}catch(t){if(404===h(t))return null;throw t}}}function m(t={}){let e=(0,c.D)(t.ownerToken);if("local"===e.kind)return new f(e.dir);let r=t.ownerToken??e.token??process.env.HIGHLIGHTS_GH_TOKEN;return new p(r?new o.v({auth:r}):new o.v,e.owner,e.repo,!r)}},8502:(t,e,r)=>{r.d(e,{Bk:()=>u,Om:()=>s,x:()=>c});var i=r(4037);let s=i.Ry({startOffset:i.Rx().int().nonnegative(),endOffset:i.Rx().int().nonnegative(),exact:i.Z_().min(1).max(1e3),prefix:i.Z_().max(64),suffix:i.Z_().max(64)}).refine(t=>t.endOffset>=t.startOffset,{message:"endOffset must be >= startOffset"}),n=i.IM(i.Z_(),i.IX(i.Z_())),o=i.Km(["ios","android","web"]),a=i.Ry({id:i.Z_().min(1).max(64),parentId:i.Z_().min(1).max(64).nullable(),body:i.Z_().min(1).max(2e3),authorName:i.Z_().max(40).nullable(),fingerprint:i.Z_().min(1).max(128),country:i.Z_().max(8),platform:o,reactions:n,resolved:i.O7(),createdAt:i.Z_().datetime(),hidden:i.O7(),hiddenReason:i.Z_().max(200).optional()}),l=i.Ry({id:i.Z_().min(1).max(64),anchor:s,thread:i.IX(a).min(1),resolved:i.O7(),createdAt:i.Z_().datetime()}),c=i.Ry({postId:i.Z_().min(1),highlights:i.IX(l),schemaVersion:i.i0(1)});function u(t){return{postId:t,highlights:[],schemaVersion:1}}},81336:(t,e,r)=>{r.d(e,{T:()=>g,X:()=>u});var i=r(92048),s=r.n(i),n=r(55315),o=r.n(n),a=r(73194);let l={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".avif":"image/avif"};function c(){return o().join((0,a.$)(),"assets")}async function u(t,e){let r=function(t,e){let r=o().extname(t||"").toLowerCase();if(r&&l[r])return r;if(e){let t=`.${e.split("/")[1]||""}`.toLowerCase();if(l[t])return t}return r||".png"}(t.name,t.type),i=o().posix.join("images",e.date),n=`${e.id}${r}`,a=o().join(c(),i);s().mkdirSync(a,{recursive:!0});let u=Buffer.from(await t.arrayBuffer());return s().writeFileSync(o().join(a,n),u),`/api/asset/${i}/${n}`}function g(t){if(t.some(t=>!t||".."===t||t.includes("\0")||t.includes("/")||t.includes("\\")))return null;let e=c(),r=o().resolve(e,...t);if(r!==e&&!r.startsWith(e+o().sep)||!s().existsSync(r)||!s().statSync(r).isFile())return null;let i=o().extname(r).toLowerCase();return{body:s().readFileSync(r),contentType:l[i]??"application/octet-stream"}}},88069:(t,e,r)=>{r.d(e,{D:()=>o});var i=r(55315),s=r.n(i);let n="cici";function o(t){let e=process.env.CICI_DIR;if(e)return{kind:"local",dir:s().resolve(e)};let r=process.env.CICI_REPO;if(r){let[e,i]=r.split("/");if(!e)throw Error(`Invalid CICI_REPO "${r}" — expected "owner/name".`);return{kind:"github",owner:e,repo:i||n,token:process.env.CICI_TOKEN||t||void 0}}return{kind:"github",owner:process.env.GITHUB_USERNAME||"metrue",repo:n,token:t||void 0}}},73194:(t,e,r)=>{r.d(e,{$:()=>a,g:()=>o});var i=r(55315),s=r.n(i),n=r(88069);function o(){return"local"===(0,n.D)().kind}function a(){let t=process.env.CICI_DIR;return t?s().resolve(t):s().join(process.cwd(),"sample-content")}},63607:(t,e,r)=>{r.d(e,{VH:()=>A});var i=r(88069),s=r(81336),n=r(54428),o=r(92048),a=r.n(o),l=r(55315),c=r.n(l);function u(t){let{frontmatter:e}=function(t){let e=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);return e?{frontmatter:e[1],body:e[2].replace(/^\n/,"")}:{frontmatter:"",body:t}}(t),r=e.match(/title:[ \t]*(.+)/),i=e.match(/date:[ \t]*(.+)/),s=e.match(/latitude:[ \t]*(.+)/),n=e.match(/longitude:[ \t]*(.+)/),o=e.match(/city:[ \t]*(.+)/),a=e.match(/street:[ \t]*(.+)/),l=e.match(/status:[ \t]*(.+)/),c=e.match(/publishedAt:[ \t]*(.+)/),u=e.match(/lastModified:[ \t]*(.+)/),g=s?.[1]?.trim(),d=n?.[1]?.trim(),h=g?parseFloat(g):NaN,f=d?parseFloat(d):NaN;return{title:r?r[1].trim():"",date:i?i[1].trim():new Date().toISOString(),discussions:function(t){let e=[],r=t.match(/external_discussions:\s*\n([\s\S]*?)(?=\n\w|$)/);if(!r)return e;let i=r[1].split("\n").filter(t=>t.trim()),s={};for(let t of i)t.includes("platform:")?(s.platform&&s.url&&e.push(s),s={platform:t.split(":")[1].trim()}):t.includes("url:")&&s.platform&&(s.url=t.split("url:")[1].trim());return s.platform&&s.url&&e.push(s),e}(e),...g&&!isNaN(h)&&{latitude:h},...d&&!isNaN(f)&&{longitude:f},...o&&o[1].trim()&&{city:o[1].trim()},...a&&a[1].trim()&&{street:a[1].trim()},...l&&{status:l[1].trim()},...c&&{publishedAt:c[1].trim()},...u&&{lastModified:u[1].trim()}}}var g=r(31470),d=r(73194),h=r(42491);class f{abs(t){return c().join((0,d.$)(),t)}get dataDir(){return(0,d.$)()}get blogDir(){return this.abs(g.Bf.blogDir())}async getBlogPosts(t=!1){try{if(!a().existsSync(this.blogDir))return console.log("Blog directory does not exist, returning empty array"),[];let e=a().readdirSync(this.blogDir).filter(t=>t.endsWith(".md")&&".gitkeep"!==t),r=[];for(let t of e){let e=await this.getBlogPost(t);e&&r.push(e)}let i=r.sort((t,e)=>new Date(e.date).getTime()-new Date(t.date).getTime());if(t)return i;return i.filter(t=>"published"===t.status)}catch(t){return console.error("Error reading local blog posts:",t),[]}}async getBlogPost(t){try{let e=c().join(this.blogDir,t);if(!a().existsSync(e))return null;let r=a().readFileSync(e,"utf-8"),i=u(r),s=this.getFirstImageURLFrom(r);return{id:t.replace(".md",""),title:i.title||t.replace(".md",""),content:r,imageUrl:s,date:i.date?new Date(i.date).toISOString():new Date().toISOString(),discussions:i.discussions.length>0?i.discussions:void 0,latitude:i.latitude,longitude:i.longitude,city:i.city,street:i.street,status:i.status||"published",publishedAt:i.publishedAt||i.date,lastModified:i.lastModified||i.date||new Date().toISOString()}}catch(e){return console.error(`Error reading blog post ${t}:`,e),null}}async getMemos(){try{let t=this.abs(g.Bf.memos());if(!a().existsSync(t))return console.log("memos.json not found, returning empty array"),[];let e=a().readFileSync(t,"utf-8"),r=JSON.parse(e);return Array.isArray(r)?r:[]}catch(t){return console.error("Error reading local memos:",t),[]}}async getSiteConfig(){try{let t=a().readFileSync(this.abs(g.Bf.siteConfig()),"utf-8");return JSON.parse(t)}catch{return null}}async getLinks(){try{let t=this.abs(g.Bf.siteConfig());if(!a().existsSync(t))return{};let e=a().readFileSync(t,"utf-8");return JSON.parse(e).links||{}}catch(t){return console.warn("Error reading local site config:",t),{}}}async getLikes(){try{let t=this.abs(g.Bf.likes());if(!a().existsSync(t))return console.log("likes.json not found, returning empty object"),{};let e=a().readFileSync(t,"utf-8"),r=JSON.parse(e);return"object"==typeof r&&null!==r?r:{}}catch(t){return console.error("Error reading local likes:",t),{}}}async updateLikes(t){try{let e=this.abs(g.Bf.likes()),r=JSON.stringify(t,null,2);a().writeFileSync(e,r,"utf-8"),console.log("Updated local likes data")}catch(t){throw console.error("Error updating local likes:",t),Error("Failed to update local likes data")}}async createMemo(t){try{let e=await this.getMemos(),r=[t,...e],i=this.abs(g.Bf.memos()),s=JSON.stringify(r,null,2);return a().writeFileSync(i,s,"utf-8"),console.log("Created new memo locally"),t}catch(t){throw console.error("Error creating local memo:",t),Error("Failed to create memo locally")}}async createBlogPost(t){let e=(0,h.gk)(t.title),r=this.abs(g.Bf.blogFile(`${e}.md`)),i=(0,h.X4)({title:t.title,date:new Date().toISOString(),content:t.content,status:t.status,location:t.location,discussions:t.discussions});return a().mkdirSync(c().dirname(r),{recursive:!0}),a().writeFileSync(r,i,"utf-8"),e}async updateBlogPost(t,e){let r=this.abs(g.Bf.blogPost(t)),i="";try{i=a().readFileSync(r,"utf-8")}catch{}let s=(0,h.xr)(i)??new Date().toISOString(),n=void 0!==e.status?e.status:(0,h.Mv)(i)??"published",o=(0,h.X4)({title:e.title,date:s,content:e.content,status:n,location:e.location,discussions:e.discussions});return a().mkdirSync(c().dirname(r),{recursive:!0}),a().writeFileSync(r,o,"utf-8"),t}async deleteBlogPost(t){let e=this.abs(g.Bf.blogPost(t));try{a().unlinkSync(e)}catch(t){if(t?.code!=="ENOENT")throw t}}async updateMemo(t,e){let r=await this.getMemos(),i=r.findIndex(e=>e.id===t);if(-1===i)throw Error("Memo not found");let s={...r[i],content:e},n=r.map((t,e)=>e===i?s:t);return a().writeFileSync(this.abs(g.Bf.memos()),JSON.stringify(n,null,2),"utf-8"),s}async deleteMemo(t){let e=(await this.getMemos()).filter(e=>e.id!==t);a().writeFileSync(this.abs(g.Bf.memos()),JSON.stringify(e,null,2),"utf-8")}async getDrafts(){return(await this.getBlogPosts(!0)).filter(t=>"draft"===t.status)}async getAllBlogPosts(){return this.getBlogPosts(!0)}async checkRepositoryHealth(){return a().existsSync(this.dataDir)}getFirstImageURLFrom(t){let e=/(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/i.exec(t);if(e){let t=e[1];return t.startsWith("https://github")?`${t}?raw=true`:t}return null}}class p{constructor(t){this.dir=t,this.client=new f}get label(){return`local: ${this.dir}`}canWrite(){return!0}getBlogPosts(t){return this.client.getBlogPosts(t?.includeDrafts??!1)}async getBlogPost(t){return await this.client.getBlogPost(`${t}.md`)??void 0}getMemos(){return this.client.getMemos()}getLinks(){return this.client.getLinks()}getLikes(){return this.client.getLikes()}getSiteConfig(){return this.client.getSiteConfig()}createBlogPost(t){return this.client.createBlogPost(t)}updateBlogPost(t,e){return this.client.updateBlogPost(t,e)}deleteBlogPost(t){return this.client.deleteBlogPost(t)}createMemo(t){return this.client.createMemo(t)}updateMemo(t,e){return this.client.updateMemo(t,e)}deleteMemo(t){return this.client.deleteMemo(t)}updateLikes(t){return this.client.updateLikes(t)}uploadAsset(t){return(0,s.X)(t,{date:new Date().toISOString().split("T")[0],id:Date.now().toString()})}highlights(){return new n.K4(this.dir)}}var m=r(45854),w=r(82575),y=r(94545);let b=t=>{let e=/(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/i.exec(t);if(e){let t=e[1];return t.startsWith("https://github")?`${t}?raw=true`:t}return null};class k{constructor(t,e="cici"){this.accessToken=t,this.repo=e}async getSafeOwner(t){if(t&&"true"!==t)return t;if(this.accessToken)try{let t=new y.v({auth:this.accessToken}),{data:e}=await t.users.getAuthenticated();if(e.login&&"true"!==e.login)return e.login}catch(t){console.warn("Failed to get authenticated user:",t)}return process.env.GITHUB_USERNAME||"metrue"}async getBlogPosts(t,e=!1){let r=this.accessToken?new y.v({auth:this.accessToken}):new y.v,i=await this.getSafeOwner(t);try{let t=await r.repos.getContent({owner:i,repo:this.repo,path:g.CT.blogDir()});if(!Array.isArray(t.data))return console.warn("Unexpected response from GitHub API: data is not an array"),[];let s=(await Promise.all(t.data.filter(t=>"file"===t.type&&".gitkeep"!==t.name&&t.name.endsWith(".md")).map(async t=>this.getBlogPost(t.name,i)))).filter(t=>void 0!==t);if(e&&this.accessToken)return s;return s.filter(t=>"published"===t.status)}catch(t){if(console.error("Error fetching blog posts:",t),t instanceof Error&&"status"in t&&404===t.status)return console.log("Blog directory does not exist, returning empty array"),[];throw t}}async getBlogPost(t,e){let r=this.accessToken?new y.v({auth:this.accessToken}):new y.v,i=await this.getSafeOwner(e),s=await r.repos.getContent({owner:i,repo:this.repo,path:g.CT.blogFile(t)});if("content"in s.data){let e=Buffer.from(s.data.content,"base64").toString("utf-8"),r=u(e);return{id:t.replace(".md",""),title:r.title?decodeURIComponent(r.title):decodeURIComponent(t.replace(".md","")),content:e,imageUrl:b(e),date:r.date?new Date(r.date).toISOString():new Date().toISOString(),discussions:r.discussions.length>0?r.discussions:void 0,latitude:r.latitude,longitude:r.longitude,city:r.city,street:r.street,status:r.status||"published",publishedAt:r.publishedAt||r.date,lastModified:r.lastModified||r.date||new Date().toISOString()}}}async getMemos(t){let e=this.accessToken?new y.v({auth:this.accessToken}):new y.v,r=await this.getSafeOwner(t);try{let t=await e.repos.getContent({owner:r,repo:this.repo,path:g.CT.memos()});if(Array.isArray(t.data)||!("content"in t.data))return[];let i=Buffer.from(t.data.content,"base64").toString("utf-8");return JSON.parse(i)}catch(t){return console.error("Error fetching public memos:",t),[]}}async getLinks(t){let e=this.accessToken?new y.v({auth:this.accessToken}):new y.v,r=await this.getSafeOwner(t);try{let t=await e.repos.getContent({owner:r,repo:this.repo,path:g.CT.siteConfig()});if(Array.isArray(t.data)||!("content"in t.data))return{};let i=Buffer.from(t.data.content,"base64").toString("utf-8");return JSON.parse(i).links||{}}catch(t){return console.warn("Error fetching links:",t),{}}}async getLikes(t){let e=this.accessToken?new y.v({auth:this.accessToken}):new y.v,r=await this.getSafeOwner(t);try{let t=await e.repos.getContent({owner:r,repo:this.repo,path:g.CT.likes()});if(Array.isArray(t.data)||!("content"in t.data))return{};let i=Buffer.from(t.data.content,"base64").toString("utf-8");return JSON.parse(i)}catch(t){if(console.error("Error fetching likes:",t),t instanceof Error&&"status"in t&&404===t.status)return{};throw t}}async updateLikes(t,e){let r=new y.v({auth:this.accessToken}),i=await this.getSafeOwner(e);try{let e;try{let t=await r.repos.getContent({owner:i,repo:this.repo,path:g.CT.likes()});!Array.isArray(t.data)&&"sha"in t.data&&(e=t.data.sha)}catch(t){}await r.repos.createOrUpdateFileContents({owner:i,repo:this.repo,path:g.CT.likes(),message:`Update likes data - ${new Date().toISOString()}`,content:Buffer.from(JSON.stringify(t,null,2)).toString("base64"),...e&&{sha:e}})}catch(t){throw console.error("Error updating likes:",t),Error("Failed to update likes data")}}async getDrafts(t){return(await this.getBlogPosts(t,!0)).filter(t=>"draft"===t.status)}async getAllBlogPosts(t){return this.getBlogPosts(t,!0)}}let S=(t,e)=>new k(t,e),$=t=>{let e=/(https?:\/\/[^\s]+?\.(?:png|jpg|jpeg|gif|webp))/i.exec(t);if(e){let t=e[1];return t.startsWith("https://github")?`${t}?raw=true`:t}return null};class C{constructor(t,e="cici"){this.owner=t,this.baseUrl=`https://raw.githubusercontent.com/${t}/${e}/main`}async getBlogPosts(t=!1){try{try{let e=await fetch(`${this.baseUrl}/${g.CT.blogManifest()}`);if(e.ok){let r=await e.json(),i=r.files||[...r.published||[],...r.drafts||[]],s=(await Promise.all(i.map(t=>this.getBlogPost(t)))).filter(t=>null!==t);if(t)return s;return s.filter(t=>"published"===t.status)}}catch{}return console.warn("Blog manifest not found, returning empty array"),[]}catch(t){throw console.error("Error fetching blog posts via raw URLs:",t),t}}async getBlogPost(t){try{let e=await fetch(`${this.baseUrl}/${g.CT.blogFile(t)}`);if(!e.ok){if(404===e.status)return null;throw Error(`HTTP ${e.status}: ${e.statusText}`)}let r=await e.text(),i=u(r);return{id:t.replace(".md",""),title:i.title?decodeURIComponent(i.title.trim()):decodeURIComponent(t.replace(".md","")),content:r,imageUrl:$(r),date:i.date?new Date(i.date.trim()).toISOString():new Date().toISOString(),discussions:i.discussions.length>0?i.discussions:void 0,latitude:i.latitude,longitude:i.longitude,city:i.city,street:i.street,status:i.status||"published",publishedAt:i.publishedAt||i.date,lastModified:i.lastModified||i.date||new Date().toISOString()}}catch(e){return console.error(`Error fetching blog post ${t}:`,e),null}}async getMemos(){try{let t=await fetch(`${this.baseUrl}/${g.CT.memos()}`);if(!t.ok){if(404===t.status)return console.log("memos.json not found, returning empty array"),[];throw Error(`HTTP ${t.status}: ${t.statusText}`)}let e=await t.json();return Array.isArray(e)?e:[]}catch(t){return console.error("Error fetching memos via raw URLs:",t),[]}}async getLinks(){try{let t=await fetch(`${this.baseUrl}/${g.CT.siteConfig()}`);if(!t.ok){if(404===t.status)return{};throw Error(`HTTP ${t.status}: ${t.statusText}`)}return(await t.json()).links||{}}catch(t){return console.warn("Error fetching links via raw URLs:",t),{}}}async getLikes(){try{let t=await fetch(`${this.baseUrl}/${g.CT.likes()}`);if(!t.ok){if(404===t.status)return console.log("likes.json not found, returning empty object"),{};throw Error(`HTTP ${t.status}: ${t.statusText}`)}let e=await t.json();return"object"==typeof e&&null!==e?e:{}}catch(t){return console.error("Error fetching likes via raw URLs:",t),{}}}async getDrafts(){return(await this.getBlogPosts(!0)).filter(t=>"draft"===t.status)}async getAllBlogPosts(){return this.getBlogPosts(!0)}async checkRepositoryHealth(){try{return(await fetch(`${this.baseUrl}/README.md`)).ok}catch{return!1}}}class B extends Error{constructor(t="This cici instance is read-only. Provide a token to enable editing."){super(t),this.name="ReadOnlyError"}}class E{constructor(t){this.owner=t.owner,this.repo=t.repo,this.token=t.token,this.reader=new C(t.owner,t.repo),this.apiReader=t.token?S(t.token,t.repo):void 0,this.target={owner:t.owner,repo:t.repo}}async fresh(t,e){if(this.apiReader)try{return await t(this.apiReader)}catch(t){console.warn("GitHub API read failed, falling back to raw URL:",t)}return e()}get label(){return`github: ${this.owner}/${this.repo}${this.token?"":" (read-only)"}`}canWrite(){return!!this.token}requireToken(){if(!this.token)throw new B;return this.token}writeOctokit(){return(0,m.Pe)(this.requireToken())}getBlogPosts(t){let e=t?.includeDrafts??!1;return this.fresh(t=>t.getBlogPosts(this.owner,e),()=>this.reader.getBlogPosts(e))}async getBlogPost(t){return await this.fresh(e=>e.getBlogPost(`${t}.md`,this.owner),()=>this.reader.getBlogPost(`${t}.md`))??void 0}getMemos(){return this.fresh(t=>t.getMemos(this.owner),()=>this.reader.getMemos())}getLinks(){return this.fresh(t=>t.getLinks(this.owner),()=>this.reader.getLinks())}getLikes(){return this.fresh(t=>t.getLikes(this.owner),()=>this.reader.getLikes())}async getSiteConfig(){if(this.token)try{let t=(0,m.Pe)(this.token),e=await t.repos.getContent({owner:this.owner,repo:this.repo,path:g.CT.siteConfig()});if(!Array.isArray(e.data)&&"content"in e.data){let t=Buffer.from(e.data.content,"base64").toString("utf-8");return JSON.parse(t)}}catch(t){console.warn("GitHub API site-config read failed, falling back to raw URL:",t)}try{let t=`https://raw.githubusercontent.com/${this.owner}/${this.repo}/main/${g.CT.siteConfig()}`,e=await fetch(t);if(!e.ok)return null;return await e.json()}catch{return null}}async createBlogPost(t){let e=this.requireToken();return await (0,w.I7)(t.title,t.content,e,t.discussions,t.location,t.status,this.target),(0,h.gk)(t.title)}async updateBlogPost(t,e){let r=this.requireToken();return await (0,w.Kx)(t,e.title,e.content,r,e.discussions,e.location,e.status,this.target),t}async deleteBlogPost(t){await (0,w.XD)(t,this.requireToken(),this.target)}async uploadAsset(t){return(0,w.Ix)(t,this.requireToken(),this.target)}async createMemo(t){let e=g.CT.memos(),{data:r,sha:i}=await this.getJsonFile(e),s=Array.isArray(r)?r:[];return await this.putFile(e,JSON.stringify([t,...s],null,2),`Add memo ${t.id}`,i),t}async updateMemo(t,e){let r=g.CT.memos(),{data:i,sha:s}=await this.getJsonFile(r),n=Array.isArray(i)?i:[],o=n.findIndex(e=>e.id===t);if(-1===o)throw Error("Memo not found");let a={...n[o],content:e},l=n.map((t,e)=>e===o?a:t);return await this.putFile(r,JSON.stringify(l,null,2),`Update memo ${t}`,s),a}async deleteMemo(t){let e=g.CT.memos(),{data:r,sha:i}=await this.getJsonFile(e),s=Array.isArray(r)?r:[];await this.putFile(e,JSON.stringify(s.filter(e=>e.id!==t),null,2),`Delete memo ${t}`,i)}async updateLikes(t){let e=g.CT.likes(),{sha:r}=await this.getJsonFile(e);await this.putFile(e,JSON.stringify(t,null,2),"Update likes",r)}highlights(){return new n.Bi((0,m.Pe)(this.token),this.owner,this.repo)}async getJsonFile(t){let e=this.writeOctokit();try{let r=await e.repos.getContent({owner:this.owner,repo:this.repo,path:t});if(Array.isArray(r.data)||!("content"in r.data))return{data:null};let i=Buffer.from(r.data.content,"base64").toString("utf-8");return{data:JSON.parse(i),sha:r.data.sha}}catch(t){if(t?.status===404)return{data:null};throw t}}putFile(t,e,r,i){return(0,m.gO)(this.writeOctokit(),this.owner,this.repo,t,r,e,i)}}function A(t){var e;return"local"===(e=(0,i.D)(t)).kind?new p(e.dir):new E({owner:e.owner,repo:e.repo,token:e.token})}}};
@@ -1 +1 @@
1
- "use strict";exports.id=3844,exports.ids=[3844],exports.modules={68015:(e,t,r)=>{r.r(t),r.d(t,{ErrorCode:()=>h,FormatError:()=>er,IntlMessageFormat:()=>eu,InvalidValueError:()=>en,InvalidValueTypeError:()=>eo,MissingValueError:()=>ei,PART_TYPE:()=>u,default:()=>el,formatToParts:()=>es,isFormatXMLElementFn:()=>ea});var n,o,i,a,s,h,u,l=r(65826);function c(e){return e.type===o.literal}function f(e){return e.type===o.number}function p(e){return e.type===o.date}function m(e){return e.type===o.time}function E(e){return e.type===o.select}function g(e){return e.type===o.plural}function b(e){return e.type===o.tag}function d(e){return!!(e&&"object"==typeof e&&e.type===i.number)}function y(e){return!!(e&&"object"==typeof e&&e.type===i.dateTime)}(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(n||(n={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(o||(o={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(i||(i={}));var T=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,v=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g,_=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i,H=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,A=/^(@+)?(\+|#+)?[rs]?$/g,I=/(\*)(0+)|(#+)(0+)|(0+)/g,B=/^(0+)$/;function S(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(A,function(e,r,n){return"string"!=typeof n?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):"+"===n?t.minimumSignificantDigits=r.length:"#"===r[0]?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+("string"==typeof n?n.length:0)),""}),t}function N(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function L(e){return N(e)||{}}var P={"001":["H","h"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["H","h","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["H","hB","h","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["H","h","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["H","h","hB","hb"],CU:["H","h","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["H","hB","h","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["H","h","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["H","h","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["H","h","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["H","h","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["H","hB","h","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["H","h","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["H","h","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["H","h","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"es-BO":["H","h","hB","hb"],"es-BR":["H","h","hB","hb"],"es-EC":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"es-PE":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]},M=new RegExp("^".concat(T.source,"*")),O=new RegExp("".concat(T.source,"*$"));function C(e,t){return{start:e,end:t}}var R=!!String.prototype.startsWith&&"_a".startsWith("a",1),G=!!String.fromCodePoint,w=!!Object.fromEntries,F=!!String.prototype.codePointAt,U=!!String.prototype.trimStart,D=!!String.prototype.trimEnd,k=Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&9007199254740991>=Math.abs(e)},V=!0;try{var x=z("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");V=(null===(a=x.exec("a"))||void 0===a?void 0:a[0])==="a"}catch(e){V=!1}var j=R?function(e,t,r){return e.startsWith(t,r)}:function(e,t,r){return e.slice(r,r+t.length)===t},X=G?String.fromCodePoint:function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n="",o=t.length,i=0;o>i;){if((e=t[i++])>1114111)throw RangeError(e+" is not a valid code point");n+=e<65536?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,e%1024+56320)}return n},K=w?Object.fromEntries:function(e){for(var t={},r=0;r<e.length;r++){var n=e[r],o=n[0],i=n[1];t[o]=i}return t},Z=F?function(e,t){return e.codePointAt(t)}:function(e,t){var r,n=e.length;if(!(t<0)&&!(t>=n)){var o=e.charCodeAt(t);return o<55296||o>56319||t+1===n||(r=e.charCodeAt(t+1))<56320||r>57343?o:(o-55296<<10)+(r-56320)+65536}},Y=U?function(e){return e.trimStart()}:function(e){return e.replace(M,"")},W=D?function(e){return e.trimEnd()}:function(e){return e.replace(O,"")};function z(e,t){return new RegExp(e,t)}if(V){var Q=z("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");s=function(e,t){var r;return Q.lastIndex=t,null!==(r=Q.exec(e)[1])&&void 0!==r?r:""}}else s=function(e,t){for(var r=[];;){var n,o=Z(e,t);if(void 0===o||$(o)||(n=o)>=33&&n<=35||36===n||n>=37&&n<=39||40===n||41===n||42===n||43===n||44===n||45===n||n>=46&&n<=47||n>=58&&n<=59||n>=60&&n<=62||n>=63&&n<=64||91===n||92===n||93===n||94===n||96===n||123===n||124===n||125===n||126===n||161===n||n>=162&&n<=165||166===n||167===n||169===n||171===n||172===n||174===n||176===n||177===n||182===n||187===n||191===n||215===n||247===n||n>=8208&&n<=8213||n>=8214&&n<=8215||8216===n||8217===n||8218===n||n>=8219&&n<=8220||8221===n||8222===n||8223===n||n>=8224&&n<=8231||n>=8240&&n<=8248||8249===n||8250===n||n>=8251&&n<=8254||n>=8257&&n<=8259||8260===n||8261===n||8262===n||n>=8263&&n<=8273||8274===n||8275===n||n>=8277&&n<=8286||n>=8592&&n<=8596||n>=8597&&n<=8601||n>=8602&&n<=8603||n>=8604&&n<=8607||8608===n||n>=8609&&n<=8610||8611===n||n>=8612&&n<=8613||8614===n||n>=8615&&n<=8621||8622===n||n>=8623&&n<=8653||n>=8654&&n<=8655||n>=8656&&n<=8657||8658===n||8659===n||8660===n||n>=8661&&n<=8691||n>=8692&&n<=8959||n>=8960&&n<=8967||8968===n||8969===n||8970===n||8971===n||n>=8972&&n<=8991||n>=8992&&n<=8993||n>=8994&&n<=9e3||9001===n||9002===n||n>=9003&&n<=9083||9084===n||n>=9085&&n<=9114||n>=9115&&n<=9139||n>=9140&&n<=9179||n>=9180&&n<=9185||n>=9186&&n<=9254||n>=9255&&n<=9279||n>=9280&&n<=9290||n>=9291&&n<=9311||n>=9472&&n<=9654||9655===n||n>=9656&&n<=9664||9665===n||n>=9666&&n<=9719||n>=9720&&n<=9727||n>=9728&&n<=9838||9839===n||n>=9840&&n<=10087||10088===n||10089===n||10090===n||10091===n||10092===n||10093===n||10094===n||10095===n||10096===n||10097===n||10098===n||10099===n||10100===n||10101===n||n>=10132&&n<=10175||n>=10176&&n<=10180||10181===n||10182===n||n>=10183&&n<=10213||10214===n||10215===n||10216===n||10217===n||10218===n||10219===n||10220===n||10221===n||10222===n||10223===n||n>=10224&&n<=10239||n>=10240&&n<=10495||n>=10496&&n<=10626||10627===n||10628===n||10629===n||10630===n||10631===n||10632===n||10633===n||10634===n||10635===n||10636===n||10637===n||10638===n||10639===n||10640===n||10641===n||10642===n||10643===n||10644===n||10645===n||10646===n||10647===n||10648===n||n>=10649&&n<=10711||10712===n||10713===n||10714===n||10715===n||n>=10716&&n<=10747||10748===n||10749===n||n>=10750&&n<=11007||n>=11008&&n<=11055||n>=11056&&n<=11076||n>=11077&&n<=11078||n>=11079&&n<=11084||n>=11085&&n<=11123||n>=11124&&n<=11125||n>=11126&&n<=11157||11158===n||n>=11159&&n<=11263||n>=11776&&n<=11777||11778===n||11779===n||11780===n||11781===n||n>=11782&&n<=11784||11785===n||11786===n||11787===n||11788===n||11789===n||n>=11790&&n<=11798||11799===n||n>=11800&&n<=11801||11802===n||11803===n||11804===n||11805===n||n>=11806&&n<=11807||11808===n||11809===n||11810===n||11811===n||11812===n||11813===n||11814===n||11815===n||11816===n||11817===n||n>=11818&&n<=11822||11823===n||n>=11824&&n<=11833||n>=11834&&n<=11835||n>=11836&&n<=11839||11840===n||11841===n||11842===n||n>=11843&&n<=11855||n>=11856&&n<=11857||11858===n||n>=11859&&n<=11903||n>=12289&&n<=12291||12296===n||12297===n||12298===n||12299===n||12300===n||12301===n||12302===n||12303===n||12304===n||12305===n||n>=12306&&n<=12307||12308===n||12309===n||12310===n||12311===n||12312===n||12313===n||12314===n||12315===n||12316===n||12317===n||n>=12318&&n<=12319||12320===n||12336===n||64830===n||64831===n||n>=65093&&n<=65094)break;r.push(o),t+=o>=65536?2:1}return X.apply(void 0,r)};var q=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,r){for(var i=[];!this.isEOF();){var a=this.char();if(123===a){var s=this.parseArgument(e,r);if(s.err)return s;i.push(s.val)}else if(125===a&&e>0)break;else if(35===a&&("plural"===t||"selectordinal"===t)){var h=this.clonePosition();this.bump(),i.push({type:o.pound,location:C(h,this.clonePosition())})}else if(60!==a||this.ignoreTag||47!==this.peek()){if(60===a&&!this.ignoreTag&&J(this.peek()||0)){var s=this.parseTag(e,t);if(s.err)return s;i.push(s.val)}else{var s=this.parseLiteral(e,t);if(s.err)return s;i.push(s.val)}}else{if(!r)return this.error(n.UNMATCHED_CLOSING_TAG,C(this.clonePosition(),this.clonePosition()));break}}return{val:i,err:null}},e.prototype.parseTag=function(e,t){var r=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:o.literal,value:"<".concat(i,"/>"),location:C(r,this.clonePosition())},err:null};if(!this.bumpIf(">"))return this.error(n.INVALID_TAG,C(r,this.clonePosition()));var a=this.parseMessage(e+1,t,!0);if(a.err)return a;var s=a.val,h=this.clonePosition();if(!this.bumpIf("</"))return this.error(n.UNCLOSED_TAG,C(r,this.clonePosition()));if(this.isEOF()||!J(this.char()))return this.error(n.INVALID_TAG,C(h,this.clonePosition()));var u=this.clonePosition();return i!==this.parseTagName()?this.error(n.UNMATCHED_CLOSING_TAG,C(u,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">"))?{val:{type:o.tag,value:i,children:s,location:C(r,this.clonePosition())},err:null}:this.error(n.INVALID_TAG,C(h,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var r=this.clonePosition(),n="";;){var i=this.tryParseQuote(t);if(i){n+=i;continue}var a=this.tryParseUnquoted(e,t);if(a){n+=a;continue}var s=this.tryParseLeftAngleBracket();if(s){n+=s;continue}break}var h=C(r,this.clonePosition());return{val:{type:o.literal,value:n,location:h},err:null}},e.prototype.tryParseLeftAngleBracket=function(){var e;return this.isEOF()||60!==this.char()||!this.ignoreTag&&(J(e=this.peek()||0)||47===e)?null:(this.bump(),"<")},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(39===r){if(39===this.peek())t.push(39),this.bump();else{this.bump();break}}else t.push(r);this.bump()}return X.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var r=this.char();return 60===r||123===r||35===r&&("plural"===t||"selectordinal"===t)||125===r&&e>0?null:(this.bump(),X(r))},e.prototype.parseArgument=function(e,t){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(r,this.clonePosition()));if(125===this.char())return this.bump(),this.error(n.EMPTY_ARGUMENT,C(r,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(n.MALFORMED_ARGUMENT,C(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:o.argument,value:i,location:C(r,this.clonePosition())},err:null};case 44:if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(r,this.clonePosition()));return this.parseArgumentOptions(e,t,i,r);default:return this.error(n.MALFORMED_ARGUMENT,C(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=s(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:C(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,r,a){var s,h=this.clonePosition(),u=this.parseIdentifierIfPossible().value,c=this.clonePosition();switch(u){case"":return this.error(n.EXPECT_ARGUMENT_TYPE,C(h,c));case"number":case"date":case"time":this.bumpSpace();var f=null;if(this.bumpIf(",")){this.bumpSpace();var p=this.clonePosition(),m=this.parseSimpleArgStyleIfPossible();if(m.err)return m;var E=W(m.val);if(0===E.length)return this.error(n.EXPECT_ARGUMENT_STYLE,C(this.clonePosition(),this.clonePosition()));f={style:E,styleLocation:C(p,this.clonePosition())}}var g=this.tryParseArgumentClose(a);if(g.err)return g;var b=C(a,this.clonePosition());if(f&&j(null==f?void 0:f.style,"::",0)){var d,y=Y(f.style.slice(2));if("number"===u){var m=this.parseNumberSkeletonFromString(y,f.styleLocation);if(m.err)return m;return{val:{type:o.number,value:r,location:b,style:m.val},err:null}}if(0===y.length)return this.error(n.EXPECT_DATE_TIME_SKELETON,b);var T=y;this.locale&&(T=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e.charAt(n);if("j"===o){for(var i=0;n+1<e.length&&e.charAt(n+1)===o;)i++,n++;var a=1+(1&i),s=i<2?1:3+(i>>1),h=function(e){var t,r=e.hourCycle;if(void 0===r&&e.hourCycles&&e.hourCycles.length&&(r=e.hourCycles[0]),r)switch(r){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw Error("Invalid hourCycle")}var n=e.language;return"root"!==n&&(t=e.maximize().region),(P[t||""]||P[n||""]||P["".concat(n,"-001")]||P["001"])[0]}(t);for(("H"==h||"k"==h)&&(s=0);s-- >0;)r+="a";for(;a-- >0;)r=h+r}else"J"===o?r+="H":r+=o}return r}(y,this.locale));var E={type:i.dateTime,pattern:T,location:f.styleLocation,parsedOptions:this.shouldParseSkeletons?(d={},T.replace(v,function(e){var t=e.length;switch(e[0]){case"G":d.era=4===t?"long":5===t?"narrow":"short";break;case"y":d.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":d.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw RangeError("`w/W` (week) patterns are not supported");case"d":d.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":d.weekday=4===t?"long":5===t?"narrow":"short";break;case"e":if(t<4)throw RangeError("`e..eee` (weekday) patterns are not supported");d.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw RangeError("`c..ccc` (weekday) patterns are not supported");d.weekday=["short","long","narrow","short"][t-4];break;case"a":d.hour12=!0;break;case"b":case"B":throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":d.hourCycle="h12",d.hour=["numeric","2-digit"][t-1];break;case"H":d.hourCycle="h23",d.hour=["numeric","2-digit"][t-1];break;case"K":d.hourCycle="h11",d.hour=["numeric","2-digit"][t-1];break;case"k":d.hourCycle="h24",d.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":d.minute=["numeric","2-digit"][t-1];break;case"s":d.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":d.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),d):{}};return{val:{type:"date"===u?o.date:o.time,value:r,location:b,style:E},err:null}}return{val:{type:"number"===u?o.number:"date"===u?o.date:o.time,value:r,location:b,style:null!==(s=null==f?void 0:f.style)&&void 0!==s?s:null},err:null};case"plural":case"selectordinal":case"select":var _=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(n.EXPECT_SELECT_ARGUMENT_OPTIONS,C(_,(0,l.pi)({},_)));this.bumpSpace();var H=this.parseIdentifierIfPossible(),A=0;if("select"!==u&&"offset"===H.value){if(!this.bumpIf(":"))return this.error(n.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,C(this.clonePosition(),this.clonePosition()));this.bumpSpace();var m=this.tryParseDecimalInteger(n.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,n.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(m.err)return m;this.bumpSpace(),H=this.parseIdentifierIfPossible(),A=m.val}var I=this.tryParsePluralOrSelectOptions(e,u,t,H);if(I.err)return I;var g=this.tryParseArgumentClose(a);if(g.err)return g;var B=C(a,this.clonePosition());if("select"===u)return{val:{type:o.select,value:r,options:K(I.val),location:B},err:null};return{val:{type:o.plural,value:r,options:K(I.val),offset:A,pluralType:"plural"===u?"cardinal":"ordinal",location:B},err:null};default:return this.error(n.INVALID_ARGUMENT_TYPE,C(h,c))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(n.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,C(r,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var r=[];try{r=function(e){if(0===e.length)throw Error("Number skeleton cannot be empty");for(var t=e.split(_).filter(function(e){return e.length>0}),r=[],n=0;n<t.length;n++){var o=t[n].split("/");if(0===o.length)throw Error("Invalid number skeleton");for(var i=o[0],a=o.slice(1),s=0;s<a.length;s++)if(0===a[s].length)throw Error("Invalid number skeleton");r.push({stem:i,options:a})}return r}(e)}catch(e){return this.error(n.INVALID_NUMBER_SKELETON,t)}return{val:{type:i.number,tokens:r,location:t,parsedOptions:this.shouldParseSkeletons?function(e){for(var t={},r=0;r<e.length;r++){var n=e[r];switch(n.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=n.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=n.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=(0,l.pi)((0,l.pi)((0,l.pi)({},t),{notation:"scientific"}),n.options.reduce(function(e,t){return(0,l.pi)((0,l.pi)({},e),N(t)||{})},{}));continue;case"engineering":t=(0,l.pi)((0,l.pi)((0,l.pi)({},t),{notation:"engineering"}),n.options.reduce(function(e,t){return(0,l.pi)((0,l.pi)({},e),N(t)||{})},{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(n.options[0]);continue;case"rounding-mode-floor":t.roundingMode="floor";continue;case"rounding-mode-ceiling":t.roundingMode="ceil";continue;case"rounding-mode-down":t.roundingMode="trunc";continue;case"rounding-mode-up":t.roundingMode="expand";continue;case"rounding-mode-half-even":t.roundingMode="halfEven";continue;case"rounding-mode-half-down":t.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":t.roundingMode="halfExpand";continue;case"integer-width":if(n.options.length>1)throw RangeError("integer-width stems only accept a single optional option");n.options[0].replace(I,function(e,r,n,o,i,a){if(r)t.minimumIntegerDigits=n.length;else if(o&&i)throw Error("We currently do not support maximum integer digits");else if(a)throw Error("We currently do not support exact integer digits");return""});continue}if(B.test(n.stem)){t.minimumIntegerDigits=n.stem.length;continue}if(H.test(n.stem)){if(n.options.length>1)throw RangeError("Fraction-precision stems only accept a single optional option");n.stem.replace(H,function(e,r,n,o,i,a){return"*"===n?t.minimumFractionDigits=r.length:o&&"#"===o[0]?t.maximumFractionDigits=o.length:i&&a?(t.minimumFractionDigits=i.length,t.maximumFractionDigits=i.length+a.length):(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length),""});var o=n.options[0];"w"===o?t=(0,l.pi)((0,l.pi)({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=(0,l.pi)((0,l.pi)({},t),S(o)));continue}if(A.test(n.stem)){t=(0,l.pi)((0,l.pi)({},t),S(n.stem));continue}var i=N(n.stem);i&&(t=(0,l.pi)((0,l.pi)({},t),i));var a=function(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var r=e.slice(0,2);if("+!"===r?(t.signDisplay="always",e=e.slice(2)):"+?"===r&&(t.signDisplay="exceptZero",e=e.slice(2)),!B.test(e))throw Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}(n.stem);a&&(t=(0,l.pi)((0,l.pi)({},t),a))}return t}(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,o){for(var i,a=!1,s=[],h=new Set,u=o.value,l=o.location;;){if(0===u.length){var c=this.clonePosition();if("select"!==t&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(n.EXPECT_PLURAL_ARGUMENT_SELECTOR,n.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;l=C(c,this.clonePosition()),u=this.message.slice(c.offset,this.offset())}else break}if(h.has(u))return this.error("select"===t?n.DUPLICATE_SELECT_ARGUMENT_SELECTOR:n.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,l);"other"===u&&(a=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?n.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:n.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,C(this.clonePosition(),this.clonePosition()));var m=this.parseMessage(e+1,t,r);if(m.err)return m;var E=this.tryParseArgumentClose(p);if(E.err)return E;s.push([u,{value:m.val,location:C(p,this.clonePosition())}]),h.add(u),this.bumpSpace(),u=(i=this.parseIdentifierIfPossible()).value,l=i.location}return 0===s.length?this.error("select"===t?n.EXPECT_SELECT_ARGUMENT_SELECTOR:n.EXPECT_PLURAL_ARGUMENT_SELECTOR,C(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!a?this.error(n.MISSING_OTHER_CLAUSE,C(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var r=1,n=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var o=!1,i=0;!this.isEOF();){var a=this.char();if(a>=48&&a<=57)o=!0,i=10*i+(a-48),this.bump();else break}var s=C(n,this.clonePosition());return o?k(i*=r)?{val:i,err:null}:this.error(t,s):this.error(e,s)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=Z(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(j(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),r=this.message.indexOf(e,t);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&$(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),r=this.message.charCodeAt(t+(e>=65536?2:1));return null!=r?r:null},e}();function J(e){return e>=97&&e<=122||e>=65&&e<=90}function $(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function ee(e,t){void 0===t&&(t={});var r=new q(e,t=(0,l.pi)({shouldParseSkeletons:!0,requiresOtherClause:!0},t)).parse();if(r.err){var o=SyntaxError(n[r.err.kind]);throw o.location=r.err.location,o.originalMessage=r.err.message,o}return(null==t?void 0:t.captureLocation)||function e(t){t.forEach(function(t){if(delete t.location,E(t)||g(t))for(var r in t.options)delete t.options[r].location,e(t.options[r].value);else f(t)&&d(t.style)?delete t.style.location:(p(t)||m(t))&&y(t.style)?delete t.style.location:b(t)&&e(t.children)})}(r.val),r.val}var et=r(68913);!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(h||(h={}));var er=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.code=r,o.originalMessage=n,o}return(0,l.ZT)(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),en=function(e){function t(t,r,n,o){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(r,'". Options are "').concat(Object.keys(n).join('", "'),'"'),h.INVALID_VALUE,o)||this}return(0,l.ZT)(t,e),t}(er),eo=function(e){function t(t,r,n){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(r),h.INVALID_VALUE,n)||this}return(0,l.ZT)(t,e),t}(er),ei=function(e){function t(t,r){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(r,'"'),h.MISSING_VALUE,r)||this}return(0,l.ZT)(t,e),t}(er);function ea(e){return"function"==typeof e}function es(e,t,r,n,i,a,s){if(1===e.length&&c(e[0]))return[{type:u.literal,value:e[0].value}];for(var l=[],T=0;T<e.length;T++){var v=e[T];if(c(v)){l.push({type:u.literal,value:v.value});continue}if(v.type===o.pound){"number"==typeof a&&l.push({type:u.literal,value:r.getNumberFormat(t).format(a)});continue}var _=v.value;if(!(i&&_ in i))throw new ei(_,s);var H=i[_];if(v.type===o.argument){H&&"string"!=typeof H&&"number"!=typeof H||(H="string"==typeof H||"number"==typeof H?String(H):""),l.push({type:"string"==typeof H?u.literal:u.object,value:H});continue}if(p(v)){var A="string"==typeof v.style?n.date[v.style]:y(v.style)?v.style.parsedOptions:void 0;l.push({type:u.literal,value:r.getDateTimeFormat(t,A).format(H)});continue}if(m(v)){var A="string"==typeof v.style?n.time[v.style]:y(v.style)?v.style.parsedOptions:n.time.medium;l.push({type:u.literal,value:r.getDateTimeFormat(t,A).format(H)});continue}if(f(v)){var A="string"==typeof v.style?n.number[v.style]:d(v.style)?v.style.parsedOptions:void 0;A&&A.scale&&(H*=A.scale||1),l.push({type:u.literal,value:r.getNumberFormat(t,A).format(H)});continue}if(b(v)){var I=v.children,B=v.value,S=i[B];if(!ea(S))throw new eo(B,"function",s);var N=S(es(I,t,r,n,i,a).map(function(e){return e.value}));Array.isArray(N)||(N=[N]),l.push.apply(l,N.map(function(e){return{type:"string"==typeof e?u.literal:u.object,value:e}}))}if(E(v)){var L=v.options[H]||v.options.other;if(!L)throw new en(v.value,H,Object.keys(v.options),s);l.push.apply(l,es(L.value,t,r,n,i));continue}if(g(v)){var L=v.options["=".concat(H)];if(!L){if(!Intl.PluralRules)throw new er('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',h.MISSING_INTL_API,s);var P=r.getPluralRules(t,{type:v.pluralType}).select(H-(v.offset||0));L=v.options[P]||v.options.other}if(!L)throw new en(v.value,H,Object.keys(v.options),s);l.push.apply(l,es(L.value,t,r,n,i,H-(v.offset||0)));continue}}return l.length<2?l:l.reduce(function(e,t){var r=e[e.length-1];return r&&r.type===u.literal&&t.type===u.literal?r.value+=t.value:e.push(t),e},[])}function eh(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(u||(u={}));var eu=function(){function e(t,r,n,o){var i,a,s=this;if(void 0===r&&(r=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);if(1===t.length)return t[0].value;var r=t.reduce(function(e,t){return e.length&&t.type===u.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e},[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return es(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){var e;return{locale:(null===(e=s.resolvedLocale)||void 0===e?void 0:e.toString())||Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},this.locales=r,this.resolvedLocale=e.resolveLocale(r),"string"==typeof t){if(this.message=t,!e.__parse)throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");var h=o||{},c=(h.formatters,(0,l._T)(h,["formatters"]));this.ast=e.__parse(t,(0,l.pi)((0,l.pi)({},c),{locale:this.resolvedLocale}))}else this.ast=t;if(!Array.isArray(this.ast))throw TypeError("A message must be provided as a String or AST.");this.formats=(i=e.formats,n?Object.keys(i).reduce(function(e,t){var r,o;return e[t]=(r=i[t],(o=n[t])?(0,l.pi)((0,l.pi)((0,l.pi)({},r||{}),o||{}),Object.keys(r).reduce(function(e,t){return e[t]=(0,l.pi)((0,l.pi)({},r[t]),o[t]||{}),e},{})):r),e},(0,l.pi)({},i)):i),this.formatters=o&&o.formatters||(void 0===(a=this.formatterCache)&&(a={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:(0,et.memoize)(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.NumberFormat).bind.apply(e,(0,l.ev)([void 0],t,!1)))},{cache:eh(a.number),strategy:et.strategies.variadic}),getDateTimeFormat:(0,et.memoize)(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.DateTimeFormat).bind.apply(e,(0,l.ev)([void 0],t,!1)))},{cache:eh(a.dateTime),strategy:et.strategies.variadic}),getPluralRules:(0,et.memoize)(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.PluralRules).bind.apply(e,(0,l.ev)([void 0],t,!1)))},{cache:eh(a.pluralRules),strategy:et.strategies.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(e){if(void 0!==Intl.Locale){var t=Intl.NumberFormat.supportedLocalesOf(e);return new Intl.Locale(t.length>0?t[0]:"string"==typeof e?e:e[0])}},e.__parse=ee,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();let el=eu},2167:(e,t)=>{function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.extends=r},23844:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(13378),o=r(87544),i=r(40397),a=r(78119);t.useFormatter=n.useFormatter,t.useTranslations=n.useTranslations,t.useLocale=o.default,t.NextIntlClientProvider=i.default,Object.keys(a).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})})},13378:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(78119);function o(e,t){return function(){try{return t(...arguments)}catch(e){throw Error(void 0)}}}let i=o(0,n.useTranslations),a=o(0,n.useFormatter);t.useFormatter=a,t.useTranslations=i,Object.keys(n).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})},87544:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(35047),o=r(13015),i=r(19237);t.default=function(){let e;let t=n.useParams();try{e=o.useLocale()}catch(r){if("string"!=typeof(null==t?void 0:t[i.LOCALE_SEGMENT_NAME]))throw r;e=t[i.LOCALE_SEGMENT_NAME]}return e}},40397:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(2167),o=r(17577),i=r(11669),a=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(e){let{locale:t,...r}=e;if(!t)throw Error(void 0);return a.default.createElement(i.IntlProvider,n.extends({locale:t},r))}},19237:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.COOKIE_LOCALE_NAME="NEXT_LOCALE",t.COOKIE_MAX_AGE=31536e3,t.COOKIE_SAME_SITE="lax",t.HEADER_LOCALE_NAME="X-NEXT-INTL-LOCALE",t.LOCALE_SEGMENT_NAME="locale"},11669:(e,t,r)=>{e.exports=r(30776)},13015:(e,t,r)=>{e.exports=r(39471)},78119:(e,t,r)=>{e.exports=r(45948)},69422:(e,t,r)=>{var n=r(17577),o=r(91695);function i(){let e=n.useContext(o.IntlContext);if(!e)throw Error(void 0);return e}t.useIntlContext=i,t.useLocale=function(){return i().locale}},39471:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(69422);r(17577),r(91695),t.useLocale=n.useLocale},1153:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(50148),o=r(36118);r(68015),r(17577),r(68913),t.IntlError=n.IntlError,t.IntlErrorCode=n.IntlErrorCode,t.createFormatter=n.createFormatter,t._createCache=o.createCache,t._createIntlFormatters=o.createIntlFormatters,t.initializeConfig=o.initializeConfig,t.createTranslator=function(e){let{_cache:t=o.createCache(),_formatters:r=o.createIntlFormatters(t),getMessageFallback:i=o.defaultGetMessageFallback,messages:a,namespace:s,onError:h=o.defaultOnError,...u}=e;return function(e,t){let{messages:r,namespace:o,...i}=e;return r=r["!"],o=n.resolveNamespace(o,"!"),n.createBaseTranslator({...i,messages:r,namespace:o})}({...u,onError:h,cache:t,formatters:r,getMessageFallback:i,messages:{"!":a},namespace:s?"!.".concat(s):"!"},0)}},50148:(e,t,r)=>{var n=r(68015),o=r(17577),i=r(36118),a=function(e){return e&&e.__esModule?e:{default:e}}(n);function s(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let h=function(e){return e.MISSING_MESSAGE="MISSING_MESSAGE",e.MISSING_FORMAT="MISSING_FORMAT",e.ENVIRONMENT_FALLBACK="ENVIRONMENT_FALLBACK",e.INSUFFICIENT_PATH="INSUFFICIENT_PATH",e.INVALID_MESSAGE="INVALID_MESSAGE",e.INVALID_KEY="INVALID_KEY",e.FORMATTING_ERROR="FORMATTING_ERROR",e}({});class u extends Error{constructor(e,t){let r=e;t&&(r+=": "+t),super(r),s(this,"code",void 0),s(this,"originalMessage",void 0),this.code=e,t&&(this.originalMessage=t)}}function l(e,t){return e?Object.keys(e).reduce((r,n)=>(r[n]={timeZone:t,...e[n]},r),{}):e}function c(e,t,r,n){let o=i.joinPath(n,r);if(!t)throw Error(o);let a=t;return r.split(".").forEach(t=>{let r=a[t];if(null==t||null==r)throw Error(o+" (".concat(e,")"));a=r}),a}let f=365/12*86400,p={second:1,seconds:1,minute:60,minutes:60,hour:3600,hours:3600,day:86400,days:86400,week:604800,weeks:604800,month:365/12*86400,months:365/12*86400,quarter:365/12*259200,quarters:365/12*259200,year:31536e3,years:31536e3};t.IntlError=u,t.IntlErrorCode=h,t.createBaseTranslator=function(e){let t=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i.defaultOnError;try{if(!t)throw Error(void 0);let n=r?c(e,t,r):t;if(!n)throw Error(r);return n}catch(t){let e=new u(h.MISSING_MESSAGE,t.message);return n(e),e}}(e.locale,e.messages,e.namespace,e.onError);return function(e){let{cache:t,defaultTranslationValues:r,formats:n,formatters:s,getMessageFallback:f=i.defaultGetMessageFallback,locale:p,messagesOrError:m,namespace:E,onError:g,timeZone:b}=e;function d(e,t,r){let n=new u(t,r);return g(n),f({error:n,key:e,namespace:E})}function y(e,g,y){let T,v;if(m instanceof u)return f({error:m,key:e,namespace:E});try{T=c(p,m,e,E)}catch(t){return d(e,h.MISSING_MESSAGE,t.message)}if("object"==typeof T){let t;return d(e,Array.isArray(T)?h.INVALID_MESSAGE:h.INSUFFICIENT_PATH,t)}let _=function(e,t){if(t)return;let r=e.replace(/'([{}])/gi,"$1");return/<|{/.test(r)?void 0:r}(T,g);if(_)return _;s.getMessageFormat||(s.getMessageFormat=i.memoFn(function(){return new a.default(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],{formatters:s,...arguments.length<=3?void 0:arguments[3]})},t.message));try{v=s.getMessageFormat(T,p,function(e,t){let r=t?{...e,dateTime:l(e.dateTime,t)}:e,n=a.default.formats.date,o=t?l(n,t):n,i=a.default.formats.time,s=t?l(i,t):i;return{...r,date:{...o,...null==r?void 0:r.dateTime},time:{...s,...null==r?void 0:r.dateTime}}}({...n,...y},b),{formatters:{...s,getDateTimeFormat:(e,t)=>s.getDateTimeFormat(e,{timeZone:b,...t})}})}catch(t){return d(e,h.INVALID_MESSAGE,t.message)}try{let e=v.format(function(e){if(0===Object.keys(e).length)return;let t={};return Object.keys(e).forEach(r=>{let n,i=0,a=e[r];n="function"==typeof a?e=>{let t=a(e);return o.isValidElement(t)?o.cloneElement(t,{key:r+i++}):t}:a,t[r]=n}),t}({...r,...g}));if(null==e)throw Error(void 0);return o.isValidElement(e)||Array.isArray(e)||"string"==typeof e?e:String(e)}catch(t){return d(e,h.FORMATTING_ERROR,t.message)}}function T(e,t,r){let n=y(e,t,r);return"string"!=typeof n?d(e,h.INVALID_MESSAGE,void 0):n}return T.rich=y,T.markup=(e,t,r)=>{let n=y(e,t,r);if("string"!=typeof n){let t=new u(h.FORMATTING_ERROR,void 0);return g(t),f({error:t,key:e,namespace:E})}return n},T.raw=e=>{if(m instanceof u)return f({error:m,key:e,namespace:E});try{return c(p,m,e,E)}catch(t){return d(e,h.MISSING_MESSAGE,t.message)}},T}({...e,messagesOrError:t})},t.createFormatter=function(e){let{_cache:t=i.createCache(),_formatters:r=i.createIntlFormatters(t),formats:n,locale:o,now:a,onError:s=i.defaultOnError,timeZone:l}=e;function c(e){var t;return null!==(t=e)&&void 0!==t&&t.timeZone||(l?e={...e,timeZone:l}:s(new u(h.ENVIRONMENT_FALLBACK,void 0))),e}function m(e,t,r,n){let o;try{o=function(e,t){let r;if("string"==typeof t){if(!(r=null==e?void 0:e[t])){let e=new u(h.MISSING_FORMAT,void 0);throw s(e),e}}else r=t;return r}(t,e)}catch(e){return n()}try{return r(o)}catch(e){return s(new u(h.FORMATTING_ERROR,e.message)),n()}}function E(e,t){return m(t,null==n?void 0:n.dateTime,t=>(t=c(t),r.getDateTimeFormat(o,t).format(e)),()=>String(e))}function g(){return a||(s(new u(h.ENVIRONMENT_FALLBACK,void 0)),new Date)}return{dateTime:E,number:function(e,t){return m(t,null==n?void 0:n.number,t=>r.getNumberFormat(o,t).format(e),()=>String(e))},relativeTime:function(e,t){try{var n;let i,a;let s={};t instanceof Date||"number"==typeof t?i=new Date(t):t&&(i=null!=t.now?new Date(t.now):g(),a=t.unit,s.style=t.style,s.numberingSystem=t.numberingSystem),i||(i=g());let h=(new Date(e).getTime()-i.getTime())/1e3;a||(a=function(e){let t=Math.abs(e);return t<60?"second":t<3600?"minute":t<86400?"hour":t<604800?"day":t<f?"week":t<31536e3?"month":"year"}(h)),s.numeric="second"===a?"auto":"always";let u=(n=a,Math.round(h/p[n]));return r.getRelativeTimeFormat(o,s).format(u,a)}catch(t){return s(new u(h.FORMATTING_ERROR,t.message)),String(e)}},list:function(e,t){let i=[],a=new Map,s=0;for(let t of e){let e;"object"==typeof t?(e=String(s),a.set(e,t)):e=String(t),i.push(e),s++}return m(t,null==n?void 0:n.list,e=>{let t=r.getListFormat(o,e).formatToParts(i).map(e=>"literal"===e.type?e.value:a.get(e.value)||e.value);return a.size>0?t:t.join("")},()=>String(e))},dateTimeRange:function(e,t,i){return m(i,null==n?void 0:n.dateTime,n=>(n=c(n),r.getDateTimeFormat(o,n).formatRange(e,t)),()=>[E(e),E(t)].join(" – "))}}},t.resolveNamespace=function(e,t){return e===t?void 0:e.slice((t+".").length)}},45948:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(50148),o=r(1153),i=r(36118),a=r(30776),s=r(55965),h=r(69422);r(68015),r(17577),r(68913),r(91695),t.IntlError=n.IntlError,t.IntlErrorCode=n.IntlErrorCode,t.createFormatter=n.createFormatter,t.createTranslator=o.createTranslator,t._createCache=i.createCache,t._createIntlFormatters=i.createIntlFormatters,t.initializeConfig=i.initializeConfig,t.IntlProvider=a.IntlProvider,t.useFormatter=s.useFormatter,t.useMessages=s.useMessages,t.useNow=s.useNow,t.useTimeZone=s.useTimeZone,t.useTranslations=s.useTranslations,t.useLocale=h.useLocale},55965:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(30776),o=r(69422),i=r(17577),a=r(50148);r(36118),r(68913),r(91695),r(68015);let s=!1,h="undefined"==typeof window;t.IntlProvider=n.IntlProvider,t.useLocale=o.useLocale,t.useFormatter=function(){let{formats:e,formatters:t,locale:r,now:n,onError:s,timeZone:h}=o.useIntlContext();return i.useMemo(()=>a.createFormatter({formats:e,locale:r,now:n,onError:s,timeZone:h,_formatters:t}),[e,t,n,r,s,h])},t.useMessages=function(){let e=o.useIntlContext();if(!e.messages)throw Error(void 0);return e.messages},t.useNow=function(e){let t=null==e?void 0:e.updateInterval,{now:r}=o.useIntlContext(),[n,a]=i.useState(r||new Date);return i.useEffect(()=>{if(!t)return;let e=setInterval(()=>{a(new Date)},t);return()=>{clearInterval(e)}},[r,t]),null==t&&r?r:n},t.useTimeZone=function(){return o.useIntlContext().timeZone},t.useTranslations=function(e){return function(e,t,r){let{cache:n,defaultTranslationValues:u,formats:l,formatters:c,getMessageFallback:f,locale:p,onError:m,timeZone:E}=o.useIntlContext(),g=e["!"],b=a.resolveNamespace(t,"!");return E||s||!h||(s=!0,m(new a.IntlError(a.IntlErrorCode.ENVIRONMENT_FALLBACK,void 0))),i.useMemo(()=>a.createBaseTranslator({cache:n,formatters:c,getMessageFallback:f,messages:g,defaultTranslationValues:u,namespace:b,onError:m,formats:l,locale:p,timeZone:E}),[n,c,f,g,u,b,m,l,p,E])}({"!":o.useIntlContext().messages},e?"!.".concat(e):"!",0)}},65826:(e,t,r)=>{r.d(t,{CR:()=>u,Jh:()=>h,ZT:()=>o,_T:()=>a,ev:()=>l,mG:()=>s,pi:()=>i});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{h(n.next(e))}catch(e){i(e)}}function s(e){try{h(n.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}h((n=n.apply(e,t||[])).next())})}function h(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(h){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function l(e,t,r){if(r||2==arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError}};
1
+ "use strict";exports.id=3844,exports.ids=[3844],exports.modules={68015:(e,t,r)=>{r.r(t),r.d(t,{ErrorCode:()=>h,FormatError:()=>er,IntlMessageFormat:()=>eu,InvalidValueError:()=>en,InvalidValueTypeError:()=>eo,MissingValueError:()=>ei,PART_TYPE:()=>u,default:()=>el,formatToParts:()=>es,isFormatXMLElementFn:()=>ea});var n,o,i,a,s,h,u,l=r(65826);function c(e){return e.type===o.literal}function f(e){return e.type===o.number}function p(e){return e.type===o.date}function m(e){return e.type===o.time}function E(e){return e.type===o.select}function g(e){return e.type===o.plural}function b(e){return e.type===o.tag}function d(e){return!!(e&&"object"==typeof e&&e.type===i.number)}function y(e){return!!(e&&"object"==typeof e&&e.type===i.dateTime)}(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(n||(n={})),function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"}(o||(o={})),function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"}(i||(i={}));var T=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,v=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g,_=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i,H=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,A=/^(@+)?(\+|#+)?[rs]?$/g,I=/(\*)(0+)|(#+)(0+)|(0+)/g,B=/^(0+)$/;function S(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(A,function(e,r,n){return"string"!=typeof n?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):"+"===n?t.minimumSignificantDigits=r.length:"#"===r[0]?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+("string"==typeof n?n.length:0)),""}),t}function N(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function L(e){return N(e)||{}}var P={"001":["H","h"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["H","h","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["H","hB","h","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["H","h","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["H","h","hB","hb"],CU:["H","h","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["H","hB","h","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["H","h","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["H","h","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["H","h","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["H","h","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["H","hB","h","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["H","h","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["H","h","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["H","h","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"es-BO":["H","h","hB","hb"],"es-BR":["H","h","hB","hb"],"es-EC":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"es-PE":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]},M=new RegExp("^".concat(T.source,"*")),O=new RegExp("".concat(T.source,"*$"));function C(e,t){return{start:e,end:t}}var R=!!String.prototype.startsWith&&"_a".startsWith("a",1),G=!!String.fromCodePoint,w=!!Object.fromEntries,F=!!String.prototype.codePointAt,U=!!String.prototype.trimStart,D=!!String.prototype.trimEnd,k=Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&9007199254740991>=Math.abs(e)},V=!0;try{var x=z("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");V=(null===(a=x.exec("a"))||void 0===a?void 0:a[0])==="a"}catch(e){V=!1}var j=R?function(e,t,r){return e.startsWith(t,r)}:function(e,t,r){return e.slice(r,r+t.length)===t},X=G?String.fromCodePoint:function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n="",o=t.length,i=0;o>i;){if((e=t[i++])>1114111)throw RangeError(e+" is not a valid code point");n+=e<65536?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,e%1024+56320)}return n},K=w?Object.fromEntries:function(e){for(var t={},r=0;r<e.length;r++){var n=e[r],o=n[0],i=n[1];t[o]=i}return t},Z=F?function(e,t){return e.codePointAt(t)}:function(e,t){var r,n=e.length;if(!(t<0)&&!(t>=n)){var o=e.charCodeAt(t);return o<55296||o>56319||t+1===n||(r=e.charCodeAt(t+1))<56320||r>57343?o:(o-55296<<10)+(r-56320)+65536}},Y=U?function(e){return e.trimStart()}:function(e){return e.replace(M,"")},W=D?function(e){return e.trimEnd()}:function(e){return e.replace(O,"")};function z(e,t){return new RegExp(e,t)}if(V){var Q=z("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");s=function(e,t){var r;return Q.lastIndex=t,null!==(r=Q.exec(e)[1])&&void 0!==r?r:""}}else s=function(e,t){for(var r=[];;){var n,o=Z(e,t);if(void 0===o||$(o)||(n=o)>=33&&n<=35||36===n||n>=37&&n<=39||40===n||41===n||42===n||43===n||44===n||45===n||n>=46&&n<=47||n>=58&&n<=59||n>=60&&n<=62||n>=63&&n<=64||91===n||92===n||93===n||94===n||96===n||123===n||124===n||125===n||126===n||161===n||n>=162&&n<=165||166===n||167===n||169===n||171===n||172===n||174===n||176===n||177===n||182===n||187===n||191===n||215===n||247===n||n>=8208&&n<=8213||n>=8214&&n<=8215||8216===n||8217===n||8218===n||n>=8219&&n<=8220||8221===n||8222===n||8223===n||n>=8224&&n<=8231||n>=8240&&n<=8248||8249===n||8250===n||n>=8251&&n<=8254||n>=8257&&n<=8259||8260===n||8261===n||8262===n||n>=8263&&n<=8273||8274===n||8275===n||n>=8277&&n<=8286||n>=8592&&n<=8596||n>=8597&&n<=8601||n>=8602&&n<=8603||n>=8604&&n<=8607||8608===n||n>=8609&&n<=8610||8611===n||n>=8612&&n<=8613||8614===n||n>=8615&&n<=8621||8622===n||n>=8623&&n<=8653||n>=8654&&n<=8655||n>=8656&&n<=8657||8658===n||8659===n||8660===n||n>=8661&&n<=8691||n>=8692&&n<=8959||n>=8960&&n<=8967||8968===n||8969===n||8970===n||8971===n||n>=8972&&n<=8991||n>=8992&&n<=8993||n>=8994&&n<=9e3||9001===n||9002===n||n>=9003&&n<=9083||9084===n||n>=9085&&n<=9114||n>=9115&&n<=9139||n>=9140&&n<=9179||n>=9180&&n<=9185||n>=9186&&n<=9254||n>=9255&&n<=9279||n>=9280&&n<=9290||n>=9291&&n<=9311||n>=9472&&n<=9654||9655===n||n>=9656&&n<=9664||9665===n||n>=9666&&n<=9719||n>=9720&&n<=9727||n>=9728&&n<=9838||9839===n||n>=9840&&n<=10087||10088===n||10089===n||10090===n||10091===n||10092===n||10093===n||10094===n||10095===n||10096===n||10097===n||10098===n||10099===n||10100===n||10101===n||n>=10132&&n<=10175||n>=10176&&n<=10180||10181===n||10182===n||n>=10183&&n<=10213||10214===n||10215===n||10216===n||10217===n||10218===n||10219===n||10220===n||10221===n||10222===n||10223===n||n>=10224&&n<=10239||n>=10240&&n<=10495||n>=10496&&n<=10626||10627===n||10628===n||10629===n||10630===n||10631===n||10632===n||10633===n||10634===n||10635===n||10636===n||10637===n||10638===n||10639===n||10640===n||10641===n||10642===n||10643===n||10644===n||10645===n||10646===n||10647===n||10648===n||n>=10649&&n<=10711||10712===n||10713===n||10714===n||10715===n||n>=10716&&n<=10747||10748===n||10749===n||n>=10750&&n<=11007||n>=11008&&n<=11055||n>=11056&&n<=11076||n>=11077&&n<=11078||n>=11079&&n<=11084||n>=11085&&n<=11123||n>=11124&&n<=11125||n>=11126&&n<=11157||11158===n||n>=11159&&n<=11263||n>=11776&&n<=11777||11778===n||11779===n||11780===n||11781===n||n>=11782&&n<=11784||11785===n||11786===n||11787===n||11788===n||11789===n||n>=11790&&n<=11798||11799===n||n>=11800&&n<=11801||11802===n||11803===n||11804===n||11805===n||n>=11806&&n<=11807||11808===n||11809===n||11810===n||11811===n||11812===n||11813===n||11814===n||11815===n||11816===n||11817===n||n>=11818&&n<=11822||11823===n||n>=11824&&n<=11833||n>=11834&&n<=11835||n>=11836&&n<=11839||11840===n||11841===n||11842===n||n>=11843&&n<=11855||n>=11856&&n<=11857||11858===n||n>=11859&&n<=11903||n>=12289&&n<=12291||12296===n||12297===n||12298===n||12299===n||12300===n||12301===n||12302===n||12303===n||12304===n||12305===n||n>=12306&&n<=12307||12308===n||12309===n||12310===n||12311===n||12312===n||12313===n||12314===n||12315===n||12316===n||12317===n||n>=12318&&n<=12319||12320===n||12336===n||64830===n||64831===n||n>=65093&&n<=65094)break;r.push(o),t+=o>=65536?2:1}return X.apply(void 0,r)};var q=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,r){for(var i=[];!this.isEOF();){var a=this.char();if(123===a){var s=this.parseArgument(e,r);if(s.err)return s;i.push(s.val)}else if(125===a&&e>0)break;else if(35===a&&("plural"===t||"selectordinal"===t)){var h=this.clonePosition();this.bump(),i.push({type:o.pound,location:C(h,this.clonePosition())})}else if(60!==a||this.ignoreTag||47!==this.peek()){if(60===a&&!this.ignoreTag&&J(this.peek()||0)){var s=this.parseTag(e,t);if(s.err)return s;i.push(s.val)}else{var s=this.parseLiteral(e,t);if(s.err)return s;i.push(s.val)}}else{if(!r)return this.error(n.UNMATCHED_CLOSING_TAG,C(this.clonePosition(),this.clonePosition()));break}}return{val:i,err:null}},e.prototype.parseTag=function(e,t){var r=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:o.literal,value:"<".concat(i,"/>"),location:C(r,this.clonePosition())},err:null};if(!this.bumpIf(">"))return this.error(n.INVALID_TAG,C(r,this.clonePosition()));var a=this.parseMessage(e+1,t,!0);if(a.err)return a;var s=a.val,h=this.clonePosition();if(!this.bumpIf("</"))return this.error(n.UNCLOSED_TAG,C(r,this.clonePosition()));if(this.isEOF()||!J(this.char()))return this.error(n.INVALID_TAG,C(h,this.clonePosition()));var u=this.clonePosition();return i!==this.parseTagName()?this.error(n.UNMATCHED_CLOSING_TAG,C(u,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">"))?{val:{type:o.tag,value:i,children:s,location:C(r,this.clonePosition())},err:null}:this.error(n.INVALID_TAG,C(h,this.clonePosition()))},e.prototype.parseTagName=function(){var e,t=this.offset();for(this.bump();!this.isEOF()&&(45===(e=this.char())||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var r=this.clonePosition(),n="";;){var i=this.tryParseQuote(t);if(i){n+=i;continue}var a=this.tryParseUnquoted(e,t);if(a){n+=a;continue}var s=this.tryParseLeftAngleBracket();if(s){n+=s;continue}break}var h=C(r,this.clonePosition());return{val:{type:o.literal,value:n,location:h},err:null}},e.prototype.tryParseLeftAngleBracket=function(){var e;return this.isEOF()||60!==this.char()||!this.ignoreTag&&(J(e=this.peek()||0)||47===e)?null:(this.bump(),"<")},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(39===r){if(39===this.peek())t.push(39),this.bump();else{this.bump();break}}else t.push(r);this.bump()}return X.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var r=this.char();return 60===r||123===r||35===r&&("plural"===t||"selectordinal"===t)||125===r&&e>0?null:(this.bump(),X(r))},e.prototype.parseArgument=function(e,t){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(r,this.clonePosition()));if(125===this.char())return this.bump(),this.error(n.EMPTY_ARGUMENT,C(r,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(n.MALFORMED_ARGUMENT,C(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:o.argument,value:i,location:C(r,this.clonePosition())},err:null};case 44:if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(r,this.clonePosition()));return this.parseArgumentOptions(e,t,i,r);default:return this.error(n.MALFORMED_ARGUMENT,C(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=s(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:C(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,r,a){var s,h=this.clonePosition(),u=this.parseIdentifierIfPossible().value,c=this.clonePosition();switch(u){case"":return this.error(n.EXPECT_ARGUMENT_TYPE,C(h,c));case"number":case"date":case"time":this.bumpSpace();var f=null;if(this.bumpIf(",")){this.bumpSpace();var p=this.clonePosition(),m=this.parseSimpleArgStyleIfPossible();if(m.err)return m;var E=W(m.val);if(0===E.length)return this.error(n.EXPECT_ARGUMENT_STYLE,C(this.clonePosition(),this.clonePosition()));f={style:E,styleLocation:C(p,this.clonePosition())}}var g=this.tryParseArgumentClose(a);if(g.err)return g;var b=C(a,this.clonePosition());if(f&&j(null==f?void 0:f.style,"::",0)){var d,y=Y(f.style.slice(2));if("number"===u){var m=this.parseNumberSkeletonFromString(y,f.styleLocation);if(m.err)return m;return{val:{type:o.number,value:r,location:b,style:m.val},err:null}}if(0===y.length)return this.error(n.EXPECT_DATE_TIME_SKELETON,b);var T=y;this.locale&&(T=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e.charAt(n);if("j"===o){for(var i=0;n+1<e.length&&e.charAt(n+1)===o;)i++,n++;var a=1+(1&i),s=i<2?1:3+(i>>1),h=function(e){var t,r=e.hourCycle;if(void 0===r&&e.hourCycles&&e.hourCycles.length&&(r=e.hourCycles[0]),r)switch(r){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw Error("Invalid hourCycle")}var n=e.language;return"root"!==n&&(t=e.maximize().region),(P[t||""]||P[n||""]||P["".concat(n,"-001")]||P["001"])[0]}(t);for(("H"==h||"k"==h)&&(s=0);s-- >0;)r+="a";for(;a-- >0;)r=h+r}else"J"===o?r+="H":r+=o}return r}(y,this.locale));var E={type:i.dateTime,pattern:T,location:f.styleLocation,parsedOptions:this.shouldParseSkeletons?(d={},T.replace(v,function(e){var t=e.length;switch(e[0]){case"G":d.era=4===t?"long":5===t?"narrow":"short";break;case"y":d.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":d.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw RangeError("`w/W` (week) patterns are not supported");case"d":d.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":d.weekday=4===t?"long":5===t?"narrow":"short";break;case"e":if(t<4)throw RangeError("`e..eee` (weekday) patterns are not supported");d.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw RangeError("`c..ccc` (weekday) patterns are not supported");d.weekday=["short","long","narrow","short"][t-4];break;case"a":d.hour12=!0;break;case"b":case"B":throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":d.hourCycle="h12",d.hour=["numeric","2-digit"][t-1];break;case"H":d.hourCycle="h23",d.hour=["numeric","2-digit"][t-1];break;case"K":d.hourCycle="h11",d.hour=["numeric","2-digit"][t-1];break;case"k":d.hourCycle="h24",d.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":d.minute=["numeric","2-digit"][t-1];break;case"s":d.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":d.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),d):{}};return{val:{type:"date"===u?o.date:o.time,value:r,location:b,style:E},err:null}}return{val:{type:"number"===u?o.number:"date"===u?o.date:o.time,value:r,location:b,style:null!==(s=null==f?void 0:f.style)&&void 0!==s?s:null},err:null};case"plural":case"selectordinal":case"select":var _=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(n.EXPECT_SELECT_ARGUMENT_OPTIONS,C(_,(0,l.pi)({},_)));this.bumpSpace();var H=this.parseIdentifierIfPossible(),A=0;if("select"!==u&&"offset"===H.value){if(!this.bumpIf(":"))return this.error(n.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,C(this.clonePosition(),this.clonePosition()));this.bumpSpace();var m=this.tryParseDecimalInteger(n.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,n.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(m.err)return m;this.bumpSpace(),H=this.parseIdentifierIfPossible(),A=m.val}var I=this.tryParsePluralOrSelectOptions(e,u,t,H);if(I.err)return I;var g=this.tryParseArgumentClose(a);if(g.err)return g;var B=C(a,this.clonePosition());if("select"===u)return{val:{type:o.select,value:r,options:K(I.val),location:B},err:null};return{val:{type:o.plural,value:r,options:K(I.val),offset:A,pluralType:"plural"===u?"cardinal":"ordinal",location:B},err:null};default:return this.error(n.INVALID_ARGUMENT_TYPE,C(h,c))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(n.EXPECT_ARGUMENT_CLOSING_BRACE,C(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(n.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,C(r,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var r=[];try{r=function(e){if(0===e.length)throw Error("Number skeleton cannot be empty");for(var t=e.split(_).filter(function(e){return e.length>0}),r=[],n=0;n<t.length;n++){var o=t[n].split("/");if(0===o.length)throw Error("Invalid number skeleton");for(var i=o[0],a=o.slice(1),s=0;s<a.length;s++)if(0===a[s].length)throw Error("Invalid number skeleton");r.push({stem:i,options:a})}return r}(e)}catch(e){return this.error(n.INVALID_NUMBER_SKELETON,t)}return{val:{type:i.number,tokens:r,location:t,parsedOptions:this.shouldParseSkeletons?function(e){for(var t={},r=0;r<e.length;r++){var n=e[r];switch(n.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=n.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=n.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=(0,l.pi)((0,l.pi)((0,l.pi)({},t),{notation:"scientific"}),n.options.reduce(function(e,t){return(0,l.pi)((0,l.pi)({},e),N(t)||{})},{}));continue;case"engineering":t=(0,l.pi)((0,l.pi)((0,l.pi)({},t),{notation:"engineering"}),n.options.reduce(function(e,t){return(0,l.pi)((0,l.pi)({},e),N(t)||{})},{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(n.options[0]);continue;case"rounding-mode-floor":t.roundingMode="floor";continue;case"rounding-mode-ceiling":t.roundingMode="ceil";continue;case"rounding-mode-down":t.roundingMode="trunc";continue;case"rounding-mode-up":t.roundingMode="expand";continue;case"rounding-mode-half-even":t.roundingMode="halfEven";continue;case"rounding-mode-half-down":t.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":t.roundingMode="halfExpand";continue;case"integer-width":if(n.options.length>1)throw RangeError("integer-width stems only accept a single optional option");n.options[0].replace(I,function(e,r,n,o,i,a){if(r)t.minimumIntegerDigits=n.length;else if(o&&i)throw Error("We currently do not support maximum integer digits");else if(a)throw Error("We currently do not support exact integer digits");return""});continue}if(B.test(n.stem)){t.minimumIntegerDigits=n.stem.length;continue}if(H.test(n.stem)){if(n.options.length>1)throw RangeError("Fraction-precision stems only accept a single optional option");n.stem.replace(H,function(e,r,n,o,i,a){return"*"===n?t.minimumFractionDigits=r.length:o&&"#"===o[0]?t.maximumFractionDigits=o.length:i&&a?(t.minimumFractionDigits=i.length,t.maximumFractionDigits=i.length+a.length):(t.minimumFractionDigits=r.length,t.maximumFractionDigits=r.length),""});var o=n.options[0];"w"===o?t=(0,l.pi)((0,l.pi)({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=(0,l.pi)((0,l.pi)({},t),S(o)));continue}if(A.test(n.stem)){t=(0,l.pi)((0,l.pi)({},t),S(n.stem));continue}var i=N(n.stem);i&&(t=(0,l.pi)((0,l.pi)({},t),i));var a=function(e){var t;if("E"===e[0]&&"E"===e[1]?(t={notation:"engineering"},e=e.slice(2)):"E"===e[0]&&(t={notation:"scientific"},e=e.slice(1)),t){var r=e.slice(0,2);if("+!"===r?(t.signDisplay="always",e=e.slice(2)):"+?"===r&&(t.signDisplay="exceptZero",e=e.slice(2)),!B.test(e))throw Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}(n.stem);a&&(t=(0,l.pi)((0,l.pi)({},t),a))}return t}(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,o){for(var i,a=!1,s=[],h=new Set,u=o.value,l=o.location;;){if(0===u.length){var c=this.clonePosition();if("select"!==t&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(n.EXPECT_PLURAL_ARGUMENT_SELECTOR,n.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;l=C(c,this.clonePosition()),u=this.message.slice(c.offset,this.offset())}else break}if(h.has(u))return this.error("select"===t?n.DUPLICATE_SELECT_ARGUMENT_SELECTOR:n.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,l);"other"===u&&(a=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?n.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:n.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,C(this.clonePosition(),this.clonePosition()));var m=this.parseMessage(e+1,t,r);if(m.err)return m;var E=this.tryParseArgumentClose(p);if(E.err)return E;s.push([u,{value:m.val,location:C(p,this.clonePosition())}]),h.add(u),this.bumpSpace(),u=(i=this.parseIdentifierIfPossible()).value,l=i.location}return 0===s.length?this.error("select"===t?n.EXPECT_SELECT_ARGUMENT_SELECTOR:n.EXPECT_PLURAL_ARGUMENT_SELECTOR,C(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!a?this.error(n.MISSING_OTHER_CLAUSE,C(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var r=1,n=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var o=!1,i=0;!this.isEOF();){var a=this.char();if(a>=48&&a<=57)o=!0,i=10*i+(a-48),this.bump();else break}var s=C(n,this.clonePosition());return o?k(i*=r)?{val:i,err:null}:this.error(t,s):this.error(e,s)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=Z(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(j(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),r=this.message.indexOf(e,t);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&$(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),r=this.message.charCodeAt(t+(e>=65536?2:1));return null!=r?r:null},e}();function J(e){return e>=97&&e<=122||e>=65&&e<=90}function $(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function ee(e,t){void 0===t&&(t={});var r=new q(e,t=(0,l.pi)({shouldParseSkeletons:!0,requiresOtherClause:!0},t)).parse();if(r.err){var o=SyntaxError(n[r.err.kind]);throw o.location=r.err.location,o.originalMessage=r.err.message,o}return(null==t?void 0:t.captureLocation)||function e(t){t.forEach(function(t){if(delete t.location,E(t)||g(t))for(var r in t.options)delete t.options[r].location,e(t.options[r].value);else f(t)&&d(t.style)?delete t.style.location:(p(t)||m(t))&&y(t.style)?delete t.style.location:b(t)&&e(t.children)})}(r.val),r.val}var et=r(68913);!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(h||(h={}));var er=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.code=r,o.originalMessage=n,o}return(0,l.ZT)(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),en=function(e){function t(t,r,n,o){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(r,'". Options are "').concat(Object.keys(n).join('", "'),'"'),h.INVALID_VALUE,o)||this}return(0,l.ZT)(t,e),t}(er),eo=function(e){function t(t,r,n){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(r),h.INVALID_VALUE,n)||this}return(0,l.ZT)(t,e),t}(er),ei=function(e){function t(t,r){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(r,'"'),h.MISSING_VALUE,r)||this}return(0,l.ZT)(t,e),t}(er);function ea(e){return"function"==typeof e}function es(e,t,r,n,i,a,s){if(1===e.length&&c(e[0]))return[{type:u.literal,value:e[0].value}];for(var l=[],T=0;T<e.length;T++){var v=e[T];if(c(v)){l.push({type:u.literal,value:v.value});continue}if(v.type===o.pound){"number"==typeof a&&l.push({type:u.literal,value:r.getNumberFormat(t).format(a)});continue}var _=v.value;if(!(i&&_ in i))throw new ei(_,s);var H=i[_];if(v.type===o.argument){H&&"string"!=typeof H&&"number"!=typeof H||(H="string"==typeof H||"number"==typeof H?String(H):""),l.push({type:"string"==typeof H?u.literal:u.object,value:H});continue}if(p(v)){var A="string"==typeof v.style?n.date[v.style]:y(v.style)?v.style.parsedOptions:void 0;l.push({type:u.literal,value:r.getDateTimeFormat(t,A).format(H)});continue}if(m(v)){var A="string"==typeof v.style?n.time[v.style]:y(v.style)?v.style.parsedOptions:n.time.medium;l.push({type:u.literal,value:r.getDateTimeFormat(t,A).format(H)});continue}if(f(v)){var A="string"==typeof v.style?n.number[v.style]:d(v.style)?v.style.parsedOptions:void 0;A&&A.scale&&(H*=A.scale||1),l.push({type:u.literal,value:r.getNumberFormat(t,A).format(H)});continue}if(b(v)){var I=v.children,B=v.value,S=i[B];if(!ea(S))throw new eo(B,"function",s);var N=S(es(I,t,r,n,i,a).map(function(e){return e.value}));Array.isArray(N)||(N=[N]),l.push.apply(l,N.map(function(e){return{type:"string"==typeof e?u.literal:u.object,value:e}}))}if(E(v)){var L=v.options[H]||v.options.other;if(!L)throw new en(v.value,H,Object.keys(v.options),s);l.push.apply(l,es(L.value,t,r,n,i));continue}if(g(v)){var L=v.options["=".concat(H)];if(!L){if(!Intl.PluralRules)throw new er('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',h.MISSING_INTL_API,s);var P=r.getPluralRules(t,{type:v.pluralType}).select(H-(v.offset||0));L=v.options[P]||v.options.other}if(!L)throw new en(v.value,H,Object.keys(v.options),s);l.push.apply(l,es(L.value,t,r,n,i,H-(v.offset||0)));continue}}return l.length<2?l:l.reduce(function(e,t){var r=e[e.length-1];return r&&r.type===u.literal&&t.type===u.literal?r.value+=t.value:e.push(t),e},[])}function eh(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(u||(u={}));var eu=function(){function e(t,r,n,o){var i,a,s=this;if(void 0===r&&(r=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);if(1===t.length)return t[0].value;var r=t.reduce(function(e,t){return e.length&&t.type===u.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e},[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return es(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){var e;return{locale:(null===(e=s.resolvedLocale)||void 0===e?void 0:e.toString())||Intl.NumberFormat.supportedLocalesOf(s.locales)[0]}},this.getAst=function(){return s.ast},this.locales=r,this.resolvedLocale=e.resolveLocale(r),"string"==typeof t){if(this.message=t,!e.__parse)throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");var h=o||{},c=(h.formatters,(0,l._T)(h,["formatters"]));this.ast=e.__parse(t,(0,l.pi)((0,l.pi)({},c),{locale:this.resolvedLocale}))}else this.ast=t;if(!Array.isArray(this.ast))throw TypeError("A message must be provided as a String or AST.");this.formats=(i=e.formats,n?Object.keys(i).reduce(function(e,t){var r,o;return e[t]=(r=i[t],(o=n[t])?(0,l.pi)((0,l.pi)((0,l.pi)({},r||{}),o||{}),Object.keys(r).reduce(function(e,t){return e[t]=(0,l.pi)((0,l.pi)({},r[t]),o[t]||{}),e},{})):r),e},(0,l.pi)({},i)):i),this.formatters=o&&o.formatters||(void 0===(a=this.formatterCache)&&(a={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:(0,et.memoize)(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.NumberFormat).bind.apply(e,(0,l.ev)([void 0],t,!1)))},{cache:eh(a.number),strategy:et.strategies.variadic}),getDateTimeFormat:(0,et.memoize)(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.DateTimeFormat).bind.apply(e,(0,l.ev)([void 0],t,!1)))},{cache:eh(a.dateTime),strategy:et.strategies.variadic}),getPluralRules:(0,et.memoize)(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.PluralRules).bind.apply(e,(0,l.ev)([void 0],t,!1)))},{cache:eh(a.pluralRules),strategy:et.strategies.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(e){if(void 0!==Intl.Locale){var t=Intl.NumberFormat.supportedLocalesOf(e);return new Intl.Locale(t.length>0?t[0]:"string"==typeof e?e:e[0])}},e.__parse=ee,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();let el=eu},2167:(e,t)=>{function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.extends=r},23844:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(13378),o=r(27916),i=r(40397),a=r(78119);t.useFormatter=n.useFormatter,t.useTranslations=n.useTranslations,t.useLocale=o.default,t.NextIntlClientProvider=i.default,Object.keys(a).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})})},13378:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(78119);function o(e,t){return function(){try{return t(...arguments)}catch(e){throw Error(void 0)}}}let i=o(0,n.useTranslations),a=o(0,n.useFormatter);t.useFormatter=a,t.useTranslations=i,Object.keys(n).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})},27916:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(35047),o=r(13015),i=r(19237);t.default=function(){let e;let t=n.useParams();try{e=o.useLocale()}catch(r){if("string"!=typeof(null==t?void 0:t[i.LOCALE_SEGMENT_NAME]))throw r;e=t[i.LOCALE_SEGMENT_NAME]}return e}},40397:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(2167),o=r(17577),i=r(11669),a=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(e){let{locale:t,...r}=e;if(!t)throw Error(void 0);return a.default.createElement(i.IntlProvider,n.extends({locale:t},r))}},19237:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.COOKIE_LOCALE_NAME="NEXT_LOCALE",t.COOKIE_MAX_AGE=31536e3,t.COOKIE_SAME_SITE="lax",t.HEADER_LOCALE_NAME="X-NEXT-INTL-LOCALE",t.LOCALE_SEGMENT_NAME="locale"},11669:(e,t,r)=>{e.exports=r(30776)},13015:(e,t,r)=>{e.exports=r(39471)},78119:(e,t,r)=>{e.exports=r(45948)},69422:(e,t,r)=>{var n=r(17577),o=r(91695);function i(){let e=n.useContext(o.IntlContext);if(!e)throw Error(void 0);return e}t.useIntlContext=i,t.useLocale=function(){return i().locale}},39471:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(69422);r(17577),r(91695),t.useLocale=n.useLocale},1153:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(50148),o=r(36118);r(68015),r(17577),r(68913),t.IntlError=n.IntlError,t.IntlErrorCode=n.IntlErrorCode,t.createFormatter=n.createFormatter,t._createCache=o.createCache,t._createIntlFormatters=o.createIntlFormatters,t.initializeConfig=o.initializeConfig,t.createTranslator=function(e){let{_cache:t=o.createCache(),_formatters:r=o.createIntlFormatters(t),getMessageFallback:i=o.defaultGetMessageFallback,messages:a,namespace:s,onError:h=o.defaultOnError,...u}=e;return function(e,t){let{messages:r,namespace:o,...i}=e;return r=r["!"],o=n.resolveNamespace(o,"!"),n.createBaseTranslator({...i,messages:r,namespace:o})}({...u,onError:h,cache:t,formatters:r,getMessageFallback:i,messages:{"!":a},namespace:s?"!.".concat(s):"!"},0)}},50148:(e,t,r)=>{var n=r(68015),o=r(17577),i=r(36118),a=function(e){return e&&e.__esModule?e:{default:e}}(n);function s(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let h=function(e){return e.MISSING_MESSAGE="MISSING_MESSAGE",e.MISSING_FORMAT="MISSING_FORMAT",e.ENVIRONMENT_FALLBACK="ENVIRONMENT_FALLBACK",e.INSUFFICIENT_PATH="INSUFFICIENT_PATH",e.INVALID_MESSAGE="INVALID_MESSAGE",e.INVALID_KEY="INVALID_KEY",e.FORMATTING_ERROR="FORMATTING_ERROR",e}({});class u extends Error{constructor(e,t){let r=e;t&&(r+=": "+t),super(r),s(this,"code",void 0),s(this,"originalMessage",void 0),this.code=e,t&&(this.originalMessage=t)}}function l(e,t){return e?Object.keys(e).reduce((r,n)=>(r[n]={timeZone:t,...e[n]},r),{}):e}function c(e,t,r,n){let o=i.joinPath(n,r);if(!t)throw Error(o);let a=t;return r.split(".").forEach(t=>{let r=a[t];if(null==t||null==r)throw Error(o+" (".concat(e,")"));a=r}),a}let f=365/12*86400,p={second:1,seconds:1,minute:60,minutes:60,hour:3600,hours:3600,day:86400,days:86400,week:604800,weeks:604800,month:365/12*86400,months:365/12*86400,quarter:365/12*259200,quarters:365/12*259200,year:31536e3,years:31536e3};t.IntlError=u,t.IntlErrorCode=h,t.createBaseTranslator=function(e){let t=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i.defaultOnError;try{if(!t)throw Error(void 0);let n=r?c(e,t,r):t;if(!n)throw Error(r);return n}catch(t){let e=new u(h.MISSING_MESSAGE,t.message);return n(e),e}}(e.locale,e.messages,e.namespace,e.onError);return function(e){let{cache:t,defaultTranslationValues:r,formats:n,formatters:s,getMessageFallback:f=i.defaultGetMessageFallback,locale:p,messagesOrError:m,namespace:E,onError:g,timeZone:b}=e;function d(e,t,r){let n=new u(t,r);return g(n),f({error:n,key:e,namespace:E})}function y(e,g,y){let T,v;if(m instanceof u)return f({error:m,key:e,namespace:E});try{T=c(p,m,e,E)}catch(t){return d(e,h.MISSING_MESSAGE,t.message)}if("object"==typeof T){let t;return d(e,Array.isArray(T)?h.INVALID_MESSAGE:h.INSUFFICIENT_PATH,t)}let _=function(e,t){if(t)return;let r=e.replace(/'([{}])/gi,"$1");return/<|{/.test(r)?void 0:r}(T,g);if(_)return _;s.getMessageFormat||(s.getMessageFormat=i.memoFn(function(){return new a.default(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],{formatters:s,...arguments.length<=3?void 0:arguments[3]})},t.message));try{v=s.getMessageFormat(T,p,function(e,t){let r=t?{...e,dateTime:l(e.dateTime,t)}:e,n=a.default.formats.date,o=t?l(n,t):n,i=a.default.formats.time,s=t?l(i,t):i;return{...r,date:{...o,...null==r?void 0:r.dateTime},time:{...s,...null==r?void 0:r.dateTime}}}({...n,...y},b),{formatters:{...s,getDateTimeFormat:(e,t)=>s.getDateTimeFormat(e,{timeZone:b,...t})}})}catch(t){return d(e,h.INVALID_MESSAGE,t.message)}try{let e=v.format(function(e){if(0===Object.keys(e).length)return;let t={};return Object.keys(e).forEach(r=>{let n,i=0,a=e[r];n="function"==typeof a?e=>{let t=a(e);return o.isValidElement(t)?o.cloneElement(t,{key:r+i++}):t}:a,t[r]=n}),t}({...r,...g}));if(null==e)throw Error(void 0);return o.isValidElement(e)||Array.isArray(e)||"string"==typeof e?e:String(e)}catch(t){return d(e,h.FORMATTING_ERROR,t.message)}}function T(e,t,r){let n=y(e,t,r);return"string"!=typeof n?d(e,h.INVALID_MESSAGE,void 0):n}return T.rich=y,T.markup=(e,t,r)=>{let n=y(e,t,r);if("string"!=typeof n){let t=new u(h.FORMATTING_ERROR,void 0);return g(t),f({error:t,key:e,namespace:E})}return n},T.raw=e=>{if(m instanceof u)return f({error:m,key:e,namespace:E});try{return c(p,m,e,E)}catch(t){return d(e,h.MISSING_MESSAGE,t.message)}},T}({...e,messagesOrError:t})},t.createFormatter=function(e){let{_cache:t=i.createCache(),_formatters:r=i.createIntlFormatters(t),formats:n,locale:o,now:a,onError:s=i.defaultOnError,timeZone:l}=e;function c(e){var t;return null!==(t=e)&&void 0!==t&&t.timeZone||(l?e={...e,timeZone:l}:s(new u(h.ENVIRONMENT_FALLBACK,void 0))),e}function m(e,t,r,n){let o;try{o=function(e,t){let r;if("string"==typeof t){if(!(r=null==e?void 0:e[t])){let e=new u(h.MISSING_FORMAT,void 0);throw s(e),e}}else r=t;return r}(t,e)}catch(e){return n()}try{return r(o)}catch(e){return s(new u(h.FORMATTING_ERROR,e.message)),n()}}function E(e,t){return m(t,null==n?void 0:n.dateTime,t=>(t=c(t),r.getDateTimeFormat(o,t).format(e)),()=>String(e))}function g(){return a||(s(new u(h.ENVIRONMENT_FALLBACK,void 0)),new Date)}return{dateTime:E,number:function(e,t){return m(t,null==n?void 0:n.number,t=>r.getNumberFormat(o,t).format(e),()=>String(e))},relativeTime:function(e,t){try{var n;let i,a;let s={};t instanceof Date||"number"==typeof t?i=new Date(t):t&&(i=null!=t.now?new Date(t.now):g(),a=t.unit,s.style=t.style,s.numberingSystem=t.numberingSystem),i||(i=g());let h=(new Date(e).getTime()-i.getTime())/1e3;a||(a=function(e){let t=Math.abs(e);return t<60?"second":t<3600?"minute":t<86400?"hour":t<604800?"day":t<f?"week":t<31536e3?"month":"year"}(h)),s.numeric="second"===a?"auto":"always";let u=(n=a,Math.round(h/p[n]));return r.getRelativeTimeFormat(o,s).format(u,a)}catch(t){return s(new u(h.FORMATTING_ERROR,t.message)),String(e)}},list:function(e,t){let i=[],a=new Map,s=0;for(let t of e){let e;"object"==typeof t?(e=String(s),a.set(e,t)):e=String(t),i.push(e),s++}return m(t,null==n?void 0:n.list,e=>{let t=r.getListFormat(o,e).formatToParts(i).map(e=>"literal"===e.type?e.value:a.get(e.value)||e.value);return a.size>0?t:t.join("")},()=>String(e))},dateTimeRange:function(e,t,i){return m(i,null==n?void 0:n.dateTime,n=>(n=c(n),r.getDateTimeFormat(o,n).formatRange(e,t)),()=>[E(e),E(t)].join(" – "))}}},t.resolveNamespace=function(e,t){return e===t?void 0:e.slice((t+".").length)}},45948:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(50148),o=r(1153),i=r(36118),a=r(30776),s=r(55965),h=r(69422);r(68015),r(17577),r(68913),r(91695),t.IntlError=n.IntlError,t.IntlErrorCode=n.IntlErrorCode,t.createFormatter=n.createFormatter,t.createTranslator=o.createTranslator,t._createCache=i.createCache,t._createIntlFormatters=i.createIntlFormatters,t.initializeConfig=i.initializeConfig,t.IntlProvider=a.IntlProvider,t.useFormatter=s.useFormatter,t.useMessages=s.useMessages,t.useNow=s.useNow,t.useTimeZone=s.useTimeZone,t.useTranslations=s.useTranslations,t.useLocale=h.useLocale},55965:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(30776),o=r(69422),i=r(17577),a=r(50148);r(36118),r(68913),r(91695),r(68015);let s=!1,h="undefined"==typeof window;t.IntlProvider=n.IntlProvider,t.useLocale=o.useLocale,t.useFormatter=function(){let{formats:e,formatters:t,locale:r,now:n,onError:s,timeZone:h}=o.useIntlContext();return i.useMemo(()=>a.createFormatter({formats:e,locale:r,now:n,onError:s,timeZone:h,_formatters:t}),[e,t,n,r,s,h])},t.useMessages=function(){let e=o.useIntlContext();if(!e.messages)throw Error(void 0);return e.messages},t.useNow=function(e){let t=null==e?void 0:e.updateInterval,{now:r}=o.useIntlContext(),[n,a]=i.useState(r||new Date);return i.useEffect(()=>{if(!t)return;let e=setInterval(()=>{a(new Date)},t);return()=>{clearInterval(e)}},[r,t]),null==t&&r?r:n},t.useTimeZone=function(){return o.useIntlContext().timeZone},t.useTranslations=function(e){return function(e,t,r){let{cache:n,defaultTranslationValues:u,formats:l,formatters:c,getMessageFallback:f,locale:p,onError:m,timeZone:E}=o.useIntlContext(),g=e["!"],b=a.resolveNamespace(t,"!");return E||s||!h||(s=!0,m(new a.IntlError(a.IntlErrorCode.ENVIRONMENT_FALLBACK,void 0))),i.useMemo(()=>a.createBaseTranslator({cache:n,formatters:c,getMessageFallback:f,messages:g,defaultTranslationValues:u,namespace:b,onError:m,formats:l,locale:p,timeZone:E}),[n,c,f,g,u,b,m,l,p,E])}({"!":o.useIntlContext().messages},e?"!.".concat(e):"!",0)}},65826:(e,t,r)=>{r.d(t,{CR:()=>u,Jh:()=>h,ZT:()=>o,_T:()=>a,ev:()=>l,mG:()=>s,pi:()=>i});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{h(n.next(e))}catch(e){i(e)}}function s(e){try{h(n.throw(e))}catch(e){i(e)}}function h(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}h((n=n.apply(e,t||[])).next())})}function h(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(h){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,h])}}}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function l(e,t,r){if(r||2==arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError}};
@@ -1 +1 @@
1
- "use strict";exports.id=719,exports.ids=[719],exports.modules={90455:(e,t,n)=>{n.d(t,{G:()=>s,L:()=>i});var r=n(45609);async function s(){let e=await (0,r.getServerSession)(i);return e?(e.accessToken?console.log("Session found with access token"):console.log("Session found, but no access token"),e):(console.log("No session found"),null)}let i={providers:[(0,n(77210).Z)({clientId:process.env.GITHUB_ID,clientSecret:process.env.GITHUB_SECRET,authorization:{params:{scope:"public_repo workflow"}}})],callbacks:{async jwt({token:e,account:t,profile:n}){t&&t.access_token&&(e.accessToken=t.access_token);let r=n&&"object"==typeof n&&"login"in n?n.login:void 0,s=t&&"object"==typeof t&&"username"in t?t.username:void 0;return(r||s)&&(e.username=r??s),e},session:async({session:e,token:t})=>(e.accessToken=t.accessToken,e.user&&(e.user.username=t.username),e)},secret:process.env.NEXTAUTH_SECRET,debug:!1}},31470:(e,t,n)=>{n.d(t,{Bf:()=>s,CT:()=>o});let r="data",s={rootKeep:()=>".gitkeep",blogDir:()=>"blog",blogDirKeep:()=>"blog/.gitkeep",blogPost:e=>`blog/${e}.md`,blogFile:e=>`blog/${e}`,blogManifest:()=>"blog-manifest.json",memos:()=>"memos.json",likes:()=>"likes.json",siteConfig:()=>"site-config.json",highlightsDir:()=>"highlights",highlightsFile:e=>`highlights/${e}.json`},i=e=>`${r}/${e}`,o={root:()=>r,rootKeep:()=>i(s.rootKeep()),blogDir:()=>i(s.blogDir()),blogDirKeep:()=>i(s.blogDirKeep()),blogPost:e=>i(s.blogPost(e)),blogFile:e=>i(s.blogFile(e)),blogManifest:()=>i(s.blogManifest()),memos:()=>i(s.memos()),likes:()=>i(s.likes()),siteConfig:()=>i(s.siteConfig()),highlightsDir:()=>i(s.highlightsDir()),highlightsFile:e=>i(s.highlightsFile(e))}},54428:(e,t,n)=>{n.d(t,{Bi:()=>p,K4:()=>g,VD:()=>m});var r=n(92048),s=n(55315),i=n.n(s),o=n(94545),a=n(8502),l=n(31470),c=n(88069);let u=new Map;function h(e){return l.CT.highlightsFile(e)}function f(e){if(!e||0===e.length||e.length>200||e.includes("/")||e.includes("\\")||e.includes("\0")||e.includes("..")||e.startsWith("."))throw Error(`Invalid postId: ${e}`)}function d(e){if("object"==typeof e&&null!==e&&"status"in e){let t=e.status;return"number"==typeof t?t:void 0}}class g{constructor(e){this.rootDir=e}absPath(e){return i().join(this.rootDir,l.Bf.highlightsFile(e))}async load(e){f(e);try{let t=await r.promises.readFile(this.absPath(e),"utf-8");return{data:a.x.parse(JSON.parse(t)),sha:null}}catch(t){if("ENOENT"===t?.code)return{data:(0,a.Bk)(e),sha:null};throw t}}async save(e,t,n,s){f(e);let o=a.x.parse(t),l=this.absPath(e);return await r.promises.mkdir(i().dirname(l),{recursive:!0}),await r.promises.writeFile(l,JSON.stringify(o,null,2),"utf-8"),{sha:""}}}class p{constructor(e,t,n="cici"){this.octokit=e,this.owner=t,this.repo=n}async load(e){f(e);let t=u.get(e);if(t&&t.expiresAt>Date.now())return{data:t.data,sha:t.sha};let n=await this.readFile(e);if(!n){let t=(0,a.Bk)(e);return u.set(e,{data:t,sha:null,expiresAt:Date.now()+3e4}),{data:t,sha:null}}let r=a.x.parse(JSON.parse(n.content));return u.set(e,{data:r,sha:n.sha,expiresAt:Date.now()+3e4}),{data:r,sha:n.sha}}async save(e,t,n,r){f(e);let s=a.x.parse(t),i=Buffer.from(JSON.stringify(s,null,2)).toString("base64"),o=0,l=n;for(;o<3;)try{let t=await this.octokit.repos.createOrUpdateFileContents({owner:this.owner,repo:this.repo,path:h(e),message:r,content:i,...l?{sha:l}:{}}),n=t.data.content?.sha??"";return u.set(e,{data:s,sha:n,expiresAt:Date.now()+3e4}),{sha:n}}catch(n){let t=d(n);if(409===t||422===t){u.delete(e),o++;let t=await this.readFile(e);l=t?.sha??null;continue}throw n}throw Error("Save failed after 3 retries due to write contention")}async readFile(e){try{let t=(await this.octokit.repos.getContent({owner:this.owner,repo:this.repo,path:h(e)})).data;if(Array.isArray(t)||"file"!==t.type)return null;return{content:Buffer.from(t.content,"base64").toString("utf-8"),sha:t.sha}}catch(e){if(404===d(e))return null;throw e}}}function m(e={}){let t=(0,c.D)(e.ownerToken);if("local"===t.kind)return new g(t.dir);{let n=e.ownerToken??t.token??process.env.HIGHLIGHTS_GH_TOKEN;if(!n)throw Error("HIGHLIGHTS_GH_TOKEN not configured. Inline comments require a service token in production.");return new p(new o.v({auth:n}),t.owner,t.repo)}}},8502:(e,t,n)=>{n.d(t,{Bk:()=>u,Om:()=>s,x:()=>c});var r=n(4037);let s=r.Ry({startOffset:r.Rx().int().nonnegative(),endOffset:r.Rx().int().nonnegative(),exact:r.Z_().min(1).max(1e3),prefix:r.Z_().max(64),suffix:r.Z_().max(64)}).refine(e=>e.endOffset>=e.startOffset,{message:"endOffset must be >= startOffset"}),i=r.IM(r.Z_(),r.IX(r.Z_())),o=r.Km(["ios","android","web"]),a=r.Ry({id:r.Z_().min(1).max(64),parentId:r.Z_().min(1).max(64).nullable(),body:r.Z_().min(1).max(2e3),authorName:r.Z_().max(40).nullable(),fingerprint:r.Z_().min(1).max(128),country:r.Z_().max(8),platform:o,reactions:i,resolved:r.O7(),createdAt:r.Z_().datetime(),hidden:r.O7(),hiddenReason:r.Z_().max(200).optional()}),l=r.Ry({id:r.Z_().min(1).max(64),anchor:s,thread:r.IX(a).min(1),resolved:r.O7(),createdAt:r.Z_().datetime()}),c=r.Ry({postId:r.Z_().min(1),highlights:r.IX(l),schemaVersion:r.i0(1)});function u(e){return{postId:e,highlights:[],schemaVersion:1}}},54904:(e,t,n)=>{n.d(t,{AH:()=>f,Cg:()=>u,Kz:()=>w,N9:()=>a,W4:()=>c,bH:()=>m,fT:()=>d,mF:()=>h,qF:()=>l});var r=n(87070),s=n(69271),i=n(90455),o=n(73194);function a(e,t){return r.NextResponse.json({success:!0,data:e},t)}function l(e,t=400){return r.NextResponse.json({success:!1,error:e},{status:t})}function c(e,t="Internal server error",n=500){return console.error("[highlights]",e),l(e instanceof Error&&e.message?e.message:t,n)}function u(e){let t=(0,s.H9)(e),n=(0,s.zC)(e),r=(0,s.D4)(t);return{fingerprint:(0,s.F6)(r,n),country:n.country,platform:(0,s.tz)(n.userAgent)}}async function h(){if((0,o.g)())return!0;let e=await (0,i.G)(),t=process.env.GITHUB_USERNAME;if(!t)return!1;if(e?.user?.username)return e.user.username===t;if(e?.accessToken){let n=await p(e.accessToken);if(n)return n===t}return!1}async function f(){let e=await (0,i.G)();return e?.accessToken}async function d(){let e=await (0,i.G)();if(e?.user?.username)return e.user.username;if(e?.accessToken){let t=await p(e.accessToken);if(t)return t}return e?.user?.name??null}let g=new Map;async function p(e){let t=g.get(e);if(t&&t.expiresAt>Date.now())return t.login;try{let t=await fetch("https://api.github.com/user",{headers:{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json"}});if(!t.ok)return null;let n=await t.json();if(!n.login)return null;return g.set(e,{login:n.login,expiresAt:Date.now()+6e5}),n.login}catch{return null}}class m extends Error{}async function w(e,t){let n;try{n=await e.json()}catch{throw new m("Invalid JSON body")}let r=t.safeParse(n);if(!r.success)throw new m(r.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; "));return r.data}},69271:(e,t,n)=>{n.d(t,{D4:()=>a,Ed:()=>u,F6:()=>c,H9:()=>i,JS:()=>h,SS:()=>d,Wz:()=>f,tz:()=>l,zC:()=>o});var r=n(84770),s=n.n(r);function i(e){let t=e.headers.get("x-forwarded-for"),n=e.headers.get("x-real-ip");return e.headers.get("cf-connecting-ip")||t?.split(",")[0]?.trim()||n||e.ip||"127.0.0.1"}function o(e){let t=e.headers.get("accept-language")||"",n=e.headers.get("user-agent")||"",r=t.split(",")[0]?.trim()||"unknown";return{country:r.includes("-")?r.split("-")[1]?.toUpperCase():"UNKNOWN",language:r,userAgent:n}}function a(e){let t=process.env.LIKE_HASH_SALT||"cofe-likes-salt-2025";return s().createHash("sha256").update(e+t).digest("hex").substring(0,12)}function l(e){return/iPhone|iPad|iPod/.test(e)?"ios":/Android/.test(e)?"android":"web"}function c(e,t){let n=l(t.userAgent),r=function(e){let t=process.env.LIKE_HASH_SALT||"cofe-likes-salt-2025";return s().createHash("sha256").update(e+t).digest("hex").substring(0,8)}(t.userAgent);return`${e}_${t.country}_${n}_${r}`}function u(e,t){return`${e}_${t}`}function h(e,t,n){let r=Object.keys(e[t]||{}).find(e=>e.startsWith(`${n}_`));return{hasLiked:!!r,existingLikeId:r}}function f(e,t,n){let r=Object.values(e[t]||{}),s=Array.from(new Set(r.map(e=>e.country).filter(e=>"UNKNOWN"!==e))),{hasLiked:i}=h(e,t,n);return{count:r.length,countries:s,userLiked:i}}function d(e,t){return`${e}_${t}`}},88069:(e,t,n)=>{n.d(t,{D:()=>o});var r=n(55315),s=n.n(r);let i="cici";function o(e){let t=process.env.CICI_DIR;if(t)return{kind:"local",dir:s().resolve(t)};let n=process.env.CICI_REPO;if(n){let[t,r]=n.split("/");if(!t)throw Error(`Invalid CICI_REPO "${n}" — expected "owner/name".`);return{kind:"github",owner:t,repo:r||i,token:process.env.CICI_TOKEN||e||void 0}}return{kind:"github",owner:process.env.GITHUB_USERNAME||"metrue",repo:i,token:e||void 0}}},73194:(e,t,n)=>{n.d(t,{$:()=>a,g:()=>o});var r=n(55315),s=n.n(r),i=n(88069);function o(){return"local"===(0,i.D)().kind}function a(){let e=process.env.CICI_DIR;return e?s().resolve(e):s().join(process.cwd(),"sample-content")}},49303:(e,t,n)=>{e.exports=n(30517)}};
1
+ "use strict";exports.id=719,exports.ids=[719],exports.modules={90455:(e,t,n)=>{n.d(t,{G:()=>s,L:()=>i});var r=n(45609);async function s(){let e=await (0,r.getServerSession)(i);return e?(e.accessToken?console.log("Session found with access token"):console.log("Session found, but no access token"),e):(console.log("No session found"),null)}let i={providers:[(0,n(77210).Z)({clientId:process.env.GITHUB_ID,clientSecret:process.env.GITHUB_SECRET,authorization:{params:{scope:"public_repo workflow"}}})],callbacks:{async jwt({token:e,account:t,profile:n}){t&&t.access_token&&(e.accessToken=t.access_token);let r=n&&"object"==typeof n&&"login"in n?n.login:void 0,s=t&&"object"==typeof t&&"username"in t?t.username:void 0;return(r||s)&&(e.username=r??s),e},session:async({session:e,token:t})=>(e.accessToken=t.accessToken,e.user&&(e.user.username=t.username),e)},secret:process.env.NEXTAUTH_SECRET,debug:!1}},31470:(e,t,n)=>{n.d(t,{Bf:()=>s,CT:()=>o});let r="data",s={rootKeep:()=>".gitkeep",blogDir:()=>"blog",blogDirKeep:()=>"blog/.gitkeep",blogPost:e=>`blog/${e}.md`,blogFile:e=>`blog/${e}`,blogManifest:()=>"blog-manifest.json",memos:()=>"memos.json",likes:()=>"likes.json",siteConfig:()=>"site-config.json",highlightsDir:()=>"highlights",highlightsFile:e=>`highlights/${e}.json`},i=e=>`${r}/${e}`,o={root:()=>r,rootKeep:()=>i(s.rootKeep()),blogDir:()=>i(s.blogDir()),blogDirKeep:()=>i(s.blogDirKeep()),blogPost:e=>i(s.blogPost(e)),blogFile:e=>i(s.blogFile(e)),blogManifest:()=>i(s.blogManifest()),memos:()=>i(s.memos()),likes:()=>i(s.likes()),siteConfig:()=>i(s.siteConfig()),highlightsDir:()=>i(s.highlightsDir()),highlightsFile:e=>i(s.highlightsFile(e))}},54428:(e,t,n)=>{n.d(t,{Bi:()=>p,K4:()=>g,VD:()=>m});var r=n(92048),s=n(55315),i=n.n(s),o=n(94545),a=n(8502),l=n(31470),c=n(88069);let u=new Map;function h(e){return l.CT.highlightsFile(e)}function d(e){if(!e||0===e.length||e.length>200||e.includes("/")||e.includes("\\")||e.includes("\0")||e.includes("..")||e.startsWith("."))throw Error(`Invalid postId: ${e}`)}function f(e){if("object"==typeof e&&null!==e&&"status"in e){let t=e.status;return"number"==typeof t?t:void 0}}class g{constructor(e){this.rootDir=e}absPath(e){return i().join(this.rootDir,l.Bf.highlightsFile(e))}async load(e){d(e);try{let t=await r.promises.readFile(this.absPath(e),"utf-8");return{data:a.x.parse(JSON.parse(t)),sha:null}}catch(t){if("ENOENT"===t?.code)return{data:(0,a.Bk)(e),sha:null};throw t}}async save(e,t,n,s){d(e);let o=a.x.parse(t),l=this.absPath(e);return await r.promises.mkdir(i().dirname(l),{recursive:!0}),await r.promises.writeFile(l,JSON.stringify(o,null,2),"utf-8"),{sha:""}}}class p{constructor(e,t,n="cici",r=!1){this.octokit=e,this.owner=t,this.repo=n,this.readOnly=r}async load(e){d(e);let t=u.get(e);if(t&&t.expiresAt>Date.now())return{data:t.data,sha:t.sha};let n=await this.readFile(e);if(!n){let t=(0,a.Bk)(e);return u.set(e,{data:t,sha:null,expiresAt:Date.now()+3e4}),{data:t,sha:null}}let r=a.x.parse(JSON.parse(n.content));return u.set(e,{data:r,sha:n.sha,expiresAt:Date.now()+3e4}),{data:r,sha:n.sha}}async save(e,t,n,r){if(d(e),this.readOnly)throw Error("Highlights are read-only: no write token available. Sign in as the repo owner to add or moderate inline comments.");let s=a.x.parse(t),i=Buffer.from(JSON.stringify(s,null,2)).toString("base64"),o=0,l=n;for(;o<3;)try{let t=await this.octokit.repos.createOrUpdateFileContents({owner:this.owner,repo:this.repo,path:h(e),message:r,content:i,...l?{sha:l}:{}}),n=t.data.content?.sha??"";return u.set(e,{data:s,sha:n,expiresAt:Date.now()+3e4}),{sha:n}}catch(n){let t=f(n);if(409===t||422===t){u.delete(e),o++;let t=await this.readFile(e);l=t?.sha??null;continue}throw n}throw Error("Save failed after 3 retries due to write contention")}async readFile(e){try{let t=(await this.octokit.repos.getContent({owner:this.owner,repo:this.repo,path:h(e)})).data;if(Array.isArray(t)||"file"!==t.type)return null;return{content:Buffer.from(t.content,"base64").toString("utf-8"),sha:t.sha}}catch(e){if(404===f(e))return null;throw e}}}function m(e={}){let t=(0,c.D)(e.ownerToken);if("local"===t.kind)return new g(t.dir);let n=e.ownerToken??t.token??process.env.HIGHLIGHTS_GH_TOKEN;return new p(n?new o.v({auth:n}):new o.v,t.owner,t.repo,!n)}},8502:(e,t,n)=>{n.d(t,{Bk:()=>u,Om:()=>s,x:()=>c});var r=n(4037);let s=r.Ry({startOffset:r.Rx().int().nonnegative(),endOffset:r.Rx().int().nonnegative(),exact:r.Z_().min(1).max(1e3),prefix:r.Z_().max(64),suffix:r.Z_().max(64)}).refine(e=>e.endOffset>=e.startOffset,{message:"endOffset must be >= startOffset"}),i=r.IM(r.Z_(),r.IX(r.Z_())),o=r.Km(["ios","android","web"]),a=r.Ry({id:r.Z_().min(1).max(64),parentId:r.Z_().min(1).max(64).nullable(),body:r.Z_().min(1).max(2e3),authorName:r.Z_().max(40).nullable(),fingerprint:r.Z_().min(1).max(128),country:r.Z_().max(8),platform:o,reactions:i,resolved:r.O7(),createdAt:r.Z_().datetime(),hidden:r.O7(),hiddenReason:r.Z_().max(200).optional()}),l=r.Ry({id:r.Z_().min(1).max(64),anchor:s,thread:r.IX(a).min(1),resolved:r.O7(),createdAt:r.Z_().datetime()}),c=r.Ry({postId:r.Z_().min(1),highlights:r.IX(l),schemaVersion:r.i0(1)});function u(e){return{postId:e,highlights:[],schemaVersion:1}}},54904:(e,t,n)=>{n.d(t,{AH:()=>d,Cg:()=>u,Kz:()=>w,N9:()=>a,W4:()=>c,bH:()=>m,fT:()=>f,mF:()=>h,qF:()=>l});var r=n(87070),s=n(69271),i=n(90455),o=n(73194);function a(e,t){return r.NextResponse.json({success:!0,data:e},t)}function l(e,t=400){return r.NextResponse.json({success:!1,error:e},{status:t})}function c(e,t="Internal server error",n=500){return console.error("[highlights]",e),l(e instanceof Error&&e.message?e.message:t,n)}function u(e){let t=(0,s.H9)(e),n=(0,s.zC)(e),r=(0,s.D4)(t);return{fingerprint:(0,s.F6)(r,n),country:n.country,platform:(0,s.tz)(n.userAgent)}}async function h(){if((0,o.g)())return!0;let e=await (0,i.G)(),t=process.env.GITHUB_USERNAME;if(!t)return!1;if(e?.user?.username)return e.user.username===t;if(e?.accessToken){let n=await p(e.accessToken);if(n)return n===t}return!1}async function d(){let e=await (0,i.G)();return e?.accessToken}async function f(){let e=await (0,i.G)();if(e?.user?.username)return e.user.username;if(e?.accessToken){let t=await p(e.accessToken);if(t)return t}return e?.user?.name??null}let g=new Map;async function p(e){let t=g.get(e);if(t&&t.expiresAt>Date.now())return t.login;try{let t=await fetch("https://api.github.com/user",{headers:{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json"}});if(!t.ok)return null;let n=await t.json();if(!n.login)return null;return g.set(e,{login:n.login,expiresAt:Date.now()+6e5}),n.login}catch{return null}}class m extends Error{}async function w(e,t){let n;try{n=await e.json()}catch{throw new m("Invalid JSON body")}let r=t.safeParse(n);if(!r.success)throw new m(r.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; "));return r.data}},69271:(e,t,n)=>{n.d(t,{D4:()=>a,Ed:()=>u,F6:()=>c,H9:()=>i,JS:()=>h,SS:()=>f,Wz:()=>d,tz:()=>l,zC:()=>o});var r=n(84770),s=n.n(r);function i(e){let t=e.headers.get("x-forwarded-for"),n=e.headers.get("x-real-ip");return e.headers.get("cf-connecting-ip")||t?.split(",")[0]?.trim()||n||e.ip||"127.0.0.1"}function o(e){let t=e.headers.get("accept-language")||"",n=e.headers.get("user-agent")||"",r=t.split(",")[0]?.trim()||"unknown";return{country:r.includes("-")?r.split("-")[1]?.toUpperCase():"UNKNOWN",language:r,userAgent:n}}function a(e){let t=process.env.LIKE_HASH_SALT||"cofe-likes-salt-2025";return s().createHash("sha256").update(e+t).digest("hex").substring(0,12)}function l(e){return/iPhone|iPad|iPod/.test(e)?"ios":/Android/.test(e)?"android":"web"}function c(e,t){let n=l(t.userAgent),r=function(e){let t=process.env.LIKE_HASH_SALT||"cofe-likes-salt-2025";return s().createHash("sha256").update(e+t).digest("hex").substring(0,8)}(t.userAgent);return`${e}_${t.country}_${n}_${r}`}function u(e,t){return`${e}_${t}`}function h(e,t,n){let r=Object.keys(e[t]||{}).find(e=>e.startsWith(`${n}_`));return{hasLiked:!!r,existingLikeId:r}}function d(e,t,n){let r=Object.values(e[t]||{}),s=Array.from(new Set(r.map(e=>e.country).filter(e=>"UNKNOWN"!==e))),{hasLiked:i}=h(e,t,n);return{count:r.length,countries:s,userLiked:i}}function f(e,t){return`${e}_${t}`}},88069:(e,t,n)=>{n.d(t,{D:()=>o});var r=n(55315),s=n.n(r);let i="cici";function o(e){let t=process.env.CICI_DIR;if(t)return{kind:"local",dir:s().resolve(t)};let n=process.env.CICI_REPO;if(n){let[t,r]=n.split("/");if(!t)throw Error(`Invalid CICI_REPO "${n}" — expected "owner/name".`);return{kind:"github",owner:t,repo:r||i,token:process.env.CICI_TOKEN||e||void 0}}return{kind:"github",owner:process.env.GITHUB_USERNAME||"metrue",repo:i,token:e||void 0}}},73194:(e,t,n)=>{n.d(t,{$:()=>a,g:()=>o});var r=n(55315),s=n.n(r),i=n(88069);function o(){return"local"===(0,i.D)().kind}function a(){let e=process.env.CICI_DIR;return e?s().resolve(e):s().join(process.cwd(),"sample-content")}},49303:(e,t,n)=>{e.exports=n(30517)}};