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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +13 -13
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mile/prompts.body +1 -1
- package/.next/server/app/atom.xml.body +1 -1
- package/.next/server/app/blog/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/blog/page_client-reference-manifest.js +1 -1
- package/.next/server/app/editor/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/memos/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/rss.xml.body +1 -1
- package/.next/server/app/sitemap.xml/route.js +1 -1
- package/.next/server/app/sitemap.xml.body +5 -5
- package/.next/server/app/unavailable/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +8 -8
- package/.next/server/chunks/3607.js +1 -1
- package/.next/server/chunks/3844.js +1 -1
- package/.next/server/chunks/719.js +1 -1
- package/.next/server/chunks/9715.js +1 -1
- package/.next/server/functions-config-manifest.json +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +13 -13
- package/.next/standalone/.next/app-path-routes-manifest.json +1 -1
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mile/prompts.body +1 -1
- package/.next/standalone/.next/server/app/atom.xml.body +1 -1
- package/.next/standalone/.next/server/app/blog/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/blog/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/editor/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/memos/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/rss.xml.body +1 -1
- package/.next/standalone/.next/server/app/sitemap.xml/route.js +1 -1
- package/.next/standalone/.next/server/app/sitemap.xml.body +5 -5
- package/.next/standalone/.next/server/app/unavailable/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +8 -8
- package/.next/standalone/.next/server/chunks/3607.js +1 -1
- package/.next/standalone/.next/server/chunks/3844.js +1 -1
- package/.next/standalone/.next/server/chunks/719.js +1 -1
- package/.next/standalone/.next/server/chunks/9715.js +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/pages-manifest.json +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/package.json +1 -1
- package/.next/trace +120 -120
- package/README.md +77 -67
- package/package.json +1 -1
- /package/.next/standalone/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_ssgManifest.js +0 -0
- /package/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_buildManifest.js +0 -0
- /package/.next/static/{CsV2H6n03Dh7kIQJcmDlJ → v9qou3KOjBLcMsh9D_4gA}/_ssgManifest.js +0 -0
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
`)}t.write("payload.value = newResult;"),t.write("return payload;");let a=t.compile();return(t,r)=>a(e,t,r)},a=!k.jitless,l=a&&eu.value,c=t.catchall;e._zod.parse=(u,p)=>{s??(s=n.value);let d=u.value;return ec(d)?a&&l&&p?.async===!1&&!0!==p.jitless?(r||(r=i(t.shape)),u=r(u,p),c)?tk([],d,u,p,s,e):u:o(u,p):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function tS(e,t,r,s){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let o=e.filter(e=>!ey(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>eE(e,s,P())))}),t)}let tA=E("$ZodUnion",(e,t)=>{eX.init(e,t),eo(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),eo(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),eo(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),eo(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>er(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(s,o)=>{if(r)return r(s,o);let n=!1,i=[];for(let e of t.options){let t=e._zod.run({value:s.value,issues:[]},o);if(t instanceof Promise)i.push(t),n=!0;else{if(0===t.issues.length)return t;i.push(t)}}return n?Promise.all(i).then(t=>tS(t,s,e,o)):tS(i,s,e,o)}}),tG=E("$ZodIntersection",(e,t)=>{eX.init(e,t),e._zod.parse=(e,r)=>{let s=e.value,o=t.left._zod.run({value:s,issues:[]},r),n=t.right._zod.run({value:s,issues:[]},r);return o instanceof Promise||n instanceof Promise?Promise.all([o,n]).then(([t,r])=>tF(e,t,r)):tF(e,o,n)}});function tF(e,t,r){let s;let o=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(s??(s=r),r.keys))o.has(e)||o.set(e,{}),o.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(t);let n=[...o].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(n.length&&s&&e.issues.push({...s,keys:n}),ey(e))return e;let i=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(ep(t)&&ep(r)){let s=Object.keys(r),o=Object.keys(t).filter(e=>-1!==s.indexOf(e)),n={...t,...r};for(let s of o){let o=e(t[s],r[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};n[s]=o.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let s=[];for(let o=0;o<t.length;o++){let n=e(t[o],r[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};s.push(n.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}let tR=E("$ZodRecord",(e,t)=>{eX.init(e,t),e._zod.parse=(r,s)=>{let o=r.value;if(!ep(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let n=[],i=t.keyType._zod.values;if(i){let a;r.value={};let l=new Set;for(let a of i)if("string"==typeof a||"number"==typeof a||"symbol"==typeof a){l.add("number"==typeof a?a.toString():a);let i=t.keyType._zod.run({value:a,issues:[]},s);if(i instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(i.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:i.issues.map(e=>eE(e,s,P())),input:a,path:[a],inst:e});continue}let c=i.value,u=t.valueType._zod.run({value:o[a],issues:[]},s);u instanceof Promise?n.push(u.then(e=>{e.issues.length&&r.issues.push(...eb(a,e.issues)),r.value[c]=e.value})):(u.issues.length&&r.issues.push(...eb(a,u.issues)),r.value[c]=u.value)}for(let e in o)l.has(e)||(a=a??[]).push(e);a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else for(let i of(r.value={},Reflect.ownKeys(o))){if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(o,i))continue;let a=t.keyType._zod.run({value:i,issues:[]},s);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof i&&V.test(i)&&a.issues.length){let e=t.keyType._zod.run({value:Number(i),issues:[]},s);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?r.value[i]=o[i]:r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>eE(e,s,P())),input:i,path:[i],inst:e});continue}let l=t.valueType._zod.run({value:o[i],issues:[]},s);l instanceof Promise?n.push(l.then(e=>{e.issues.length&&r.issues.push(...eb(i,e.issues)),r.value[a.value]=e.value})):(l.issues.length&&r.issues.push(...eb(i,l.issues)),r.value[a.value]=l.value)}return n.length?Promise.all(n).then(()=>r):r}}),tz=E("$ZodEnum",(e,t)=>{eX.init(e,t);let r=Q(t.entries),s=new Set(r);e._zod.values=s,e._zod.pattern=RegExp(`^(${r.filter(e=>eg.has(typeof e)).map(e=>"string"==typeof e?em(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{let n=t.value;return s.has(n)||t.issues.push({code:"invalid_value",values:r,input:n,inst:e}),t}}),tU=E("$ZodLiteral",(e,t)=>{if(eX.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?em(e):e?em(e.toString()):String(e)).join("|")})$`),e._zod.parse=(s,o)=>{let n=s.value;return r.has(n)||s.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),s}}),t$=E("$ZodTransform",(e,t)=>{eX.init(e,t),e._zod.optin="optional",e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new v(e.constructor.name);let o=t.transform(r.value,r);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(r.value=e,r.fallback=!0,r));if(o instanceof Promise)throw new T;return r.value=o,r.fallback=!0,r}});function tC(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let tD=E("$ZodOptional",(e,t)=>{eX.init(e,t),e._zod.optin="optional",e._zod.optout="optional",eo(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),eo(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${er(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let s=e.value,o=t.innerType._zod.run(e,r);return o instanceof Promise?o.then(e=>tC(e,s)):tC(o,s)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),tj=E("$ZodExactOptional",(e,t)=>{tD.init(e,t),eo(e._zod,"values",()=>t.innerType._zod.values),eo(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),tI=E("$ZodNullable",(e,t)=>{eX.init(e,t),eo(e._zod,"optin",()=>t.innerType._zod.optin),eo(e._zod,"optout",()=>t.innerType._zod.optout),eo(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${er(e.source)}|null)$`):void 0}),eo(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),tx=E("$ZodDefault",(e,t)=>{eX.init(e,t),e._zod.optin="optional",eo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(e=>tL(e,t)):tL(s,t)}});function tL(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tN=E("$ZodPrefault",(e,t)=>{eX.init(e,t),e._zod.optin="optional",eo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),tZ=E("$ZodNonOptional",(e,t)=>{eX.init(e,t),eo(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,s)=>{let o=t.innerType._zod.run(r,s);return o instanceof Promise?o.then(t=>tq(t,e)):tq(o,e)}});function tq(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let tB=E("$ZodCatch",(e,t)=>{eX.init(e,t),e._zod.optin="optional",eo(e._zod,"optout",()=>t.innerType._zod.optout),eo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>eE(e,r,P()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>eE(e,r,P()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),tM=E("$ZodPipe",(e,t)=>{eX.init(e,t),eo(e._zod,"values",()=>t.in._zod.values),eo(e._zod,"optin",()=>t.in._zod.optin),eo(e._zod,"optout",()=>t.out._zod.optout),eo(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let s=t.out._zod.run(e,r);return s instanceof Promise?s.then(e=>tW(e,t.in,r)):tW(s,t.in,r)}let s=t.in._zod.run(e,r);return s instanceof Promise?s.then(e=>tW(e,t.out,r)):tW(s,t.out,r)}});function tW(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let tJ=E("$ZodReadonly",(e,t)=>{eX.init(e,t),eo(e._zod,"propValues",()=>t.innerType._zod.propValues),eo(e._zod,"values",()=>t.innerType._zod.values),eo(e._zod,"optin",()=>t.innerType?._zod?.optin),eo(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(tH):tH(s)}});function tH(e){return e.value=Object.freeze(e.value),e}let tV=E("$ZodCustom",(e,t)=>{ek.init(e,t),eX.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let s=r.value,o=t.fn(s);if(o instanceof Promise)return o.then(t=>tK(t,r,s,e));tK(o,r,s,e)}});function tK(e,t,r,s){if(!e){let e={code:"custom",input:r,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(e.params=s._zod.def.params),t.issues.push(ev(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class tY{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(i=globalThis).__zod_globalRegistry??(i.__zod_globalRegistry=new tY);let tX=globalThis.__zod_globalRegistry;function tQ(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ef(t)})}function t0(e,t){return new eO({check:"less_than",...ef(t),value:e,inclusive:!1})}function t1(e,t){return new eO({check:"less_than",...ef(t),value:e,inclusive:!0})}function t4(e,t){return new eS({check:"greater_than",...ef(t),value:e,inclusive:!1})}function t2(e,t){return new eS({check:"greater_than",...ef(t),value:e,inclusive:!0})}function t9(e,t){return new eA({check:"multiple_of",...ef(t),value:e})}function t6(e,t){return new eF({check:"max_length",...ef(t),maximum:e})}function t3(e,t){return new eR({check:"min_length",...ef(t),minimum:e})}function t8(e,t){return new ez({check:"length_equals",...ef(t),length:e})}function t5(e){return new eL({check:"overwrite",tx:e})}function t7(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??tX,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var s;let o=e._zod.def,n=t.seen.get(e);if(n)return n.count++,r.schemaPath.includes(e)&&(n.cycle=r.path),n.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let s={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,s);else{let r=i.schema,n=t.processors[o.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);n(e,t,r,s)}let n=e._zod.parent;n&&(i.ref||(i.ref=n),re(n,t,s),t.seen.get(n).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(i.schema,l),"input"===t.io&&function e(t,r){let s=r??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);let o=t._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return e(o.element,s);if("set"===o.type)return e(o.valueType,s);if("lazy"===o.type)return e(o.getter(),s);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return e(o.innerType,s);if("intersection"===o.type)return e(o.left,s)||e(o.right,s);if("record"===o.type||"map"===o.type)return e(o.keyType,s)||e(o.valueType,s);if("pipe"===o.type)return!!t._zod.traits.has("$ZodCodec")||e(o.in,s)||e(o.out,s);if("object"===o.type){for(let t in o.shape)if(e(o.shape[t],s))return!0;return!1}if("union"===o.type){for(let t of o.options)if(e(t,s))return!0;return!1}if("tuple"===o.type){for(let t of o.items)if(e(t,s))return!0;if(o.rest&&e(o.rest,s))return!0}return!1}(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&"_prefault"in i.schema&&((s=i.schema).default??(s.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function rt(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=s.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(r,t[0])}}let o=t=>{let s="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,o=e.external.uri??(e=>e);if(r)return{ref:o(r)};let n=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=n,{defId:n,ref:`${o("__shared")}#/${s}/${n}`}}if(t[1]===r)return{ref:"#"};let o=`#/${s}/`,n=t[1].schema.id??`__schema${e.counter++}`;return{defId:n,ref:o+n}},n=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:r,defId:s}=o(e);t.def={...t.schema},s&&(t.defId=s);let n=t.schema;for(let e in n)delete n[e];n.$ref=r};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
61
61
|
|
|
62
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let s=r[1];if(t===r[0]){n(r);continue}if(e.external){let s=e.external.registry.get(r[0])?.id;if(t!==r[0]&&s){n(r);continue}}if(e.metadataRegistry.get(r[0])?.id||s.cycle||s.count>1&&"ref"===e.reused){n(r);continue}}}function rr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=t=>{let r=e.seen.get(t);if(null===r.ref)return;let o=r.def??r.schema,n={...o},i=r.ref;if(r.ref=null,i){s(i);let r=e.seen.get(i),a=r.schema;if(a.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(o.allOf=o.allOf??[],o.allOf.push(a)):Object.assign(o,a),Object.assign(o,n),t._zod.parent===i)for(let e in o)"$ref"===e||"allOf"===e||e in n||delete o[e];if(a.$ref&&r.def)for(let e in o)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(o[e])===JSON.stringify(r.def[e])&&delete o[e]}let a=t._zod.parent;if(a&&a!==i){s(a);let t=e.seen.get(a);if(t?.schema.$ref&&(o.$ref=t.schema.$ref,t.def))for(let e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}e.override({zodSchema:t,jsonSchema:o,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())s(t[0]);let o={};if("draft-2020-12"===e.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(r)}Object.assign(o,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&o.id===n&&delete o.id;let i=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?o.$defs=i:o.definitions=i);try{let r=JSON.parse(JSON.stringify(o));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ro(t,"input",e.processors),output:ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rs=(e,t={})=>r=>{let s=t7({...r,processors:t});return re(e,s),rt(s,e),rr(s,e)},ro=(e,t,r={})=>s=>{let{libraryOptions:o,target:n}=s??{},i=t7({...o??{},target:n,io:t,processors:r});return re(e,i),rt(i,e),rr(i,e)},rn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ri=(e,t,r,s)=>{r.type="string";let{minimum:o,maximum:n,format:i,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof o&&(r.minLength=o),"number"==typeof n&&(r.maxLength=n),i&&(r.format=rn[i]??i,""===r.format&&delete r.format,"time"===i&&delete r.format),l&&(r.contentEncoding=l),a&&a.size>0){let e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},ra=(e,t,r,s)=>{let{minimum:o,maximum:n,format:i,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof i&&i.includes("int")?r.type="integer":r.type="number";let u="number"==typeof c&&c>=(o??Number.NEGATIVE_INFINITY),p="number"==typeof l&&l<=(n??Number.POSITIVE_INFINITY),d="draft-04"===t.target||"openapi-3.0"===t.target;u?d?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof o&&(r.minimum=o),p?d?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof n&&(r.maximum=n),"number"==typeof a&&(r.multipleOf=a)},rl=(e,t,r,s)=>{r.type="boolean"},rc=(e,t,r,s)=>{r.not={}},ru=(e,t,r,s)=>{},rp=(e,t,r,s)=>{let o=Q(e._zod.def.entries);o.every(e=>"number"==typeof e)&&(r.type="number"),o.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=o},rd=(e,t,r,s)=>{let o=e._zod.def,n=[];for(let e of o.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");n.push(Number(e))}else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n},rg=(e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rm=(e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},rh=(e,t,r,s)=>{let o=e._zod.def,{minimum:n,maximum:i}=e._zod.bag;"number"==typeof n&&(r.minItems=n),"number"==typeof i&&(r.maxItems=i),r.type="array",r.items=re(o.element,t,{...s,path:[...s.path,"items"]})},rf=(e,t,r,s)=>{let o=e._zod.def;r.type="object",r.properties={};let n=o.shape;for(let e in n)r.properties[e]=re(n[e],t,{...s,path:[...s.path,"properties",e]});let i=new Set([...new Set(Object.keys(n))].filter(e=>{let r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));i.size>0&&(r.required=Array.from(i)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=re(o.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rw=(e,t,r,s)=>{let o=e._zod.def,n=!1===o.inclusive,i=o.options.map((e,r)=>re(e,t,{...s,path:[...s.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=i:r.anyOf=i},ry=(e,t,r,s)=>{let o=e._zod.def,n=re(o.left,t,{...s,path:[...s.path,"allOf",0]}),i=re(o.right,t,{...s,path:[...s.path,"allOf",1]}),a=[..."allOf"in n&&1===Object.keys(n).length?n.allOf:[n],..."allOf"in i&&1===Object.keys(i).length?i.allOf:[i]];r.allOf=a},rb=(e,t,r,s)=>{let o=e._zod.def;r.type="object";let n=o.keyType,i=n._zod.bag,a=i?.patterns;if("loose"===o.mode&&a&&a.size>0){let e=re(o.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});for(let t of(r.patternProperties={},a))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=re(o.keyType,t,{...s,path:[...s.path,"propertyNames"]})),r.additionalProperties=re(o.valueType,t,{...s,path:[...s.path,"additionalProperties"]});let l=n._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},r_=(e,t,r,s)=>{let o=e._zod.def,n=re(o.innerType,t,s),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},rE=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType},rT=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},rv=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},rk=(e,t,r,s)=>{let o;let n=e._zod.def;re(n.innerType,t,s),t.seen.get(e).ref=n.innerType;try{o=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=o},rP=(e,t,r,s)=>{let o=e._zod.def,n=o.in._zod.traits.has("$ZodTransform"),i="input"===t.io?n?o.out:o.in:o.out;re(i,t,s),t.seen.get(e).ref=i},rO=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType,r.readOnly=!0},rS=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType},rA=E("ZodISODateTime",(e,t)=>{tr.init(e,t),rY.init(e,t)}),rG=E("ZodISODate",(e,t)=>{ts.init(e,t),rY.init(e,t)}),rF=E("ZodISOTime",(e,t)=>{to.init(e,t),rY.init(e,t)}),rR=E("ZodISODuration",(e,t)=>{tn.init(e,t),rY.init(e,t)}),rz=E("ZodError",(e,t)=>{eq.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},s=(e,o=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>s({issues:e},[...o,...n.path]));else if("invalid_key"===n.code)s({issues:n.issues},[...o,...n.path]);else if("invalid_element"===n.code)s({issues:n.issues},[...o,...n.path]);else{let e=[...o,...n.path];if(0===e.length)r._errors.push(t(n));else{let s=r,o=0;for(;o<e.length;){let r=e[o];o===e.length-1?(s[r]=s[r]||{_errors:[]},s[r]._errors.push(t(n))):s[r]=s[r]||{_errors:[]},s=s[r],o++}}}};return s(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},s=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):s.push(t(o));return{formErrors:s,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ee,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ee,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),rU=eM(rz),r$=eW(rz),rC=eJ(rz),rD=eV(rz),rj=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eM(rz)(e,t,s)},rI=(e,t,r)=>eM(rz)(e,t,r),rx=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eW(rz)(e,t,s)},rL=async(e,t,r)=>eW(rz)(e,t,r),rN=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eJ(rz)(e,t,s)},rZ=(e,t,r)=>eJ(rz)(e,t,r),rq=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eV(rz)(e,t,s)},rB=async(e,t,r)=>eV(rz)(e,t,r),rM=new WeakMap;function rW(e,t,r){let s=Object.getPrototypeOf(e),o=rM.get(s);if(o||(o=new Set,rM.set(s,o)),!o.has(t))for(let e in o.add(t),r){let t=r[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let rJ=E("ZodType",(e,t)=>(eX.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ro(e,"input"),output:ro(e,"output")}}),e.toJSONSchema=rs(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>rU(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>rC(e,t,r),e.parseAsync=async(t,r)=>r$(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>rD(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>rj(e,t,r),e.decode=(t,r)=>rI(e,t,r),e.encodeAsync=async(t,r)=>rx(e,t,r),e.decodeAsync=async(t,r)=>rL(e,t,r),e.safeEncode=(t,r)=>rN(e,t,r),e.safeDecode=(t,r)=>rZ(e,t,r),e.safeEncodeAsync=async(t,r)=>rq(e,t,r),e.safeDecodeAsync=async(t,r)=>rB(e,t,r),rW(e,"ZodType",{check(...e){let t=this.def;return this.clone(ei(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eh(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new sx({type:"custom",check:"custom",fn:e,...ef(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){let r=function(e,t){let r=new ek({check:"custom",...ef(t)});return r._zod.check=e,r}(t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(ev(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(ev(e)))},e(t.value,t)),t);return r}(e,t))},overwrite(e){return this.check(t5(e))},optional(){return sA(this)},exactOptional(){return new sG({type:"optional",innerType:this})},nullable(){return sR(this)},nullish(){return sA(sR(this))},nonoptional(e){return new s$({type:"nonoptional",innerType:this,...ef(e)})},array(){return sw(this)},or(e){var t;return new s_({type:"union",options:[this,e],...ef(void 0)})},and(e){return new sE({type:"intersection",left:this,right:e})},transform(e){return sj(this,new sO({type:"transform",transform:e}))},default(e){return new sz({type:"default",innerType:this,get defaultValue(){return"function"==typeof e?e():ed(e)}})},prefault(e){return new sU({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof e?e():ed(e)}})},catch(e){return new sC({type:"catch",innerType:this,catchValue:"function"==typeof e?e:()=>e})},pipe(e){return sj(this,e)},readonly(){return new sI({type:"readonly",innerType:this})},describe(e){let t=this.clone();return tX.add(t,{description:e}),t},meta(...e){if(0===e.length)return tX.get(this);let t=this.clone();return tX.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>tX.get(e)?.description,configurable:!0}),e)),rH=E("_ZodString",(e,t)=>{eQ.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ri(e,t,r,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,rW(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new e$({check:"string_format",format:"regex",...ef(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ej({check:"string_format",format:"includes",...ef(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new eI({check:"string_format",format:"starts_with",...ef(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ex({check:"string_format",format:"ends_with",...ef(t),suffix:e})}(...e))},min(...e){return this.check(t3(...e))},max(...e){return this.check(t6(...e))},length(...e){return this.check(t8(...e))},nonempty(...e){return this.check(t3(1,...e))},lowercase(e){return this.check(new eC({check:"string_format",format:"lowercase",...ef(e)}))},uppercase(e){return this.check(new eD({check:"string_format",format:"uppercase",...ef(e)}))},trim(){return this.check(t5(e=>e.trim()))},normalize(...e){return this.check(function(e){return t5(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(t5(e=>e.toLowerCase()))},toUpperCase(){return this.check(t5(e=>e.toUpperCase()))},slugify(){return this.check(t5(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),rV=E("ZodString",(e,t)=>{eQ.init(e,t),rH.init(e,t),e.email=t=>e.check(new rX({type:"string",format:"email",check:"string_format",abort:!1,...ef(t)})),e.url=t=>e.check(new r1({type:"string",format:"url",check:"string_format",abort:!1,...ef(t)})),e.jwt=t=>e.check(new si({type:"string",format:"jwt",check:"string_format",abort:!1,...ef(t)})),e.emoji=t=>e.check(new r4({type:"string",format:"emoji",check:"string_format",abort:!1,...ef(t)})),e.guid=t=>e.check(tQ(rQ,t)),e.uuid=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,...ef(t)})),e.uuidv4=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ef(t)})),e.uuidv6=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ef(t)})),e.uuidv7=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ef(t)})),e.nanoid=t=>e.check(new r2({type:"string",format:"nanoid",check:"string_format",abort:!1,...ef(t)})),e.guid=t=>e.check(tQ(rQ,t)),e.cuid=t=>e.check(new r9({type:"string",format:"cuid",check:"string_format",abort:!1,...ef(t)})),e.cuid2=t=>e.check(new r6({type:"string",format:"cuid2",check:"string_format",abort:!1,...ef(t)})),e.ulid=t=>e.check(new r3({type:"string",format:"ulid",check:"string_format",abort:!1,...ef(t)})),e.base64=t=>e.check(new ss({type:"string",format:"base64",check:"string_format",abort:!1,...ef(t)})),e.base64url=t=>e.check(new so({type:"string",format:"base64url",check:"string_format",abort:!1,...ef(t)})),e.xid=t=>e.check(new r8({type:"string",format:"xid",check:"string_format",abort:!1,...ef(t)})),e.ksuid=t=>e.check(new r5({type:"string",format:"ksuid",check:"string_format",abort:!1,...ef(t)})),e.ipv4=t=>e.check(new r7({type:"string",format:"ipv4",check:"string_format",abort:!1,...ef(t)})),e.ipv6=t=>e.check(new se({type:"string",format:"ipv6",check:"string_format",abort:!1,...ef(t)})),e.cidrv4=t=>e.check(new st({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ef(t)})),e.cidrv6=t=>e.check(new sr({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ef(t)})),e.e164=t=>e.check(new sn({type:"string",format:"e164",check:"string_format",abort:!1,...ef(t)})),e.datetime=t=>e.check(new rA({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ef(t)})),e.date=t=>e.check(new rG({type:"string",format:"date",check:"string_format",...ef(t)})),e.time=t=>e.check(new rF({type:"string",format:"time",check:"string_format",precision:null,...ef(t)})),e.duration=t=>e.check(new rR({type:"string",format:"duration",check:"string_format",...ef(t)}))});function rK(e){return new rV({type:"string",...ef(e)})}let rY=E("ZodStringFormat",(e,t)=>{e0.init(e,t),rH.init(e,t)}),rX=E("ZodEmail",(e,t)=>{e2.init(e,t),rY.init(e,t)}),rQ=E("ZodGUID",(e,t)=>{e1.init(e,t),rY.init(e,t)}),r0=E("ZodUUID",(e,t)=>{e4.init(e,t),rY.init(e,t)}),r1=E("ZodURL",(e,t)=>{e9.init(e,t),rY.init(e,t)}),r4=E("ZodEmoji",(e,t)=>{e6.init(e,t),rY.init(e,t)}),r2=E("ZodNanoID",(e,t)=>{e3.init(e,t),rY.init(e,t)}),r9=E("ZodCUID",(e,t)=>{e8.init(e,t),rY.init(e,t)}),r6=E("ZodCUID2",(e,t)=>{e5.init(e,t),rY.init(e,t)}),r3=E("ZodULID",(e,t)=>{e7.init(e,t),rY.init(e,t)}),r8=E("ZodXID",(e,t)=>{te.init(e,t),rY.init(e,t)}),r5=E("ZodKSUID",(e,t)=>{tt.init(e,t),rY.init(e,t)}),r7=E("ZodIPv4",(e,t)=>{ti.init(e,t),rY.init(e,t)}),se=E("ZodIPv6",(e,t)=>{ta.init(e,t),rY.init(e,t)}),st=E("ZodCIDRv4",(e,t)=>{tl.init(e,t),rY.init(e,t)}),sr=E("ZodCIDRv6",(e,t)=>{tc.init(e,t),rY.init(e,t)}),ss=E("ZodBase64",(e,t)=>{tp.init(e,t),rY.init(e,t)}),so=E("ZodBase64URL",(e,t)=>{td.init(e,t),rY.init(e,t)}),sn=E("ZodE164",(e,t)=>{tg.init(e,t),rY.init(e,t)}),si=E("ZodJWT",(e,t)=>{tm.init(e,t),rY.init(e,t)}),sa=E("ZodNumber",(e,t)=>{th.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ra(e,t,r,s),rW(e,"ZodNumber",{gt(e,t){return this.check(t4(e,t))},gte(e,t){return this.check(t2(e,t))},min(e,t){return this.check(t2(e,t))},lt(e,t){return this.check(t0(e,t))},lte(e,t){return this.check(t1(e,t))},max(e,t){return this.check(t1(e,t))},int(e){return this.check(su(e))},safe(e){return this.check(su(e))},positive(e){return this.check(t4(0,e))},nonnegative(e){return this.check(t2(0,e))},negative(e){return this.check(t0(0,e))},nonpositive(e){return this.check(t1(0,e))},multipleOf(e,t){return this.check(t9(e,t))},step(e,t){return this.check(t9(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function sl(e){return new sa({type:"number",checks:[],...ef(e)})}let sc=E("ZodNumberFormat",(e,t)=>{tf.init(e,t),sa.init(e,t)});function su(e){return new sc({type:"number",check:"number_format",abort:!1,format:"safeint",...ef(e)})}let sp=E("ZodBoolean",(e,t)=>{tw.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rl(e,t,r,s)});function sd(e){return new sp({type:"boolean",...ef(e)})}let sg=E("ZodUnknown",(e,t)=>{ty.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ru(e,t,r,s)});function sm(){return new sg({type:"unknown"})}let sh=E("ZodNever",(e,t)=>{tb.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rc(e,t,r,s)}),sf=E("ZodArray",(e,t)=>{tE.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rh(e,t,r,s),e.element=t.element,rW(e,"ZodArray",{min(e,t){return this.check(t3(e,t))},nonempty(e){return this.check(t3(1,e))},max(e,t){return this.check(t6(e,t))},length(e,t){return this.check(t8(e,t))},unwrap(){return this.element}})});function sw(e,t){return new sf({type:"array",element:e,...ef(t)})}let sy=E("ZodObject",(e,t)=>{tO.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rf(e,t,r,s),eo(e,"shape",()=>t.shape),rW(e,"ZodObject",{keyof(){return sk(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:sm()})},loose(){return this.clone({...this._zod.def,catchall:sm()})},strict(){return this.clone({...this._zod.def,catchall:new sh({type:"never",...ef(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!ep(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=ei(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return en(this,"shape",r),r}});return eh(e,s)}(this,e)},safeExtend(e){return function(e,t){if(!ep(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ei(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return en(this,"shape",r),r}});return eh(e,r)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ei(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return en(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return eh(e,r)}(this,e)},pick(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o=ei(e._zod.def,{get shape(){let e={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=r.shape[s])}return en(this,"shape",e),e},checks:[]});return eh(e,o)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=ei(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return en(this,"shape",s),s},checks:[]});return eh(e,o)}(this,e)},partial(...e){return function(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let o=ei(t._zod.def,{get shape(){let s=t._zod.def.shape,o={...s};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:s[t]}):s[t])}else for(let t in s)o[t]=e?new e({type:"optional",innerType:s[t]}):s[t];return en(this,"shape",o),o},checks:[]});return eh(t,o)}(sS,this,e[0])},required(...e){return function(e,t,r){let s=ei(t._zod.def,{get shape(){let s=t._zod.def.shape,o={...s};if(r)for(let t in r){if(!(t in o))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=new e({type:"nonoptional",innerType:s[t]}))}else for(let t in s)o[t]=new e({type:"nonoptional",innerType:s[t]});return en(this,"shape",o),o}});return eh(t,s)}(s$,this,e[0])}})});function sb(e,t){return new sy({type:"object",shape:e??{},...ef(t)})}let s_=E("ZodUnion",(e,t)=>{tA.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rw(e,t,r,s),e.options=t.options}),sE=E("ZodIntersection",(e,t)=>{tG.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ry(e,t,r,s)}),sT=E("ZodRecord",(e,t)=>{tR.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rb(e,t,r,s),e.keyType=t.keyType,e.valueType=t.valueType}),sv=E("ZodEnum",(e,t)=>{tz.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rp(e,t,r,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,s)=>{let o={};for(let s of e)if(r.has(s))o[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new sv({...t,checks:[],...ef(s),entries:o})},e.exclude=(e,s)=>{let o={...t.entries};for(let t of e)if(r.has(t))delete o[t];else throw Error(`Key ${t} not found in enum`);return new sv({...t,checks:[],...ef(s),entries:o})}});function sk(e,t){return new sv({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...ef(t)})}let sP=E("ZodLiteral",(e,t)=>{tU.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rd(e,t,r,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}),sO=E("ZodTransform",(e,t)=>{t$.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rm(e,t,r,s),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new v(e.constructor.name);r.addIssue=s=>{"string"==typeof s?r.issues.push(ev(s,r.value,t)):(s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(ev(s)))};let o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}}),sS=E("ZodOptional",(e,t)=>{tD.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rS(e,t,r,s),e.unwrap=()=>e._zod.def.innerType});function sA(e){return new sS({type:"optional",innerType:e})}let sG=E("ZodExactOptional",(e,t)=>{tj.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rS(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sF=E("ZodNullable",(e,t)=>{tI.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>r_(e,t,r,s),e.unwrap=()=>e._zod.def.innerType});function sR(e){return new sF({type:"nullable",innerType:e})}let sz=E("ZodDefault",(e,t)=>{tx.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rT(e,t,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),sU=E("ZodPrefault",(e,t)=>{tN.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rv(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),s$=E("ZodNonOptional",(e,t)=>{tZ.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rE(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sC=E("ZodCatch",(e,t)=>{tB.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rk(e,t,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),sD=E("ZodPipe",(e,t)=>{tM.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rP(e,t,r,s),e.in=t.in,e.out=t.out});function sj(e,t){return new sD({type:"pipe",in:e,out:t})}let sI=E("ZodReadonly",(e,t)=>{tJ.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rO(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sx=E("ZodCustom",(e,t)=>{tV.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rg(e,t,r,s)}),sL=sb({startOffset:sl().int().nonnegative(),endOffset:sl().int().nonnegative(),exact:rK().min(1).max(1e3),prefix:rK().max(64),suffix:rK().max(64)}).refine(e=>e.endOffset>=e.startOffset,{message:"endOffset must be >= startOffset"}),sN=function(e,t,r){return new sT(t&&t._zod?{type:"record",keyType:e,valueType:t,...ef(void 0)}:{type:"record",keyType:rK(),valueType:e,...ef(t)})}(rK(),sw(rK())),sZ=sk(["ios","android","web"]),sq=sb({id:rK().min(1).max(64),parentId:rK().min(1).max(64).nullable(),body:rK().min(1).max(2e3),authorName:rK().max(40).nullable(),fingerprint:rK().min(1).max(128),country:rK().max(8),platform:sZ,reactions:sN,resolved:sd(),createdAt:rK().datetime(),hidden:sd(),hiddenReason:rK().max(200).optional()}),sB=sb({id:rK().min(1).max(64),anchor:sL,thread:sw(sq).min(1),resolved:sd(),createdAt:rK().datetime()}),sM=sb({postId:rK().min(1),highlights:sw(sB),schemaVersion:(s=1,new sP({type:"literal",values:Array.isArray(1)?1:[1],...ef(void 0)}))});function sW(e){return{postId:e,highlights:[],schemaVersion:1}}let sJ={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",highlightsFile:e=>`highlights/${e}.json`},sH=e=>`data/${e}`,sV={rootKeep:()=>sH(sJ.rootKeep()),blogDir:()=>sH(sJ.blogDir()),blogDirKeep:()=>sH(sJ.blogDirKeep()),blogPost:e=>sH(sJ.blogPost(e)),blogFile:e=>sH(sJ.blogFile(e)),blogManifest:()=>sH(sJ.blogManifest()),memos:()=>sH(sJ.memos()),likes:()=>sH(sJ.likes()),siteConfig:()=>sH(sJ.siteConfig()),highlightsFile:e=>sH(sJ.highlightsFile(e))},sK=new Map;function sY(e){return sV.highlightsFile(e)}function sX(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 sQ(e){if("object"==typeof e&&null!==e&&"status"in e){let t=e.status;return"number"==typeof t?t:void 0}}class s0{constructor(e){this.rootDir=e}absPath(e){return m().join(this.rootDir,sJ.highlightsFile(e))}async load(e){sX(e);try{let t=await f.promises.readFile(this.absPath(e),"utf-8");return{data:sM.parse(JSON.parse(t)),sha:null}}catch(t){if("ENOENT"===t?.code)return{data:sW(e),sha:null};throw t}}async save(e,t,r,s){sX(e);let o=sM.parse(t),n=this.absPath(e);return await f.promises.mkdir(m().dirname(n),{recursive:!0}),await f.promises.writeFile(n,JSON.stringify(o,null,2),"utf-8"),{sha:""}}}class s1{constructor(e,t,r="cici"){this.octokit=e,this.owner=t,this.repo=r}async load(e){sX(e);let t=sK.get(e);if(t&&t.expiresAt>Date.now())return{data:t.data,sha:t.sha};let r=await this.readFile(e);if(!r){let t=sW(e);return sK.set(e,{data:t,sha:null,expiresAt:Date.now()+3e4}),{data:t,sha:null}}let s=sM.parse(JSON.parse(r.content));return sK.set(e,{data:s,sha:r.sha,expiresAt:Date.now()+3e4}),{data:s,sha:r.sha}}async save(e,t,r,s){sX(e);let o=sM.parse(t),n=Buffer.from(JSON.stringify(o,null,2)).toString("base64"),i=0,a=r;for(;i<3;)try{let t=await this.octokit.repos.createOrUpdateFileContents({owner:this.owner,repo:this.repo,path:sY(e),message:s,content:n,...a?{sha:a}:{}}),r=t.data.content?.sha??"";return sK.set(e,{data:o,sha:r,expiresAt:Date.now()+3e4}),{sha:r}}catch(r){let t=sQ(r);if(409===t||422===t){sK.delete(e),i++;let t=await this.readFile(e);a=t?.sha??null;continue}throw r}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:sY(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===sQ(e))return null;throw e}}}function s4(e){let{frontmatter:t}=function(e){let t=e.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);return t?{frontmatter:t[1],body:t[2].replace(/^\n/,"")}:{frontmatter:"",body:e}}(e),r=t.match(/title:[ \t]*(.+)/),s=t.match(/date:[ \t]*(.+)/),o=t.match(/latitude:[ \t]*(.+)/),n=t.match(/longitude:[ \t]*(.+)/),i=t.match(/city:[ \t]*(.+)/),a=t.match(/street:[ \t]*(.+)/),l=t.match(/status:[ \t]*(.+)/),c=t.match(/publishedAt:[ \t]*(.+)/),u=t.match(/lastModified:[ \t]*(.+)/),p=o?.[1]?.trim(),d=n?.[1]?.trim(),g=p?parseFloat(p):NaN,m=d?parseFloat(d):NaN;return{title:r?r[1].trim():"",date:s?s[1].trim():new Date().toISOString(),discussions:function(e){let t=[],r=e.match(/external_discussions:\s*\n([\s\S]*?)(?=\n\w|$)/);if(!r)return t;let s=r[1].split("\n").filter(e=>e.trim()),o={};for(let e of s)e.includes("platform:")?(o.platform&&o.url&&t.push(o),o={platform:e.split(":")[1].trim()}):e.includes("url:")&&o.platform&&(o.url=e.split("url:")[1].trim());return o.platform&&o.url&&t.push(o),t}(t),...p&&!isNaN(g)&&{latitude:g},...d&&!isNaN(m)&&{longitude:m},...i&&i[1].trim()&&{city:i[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()}}}function s2(e){return e.toLowerCase().replace(/\s+/g,"-")}function s9({title:e,date:t,content:r,status:s="published",location:o,discussions:n=[]}){let i=function(e=[]){if(!e.length)return"";let t=e.map(e=>` - platform: ${e.platform}
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let s=r[1];if(t===r[0]){n(r);continue}if(e.external){let s=e.external.registry.get(r[0])?.id;if(t!==r[0]&&s){n(r);continue}}if(e.metadataRegistry.get(r[0])?.id||s.cycle||s.count>1&&"ref"===e.reused){n(r);continue}}}function rr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let s=t=>{let r=e.seen.get(t);if(null===r.ref)return;let o=r.def??r.schema,n={...o},i=r.ref;if(r.ref=null,i){s(i);let r=e.seen.get(i),a=r.schema;if(a.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(o.allOf=o.allOf??[],o.allOf.push(a)):Object.assign(o,a),Object.assign(o,n),t._zod.parent===i)for(let e in o)"$ref"===e||"allOf"===e||e in n||delete o[e];if(a.$ref&&r.def)for(let e in o)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(o[e])===JSON.stringify(r.def[e])&&delete o[e]}let a=t._zod.parent;if(a&&a!==i){s(a);let t=e.seen.get(a);if(t?.schema.$ref&&(o.$ref=t.schema.$ref,t.def))for(let e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}e.override({zodSchema:t,jsonSchema:o,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())s(t[0]);let o={};if("draft-2020-12"===e.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(r)}Object.assign(o,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&o.id===n&&delete o.id;let i=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?o.$defs=i:o.definitions=i);try{let r=JSON.parse(JSON.stringify(o));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ro(t,"input",e.processors),output:ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rs=(e,t={})=>r=>{let s=t7({...r,processors:t});return re(e,s),rt(s,e),rr(s,e)},ro=(e,t,r={})=>s=>{let{libraryOptions:o,target:n}=s??{},i=t7({...o??{},target:n,io:t,processors:r});return re(e,i),rt(i,e),rr(i,e)},rn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ri=(e,t,r,s)=>{r.type="string";let{minimum:o,maximum:n,format:i,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof o&&(r.minLength=o),"number"==typeof n&&(r.maxLength=n),i&&(r.format=rn[i]??i,""===r.format&&delete r.format,"time"===i&&delete r.format),l&&(r.contentEncoding=l),a&&a.size>0){let e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},ra=(e,t,r,s)=>{let{minimum:o,maximum:n,format:i,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof i&&i.includes("int")?r.type="integer":r.type="number";let u="number"==typeof c&&c>=(o??Number.NEGATIVE_INFINITY),p="number"==typeof l&&l<=(n??Number.POSITIVE_INFINITY),d="draft-04"===t.target||"openapi-3.0"===t.target;u?d?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof o&&(r.minimum=o),p?d?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof n&&(r.maximum=n),"number"==typeof a&&(r.multipleOf=a)},rl=(e,t,r,s)=>{r.type="boolean"},rc=(e,t,r,s)=>{r.not={}},ru=(e,t,r,s)=>{},rp=(e,t,r,s)=>{let o=Q(e._zod.def.entries);o.every(e=>"number"==typeof e)&&(r.type="number"),o.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=o},rd=(e,t,r,s)=>{let o=e._zod.def,n=[];for(let e of o.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");n.push(Number(e))}else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n},rg=(e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rm=(e,t,r,s)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},rh=(e,t,r,s)=>{let o=e._zod.def,{minimum:n,maximum:i}=e._zod.bag;"number"==typeof n&&(r.minItems=n),"number"==typeof i&&(r.maxItems=i),r.type="array",r.items=re(o.element,t,{...s,path:[...s.path,"items"]})},rf=(e,t,r,s)=>{let o=e._zod.def;r.type="object",r.properties={};let n=o.shape;for(let e in n)r.properties[e]=re(n[e],t,{...s,path:[...s.path,"properties",e]});let i=new Set([...new Set(Object.keys(n))].filter(e=>{let r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));i.size>0&&(r.required=Array.from(i)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=re(o.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rw=(e,t,r,s)=>{let o=e._zod.def,n=!1===o.inclusive,i=o.options.map((e,r)=>re(e,t,{...s,path:[...s.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=i:r.anyOf=i},ry=(e,t,r,s)=>{let o=e._zod.def,n=re(o.left,t,{...s,path:[...s.path,"allOf",0]}),i=re(o.right,t,{...s,path:[...s.path,"allOf",1]}),a=[..."allOf"in n&&1===Object.keys(n).length?n.allOf:[n],..."allOf"in i&&1===Object.keys(i).length?i.allOf:[i]];r.allOf=a},rb=(e,t,r,s)=>{let o=e._zod.def;r.type="object";let n=o.keyType,i=n._zod.bag,a=i?.patterns;if("loose"===o.mode&&a&&a.size>0){let e=re(o.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});for(let t of(r.patternProperties={},a))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=re(o.keyType,t,{...s,path:[...s.path,"propertyNames"]})),r.additionalProperties=re(o.valueType,t,{...s,path:[...s.path,"additionalProperties"]});let l=n._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},r_=(e,t,r,s)=>{let o=e._zod.def,n=re(o.innerType,t,s),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},rE=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType},rT=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},rv=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},rk=(e,t,r,s)=>{let o;let n=e._zod.def;re(n.innerType,t,s),t.seen.get(e).ref=n.innerType;try{o=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=o},rP=(e,t,r,s)=>{let o=e._zod.def,n=o.in._zod.traits.has("$ZodTransform"),i="input"===t.io?n?o.out:o.in:o.out;re(i,t,s),t.seen.get(e).ref=i},rO=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType,r.readOnly=!0},rS=(e,t,r,s)=>{let o=e._zod.def;re(o.innerType,t,s),t.seen.get(e).ref=o.innerType},rA=E("ZodISODateTime",(e,t)=>{tr.init(e,t),rY.init(e,t)}),rG=E("ZodISODate",(e,t)=>{ts.init(e,t),rY.init(e,t)}),rF=E("ZodISOTime",(e,t)=>{to.init(e,t),rY.init(e,t)}),rR=E("ZodISODuration",(e,t)=>{tn.init(e,t),rY.init(e,t)}),rz=E("ZodError",(e,t)=>{eq.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},s=(e,o=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>s({issues:e},[...o,...n.path]));else if("invalid_key"===n.code)s({issues:n.issues},[...o,...n.path]);else if("invalid_element"===n.code)s({issues:n.issues},[...o,...n.path]);else{let e=[...o,...n.path];if(0===e.length)r._errors.push(t(n));else{let s=r,o=0;for(;o<e.length;){let r=e[o];o===e.length-1?(s[r]=s[r]||{_errors:[]},s[r]._errors.push(t(n))):s[r]=s[r]||{_errors:[]},s=s[r],o++}}}};return s(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},s=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):s.push(t(o));return{formErrors:s,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ee,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ee,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),rU=eM(rz),r$=eW(rz),rC=eJ(rz),rD=eV(rz),rj=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eM(rz)(e,t,s)},rI=(e,t,r)=>eM(rz)(e,t,r),rx=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eW(rz)(e,t,s)},rL=async(e,t,r)=>eW(rz)(e,t,r),rN=(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eJ(rz)(e,t,s)},rZ=(e,t,r)=>eJ(rz)(e,t,r),rq=async(e,t,r)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return eV(rz)(e,t,s)},rB=async(e,t,r)=>eV(rz)(e,t,r),rM=new WeakMap;function rW(e,t,r){let s=Object.getPrototypeOf(e),o=rM.get(s);if(o||(o=new Set,rM.set(s,o)),!o.has(t))for(let e in o.add(t),r){let t=r[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let rJ=E("ZodType",(e,t)=>(eX.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ro(e,"input"),output:ro(e,"output")}}),e.toJSONSchema=rs(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>rU(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>rC(e,t,r),e.parseAsync=async(t,r)=>r$(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>rD(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>rj(e,t,r),e.decode=(t,r)=>rI(e,t,r),e.encodeAsync=async(t,r)=>rx(e,t,r),e.decodeAsync=async(t,r)=>rL(e,t,r),e.safeEncode=(t,r)=>rN(e,t,r),e.safeDecode=(t,r)=>rZ(e,t,r),e.safeEncodeAsync=async(t,r)=>rq(e,t,r),e.safeDecodeAsync=async(t,r)=>rB(e,t,r),rW(e,"ZodType",{check(...e){let t=this.def;return this.clone(ei(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eh(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new sx({type:"custom",check:"custom",fn:e,...ef(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){let r=function(e,t){let r=new ek({check:"custom",...ef(t)});return r._zod.check=e,r}(t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(ev(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(ev(e)))},e(t.value,t)),t);return r}(e,t))},overwrite(e){return this.check(t5(e))},optional(){return sA(this)},exactOptional(){return new sG({type:"optional",innerType:this})},nullable(){return sR(this)},nullish(){return sA(sR(this))},nonoptional(e){return new s$({type:"nonoptional",innerType:this,...ef(e)})},array(){return sw(this)},or(e){var t;return new s_({type:"union",options:[this,e],...ef(void 0)})},and(e){return new sE({type:"intersection",left:this,right:e})},transform(e){return sj(this,new sO({type:"transform",transform:e}))},default(e){return new sz({type:"default",innerType:this,get defaultValue(){return"function"==typeof e?e():ed(e)}})},prefault(e){return new sU({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof e?e():ed(e)}})},catch(e){return new sC({type:"catch",innerType:this,catchValue:"function"==typeof e?e:()=>e})},pipe(e){return sj(this,e)},readonly(){return new sI({type:"readonly",innerType:this})},describe(e){let t=this.clone();return tX.add(t,{description:e}),t},meta(...e){if(0===e.length)return tX.get(this);let t=this.clone();return tX.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>tX.get(e)?.description,configurable:!0}),e)),rH=E("_ZodString",(e,t)=>{eQ.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ri(e,t,r,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,rW(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new e$({check:"string_format",format:"regex",...ef(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ej({check:"string_format",format:"includes",...ef(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new eI({check:"string_format",format:"starts_with",...ef(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ex({check:"string_format",format:"ends_with",...ef(t),suffix:e})}(...e))},min(...e){return this.check(t3(...e))},max(...e){return this.check(t6(...e))},length(...e){return this.check(t8(...e))},nonempty(...e){return this.check(t3(1,...e))},lowercase(e){return this.check(new eC({check:"string_format",format:"lowercase",...ef(e)}))},uppercase(e){return this.check(new eD({check:"string_format",format:"uppercase",...ef(e)}))},trim(){return this.check(t5(e=>e.trim()))},normalize(...e){return this.check(function(e){return t5(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(t5(e=>e.toLowerCase()))},toUpperCase(){return this.check(t5(e=>e.toUpperCase()))},slugify(){return this.check(t5(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),rV=E("ZodString",(e,t)=>{eQ.init(e,t),rH.init(e,t),e.email=t=>e.check(new rX({type:"string",format:"email",check:"string_format",abort:!1,...ef(t)})),e.url=t=>e.check(new r1({type:"string",format:"url",check:"string_format",abort:!1,...ef(t)})),e.jwt=t=>e.check(new si({type:"string",format:"jwt",check:"string_format",abort:!1,...ef(t)})),e.emoji=t=>e.check(new r4({type:"string",format:"emoji",check:"string_format",abort:!1,...ef(t)})),e.guid=t=>e.check(tQ(rQ,t)),e.uuid=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,...ef(t)})),e.uuidv4=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ef(t)})),e.uuidv6=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ef(t)})),e.uuidv7=t=>e.check(new r0({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ef(t)})),e.nanoid=t=>e.check(new r2({type:"string",format:"nanoid",check:"string_format",abort:!1,...ef(t)})),e.guid=t=>e.check(tQ(rQ,t)),e.cuid=t=>e.check(new r9({type:"string",format:"cuid",check:"string_format",abort:!1,...ef(t)})),e.cuid2=t=>e.check(new r6({type:"string",format:"cuid2",check:"string_format",abort:!1,...ef(t)})),e.ulid=t=>e.check(new r3({type:"string",format:"ulid",check:"string_format",abort:!1,...ef(t)})),e.base64=t=>e.check(new ss({type:"string",format:"base64",check:"string_format",abort:!1,...ef(t)})),e.base64url=t=>e.check(new so({type:"string",format:"base64url",check:"string_format",abort:!1,...ef(t)})),e.xid=t=>e.check(new r8({type:"string",format:"xid",check:"string_format",abort:!1,...ef(t)})),e.ksuid=t=>e.check(new r5({type:"string",format:"ksuid",check:"string_format",abort:!1,...ef(t)})),e.ipv4=t=>e.check(new r7({type:"string",format:"ipv4",check:"string_format",abort:!1,...ef(t)})),e.ipv6=t=>e.check(new se({type:"string",format:"ipv6",check:"string_format",abort:!1,...ef(t)})),e.cidrv4=t=>e.check(new st({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ef(t)})),e.cidrv6=t=>e.check(new sr({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ef(t)})),e.e164=t=>e.check(new sn({type:"string",format:"e164",check:"string_format",abort:!1,...ef(t)})),e.datetime=t=>e.check(new rA({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ef(t)})),e.date=t=>e.check(new rG({type:"string",format:"date",check:"string_format",...ef(t)})),e.time=t=>e.check(new rF({type:"string",format:"time",check:"string_format",precision:null,...ef(t)})),e.duration=t=>e.check(new rR({type:"string",format:"duration",check:"string_format",...ef(t)}))});function rK(e){return new rV({type:"string",...ef(e)})}let rY=E("ZodStringFormat",(e,t)=>{e0.init(e,t),rH.init(e,t)}),rX=E("ZodEmail",(e,t)=>{e2.init(e,t),rY.init(e,t)}),rQ=E("ZodGUID",(e,t)=>{e1.init(e,t),rY.init(e,t)}),r0=E("ZodUUID",(e,t)=>{e4.init(e,t),rY.init(e,t)}),r1=E("ZodURL",(e,t)=>{e9.init(e,t),rY.init(e,t)}),r4=E("ZodEmoji",(e,t)=>{e6.init(e,t),rY.init(e,t)}),r2=E("ZodNanoID",(e,t)=>{e3.init(e,t),rY.init(e,t)}),r9=E("ZodCUID",(e,t)=>{e8.init(e,t),rY.init(e,t)}),r6=E("ZodCUID2",(e,t)=>{e5.init(e,t),rY.init(e,t)}),r3=E("ZodULID",(e,t)=>{e7.init(e,t),rY.init(e,t)}),r8=E("ZodXID",(e,t)=>{te.init(e,t),rY.init(e,t)}),r5=E("ZodKSUID",(e,t)=>{tt.init(e,t),rY.init(e,t)}),r7=E("ZodIPv4",(e,t)=>{ti.init(e,t),rY.init(e,t)}),se=E("ZodIPv6",(e,t)=>{ta.init(e,t),rY.init(e,t)}),st=E("ZodCIDRv4",(e,t)=>{tl.init(e,t),rY.init(e,t)}),sr=E("ZodCIDRv6",(e,t)=>{tc.init(e,t),rY.init(e,t)}),ss=E("ZodBase64",(e,t)=>{tp.init(e,t),rY.init(e,t)}),so=E("ZodBase64URL",(e,t)=>{td.init(e,t),rY.init(e,t)}),sn=E("ZodE164",(e,t)=>{tg.init(e,t),rY.init(e,t)}),si=E("ZodJWT",(e,t)=>{tm.init(e,t),rY.init(e,t)}),sa=E("ZodNumber",(e,t)=>{th.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ra(e,t,r,s),rW(e,"ZodNumber",{gt(e,t){return this.check(t4(e,t))},gte(e,t){return this.check(t2(e,t))},min(e,t){return this.check(t2(e,t))},lt(e,t){return this.check(t0(e,t))},lte(e,t){return this.check(t1(e,t))},max(e,t){return this.check(t1(e,t))},int(e){return this.check(su(e))},safe(e){return this.check(su(e))},positive(e){return this.check(t4(0,e))},nonnegative(e){return this.check(t2(0,e))},negative(e){return this.check(t0(0,e))},nonpositive(e){return this.check(t1(0,e))},multipleOf(e,t){return this.check(t9(e,t))},step(e,t){return this.check(t9(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function sl(e){return new sa({type:"number",checks:[],...ef(e)})}let sc=E("ZodNumberFormat",(e,t)=>{tf.init(e,t),sa.init(e,t)});function su(e){return new sc({type:"number",check:"number_format",abort:!1,format:"safeint",...ef(e)})}let sp=E("ZodBoolean",(e,t)=>{tw.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rl(e,t,r,s)});function sd(e){return new sp({type:"boolean",...ef(e)})}let sg=E("ZodUnknown",(e,t)=>{ty.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ru(e,t,r,s)});function sm(){return new sg({type:"unknown"})}let sh=E("ZodNever",(e,t)=>{tb.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rc(e,t,r,s)}),sf=E("ZodArray",(e,t)=>{tE.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rh(e,t,r,s),e.element=t.element,rW(e,"ZodArray",{min(e,t){return this.check(t3(e,t))},nonempty(e){return this.check(t3(1,e))},max(e,t){return this.check(t6(e,t))},length(e,t){return this.check(t8(e,t))},unwrap(){return this.element}})});function sw(e,t){return new sf({type:"array",element:e,...ef(t)})}let sy=E("ZodObject",(e,t)=>{tO.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rf(e,t,r,s),eo(e,"shape",()=>t.shape),rW(e,"ZodObject",{keyof(){return sk(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:sm()})},loose(){return this.clone({...this._zod.def,catchall:sm()})},strict(){return this.clone({...this._zod.def,catchall:new sh({type:"never",...ef(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!ep(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=ei(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return en(this,"shape",r),r}});return eh(e,s)}(this,e)},safeExtend(e){return function(e,t){if(!ep(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ei(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return en(this,"shape",r),r}});return eh(e,r)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ei(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return en(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return eh(e,r)}(this,e)},pick(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o=ei(e._zod.def,{get shape(){let e={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=r.shape[s])}return en(this,"shape",e),e},checks:[]});return eh(e,o)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,s=r.checks;if(s&&s.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=ei(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return en(this,"shape",s),s},checks:[]});return eh(e,o)}(this,e)},partial(...e){return function(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let o=ei(t._zod.def,{get shape(){let s=t._zod.def.shape,o={...s};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:s[t]}):s[t])}else for(let t in s)o[t]=e?new e({type:"optional",innerType:s[t]}):s[t];return en(this,"shape",o),o},checks:[]});return eh(t,o)}(sS,this,e[0])},required(...e){return function(e,t,r){let s=ei(t._zod.def,{get shape(){let s=t._zod.def.shape,o={...s};if(r)for(let t in r){if(!(t in o))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=new e({type:"nonoptional",innerType:s[t]}))}else for(let t in s)o[t]=new e({type:"nonoptional",innerType:s[t]});return en(this,"shape",o),o}});return eh(t,s)}(s$,this,e[0])}})});function sb(e,t){return new sy({type:"object",shape:e??{},...ef(t)})}let s_=E("ZodUnion",(e,t)=>{tA.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rw(e,t,r,s),e.options=t.options}),sE=E("ZodIntersection",(e,t)=>{tG.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>ry(e,t,r,s)}),sT=E("ZodRecord",(e,t)=>{tR.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rb(e,t,r,s),e.keyType=t.keyType,e.valueType=t.valueType}),sv=E("ZodEnum",(e,t)=>{tz.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rp(e,t,r,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,s)=>{let o={};for(let s of e)if(r.has(s))o[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new sv({...t,checks:[],...ef(s),entries:o})},e.exclude=(e,s)=>{let o={...t.entries};for(let t of e)if(r.has(t))delete o[t];else throw Error(`Key ${t} not found in enum`);return new sv({...t,checks:[],...ef(s),entries:o})}});function sk(e,t){return new sv({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...ef(t)})}let sP=E("ZodLiteral",(e,t)=>{tU.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rd(e,t,r,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}),sO=E("ZodTransform",(e,t)=>{t$.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rm(e,t,r,s),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new v(e.constructor.name);r.addIssue=s=>{"string"==typeof s?r.issues.push(ev(s,r.value,t)):(s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(ev(s)))};let o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}}),sS=E("ZodOptional",(e,t)=>{tD.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rS(e,t,r,s),e.unwrap=()=>e._zod.def.innerType});function sA(e){return new sS({type:"optional",innerType:e})}let sG=E("ZodExactOptional",(e,t)=>{tj.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rS(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sF=E("ZodNullable",(e,t)=>{tI.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>r_(e,t,r,s),e.unwrap=()=>e._zod.def.innerType});function sR(e){return new sF({type:"nullable",innerType:e})}let sz=E("ZodDefault",(e,t)=>{tx.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rT(e,t,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),sU=E("ZodPrefault",(e,t)=>{tN.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rv(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),s$=E("ZodNonOptional",(e,t)=>{tZ.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rE(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sC=E("ZodCatch",(e,t)=>{tB.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rk(e,t,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),sD=E("ZodPipe",(e,t)=>{tM.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rP(e,t,r,s),e.in=t.in,e.out=t.out});function sj(e,t){return new sD({type:"pipe",in:e,out:t})}let sI=E("ZodReadonly",(e,t)=>{tJ.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rO(e,t,r,s),e.unwrap=()=>e._zod.def.innerType}),sx=E("ZodCustom",(e,t)=>{tV.init(e,t),rJ.init(e,t),e._zod.processJSONSchema=(t,r,s)=>rg(e,t,r,s)}),sL=sb({startOffset:sl().int().nonnegative(),endOffset:sl().int().nonnegative(),exact:rK().min(1).max(1e3),prefix:rK().max(64),suffix:rK().max(64)}).refine(e=>e.endOffset>=e.startOffset,{message:"endOffset must be >= startOffset"}),sN=function(e,t,r){return new sT(t&&t._zod?{type:"record",keyType:e,valueType:t,...ef(void 0)}:{type:"record",keyType:rK(),valueType:e,...ef(t)})}(rK(),sw(rK())),sZ=sk(["ios","android","web"]),sq=sb({id:rK().min(1).max(64),parentId:rK().min(1).max(64).nullable(),body:rK().min(1).max(2e3),authorName:rK().max(40).nullable(),fingerprint:rK().min(1).max(128),country:rK().max(8),platform:sZ,reactions:sN,resolved:sd(),createdAt:rK().datetime(),hidden:sd(),hiddenReason:rK().max(200).optional()}),sB=sb({id:rK().min(1).max(64),anchor:sL,thread:sw(sq).min(1),resolved:sd(),createdAt:rK().datetime()}),sM=sb({postId:rK().min(1),highlights:sw(sB),schemaVersion:(s=1,new sP({type:"literal",values:Array.isArray(1)?1:[1],...ef(void 0)}))});function sW(e){return{postId:e,highlights:[],schemaVersion:1}}let sJ={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",highlightsFile:e=>`highlights/${e}.json`},sH=e=>`data/${e}`,sV={rootKeep:()=>sH(sJ.rootKeep()),blogDir:()=>sH(sJ.blogDir()),blogDirKeep:()=>sH(sJ.blogDirKeep()),blogPost:e=>sH(sJ.blogPost(e)),blogFile:e=>sH(sJ.blogFile(e)),blogManifest:()=>sH(sJ.blogManifest()),memos:()=>sH(sJ.memos()),likes:()=>sH(sJ.likes()),siteConfig:()=>sH(sJ.siteConfig()),highlightsFile:e=>sH(sJ.highlightsFile(e))},sK=new Map;function sY(e){return sV.highlightsFile(e)}function sX(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 sQ(e){if("object"==typeof e&&null!==e&&"status"in e){let t=e.status;return"number"==typeof t?t:void 0}}class s0{constructor(e){this.rootDir=e}absPath(e){return m().join(this.rootDir,sJ.highlightsFile(e))}async load(e){sX(e);try{let t=await f.promises.readFile(this.absPath(e),"utf-8");return{data:sM.parse(JSON.parse(t)),sha:null}}catch(t){if("ENOENT"===t?.code)return{data:sW(e),sha:null};throw t}}async save(e,t,r,s){sX(e);let o=sM.parse(t),n=this.absPath(e);return await f.promises.mkdir(m().dirname(n),{recursive:!0}),await f.promises.writeFile(n,JSON.stringify(o,null,2),"utf-8"),{sha:""}}}class s1{constructor(e,t,r="cici",s=!1){this.octokit=e,this.owner=t,this.repo=r,this.readOnly=s}async load(e){sX(e);let t=sK.get(e);if(t&&t.expiresAt>Date.now())return{data:t.data,sha:t.sha};let r=await this.readFile(e);if(!r){let t=sW(e);return sK.set(e,{data:t,sha:null,expiresAt:Date.now()+3e4}),{data:t,sha:null}}let s=sM.parse(JSON.parse(r.content));return sK.set(e,{data:s,sha:r.sha,expiresAt:Date.now()+3e4}),{data:s,sha:r.sha}}async save(e,t,r,s){if(sX(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 o=sM.parse(t),n=Buffer.from(JSON.stringify(o,null,2)).toString("base64"),i=0,a=r;for(;i<3;)try{let t=await this.octokit.repos.createOrUpdateFileContents({owner:this.owner,repo:this.repo,path:sY(e),message:s,content:n,...a?{sha:a}:{}}),r=t.data.content?.sha??"";return sK.set(e,{data:o,sha:r,expiresAt:Date.now()+3e4}),{sha:r}}catch(r){let t=sQ(r);if(409===t||422===t){sK.delete(e),i++;let t=await this.readFile(e);a=t?.sha??null;continue}throw r}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:sY(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===sQ(e))return null;throw e}}}function s4(e){let{frontmatter:t}=function(e){let t=e.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);return t?{frontmatter:t[1],body:t[2].replace(/^\n/,"")}:{frontmatter:"",body:e}}(e),r=t.match(/title:[ \t]*(.+)/),s=t.match(/date:[ \t]*(.+)/),o=t.match(/latitude:[ \t]*(.+)/),n=t.match(/longitude:[ \t]*(.+)/),i=t.match(/city:[ \t]*(.+)/),a=t.match(/street:[ \t]*(.+)/),l=t.match(/status:[ \t]*(.+)/),c=t.match(/publishedAt:[ \t]*(.+)/),u=t.match(/lastModified:[ \t]*(.+)/),p=o?.[1]?.trim(),d=n?.[1]?.trim(),g=p?parseFloat(p):NaN,m=d?parseFloat(d):NaN;return{title:r?r[1].trim():"",date:s?s[1].trim():new Date().toISOString(),discussions:function(e){let t=[],r=e.match(/external_discussions:\s*\n([\s\S]*?)(?=\n\w|$)/);if(!r)return t;let s=r[1].split("\n").filter(e=>e.trim()),o={};for(let e of s)e.includes("platform:")?(o.platform&&o.url&&t.push(o),o={platform:e.split(":")[1].trim()}):e.includes("url:")&&o.platform&&(o.url=e.split("url:")[1].trim());return o.platform&&o.url&&t.push(o),t}(t),...p&&!isNaN(g)&&{latitude:g},...d&&!isNaN(m)&&{longitude:m},...i&&i[1].trim()&&{city:i[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()}}}function s2(e){return e.toLowerCase().replace(/\s+/g,"-")}function s9({title:e,date:t,content:r,status:s="published",location:o,discussions:n=[]}){let i=function(e=[]){if(!e.length)return"";let t=e.map(e=>` - platform: ${e.platform}
|
|
63
63
|
url: ${e.url}`).join("\n");return`external_discussions:
|
|
64
64
|
${t}
|
|
65
65
|
`}(n),a=o?`latitude: ${o.latitude||""}
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
3
3
|
<url>
|
|
4
4
|
<loc>https://blog.minghe.me</loc>
|
|
5
|
-
<lastmod>2026-07-
|
|
5
|
+
<lastmod>2026-07-21T21:19:20.942Z</lastmod>
|
|
6
6
|
<changefreq>daily</changefreq>
|
|
7
7
|
<priority>1</priority>
|
|
8
8
|
</url>
|
|
9
9
|
<url>
|
|
10
10
|
<loc>https://blog.minghe.me/blog</loc>
|
|
11
|
-
<lastmod>2026-07-
|
|
11
|
+
<lastmod>2026-07-21T21:19:20.942Z</lastmod>
|
|
12
12
|
<changefreq>daily</changefreq>
|
|
13
13
|
<priority>0.9</priority>
|
|
14
14
|
</url>
|
|
15
15
|
<url>
|
|
16
16
|
<loc>https://blog.minghe.me/memos</loc>
|
|
17
|
-
<lastmod>2026-07-
|
|
17
|
+
<lastmod>2026-07-21T21:19:20.942Z</lastmod>
|
|
18
18
|
<changefreq>daily</changefreq>
|
|
19
19
|
<priority>0.8</priority>
|
|
20
20
|
</url>
|
|
21
21
|
<url>
|
|
22
22
|
<loc>https://blog.minghe.me/editor</loc>
|
|
23
|
-
<lastmod>2026-07-
|
|
23
|
+
<lastmod>2026-07-21T21:19:20.942Z</lastmod>
|
|
24
24
|
<changefreq>weekly</changefreq>
|
|
25
25
|
<priority>0.5</priority>
|
|
26
26
|
</url>
|
|
27
27
|
<url>
|
|
28
28
|
<loc>https://blog.minghe.me/login</loc>
|
|
29
|
-
<lastmod>2026-07-
|
|
29
|
+
<lastmod>2026-07-21T21:19:20.942Z</lastmod>
|
|
30
30
|
<changefreq>monthly</changefreq>
|
|
31
31
|
<priority>0.3</priority>
|
|
32
32
|
</url>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/unavailable/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"3980":{"*":{"id":"94789","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"14447":{"*":{"id":"34239","name":"*","chunks":[],"async":false}},"16456":{"*":{"id":"13170","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"28490":{"*":{"id":"93169","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"37344":{"*":{"id":"92073","name":"*","chunks":[],"async":false}},"51113":{"*":{"id":"27551","name":"*","chunks":[],"async":false}},"59556":{"*":{"id":"77083","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"63141":{"*":{"id":"78584","name":"*","chunks":[],"async":false}},"63156":{"*":{"id":"41713","name":"*","chunks":[],"async":false}},"65878":{"*":{"id":"92481","name":"*","chunks":[],"async":false}},"72972":{"*":{"id":"79404","name":"*","chunks":[],"async":false}},"75247":{"*":{"id":"80943","name":"*","chunks":[],"async":false}},"75873":{"*":{"id":"52719","name":"*","chunks":[],"async":false}},"81908":{"*":{"id":"18413","name":"*","chunks":[],"async":false}},"87232":{"*":{"id":"72892","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/cici/cici/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/app/globals.css":{"id":47960,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/Analytics.tsx":{"id":75873,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/CreateButton.tsx":{"id":28490,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/EditContext.tsx":{"id":75247,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/SessionProvider.tsx":{"id":63156,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/ui/toaster.tsx":{"id":59556,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next-intl/dist/esm/shared/NextIntlClientProvider.js":{"id":16456,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/font/google/target.css?{\"path\":\"components/ui/font.ts\",\"import\":\"Gowun_Dodum\",\"arguments\":[{\"weight\":\"400\",\"subsets\":[\"latin\"],\"display\":\"swap\"}],\"variableName\":\"gowun_wodum\"}":{"id":91444,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/app/login/page.tsx":{"id":3980,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/app/blog/[id]/component.tsx":{"id":63141,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/discussing/dist/components/Discussion.js":{"id":37344,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/components/Editor.tsx":{"id":14447,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/components/GitHubSignInButton.tsx":{"id":51113,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/components/BlogList.tsx":{"id":81908,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/components/MemosList.tsx":{"id":87232,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/image-component.js":{"id":65878,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/image-component.js":{"id":65878,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/link.js":{"id":72972,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/link.js":{"id":72972,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false}},"entryCSSFiles":{"/home/runner/work/cici/cici/":[],"/home/runner/work/cici/cici/app/layout":["static/css/bf9d0ede562bd061.css","static/css/67e4cfd62ab3f75c.css"],"/home/runner/work/cici/cici/app/page":[],"/home/runner/work/cici/cici/app/unavailable/page":[]}}
|
|
1
|
+
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/unavailable/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"3980":{"*":{"id":"94789","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"14447":{"*":{"id":"34239","name":"*","chunks":[],"async":false}},"16456":{"*":{"id":"13170","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"28490":{"*":{"id":"93169","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"37344":{"*":{"id":"92073","name":"*","chunks":[],"async":false}},"51113":{"*":{"id":"27551","name":"*","chunks":[],"async":false}},"59556":{"*":{"id":"77083","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"63141":{"*":{"id":"78584","name":"*","chunks":[],"async":false}},"63156":{"*":{"id":"41713","name":"*","chunks":[],"async":false}},"65878":{"*":{"id":"92481","name":"*","chunks":[],"async":false}},"72972":{"*":{"id":"79404","name":"*","chunks":[],"async":false}},"75247":{"*":{"id":"80943","name":"*","chunks":[],"async":false}},"75873":{"*":{"id":"52719","name":"*","chunks":[],"async":false}},"81908":{"*":{"id":"18413","name":"*","chunks":[],"async":false}},"87232":{"*":{"id":"72892","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/cici/cici/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/app/globals.css":{"id":47960,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/Analytics.tsx":{"id":75873,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/CreateButton.tsx":{"id":28490,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/EditContext.tsx":{"id":75247,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/SessionProvider.tsx":{"id":63156,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/components/ui/toaster.tsx":{"id":59556,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next-intl/dist/esm/shared/NextIntlClientProvider.js":{"id":16456,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/font/google/target.css?{\"path\":\"components/ui/font.ts\",\"import\":\"Gowun_Dodum\",\"arguments\":[{\"weight\":\"400\",\"subsets\":[\"latin\"],\"display\":\"swap\"}],\"variableName\":\"gowun_wodum\"}":{"id":91444,"name":"*","chunks":["310","static/chunks/0e5ce63c-dc8fe6cd5df6dc6f.js","51","static/chunks/795d4814-090707ad3f792458.js","956","static/chunks/ee560e2c-0aeb447bc68f09f5.js","779","static/chunks/0e762574-561b753e40bf5566.js","37","static/chunks/37-4aae6f4051a21b05.js","152","static/chunks/152-16409649f7f42f9f.js","972","static/chunks/972-774fbff93f73f32d.js","343","static/chunks/343-ef3404804cc77cf3.js","153","static/chunks/153-f9c1aae3150e3029.js","185","static/chunks/app/layout-3439dc235234d73d.js"],"async":false},"/home/runner/work/cici/cici/app/login/page.tsx":{"id":3980,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/components/BlogList.tsx":{"id":81908,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/app/blog/[id]/component.tsx":{"id":63141,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/discussing/dist/components/Discussion.js":{"id":37344,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/components/Editor.tsx":{"id":14447,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/components/GitHubSignInButton.tsx":{"id":51113,"name":"*","chunks":[],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/image-component.js":{"id":65878,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/image-component.js":{"id":65878,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/client/link.js":{"id":72972,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/node_modules/next/dist/esm/client/link.js":{"id":72972,"name":"*","chunks":["37","static/chunks/37-4aae6f4051a21b05.js","586","static/chunks/586-51f7e768b82803f6.js","972","static/chunks/972-774fbff93f73f32d.js","878","static/chunks/878-b71984a1ef1b61e8.js","931","static/chunks/app/page-f7dabeade6df80fd.js"],"async":false},"/home/runner/work/cici/cici/components/MemosList.tsx":{"id":87232,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/home/runner/work/cici/cici/":[],"/home/runner/work/cici/cici/app/layout":["static/css/bf9d0ede562bd061.css","static/css/67e4cfd62ab3f75c.css"],"/home/runner/work/cici/cici/app/page":[],"/home/runner/work/cici/cici/app/unavailable/page":[]}}
|
|
@@ -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/
|
|
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
|
-
"/
|
|
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})}}};
|