@blinkk/root-cms 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +2 -2
- package/dist/plugin.js +2 -2
- package/dist/ui/ui.js +2 -2
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -83,7 +83,7 @@ function convertOneOfTypes(collection) {
|
|
|
83
83
|
// package.json
|
|
84
84
|
var package_default = {
|
|
85
85
|
name: "@blinkk/root-cms",
|
|
86
|
-
version: "2.2.
|
|
86
|
+
version: "2.2.6",
|
|
87
87
|
author: "s@blinkk.com",
|
|
88
88
|
license: "MIT",
|
|
89
89
|
engines: {
|
|
@@ -232,7 +232,7 @@ var package_default = {
|
|
|
232
232
|
yjs: "13.6.27"
|
|
233
233
|
},
|
|
234
234
|
peerDependencies: {
|
|
235
|
-
"@blinkk/root": "2.2.
|
|
235
|
+
"@blinkk/root": "2.2.6",
|
|
236
236
|
"firebase-admin": ">=11",
|
|
237
237
|
"firebase-functions": ">=4",
|
|
238
238
|
preact: ">=10",
|
package/dist/plugin.js
CHANGED
|
@@ -2552,7 +2552,7 @@ function api(server, options) {
|
|
|
2552
2552
|
// package.json
|
|
2553
2553
|
var package_default = {
|
|
2554
2554
|
name: "@blinkk/root-cms",
|
|
2555
|
-
version: "2.2.
|
|
2555
|
+
version: "2.2.6",
|
|
2556
2556
|
author: "s@blinkk.com",
|
|
2557
2557
|
license: "MIT",
|
|
2558
2558
|
engines: {
|
|
@@ -2701,7 +2701,7 @@ var package_default = {
|
|
|
2701
2701
|
yjs: "13.6.27"
|
|
2702
2702
|
},
|
|
2703
2703
|
peerDependencies: {
|
|
2704
|
-
"@blinkk/root": "2.2.
|
|
2704
|
+
"@blinkk/root": "2.2.6",
|
|
2705
2705
|
"firebase-admin": ">=11",
|
|
2706
2706
|
"firebase-functions": ">=4",
|
|
2707
2707
|
preact: ">=10",
|
package/dist/ui/ui.js
CHANGED
|
@@ -62,7 +62,7 @@ Content-Type: `+c.contentType+`\r
|
|
|
62
62
|
`));let r=[],o=t.split(/(\n|\r\n)/);o[o.length-1]||o.pop();for(let n=0;n<o.length;n++){let i=o[n];n%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r}Oe();function De(...t){return t.filter(e=>!!e).join(" ")||void 0}xo();xo();var GRe=0,Mkt=Array.isArray;function p(t,e,r,o,n,i){e||(e={});var a,s,l=e;if("ref"in l)for(s in l={},e)s=="ref"?a=e[s]:l[s]=e[s];var c={type:t,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--GRe,__i:-1,__u:0,__source:n,__self:i};if(typeof t=="function"&&(a=t.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return wt.vnode&&wt.vnode(c),c}function RQ(t){let{oldCode:e,newCode:r,className:o=""}=t,n=ve(()=>BM(e,r),[e,r]),i=W(null);V(()=>{if(i.current){let s=i.current.querySelector(".JsDiff__diffLine--added, .JsDiff__diffLine--removed");s&&s.scrollIntoView({behavior:"smooth",block:"center"})}},[e,r]);let a=()=>{let s=[],l=0;return n.forEach((c,u)=>{let d=c.added?"+":c.removed?"-":" ",f=c.value.split(`
|
|
63
63
|
`);f.forEach((m,h)=>{(m.length>0||h<f.length-1)&&s.push(p("div",{className:De("JsDiff__diffLine",c.added&&"JsDiff__diffLine--added",c.removed&&"JsDiff__diffLine--removed",!c.added&&!c.removed&&"JsDiff__diffLine--unchanged"),children:[p("span",{className:"JsDiff__lineNumber",children:++l}),p("span",{className:"JsDiff__lineContent",children:[p("span",{className:"JsDiff__sign",children:d}),p("span",{children:m||" "})]})]},`${u}-${h}`))})}),s};return p("div",{className:De("JsDiff__container",o),children:p("div",{className:"JsDiff__content",ref:i,children:a()})})}var Uee=Fp(zee(),1);var ZM=Uee.default;var KLe={};function eL(t,e){let r=e||KLe,o=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,n=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Hee(t,o,n)}function Hee(t,e,r){if(YLe(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Vee(t.children,e,r)}return Array.isArray(t)?Vee(t,e,r):""}function Vee(t,e,r){let o=[],n=-1;for(;++n<t.length;)o[n]=Hee(t[n],e,r);return o.join("")}function YLe(t){return!!(t&&typeof t=="object")}var jee=document.createElement("i");function vh(t){let e="&"+t+";";jee.innerHTML=e;let r=jee.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function Po(t,e,r,o){let n=t.length,i=0,a;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,r=r>0?r:0,o.length<1e4)a=Array.from(o),a.unshift(e,r),t.splice(...a);else for(r&&t.splice(e,r);i<o.length;)a=o.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function ci(t,e){return t.length>0?(Po(t,t.length,0,e),t):e}var Gee={}.hasOwnProperty;function US(t){let e={},r=-1;for(;++r<t.length;)XLe(e,t[r]);return e}function XLe(t,e){let r;for(r in e){let n=(Gee.call(t,r)?t[r]:void 0)||(t[r]={}),i=e[r],a;if(i)for(a in i){Gee.call(n,a)||(n[a]=[]);let s=i[a];JLe(n[a],Array.isArray(s)?s:s?[s]:[])}}}function JLe(t,e){let r=-1,o=[];for(;++r<e.length;)(e[r].add==="after"?t:o).push(e[r]);Po(t,0,0,o)}function VS(t,e){let r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function jn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var zo=Tu(/[A-Za-z]/),Uo=Tu(/[\dA-Za-z]/),Wee=Tu(/[#-'*+\--9=?A-Z^-~]/);function Pf(t){return t!==null&&(t<32||t===127)}var Uy=Tu(/\d/),qee=Tu(/[\dA-Fa-f]/),Kee=Tu(/[!-/:-@[-`{-~]/);function ke(t){return t!==null&&t<-2}function At(t){return t!==null&&(t<0||t===32)}function st(t){return t===-2||t===-1||t===32}var Of=Tu(/\p{P}|\p{S}/u),nl=Tu(/\s/);function Tu(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function nt(t,e,r,o){let n=o?o-1:Number.POSITIVE_INFINITY,i=0;return a;function a(l){return st(l)?(t.enter(r),s(l)):e(l)}function s(l){return st(l)&&i++<n?(t.consume(l),s):(t.exit(r),e(l))}}var Yee={tokenize:QLe};function QLe(t){let e=t.attempt(this.parser.constructs.contentInitial,o,n),r;return e;function o(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),nt(t,e,"linePrefix")}function n(s){return t.enter("paragraph"),i(s)}function i(s){let l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,a(s)}function a(s){if(s===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(s);return}return ke(s)?(t.consume(s),t.exit("chunkText"),i):(t.consume(s),a)}}var Jee={tokenize:ZLe},Xee={tokenize:e2e};function ZLe(t){let e=this,r=[],o=0,n,i,a;return s;function s(v){if(o<r.length){let C=r[o];return e.containerState=C[1],t.attempt(C[0].continuation,l,c)(v)}return c(v)}function l(v){if(o++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&b();let C=e.events.length,N=C,I;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){I=e.events[N][1].end;break}y(o);let E=C;for(;E<e.events.length;)e.events[E][1].end=Object.assign({},I),E++;return Po(e.events,N+1,0,e.events.slice(C)),e.events.length=E,c(v)}return s(v)}function c(v){if(o===r.length){if(!n)return f(v);if(n.currentConstruct&&n.currentConstruct.concrete)return h(v);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Xee,u,d)(v)}function u(v){return n&&b(),y(o),f(v)}function d(v){return e.parser.lazy[e.now().line]=o!==r.length,a=e.now().offset,h(v)}function f(v){return e.containerState={},t.attempt(Xee,m,h)(v)}function m(v){return o++,r.push([e.currentConstruct,e.containerState]),f(v)}function h(v){if(v===null){n&&b(),y(0),t.consume(v);return}return n=n||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:n}),g(v)}function g(v){if(v===null){_(t.exit("chunkFlow"),!0),y(0),t.consume(v);return}return ke(v)?(t.consume(v),_(t.exit("chunkFlow")),o=0,e.interrupt=void 0,s):(t.consume(v),g)}function _(v,C){let N=e.sliceStream(v);if(C&&N.push(null),v.previous=i,i&&(i.next=v),i=v,n.defineSkip(v.start),n.write(N),e.parser.lazy[v.start.line]){let I=n.events.length;for(;I--;)if(n.events[I][1].start.offset<a&&(!n.events[I][1].end||n.events[I][1].end.offset>a))return;let E=e.events.length,w=E,S,T;for(;w--;)if(e.events[w][0]==="exit"&&e.events[w][1].type==="chunkFlow"){if(S){T=e.events[w][1].end;break}S=!0}for(y(o),I=E;I<e.events.length;)e.events[I][1].end=Object.assign({},T),I++;Po(e.events,w+1,0,e.events.slice(E)),e.events.length=I}}function y(v){let C=r.length;for(;C-- >v;){let N=r[C];e.containerState=N[1],N[0].exit.call(e,t)}r.length=v}function b(){n.write([null]),i=void 0,n=void 0,e.containerState._closeFlow=void 0}}function e2e(t,e,r){return nt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ih(t){if(t===null||At(t)||nl(t))return 1;if(Of(t))return 2}function ku(t,e,r){let o=[],n=-1;for(;++n<t.length;){let i=t[n].resolveAll;i&&!o.includes(i)&&(e=i(e,r),o.push(i))}return e}var Vy={name:"attention",tokenize:r2e,resolveAll:t2e};function t2e(t,e){let r=-1,o,n,i,a,s,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(o=r;o--;)if(t[o][0]==="exit"&&t[o][1].type==="attentionSequence"&&t[o][1]._open&&e.sliceSerialize(t[o][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[o][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[o][1].end.offset-t[o][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[o][1].end.offset-t[o][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let d=Object.assign({},t[o][1].end),f=Object.assign({},t[r][1].start);Qee(d,-l),Qee(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[o][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[r][1].start),end:f},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[o][1].end),end:Object.assign({},t[r][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},a.start),end:Object.assign({},s.end)},t[o][1].end=Object.assign({},a.start),t[r][1].start=Object.assign({},s.end),c=[],t[o][1].end.offset-t[o][1].start.offset&&(c=ci(c,[["enter",t[o][1],e],["exit",t[o][1],e]])),c=ci(c,[["enter",n,e],["enter",a,e],["exit",a,e],["enter",i,e]]),c=ci(c,ku(e.parser.constructs.insideSpan.null,t.slice(o+1,r),e)),c=ci(c,[["exit",i,e],["enter",s,e],["exit",s,e],["exit",n,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=ci(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Po(t,o-1,r-o+3,c),r=o+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function r2e(t,e){let r=this.parser.constructs.attentionMarkers.null,o=this.previous,n=Ih(o),i;return a;function a(l){return i=l,t.enter("attentionSequence"),s(l)}function s(l){if(l===i)return t.consume(l),s;let c=t.exit("attentionSequence"),u=Ih(l),d=!u||u===2&&n||r.includes(l),f=!n||n===2&&u||r.includes(o);return c._open=!!(i===42?d:d&&(n||!f)),c._close=!!(i===42?f:f&&(u||!d)),e(l)}}function Qee(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var tL={name:"autolink",tokenize:o2e};function o2e(t,e,r){let o=0;return n;function n(m){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(m){return zo(m)?(t.consume(m),a):m===64?r(m):c(m)}function a(m){return m===43||m===45||m===46||Uo(m)?(o=1,s(m)):c(m)}function s(m){return m===58?(t.consume(m),o=0,l):(m===43||m===45||m===46||Uo(m))&&o++<32?(t.consume(m),s):(o=0,c(m))}function l(m){return m===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):m===null||m===32||m===60||Pf(m)?r(m):(t.consume(m),l)}function c(m){return m===64?(t.consume(m),u):Wee(m)?(t.consume(m),c):r(m)}function u(m){return Uo(m)?d(m):r(m)}function d(m){return m===46?(t.consume(m),o=0,u):m===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):f(m)}function f(m){if((m===45||Uo(m))&&o++<63){let h=m===45?f:d;return t.consume(m),h}return r(m)}}var il={tokenize:n2e,partial:!0};function n2e(t,e,r){return o;function o(i){return st(i)?nt(t,n,"linePrefix")(i):n(i)}function n(i){return i===null||ke(i)?e(i):r(i)}}var HS={name:"blockQuote",tokenize:i2e,continuation:{tokenize:a2e},exit:s2e};function i2e(t,e,r){let o=this;return n;function n(a){if(a===62){let s=o.containerState;return s.open||(t.enter("blockQuote",{_container:!0}),s.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return r(a)}function i(a){return st(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function a2e(t,e,r){let o=this;return n;function n(a){return st(a)?nt(t,i,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(HS,e,r)(a)}}function s2e(t){t.exit("blockQuote")}var jS={name:"characterEscape",tokenize:l2e};function l2e(t,e,r){return o;function o(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),n}function n(i){return Kee(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(i)}}var GS={name:"characterReference",tokenize:c2e};function c2e(t,e,r){let o=this,n=0,i,a;return s;function s(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),i=31,a=Uo,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=qee,u):(t.enter("characterReferenceValue"),i=7,a=Uy,u(d))}function u(d){if(d===59&&n){let f=t.exit("characterReferenceValue");return a===Uo&&!vh(o.sliceSerialize(f))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(d)&&n++<i?(t.consume(d),u):r(d)}}var Zee={tokenize:d2e,partial:!0},WS={name:"codeFenced",tokenize:u2e,concrete:!0};function u2e(t,e,r){let o=this,n={tokenize:N,partial:!0},i=0,a=0,s;return l;function l(I){return c(I)}function c(I){let E=o.events[o.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,s=I,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(I)}function u(I){return I===s?(a++,t.consume(I),u):a<3?r(I):(t.exit("codeFencedFenceSequence"),st(I)?nt(t,d,"whitespace")(I):d(I))}function d(I){return I===null||ke(I)?(t.exit("codeFencedFence"),o.interrupt?e(I):t.check(Zee,g,C)(I)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(I))}function f(I){return I===null||ke(I)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(I)):st(I)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),nt(t,m,"whitespace")(I)):I===96&&I===s?r(I):(t.consume(I),f)}function m(I){return I===null||ke(I)?d(I):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(I))}function h(I){return I===null||ke(I)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(I)):I===96&&I===s?r(I):(t.consume(I),h)}function g(I){return t.attempt(n,C,_)(I)}function _(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),y}function y(I){return i>0&&st(I)?nt(t,b,"linePrefix",i+1)(I):b(I)}function b(I){return I===null||ke(I)?t.check(Zee,g,C)(I):(t.enter("codeFlowValue"),v(I))}function v(I){return I===null||ke(I)?(t.exit("codeFlowValue"),b(I)):(t.consume(I),v)}function C(I){return t.exit("codeFenced"),e(I)}function N(I,E,w){let S=0;return T;function T($){return I.enter("lineEnding"),I.consume($),I.exit("lineEnding"),A}function A($){return I.enter("codeFencedFence"),st($)?nt(I,R,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):R($)}function R($){return $===s?(I.enter("codeFencedFenceSequence"),P($)):w($)}function P($){return $===s?(S++,I.consume($),P):S>=a?(I.exit("codeFencedFenceSequence"),st($)?nt(I,B,"whitespace")($):B($)):w($)}function B($){return $===null||ke($)?(I.exit("codeFencedFence"),E($)):w($)}}}function d2e(t,e,r){let o=this;return n;function n(a){return a===null?r(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return o.parser.lazy[o.now().line]?r(a):e(a)}}var Hy={name:"codeIndented",tokenize:p2e},f2e={tokenize:m2e,partial:!0};function p2e(t,e,r){let o=this;return n;function n(c){return t.enter("codeIndented"),nt(t,i,"linePrefix",5)(c)}function i(c){let u=o.events[o.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):r(c)}function a(c){return c===null?l(c):ke(c)?t.attempt(f2e,a,l)(c):(t.enter("codeFlowValue"),s(c))}function s(c){return c===null||ke(c)?(t.exit("codeFlowValue"),a(c)):(t.consume(c),s)}function l(c){return t.exit("codeIndented"),e(c)}}function m2e(t,e,r){let o=this;return n;function n(a){return o.parser.lazy[o.now().line]?r(a):ke(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n):nt(t,i,"linePrefix",5)(a)}function i(a){let s=o.events[o.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):ke(a)?n(a):r(a)}}var rL={name:"codeText",tokenize:_2e,resolve:h2e,previous:g2e};function h2e(t){let e=t.length-4,r=3,o,n;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(o=r;++o<e;)if(t[o][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(o=r-1,e++;++o<=e;)n===void 0?o!==e&&t[o][1].type!=="lineEnding"&&(n=o):(o===e||t[o][1].type==="lineEnding")&&(t[n][1].type="codeTextData",o!==n+2&&(t[n][1].end=t[o-1][1].end,t.splice(n+2,o-n-2),e-=o-n-2,o=n+2),n=void 0);return t}function g2e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _2e(t,e,r){let o=this,n=0,i,a;return s;function s(f){return t.enter("codeText"),t.enter("codeTextSequence"),l(f)}function l(f){return f===96?(t.consume(f),n++,l):(t.exit("codeTextSequence"),c(f))}function c(f){return f===null?r(f):f===32?(t.enter("space"),t.consume(f),t.exit("space"),c):f===96?(a=t.enter("codeTextSequence"),i=0,d(f)):ke(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ke(f)?(t.exit("codeTextData"),c(f)):(t.consume(f),u)}function d(f){return f===96?(t.consume(f),i++,d):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(f)):(a.type="codeTextData",u(f))}}var qS=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){let o=r??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(e,o):e>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(e,r,o){let n=r||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return o&&jy(this.left,o),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),jy(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jy(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let r=this.left.splice(e,Number.POSITIVE_INFINITY);jy(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);jy(this.left,r.reverse())}}};function jy(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function KS(t){let e={},r=-1,o,n,i,a,s,l,c,u=new qS(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(o=u.get(r),r&&o[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=o[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(o[0]==="enter")o[1].contentType&&(Object.assign(e,x2e(u,r)),r=e[r],c=!0);else if(o[1]._container){for(i=r,n=void 0;i--&&(a=u.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank");)a[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),a[1].type="lineEnding",n=i);n&&(o[1].end=Object.assign({},u.get(n)[1].start),s=u.slice(n,r),s.unshift(o),u.splice(n,r-n+1,s))}}return Po(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function x2e(t,e){let r=t.get(e)[1],o=t.get(e)[2],n=e-1,i=[],a=r._tokenizer||o.parser[r.contentType](r.start),s=a.events,l=[],c={},u,d,f=-1,m=r,h=0,g=0,_=[g];for(;m;){for(;t.get(++n)[1]!==m;);i.push(n),m._tokenizer||(u=o.sliceStream(m),m.next||u.push(null),d&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=r;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(g=f+1,_.push(g),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):_.pop(),f=_.length;f--;){let y=s.slice(_[f],_[f+1]),b=i.pop();l.push([b,b+y.length-1]),t.splice(b,2,y)}for(l.reverse(),f=-1;++f<l.length;)c[h+l[f][0]]=h+l[f][1],h+=l[f][1]-l[f][0]-1;return c}var oL={tokenize:v2e,resolve:b2e},y2e={tokenize:I2e,partial:!0};function b2e(t){return KS(t),t}function v2e(t,e){let r;return o;function o(s){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),n(s)}function n(s){return s===null?i(s):ke(s)?t.check(y2e,a,i)(s):(t.consume(s),n)}function i(s){return t.exit("chunkContent"),t.exit("content"),e(s)}function a(s){return t.consume(s),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}function I2e(t,e,r){let o=this;return n;function n(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),nt(t,i,"linePrefix")}function i(a){if(a===null||ke(a))return r(a);let s=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):t.interrupt(o.parser.constructs.flow,r,e)(a)}}function YS(t,e,r,o,n,i,a,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(y){return y===60?(t.enter(o),t.enter(n),t.enter(i),t.consume(y),t.exit(i),f):y===null||y===32||y===41||Pf(y)?r(y):(t.enter(o),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),g(y))}function f(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(n),t.exit(o),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(t.exit("chunkString"),t.exit(s),f(y)):y===null||y===60||ke(y)?r(y):(t.consume(y),y===92?h:m)}function h(y){return y===60||y===62||y===92?(t.consume(y),m):m(y)}function g(y){return!u&&(y===null||y===41||At(y))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(o),e(y)):u<c&&y===40?(t.consume(y),u++,g):y===41?(t.consume(y),u--,g):y===null||y===32||y===40||Pf(y)?r(y):(t.consume(y),y===92?_:g)}function _(y){return y===40||y===41||y===92?(t.consume(y),g):g(y)}}function XS(t,e,r,o,n,i){let a=this,s=0,l;return c;function c(m){return t.enter(o),t.enter(n),t.consume(m),t.exit(n),t.enter(i),u}function u(m){return s>999||m===null||m===91||m===93&&!l||m===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?r(m):m===93?(t.exit(i),t.enter(n),t.consume(m),t.exit(n),t.exit(o),e):ke(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||ke(m)||s++>999?(t.exit("chunkString"),u(m)):(t.consume(m),l||(l=!st(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(t.consume(m),s++,d):d(m)}}function JS(t,e,r,o,n,i){let a;return s;function s(f){return f===34||f===39||f===40?(t.enter(o),t.enter(n),t.consume(f),t.exit(n),a=f===40?41:f,l):r(f)}function l(f){return f===a?(t.enter(n),t.consume(f),t.exit(n),t.exit(o),e):(t.enter(i),c(f))}function c(f){return f===a?(t.exit(i),l(a)):f===null?r(f):ke(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),nt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||ke(f)?(t.exit("chunkString"),c(f)):(t.consume(f),f===92?d:u)}function d(f){return f===a||f===92?(t.consume(f),u):u(f)}}function Af(t,e){let r;return o;function o(n){return ke(n)?(t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),r=!0,o):st(n)?nt(t,o,r?"linePrefix":"lineSuffix")(n):e(n)}}var nL={name:"definition",tokenize:E2e},w2e={tokenize:S2e,partial:!0};function E2e(t,e,r){let o=this,n;return i;function i(m){return t.enter("definition"),a(m)}function a(m){return XS.call(o,t,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function s(m){return n=jn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),l):r(m)}function l(m){return At(m)?Af(t,c)(m):c(m)}function c(m){return YS(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return t.attempt(w2e,d,d)(m)}function d(m){return st(m)?nt(t,f,"whitespace")(m):f(m)}function f(m){return m===null||ke(m)?(t.exit("definition"),o.parser.defined.push(n),e(m)):r(m)}}function S2e(t,e,r){return o;function o(s){return At(s)?Af(t,n)(s):r(s)}function n(s){return JS(t,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return st(s)?nt(t,a,"whitespace")(s):a(s)}function a(s){return s===null||ke(s)?e(s):r(s)}}var iL={name:"hardBreakEscape",tokenize:C2e};function C2e(t,e,r){return o;function o(i){return t.enter("hardBreakEscape"),t.consume(i),n}function n(i){return ke(i)?(t.exit("hardBreakEscape"),e(i)):r(i)}}var aL={name:"headingAtx",tokenize:k2e,resolve:T2e};function T2e(t,e){let r=t.length-2,o=3,n,i;return t[o][1].type==="whitespace"&&(o+=2),r-2>o&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(o===r-1||r-4>o&&t[r-2][1].type==="whitespace")&&(r-=o+1===r?2:4),r>o&&(n={type:"atxHeadingText",start:t[o][1].start,end:t[r][1].end},i={type:"chunkText",start:t[o][1].start,end:t[r][1].end,contentType:"text"},Po(t,o,r-o+1,[["enter",n,e],["enter",i,e],["exit",i,e],["exit",n,e]])),t}function k2e(t,e,r){let o=0;return n;function n(u){return t.enter("atxHeading"),i(u)}function i(u){return t.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&o++<6?(t.consume(u),a):u===null||At(u)?(t.exit("atxHeadingSequence"),s(u)):r(u)}function s(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||ke(u)?(t.exit("atxHeading"),e(u)):st(u)?nt(t,s,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||At(u)?(t.exit("atxHeadingText"),s(u)):(t.consume(u),c)}}var ete=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],sL=["pre","script","style","textarea"];var lL={name:"htmlFlow",tokenize:A2e,resolveTo:O2e,concrete:!0},N2e={tokenize:R2e,partial:!0},P2e={tokenize:D2e,partial:!0};function O2e(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function A2e(t,e,r){let o=this,n,i,a,s,l;return c;function c(U){return u(U)}function u(U){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(U),d}function d(U){return U===33?(t.consume(U),f):U===47?(t.consume(U),i=!0,g):U===63?(t.consume(U),n=3,o.interrupt?e:L):zo(U)?(t.consume(U),a=String.fromCharCode(U),_):r(U)}function f(U){return U===45?(t.consume(U),n=2,m):U===91?(t.consume(U),n=5,s=0,h):zo(U)?(t.consume(U),n=4,o.interrupt?e:L):r(U)}function m(U){return U===45?(t.consume(U),o.interrupt?e:L):r(U)}function h(U){let ge="CDATA[";return U===ge.charCodeAt(s++)?(t.consume(U),s===ge.length?o.interrupt?e:R:h):r(U)}function g(U){return zo(U)?(t.consume(U),a=String.fromCharCode(U),_):r(U)}function _(U){if(U===null||U===47||U===62||At(U)){let ge=U===47,Se=a.toLowerCase();return!ge&&!i&&sL.includes(Se)?(n=1,o.interrupt?e(U):R(U)):ete.includes(a.toLowerCase())?(n=6,ge?(t.consume(U),y):o.interrupt?e(U):R(U)):(n=7,o.interrupt&&!o.parser.lazy[o.now().line]?r(U):i?b(U):v(U))}return U===45||Uo(U)?(t.consume(U),a+=String.fromCharCode(U),_):r(U)}function y(U){return U===62?(t.consume(U),o.interrupt?e:R):r(U)}function b(U){return st(U)?(t.consume(U),b):T(U)}function v(U){return U===47?(t.consume(U),T):U===58||U===95||zo(U)?(t.consume(U),C):st(U)?(t.consume(U),v):T(U)}function C(U){return U===45||U===46||U===58||U===95||Uo(U)?(t.consume(U),C):N(U)}function N(U){return U===61?(t.consume(U),I):st(U)?(t.consume(U),N):v(U)}function I(U){return U===null||U===60||U===61||U===62||U===96?r(U):U===34||U===39?(t.consume(U),l=U,E):st(U)?(t.consume(U),I):w(U)}function E(U){return U===l?(t.consume(U),l=null,S):U===null||ke(U)?r(U):(t.consume(U),E)}function w(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||At(U)?N(U):(t.consume(U),w)}function S(U){return U===47||U===62||st(U)?v(U):r(U)}function T(U){return U===62?(t.consume(U),A):r(U)}function A(U){return U===null||ke(U)?R(U):st(U)?(t.consume(U),A):r(U)}function R(U){return U===45&&n===2?(t.consume(U),z):U===60&&n===1?(t.consume(U),H):U===62&&n===4?(t.consume(U),ne):U===63&&n===3?(t.consume(U),L):U===93&&n===5?(t.consume(U),Y):ke(U)&&(n===6||n===7)?(t.exit("htmlFlowData"),t.check(N2e,ae,P)(U)):U===null||ke(U)?(t.exit("htmlFlowData"),P(U)):(t.consume(U),R)}function P(U){return t.check(P2e,B,ae)(U)}function B(U){return t.enter("lineEnding"),t.consume(U),t.exit("lineEnding"),$}function $(U){return U===null||ke(U)?P(U):(t.enter("htmlFlowData"),R(U))}function z(U){return U===45?(t.consume(U),L):R(U)}function H(U){return U===47?(t.consume(U),a="",G):R(U)}function G(U){if(U===62){let ge=a.toLowerCase();return sL.includes(ge)?(t.consume(U),ne):R(U)}return zo(U)&&a.length<8?(t.consume(U),a+=String.fromCharCode(U),G):R(U)}function Y(U){return U===93?(t.consume(U),L):R(U)}function L(U){return U===62?(t.consume(U),ne):U===45&&n===2?(t.consume(U),L):R(U)}function ne(U){return U===null||ke(U)?(t.exit("htmlFlowData"),ae(U)):(t.consume(U),ne)}function ae(U){return t.exit("htmlFlow"),e(U)}}function D2e(t,e,r){let o=this;return n;function n(a){return ke(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):r(a)}function i(a){return o.parser.lazy[o.now().line]?r(a):e(a)}}function R2e(t,e,r){return o;function o(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),t.attempt(il,e,r)}}var cL={name:"htmlText",tokenize:M2e};function M2e(t,e,r){let o=this,n,i,a;return s;function s(L){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(L),l}function l(L){return L===33?(t.consume(L),c):L===47?(t.consume(L),N):L===63?(t.consume(L),v):zo(L)?(t.consume(L),w):r(L)}function c(L){return L===45?(t.consume(L),u):L===91?(t.consume(L),i=0,h):zo(L)?(t.consume(L),b):r(L)}function u(L){return L===45?(t.consume(L),m):r(L)}function d(L){return L===null?r(L):L===45?(t.consume(L),f):ke(L)?(a=d,H(L)):(t.consume(L),d)}function f(L){return L===45?(t.consume(L),m):d(L)}function m(L){return L===62?z(L):L===45?f(L):d(L)}function h(L){let ne="CDATA[";return L===ne.charCodeAt(i++)?(t.consume(L),i===ne.length?g:h):r(L)}function g(L){return L===null?r(L):L===93?(t.consume(L),_):ke(L)?(a=g,H(L)):(t.consume(L),g)}function _(L){return L===93?(t.consume(L),y):g(L)}function y(L){return L===62?z(L):L===93?(t.consume(L),y):g(L)}function b(L){return L===null||L===62?z(L):ke(L)?(a=b,H(L)):(t.consume(L),b)}function v(L){return L===null?r(L):L===63?(t.consume(L),C):ke(L)?(a=v,H(L)):(t.consume(L),v)}function C(L){return L===62?z(L):v(L)}function N(L){return zo(L)?(t.consume(L),I):r(L)}function I(L){return L===45||Uo(L)?(t.consume(L),I):E(L)}function E(L){return ke(L)?(a=E,H(L)):st(L)?(t.consume(L),E):z(L)}function w(L){return L===45||Uo(L)?(t.consume(L),w):L===47||L===62||At(L)?S(L):r(L)}function S(L){return L===47?(t.consume(L),z):L===58||L===95||zo(L)?(t.consume(L),T):ke(L)?(a=S,H(L)):st(L)?(t.consume(L),S):z(L)}function T(L){return L===45||L===46||L===58||L===95||Uo(L)?(t.consume(L),T):A(L)}function A(L){return L===61?(t.consume(L),R):ke(L)?(a=A,H(L)):st(L)?(t.consume(L),A):S(L)}function R(L){return L===null||L===60||L===61||L===62||L===96?r(L):L===34||L===39?(t.consume(L),n=L,P):ke(L)?(a=R,H(L)):st(L)?(t.consume(L),R):(t.consume(L),B)}function P(L){return L===n?(t.consume(L),n=void 0,$):L===null?r(L):ke(L)?(a=P,H(L)):(t.consume(L),P)}function B(L){return L===null||L===34||L===39||L===60||L===61||L===96?r(L):L===47||L===62||At(L)?S(L):(t.consume(L),B)}function $(L){return L===47||L===62||At(L)?S(L):r(L)}function z(L){return L===62?(t.consume(L),t.exit("htmlTextData"),t.exit("htmlText"),e):r(L)}function H(L){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),G}function G(L){return st(L)?nt(t,Y,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):Y(L)}function Y(L){return t.enter("htmlTextData"),a(L)}}var Df={name:"labelEnd",tokenize:U2e,resolveTo:z2e,resolveAll:$2e},L2e={tokenize:V2e},F2e={tokenize:H2e},B2e={tokenize:j2e};function $2e(t){let e=-1;for(;++e<t.length;){let r=t[e][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(t.splice(e+1,r.type==="labelImage"?4:2),r.type="data",e++)}return t}function z2e(t,e){let r=t.length,o=0,n,i,a,s;for(;r--;)if(n=t[r][1],i){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;t[r][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(a){if(t[r][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(i=r,n.type!=="labelLink")){o=2;break}}else n.type==="labelEnd"&&(a=r);let l={type:t[i][1].type==="labelLink"?"link":"image",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[i][1].start),end:Object.assign({},t[a][1].end)},u={type:"labelText",start:Object.assign({},t[i+o+2][1].end),end:Object.assign({},t[a-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=ci(s,t.slice(i+1,i+o+3)),s=ci(s,[["enter",u,e]]),s=ci(s,ku(e.parser.constructs.insideSpan.null,t.slice(i+o+4,a-3),e)),s=ci(s,[["exit",u,e],t[a-2],t[a-1],["exit",c,e]]),s=ci(s,t.slice(a+1)),s=ci(s,[["exit",l,e]]),Po(t,i,t.length,s),t}function U2e(t,e,r){let o=this,n=o.events.length,i,a;for(;n--;)if((o.events[n][1].type==="labelImage"||o.events[n][1].type==="labelLink")&&!o.events[n][1]._balanced){i=o.events[n][1];break}return s;function s(f){return i?i._inactive?d(f):(a=o.parser.defined.includes(jn(o.sliceSerialize({start:i.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):r(f)}function l(f){return f===40?t.attempt(L2e,u,a?u:d)(f):f===91?t.attempt(F2e,u,a?c:d)(f):a?u(f):d(f)}function c(f){return t.attempt(B2e,u,d)(f)}function u(f){return e(f)}function d(f){return i._balanced=!0,r(f)}}function V2e(t,e,r){return o;function o(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),n}function n(d){return At(d)?Af(t,i)(d):i(d)}function i(d){return d===41?u(d):YS(t,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return At(d)?Af(t,l)(d):u(d)}function s(d){return r(d)}function l(d){return d===34||d===39||d===40?JS(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return At(d)?Af(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function H2e(t,e,r){let o=this;return n;function n(s){return XS.call(o,t,i,a,"reference","referenceMarker","referenceString")(s)}function i(s){return o.parser.defined.includes(jn(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?e(s):r(s)}function a(s){return r(s)}}function j2e(t,e,r){return o;function o(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),n}function n(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):r(i)}}var uL={name:"labelStartImage",tokenize:G2e,resolveAll:Df.resolveAll};function G2e(t,e,r){let o=this;return n;function n(s){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(s),t.exit("labelImageMarker"),i}function i(s){return s===91?(t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelImage"),a):r(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?r(s):e(s)}}var dL={name:"labelStartLink",tokenize:W2e,resolveAll:Df.resolveAll};function W2e(t,e,r){let o=this;return n;function n(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in o.parser.constructs?r(a):e(a)}}var Gy={name:"lineEnding",tokenize:q2e};function q2e(t,e){return r;function r(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),nt(t,e,"linePrefix")}}var Rf={name:"thematicBreak",tokenize:K2e};function K2e(t,e,r){let o=0,n;return i;function i(c){return t.enter("thematicBreak"),a(c)}function a(c){return n=c,s(c)}function s(c){return c===n?(t.enter("thematicBreakSequence"),l(c)):o>=3&&(c===null||ke(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===n?(t.consume(c),o++,l):(t.exit("thematicBreakSequence"),st(c)?nt(t,s,"whitespace")(c):s(c))}}var Gn={name:"list",tokenize:J2e,continuation:{tokenize:Q2e},exit:eFe},Y2e={tokenize:tFe,partial:!0},X2e={tokenize:Z2e,partial:!0};function J2e(t,e,r){let o=this,n=o.events[o.events.length-1],i=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,a=0;return s;function s(m){let h=o.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!o.containerState.marker||m===o.containerState.marker:Uy(m)){if(o.containerState.type||(o.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check(Rf,r,c)(m):c(m);if(!o.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(m)}return r(m)}function l(m){return Uy(m)&&++a<10?(t.consume(m),l):(!o.interrupt||a<2)&&(o.containerState.marker?m===o.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):r(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||m,t.check(il,o.interrupt?r:u,t.attempt(Y2e,f,d))}function u(m){return o.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return st(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),f):r(m)}function f(m){return o.containerState.size=i+o.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(m)}}function Q2e(t,e,r){let o=this;return o.containerState._closeFlow=void 0,t.check(il,n,i);function n(s){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,nt(t,e,"listItemIndent",o.containerState.size+1)(s)}function i(s){return o.containerState.furtherBlankLines||!st(s)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,a(s)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,t.attempt(X2e,e,a)(s))}function a(s){return o.containerState._closeFlow=!0,o.interrupt=void 0,nt(t,t.attempt(Gn,e,r),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Z2e(t,e,r){let o=this;return nt(t,n,"listItemIndent",o.containerState.size+1);function n(i){let a=o.events[o.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===o.containerState.size?e(i):r(i)}}function eFe(t){t.exit(this.containerState.type)}function tFe(t,e,r){let o=this;return nt(t,n,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(i){let a=o.events[o.events.length-1];return!st(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):r(i)}}var QS={name:"setextUnderline",tokenize:oFe,resolveTo:rFe};function rFe(t,e){let r=t.length,o,n,i;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){o=r;break}t[r][1].type==="paragraph"&&(n=r)}else t[r][1].type==="content"&&t.splice(r,1),!i&&t[r][1].type==="definition"&&(i=r);let a={type:"setextHeading",start:Object.assign({},t[n][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[n][1].type="setextHeadingText",i?(t.splice(n,0,["enter",a,e]),t.splice(i+1,0,["exit",t[o][1],e]),t[o][1].end=Object.assign({},t[i][1].end)):t[o][1]=a,t.push(["exit",a,e]),t}function oFe(t,e,r){let o=this,n;return i;function i(c){let u=o.events.length,d;for(;u--;)if(o.events[u][1].type!=="lineEnding"&&o.events[u][1].type!=="linePrefix"&&o.events[u][1].type!=="content"){d=o.events[u][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||d)?(t.enter("setextHeadingLine"),n=c,a(c)):r(c)}function a(c){return t.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===n?(t.consume(c),s):(t.exit("setextHeadingLineSequence"),st(c)?nt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ke(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var tte={tokenize:nFe};function nFe(t){let e=this,r=t.attempt(il,o,t.attempt(this.parser.constructs.flowInitial,n,nt(t,t.attempt(this.parser.constructs.flow,n,t.attempt(oL,n)),"linePrefix")));return r;function o(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function n(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,r}}var rte={resolveAll:ate()},ote=ite("string"),nte=ite("text");function ite(t){return{tokenize:e,resolveAll:ate(t==="text"?iFe:void 0)};function e(r){let o=this,n=this.parser.constructs[t],i=r.attempt(n,a,s);return a;function a(u){return c(u)?i(u):s(u)}function s(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),i(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let d=n[u],f=-1;if(d)for(;++f<d.length;){let m=d[f];if(!m.previous||m.previous.call(o,o.previous))return!0}return!1}}}function ate(t){return e;function e(r,o){let n=-1,i;for(;++n<=r.length;)i===void 0?r[n]&&r[n][1].type==="data"&&(i=n,n++):(!r[n]||r[n][1].type!=="data")&&(n!==i+2&&(r[i][1].end=r[n-1][1].end,r.splice(i+2,n-i-2),n=i+2),i=void 0);return t?t(r,o):r}}function iFe(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){let o=t[r-1][1],n=e.sliceStream(o),i=n.length,a=-1,s=0,l;for(;i--;){let c=n[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(s){let c={type:r===t.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:o.end.line,column:o.end.column-s,offset:o.end.offset-s,_index:o.start._index+i,_bufferIndex:i?a:o.start._bufferIndex+a},end:Object.assign({},o.end)};o.end=Object.assign({},c.start),o.start.offset===o.end.offset?Object.assign(o,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}function ste(t,e,r){let o=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},i=[],a=[],s=[],l=!0,c={consume:C,enter:N,exit:I,attempt:S(E),check:S(w),interrupt:S(w,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:g,sliceSerialize:h,now:_,defineSkip:y,write:m},d=e.tokenize.call(u,c),f;return e.resolveAll&&i.push(e),u;function m(P){return a=ci(a,P),b(),a[a.length-1]!==null?[]:(T(e,0),u.events=ku(i,u.events,u),u.events)}function h(P,B){return sFe(g(P),B)}function g(P){return aFe(a,P)}function _(){let{line:P,column:B,offset:$,_index:z,_bufferIndex:H}=o;return{line:P,column:B,offset:$,_index:z,_bufferIndex:H}}function y(P){n[P.line]=P.column,R()}function b(){let P;for(;o._index<a.length;){let B=a[o._index];if(typeof B=="string")for(P=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===P&&o._bufferIndex<B.length;)v(B.charCodeAt(o._bufferIndex));else v(B)}}function v(P){l=void 0,f=P,d=d(P)}function C(P){ke(P)?(o.line++,o.column=1,o.offset+=P===-3?2:1,R()):P!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===a[o._index].length&&(o._bufferIndex=-1,o._index++)),u.previous=P,l=!0}function N(P,B){let $=B||{};return $.type=P,$.start=_(),u.events.push(["enter",$,u]),s.push($),$}function I(P){let B=s.pop();return B.end=_(),u.events.push(["exit",B,u]),B}function E(P,B){T(P,B.from)}function w(P,B){B.restore()}function S(P,B){return $;function $(z,H,G){let Y,L,ne,ae;return Array.isArray(z)?ge(z):"tokenize"in z?ge([z]):U(z);function U(Me){return Ce;function Ce(at){let Rt=at!==null&&Me[at],ut=at!==null&&Me.null,ht=[...Array.isArray(Rt)?Rt:Rt?[Rt]:[],...Array.isArray(ut)?ut:ut?[ut]:[]];return ge(ht)(at)}}function ge(Me){return Y=Me,L=0,Me.length===0?G:Se(Me[L])}function Se(Me){return Ce;function Ce(at){return ae=A(),ne=Me,Me.partial||(u.currentConstruct=Me),Me.name&&u.parser.constructs.disable.null.includes(Me.name)?Qe(at):Me.tokenize.call(B?Object.assign(Object.create(u),B):u,c,He,Qe)(at)}}function He(Me){return l=!0,P(ne,ae),H}function Qe(Me){return l=!0,ae.restore(),++L<Y.length?Se(Y[L]):G}}}function T(P,B){P.resolveAll&&!i.includes(P)&&i.push(P),P.resolve&&Po(u.events,B,u.events.length-B,P.resolve(u.events.slice(B),u)),P.resolveTo&&(u.events=P.resolveTo(u.events,u))}function A(){let P=_(),B=u.previous,$=u.currentConstruct,z=u.events.length,H=Array.from(s);return{restore:G,from:z};function G(){o=P,u.previous=B,u.currentConstruct=$,u.events.length=z,s=H,R()}}function R(){o.line in n&&o.column<2&&(o.column=n[o.line],o.offset+=n[o.line]-1)}}function aFe(t,e){let r=e.start._index,o=e.start._bufferIndex,n=e.end._index,i=e.end._bufferIndex,a;if(r===n)a=[t[r].slice(o,i)];else{if(a=t.slice(r,n),o>-1){let s=a[0];typeof s=="string"?a[0]=s.slice(o):a.shift()}i>0&&a.push(t[n].slice(0,i))}return a}function sFe(t,e){let r=-1,o=[],n;for(;++r<t.length;){let i=t[r],a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
64
64
|
`;break}case-3:{a=`\r
|
|
65
|
-
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&n)continue;a=" ";break}default:a=String.fromCharCode(i)}n=i===-2,o.push(a)}return o.join("")}var fL={};nr(fL,{attentionMarkers:()=>hFe,contentInitial:()=>cFe,disable:()=>gFe,document:()=>lFe,flow:()=>dFe,flowInitial:()=>uFe,insideSpan:()=>mFe,string:()=>fFe,text:()=>pFe});var lFe={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:HS},cFe={91:nL},uFe={[-2]:Hy,[-1]:Hy,32:Hy},dFe={35:aL,42:Rf,45:[QS,Rf],60:lL,61:QS,95:Rf,96:WS,126:WS},fFe={38:GS,92:jS},pFe={[-5]:Gy,[-4]:Gy,[-3]:Gy,33:uL,38:GS,42:Vy,60:[tL,cL],91:dL,92:[iL,jS],93:Df,95:Vy,96:rL},mFe={null:[Vy,rte]},hFe={null:[42,95]},gFe={null:[]};function pL(t){let r=US([fL,...(t||{}).extensions||[]]),o={defined:[],lazy:{},constructs:r,content:n(Yee),document:n(Jee),flow:n(tte),string:n(ote),text:n(nte)};return o;function n(i){return a;function a(s){return ste(o,i,s)}}}function mL(t){for(;!KS(t););return t}var lte=/[\0\t\n\r]/g;function hL(){let t=1,e="",r=!0,o;return n;function n(i,a,s){let l=[],c,u,d,f,m;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,e="",r&&(i.charCodeAt(0)===65279&&d++,r=void 0);d<i.length;){if(lte.lastIndex=d,c=lte.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){e=i.slice(d);break}if(m===10&&d===f&&o)l.push(-3),o=void 0;else switch(o&&(l.push(-5),o=void 0),d<f&&(l.push(i.slice(d,f)),t+=f-d),m){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:o=!0,t=1}d=f+1}return s&&(o&&l.push(-5),e&&l.push(e),l.push(null)),l}}var _Fe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cte(t){return t.replace(_Fe,xFe)}function xFe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let n=r.charCodeAt(1),i=n===120||n===88;return VS(r.slice(i?2:1),i?16:10)}return vh(r)||t}function wh(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ute(t.position):"start"in t||"end"in t?ute(t):"line"in t||"column"in t?gL(t):""}function gL(t){return dte(t&&t.line)+":"+dte(t&&t.column)}function ute(t){return gL(t&&t.start)+"-"+gL(t&&t.end)}function dte(t){return t&&typeof t=="number"?t:1}var pte={}.hasOwnProperty;function _L(t,e,r){return typeof e!="string"&&(r=e,e=void 0),yFe(r)(mL(pL(r).document().write(hL()(t,e,!0))))}function yFe(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ut),autolinkProtocol:S,autolinkEmail:S,atxHeading:i(Xr),blockQuote:i(at),characterEscape:S,characterReference:S,codeFenced:i(Rt),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Rt,a),codeText:i(ut,a),codeTextData:S,data:S,codeFlowValue:S,definition:i(ht),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(yt),hardBreakEscape:i(Mt),hardBreakTrailing:i(Mt),htmlFlow:i(be,a),htmlFlowData:S,htmlText:i(be,a),htmlTextData:S,image:i(dn),label:a,link:i(Ut),listItem:i(Ur),listItemValue:f,listOrdered:i(pt,d),listUnordered:i(pt),paragraph:i(Vr),reference:U,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Xr),strong:i(Do),thematicBreak:i(ie)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:Ce,autolinkProtocol:Me,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:He,characterReference:Qe,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:T,codeIndented:l(y),codeText:l($),codeTextData:T,data:T,definition:l(),definitionDestinationString:C,definitionLabelString:b,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(P),htmlFlowData:T,htmlText:l(B),htmlTextData:T,image:l(H),label:Y,labelText:G,lineEnding:A,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ge,resourceDestinationString:L,resourceTitleString:ne,resource:ae,setextHeading:l(w),setextHeadingLineSequence:E,setextHeadingText:I,strong:l(),thematicBreak:l()}};mte(e,(t||{}).mdastExtensions||[]);let r={};return o;function o(j){let Q={type:"root",children:[]},se={stack:[Q],tokenStack:[],config:e,enter:s,exit:c,buffer:a,resume:u,data:r},Ve=[],bt=-1;for(;++bt<j.length;)if(j[bt][1].type==="listOrdered"||j[bt][1].type==="listUnordered")if(j[bt][0]==="enter")Ve.push(bt);else{let Nt=Ve.pop();bt=n(j,Nt,bt)}for(bt=-1;++bt<j.length;){let Nt=e[j[bt][0]];pte.call(Nt,j[bt][1].type)&&Nt[j[bt][1].type].call(Object.assign({sliceSerialize:j[bt][2].sliceSerialize},se),j[bt][1])}if(se.tokenStack.length>0){let Nt=se.tokenStack[se.tokenStack.length-1];(Nt[1]||fte).call(se,void 0,Nt[0])}for(Q.position={start:Nu(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Nu(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},bt=-1;++bt<e.transforms.length;)Q=e.transforms[bt](Q)||Q;return Q}function n(j,Q,se){let Ve=Q-1,bt=-1,Nt=!1,Mn,_r,Nr,Xn;for(;++Ve<=se;){let io=j[Ve];switch(io[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{io[0]==="enter"?bt++:bt--,Xn=void 0;break}case"lineEndingBlank":{io[0]==="enter"&&(Mn&&!Xn&&!bt&&!Nr&&(Nr=Ve),Xn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xn=void 0}if(!bt&&io[0]==="enter"&&io[1].type==="listItemPrefix"||bt===-1&&io[0]==="exit"&&(io[1].type==="listUnordered"||io[1].type==="listOrdered")){if(Mn){let fn=Ve;for(_r=void 0;fn--;){let pn=j[fn];if(pn[1].type==="lineEnding"||pn[1].type==="lineEndingBlank"){if(pn[0]==="exit")continue;_r&&(j[_r][1].type="lineEndingBlank",Nt=!0),pn[1].type="lineEnding",_r=fn}else if(!(pn[1].type==="linePrefix"||pn[1].type==="blockQuotePrefix"||pn[1].type==="blockQuotePrefixWhitespace"||pn[1].type==="blockQuoteMarker"||pn[1].type==="listItemIndent"))break}Nr&&(!_r||Nr<_r)&&(Mn._spread=!0),Mn.end=Object.assign({},_r?j[_r][1].start:io[1].end),j.splice(_r||Ve,0,["exit",Mn,io[2]]),Ve++,se++}if(io[1].type==="listItemPrefix"){let fn={type:"listItem",_spread:!1,start:Object.assign({},io[1].start),end:void 0};Mn=fn,j.splice(Ve,0,["enter",fn,io[2]]),Ve++,se++,Nr=void 0,Xn=!0}}}return j[Q][1]._spread=Nt,se}function i(j,Q){return se;function se(Ve){s.call(this,j(Ve),Ve),Q&&Q.call(this,Ve)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(j,Q,se){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([Q,se]),j.position={start:Nu(Q.start),end:void 0}}function l(j){return Q;function Q(se){j&&j.call(this,se),c.call(this,se)}}function c(j,Q){let se=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==j.type&&(Q?Q.call(this,j,Ve[0]):(Ve[1]||fte).call(this,j,Ve[0]));else throw new Error("Cannot close `"+j.type+"` ("+wh({start:j.start,end:j.end})+"): it\u2019s not open");se.position.end=Nu(j.end)}function u(){return eL(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(j){if(this.data.expectingFirstListItemValue){let Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function m(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=j}function h(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=j}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/(\r?\n|\r)$/g,"")}function b(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase()}function v(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function C(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function N(j){let Q=this.stack[this.stack.length-1];if(!Q.depth){let se=this.sliceSerialize(j).length;Q.depth=se}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function E(j){let Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function S(j){let se=this.stack[this.stack.length-1].children,Ve=se[se.length-1];(!Ve||Ve.type!=="text")&&(Ve=Fe(),Ve.position={start:Nu(j.start),end:void 0},se.push(Ve)),this.stack.push(Ve)}function T(j){let Q=this.stack.pop();Q.value+=this.sliceSerialize(j),Q.position.end=Nu(j.end)}function A(j){let Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){let se=Q.children[Q.children.length-1];se.position.end=Nu(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Q.type)&&(S.call(this,j),T.call(this,j))}function R(){this.data.atHardBreak=!0}function P(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function B(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function $(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function z(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function H(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function G(j){let Q=this.sliceSerialize(j),se=this.stack[this.stack.length-2];se.label=cte(Q),se.identifier=jn(Q).toLowerCase()}function Y(){let j=this.stack[this.stack.length-1],Q=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){let Ve=j.children;se.children=Ve}else se.alt=Q}function L(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function ne(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function ae(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ge(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function Se(j){this.data.characterReferenceType=j.type}function He(j){let Q=this.sliceSerialize(j),se=this.data.characterReferenceType,Ve;se?(Ve=VS(Q,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=vh(Q);let bt=this.stack[this.stack.length-1];bt.value+=Ve}function Qe(j){let Q=this.stack.pop();Q.position.end=Nu(j.end)}function Me(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(j)}function Ce(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(j)}function at(){return{type:"blockquote",children:[]}}function Rt(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function yt(){return{type:"emphasis",children:[]}}function Xr(){return{type:"heading",depth:0,children:[]}}function Mt(){return{type:"break"}}function be(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function Ut(){return{type:"link",title:null,url:"",children:[]}}function pt(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function Ur(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Do(){return{type:"strong",children:[]}}function Fe(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}function Nu(t){return{line:t.line,column:t.column,offset:t.offset}}function mte(t,e){let r=-1;for(;++r<e.length;){let o=e[r];Array.isArray(o)?mte(t,o):bFe(t,o)}}function bFe(t,e){let r;for(r in e)if(pte.call(e,r))switch(r){case"canContainEols":{let o=e[r];o&&t[r].push(...o);break}case"transforms":{let o=e[r];o&&t[r].push(...o);break}case"enter":case"exit":{let o=e[r];o&&Object.assign(t[r],o);break}}}function fte(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+wh({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is still open")}function xL(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let o=0,n=r.indexOf(e);for(;n!==-1;)o++,n=r.indexOf(e,n+e.length);return o}function yL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Eh=(function(t){if(t==null)return EFe;if(typeof t=="function")return ZS(t);if(typeof t=="object")return Array.isArray(t)?vFe(t):IFe(t);if(typeof t=="string")return wFe(t);throw new Error("Expected function, string, or object as test")});function vFe(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Eh(t[r]);return ZS(o);function o(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function IFe(t){let e=t;return ZS(r);function r(o){let n=o,i;for(i in t)if(n[i]!==e[i])return!1;return!0}}function wFe(t){return ZS(e);function e(r){return r&&r.type===t}}function ZS(t){return e;function e(r,o,n){return!!(SFe(r)&&t.call(this,r,typeof o=="number"?o:void 0,n||void 0))}}function EFe(){return!0}function SFe(t){return t!==null&&typeof t=="object"&&"type"in t}var hte=[],gte=!0,bL=!1,_te="skip";function vL(t,e,r,o){let n;typeof e=="function"&&typeof r!="function"?(o=r,r=e):n=e;let i=Eh(n),a=o?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=hte,h,g,_;if((!e||i(l,c,u[u.length-1]||void 0))&&(m=CFe(r(l,u)),m[0]===bL))return m;if("children"in l&&l.children){let y=l;if(y.children&&m[0]!==_te)for(g=(o?y.children.length:-1)+a,_=u.concat(y);g>-1&&g<y.children.length;){let b=y.children[g];if(h=s(b,g,_)(),h[0]===bL)return h;g=typeof h[1]=="number"?h[1]:g+a}}return m}}}function CFe(t){return Array.isArray(t)?t:typeof t=="number"?[gte,t]:t==null?hte:[t]}function IL(t,e,r){let n=Eh((r||{}).ignore||[]),i=TFe(e),a=-1;for(;++a<i.length;)vL(t,"text",s);function s(c,u){let d=-1,f;for(;++d<u.length;){let m=u[d],h=f?f.children:void 0;if(n(m,h?h.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){let d=u[u.length-1],f=i[a][0],m=i[a][1],h=0,_=d.children.indexOf(c),y=!1,b=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){let C=v.index,N={index:v.index,input:v.input,stack:[...u,c]},I=m(...v,N);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?f.lastIndex=C+1:(h!==C&&b.push({type:"text",value:c.value.slice(h,C)}),Array.isArray(I)?b.push(...I):I&&b.push(I),h=C+v[0].length,y=!0),!f.global)break;v=f.exec(c.value)}return y?(h<c.value.length&&b.push({type:"text",value:c.value.slice(h)}),d.children.splice(_,1,...b)):b=[c],_+b.length}}function TFe(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!t[0]||Array.isArray(t[0])?t:[t],o=-1;for(;++o<r.length;){let n=r[o];e.push([kFe(n[0]),NFe(n[1])])}return e}function kFe(t){return typeof t=="string"?new RegExp(yL(t),"g"):t}function NFe(t){return typeof t=="function"?t:function(){return t}}function EL(){return{transforms:[MFe],enter:{literalAutolink:PFe,literalAutolinkEmail:wL,literalAutolinkHttp:wL,literalAutolinkWww:wL},exit:{literalAutolink:RFe,literalAutolinkEmail:DFe,literalAutolinkHttp:OFe,literalAutolinkWww:AFe}}}function PFe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function wL(t){this.config.enter.autolinkProtocol.call(this,t)}function OFe(t){this.config.exit.autolinkProtocol.call(this,t)}function AFe(t){this.config.exit.data.call(this,t);let e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function DFe(t){this.config.exit.autolinkEmail.call(this,t)}function RFe(t){this.exit(t)}function MFe(t){IL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LFe],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,FFe]],{ignore:["link","linkReference"]})}function LFe(t,e,r,o,n){let i="";if(!xte(n)||(/^w/i.test(e)&&(r=e+r,e="",i="http://"),!BFe(r)))return!1;let a=$Fe(r+o);if(!a[0])return!1;let s={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function FFe(t,e,r,o){return!xte(o,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function BFe(t){let e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function $Fe(t){let e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],o=r.indexOf(")"),n=xL(t,"("),i=xL(t,")");for(;o!==-1&&n>i;)t+=r.slice(0,o+1),r=r.slice(o+1),o=r.indexOf(")"),i++;return[t,r]}function xte(t,e){let r=t.input.charCodeAt(t.index-1);return(t.index===0||nl(r)||Of(r))&&(!e||r!==47)}YFe.peek=XFe;function SL(){return{enter:{gfmFootnoteDefinition:UFe,gfmFootnoteDefinitionLabelString:VFe,gfmFootnoteCall:GFe,gfmFootnoteCallString:WFe},exit:{gfmFootnoteDefinition:jFe,gfmFootnoteDefinitionLabelString:HFe,gfmFootnoteCall:KFe,gfmFootnoteCallString:qFe}}}function UFe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function VFe(){this.buffer()}function HFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function jFe(t){this.exit(t)}function GFe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function WFe(){this.buffer()}function qFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function KFe(t){this.exit(t)}function YFe(t,e,r,o){let n=r.createTracker(o),i=n.move("[^"),a=r.enter("footnoteReference"),s=r.enter("reference");return i+=n.move(r.safe(r.associationId(t),{...n.current(),before:i,after:"]"})),s(),a(),i+=n.move("]"),i}function XFe(){return"["}eBe.peek=tBe;function CL(){return{canContainEols:["delete"],enter:{strikethrough:QFe},exit:{strikethrough:ZFe}}}function QFe(t){this.enter({type:"delete",children:[]},t)}function ZFe(t){this.exit(t)}function eBe(t,e,r,o){let n=r.createTracker(o),i=r.enter("strikethrough"),a=n.move("~~");return a+=r.containerPhrasing(t,{...n.current(),before:a,after:"~"}),a+=n.move("~~"),i(),a}function tBe(){return"~"}function kL(){return{enter:{table:oBe,tableData:yte,tableHeader:yte,tableRow:iBe},exit:{codeText:aBe,table:nBe,tableData:TL,tableHeader:TL,tableRow:TL}}}function oBe(t){let e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function nBe(t){this.exit(t),this.data.inTable=void 0}function iBe(t){this.enter({type:"tableRow",children:[]},t)}function TL(t){this.exit(t)}function yte(t){this.enter({type:"tableCell",children:[]},t)}function aBe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,sBe));let r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function sBe(t,e){return e==="|"?e:t}function NL(){return{exit:{taskListCheckValueChecked:bte,taskListCheckValueUnchecked:bte,paragraph:cBe}}}function bte(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function cBe(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let o=r.children[0];if(o&&o.type==="text"){let n=e.children,i=-1,a;for(;++i<n.length;){let s=n[i];if(s.type==="paragraph"){a=s;break}}a===r&&(o.value=o.value.slice(1),o.value.length===0?r.children.shift():r.position&&o.position&&typeof o.position.start.offset=="number"&&(o.position.start.column++,o.position.start.offset++,r.position.start=Object.assign({},o.position.start)))}}this.exit(t)}function PL(){return[EL(),SL(),CL(),kL(),NL()]}var dBe={tokenize:gBe,partial:!0},vte={tokenize:_Be,partial:!0},Ite={tokenize:xBe,partial:!0},wte={tokenize:yBe,partial:!0},fBe={tokenize:bBe,partial:!0},Ete={tokenize:mBe,previous:Cte},Ste={tokenize:hBe,previous:Tte},sc={tokenize:pBe,previous:kte},al={};function AL(){return{text:al}}var Mf=48;for(;Mf<123;)al[Mf]=sc,Mf++,Mf===58?Mf=65:Mf===91&&(Mf=97);al[43]=sc;al[45]=sc;al[46]=sc;al[95]=sc;al[72]=[sc,Ste];al[104]=[sc,Ste];al[87]=[sc,Ete];al[119]=[sc,Ete];function pBe(t,e,r){let o=this,n,i;return a;function a(d){return!OL(d)||!kte.call(o,o.previous)||DL(o.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),s(d))}function s(d){return OL(d)?(t.consume(d),s):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(fBe,u,c)(d):d===45||d===95||Uo(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),n=!0,l}function u(d){return i&&n&&zo(o.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function mBe(t,e,r){let o=this;return n;function n(a){return a!==87&&a!==119||!Cte.call(o,o.previous)||DL(o.events)?r(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(dBe,t.attempt(vte,t.attempt(Ite,i),r),r)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function hBe(t,e,r){let o=this,n="",i=!1;return a;function a(d){return(d===72||d===104)&&Tte.call(o,o.previous)&&!DL(o.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),n+=String.fromCodePoint(d),t.consume(d),s):r(d)}function s(d){if(zo(d)&&n.length<5)return n+=String.fromCodePoint(d),t.consume(d),s;if(d===58){let f=n.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):r(d)}function c(d){return d===null||Pf(d)||At(d)||nl(d)||Of(d)?r(d):t.attempt(vte,t.attempt(Ite,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function gBe(t,e,r){let o=0;return n;function n(a){return(a===87||a===119)&&o<3?(o++,t.consume(a),n):a===46&&o===3?(t.consume(a),i):r(a)}function i(a){return a===null?r(a):e(a)}}function _Be(t,e,r){let o,n,i;return a;function a(c){return c===46||c===95?t.check(wte,l,s)(c):c===null||At(c)||nl(c)||c!==45&&Of(c)?l(c):(i=!0,t.consume(c),a)}function s(c){return c===95?o=!0:(n=o,o=void 0),t.consume(c),a}function l(c){return n||o||!i?r(c):e(c)}}function xBe(t,e){let r=0,o=0;return n;function n(a){return a===40?(r++,t.consume(a),n):a===41&&o<r?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(wte,e,i)(a):a===null||At(a)||nl(a)?e(a):(t.consume(a),n)}function i(a){return a===41&&o++,t.consume(a),n}}function yBe(t,e,r){return o;function o(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(t.consume(s),o):s===38?(t.consume(s),i):s===93?(t.consume(s),n):s===60||s===null||At(s)||nl(s)?e(s):r(s)}function n(s){return s===null||s===40||s===91||At(s)||nl(s)?e(s):o(s)}function i(s){return zo(s)?a(s):r(s)}function a(s){return s===59?(t.consume(s),o):zo(s)?(t.consume(s),a):r(s)}}function bBe(t,e,r){return o;function o(i){return t.consume(i),n}function n(i){return Uo(i)?r(i):e(i)}}function Cte(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||At(t)}function Tte(t){return!zo(t)}function kte(t){return!(t===47||OL(t))}function OL(t){return t===43||t===45||t===46||t===95||Uo(t)}function DL(t){let e=t.length,r=!1;for(;e--;){let o=t[e][1];if((o.type==="labelLink"||o.type==="labelImage")&&!o._balanced){r=!0;break}if(o._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}var vBe={tokenize:kBe,partial:!0};function RL(){return{document:{91:{tokenize:SBe,continuation:{tokenize:CBe},exit:TBe}},text:{91:{tokenize:EBe},93:{add:"after",tokenize:IBe,resolveTo:wBe}}}}function IBe(t,e,r){let o=this,n=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),a;for(;n--;){let l=o.events[n][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return r(l);let c=jn(o.sliceSerialize({start:a.end,end:o.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function wBe(t,e){let r=t.length,o;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){o=t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...l),t}function EBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i=0,a;return s;function s(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!a||d===null||d===91||At(d))return r(d);if(d===93){t.exit("chunkString");let f=t.exit("gfmFootnoteCallString");return n.includes(jn(o.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return At(d)||(a=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function SBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i,a=0,s;return l;function l(h){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(h)}function u(h){if(a>999||h===93&&!s||h===null||h===91||At(h))return r(h);if(h===93){t.exit("chunkString");let g=t.exit("gfmFootnoteDefinitionLabelString");return i=jn(o.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return At(h)||(s=!0),a++,t.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(t.consume(h),a++,u):u(h)}function f(h){return h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),n.includes(i)||n.push(i),nt(t,m,"gfmFootnoteDefinitionWhitespace")):r(h)}function m(h){return e(h)}}function CBe(t,e,r){return t.check(il,e,t.attempt(vBe,e,r))}function TBe(t){t.exit("gfmFootnoteDefinition")}function kBe(t,e,r){let o=this;return nt(t,n,"gfmFootnoteDefinitionIndent",5);function n(i){let a=o.events[o.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):r(i)}}function ML(t){let r=(t||{}).singleTilde,o={tokenize:i,resolveAll:n};return r==null&&(r=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function n(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",d,s]],m=s.parser.constructs.insideSpan.null;m&&Po(f,f.length,0,ku(m,a.slice(c+1,l),s)),Po(f,f.length,0,[["exit",d,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",u,s]]),Po(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,s,l){let c=this.previous,u=this.events,d=0;return f;function f(h){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),m(h))}function m(h){let g=Ih(c);if(h===126)return d>1?l(h):(a.consume(h),d++,m);if(d<2&&!r)return l(h);let _=a.exit("strikethroughSequenceTemporary"),y=Ih(h);return _._open=!y||y===2&&!!g,_._close=!g||g===2&&!!y,s(h)}}}var eC=class{constructor(){this.map=[]}add(e,r,o){NBe(this,e,r,o)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length,o=[];for(;r>0;)r-=1,o.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];o.push([...e]),e.length=0;let n=o.pop();for(;n;)e.push(...n),n=o.pop();this.map.length=0}};function NBe(t,e,r,o){let n=0;if(!(r===0&&o.length===0)){for(;n<t.map.length;){if(t.map[n][0]===e){t.map[n][1]+=r,t.map[n][2].push(...o);return}n+=1}t.map.push([e,r,o])}}function Nte(t,e){let r=!1,o=[];for(;e<t.length;){let n=t[e];if(r){if(n[0]==="enter")n[1].type==="tableContent"&&o.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(n[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let i=o.length-1;o[i]=o[i]==="left"?"center":"right"}}else if(n[1].type==="tableDelimiterRow")break}else n[0]==="enter"&&n[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return o}function LL(){return{flow:{null:{tokenize:PBe,resolveAll:OBe}}}}function PBe(t,e,r){let o=this,n=0,i=0,a;return s;function s(T){let A=o.events.length-1;for(;A>-1;){let B=o.events[A][1].type;if(B==="lineEnding"||B==="linePrefix")A--;else break}let R=A>-1?o.events[A][1].type:null,P=R==="tableHead"||R==="tableRow"?I:l;return P===I&&o.parser.lazy[o.now().line]?r(T):P(T)}function l(T){return t.enter("tableHead"),t.enter("tableRow"),c(T)}function c(T){return T===124||(a=!0,i+=1),u(T)}function u(T){return T===null?r(T):ke(T)?i>1?(i=0,o.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),m):r(T):st(T)?nt(t,u,"whitespace")(T):(i+=1,a&&(a=!1,n+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),a=!0,u):(t.enter("data"),d(T)))}function d(T){return T===null||T===124||At(T)?(t.exit("data"),u(T)):(t.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(t.consume(T),d):d(T)}function m(T){return o.interrupt=!1,o.parser.lazy[o.now().line]?r(T):(t.enter("tableDelimiterRow"),a=!1,st(T)?nt(t,h,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):h(T))}function h(T){return T===45||T===58?_(T):T===124?(a=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),g):N(T)}function g(T){return st(T)?nt(t,_,"whitespace")(T):_(T)}function _(T){return T===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),y):T===45?(i+=1,y(T)):T===null||ke(T)?C(T):N(T)}function y(T){return T===45?(t.enter("tableDelimiterFiller"),b(T)):N(T)}function b(T){return T===45?(t.consume(T),b):T===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(T))}function v(T){return st(T)?nt(t,C,"whitespace")(T):C(T)}function C(T){return T===124?h(T):T===null||ke(T)?!a||n!==i?N(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(T)):N(T)}function N(T){return r(T)}function I(T){return t.enter("tableRow"),E(T)}function E(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),E):T===null||ke(T)?(t.exit("tableRow"),e(T)):st(T)?nt(t,E,"whitespace")(T):(t.enter("data"),w(T))}function w(T){return T===null||T===124||At(T)?(t.exit("data"),E(T)):(t.consume(T),T===92?S:w)}function S(T){return T===92||T===124?(t.consume(T),w):w(T)}}function OBe(t,e){let r=-1,o=!0,n=0,i=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,u,d,f=new eC;for(;++r<t.length;){let m=t[r],h=m[1];m[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(Pte(f,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",c,e]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(o=!0,d=void 0,i=[0,0,0,0],a=[0,r+1,0,0],s&&(s=!1,u={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",u,e]])),n=h.type==="tableDelimiterRow"?2:u?3:1):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(o=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d),i=[0,0,0,0]),a[2]=r)):h.type==="tableCellDivider"&&(o?o=!1:(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d)),i=a,a=[i[1],r,0,0])):h.type==="tableHead"?(s=!0,l=r):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=r,i[1]!==0?(a[0]=a[1],d=tC(f,e,i,n,r,d)):a[1]!==0&&(d=tC(f,e,a,n,r,d)),n=0):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=r)}for(l!==0&&Pte(f,e,l,c,u),f.consume(e.events),r=-1;++r<e.events.length;){let m=e.events[r];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=Nte(e.events,r))}return t}function tC(t,e,r,o,n,i){let a=o===1?"tableHeader":o===2?"tableDelimiter":"tableData",s="tableContent";r[0]!==0&&(i.end=Object.assign({},Sh(e.events,r[0])),t.add(r[0],0,[["exit",i,e]]));let l=Sh(e.events,r[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",i,e]]),r[2]!==0){let c=Sh(e.events,r[2]),u=Sh(e.events,r[3]),d={type:s,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),o!==2){let f=e.events[r[2]],m=e.events[r[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){let h=r[2]+1,g=r[3]-r[2]-1;t.add(h,g,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return n!==void 0&&(i.end=Object.assign({},Sh(e.events,n)),t.add(n,0,[["exit",i,e]]),i=void 0),i}function Pte(t,e,r,o,n){let i=[],a=Sh(e.events,r);n&&(n.end=Object.assign({},a),i.push(["exit",n,e])),o.end=Object.assign({},a),i.push(["exit",o,e]),t.add(r+1,0,i)}function Sh(t,e){let r=t[e],o=r[0]==="enter"?"start":"end";return r[1][o]}var ABe={tokenize:DBe};function FL(){return{text:{91:ABe}}}function DBe(t,e,r){let o=this;return n;function n(l){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return At(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),a):r(l)}function a(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),s):r(l)}function s(l){return ke(l)?e(l):st(l)?t.check({tokenize:RBe},e,r)(l):r(l)}}function RBe(t,e,r){return nt(t,o,"whitespace");function o(n){return n===null?r(n):e(n)}}function Ote(t){return US([AL(),RL(),ML(t),LL(),FL()])}Oe();Oe();var Ate=["bmp","gif","ico","jpeg","jpg","png","tiff","webp"],Dte=[...Ate,"svg"],Rte=["mp4","webm"],MBe="https://lh3.googleusercontent.com/";async function Pu(t,e){let r=window.__ROOT_CTX.rootConfig.projectId,o=await UBe(t),n=Ch(t.name),i=e?.preserveFilename?`${o}/${t.name}`:`${o}.${n}`,a=`${r}/uploads/${i}`,s=rQ(window.firebase.storage,a),l=eQ(s,t),c=-1,u=Date.now();return await new Promise((d,f)=>{let m=setInterval(()=>{Date.now()-u>1e4&&(clearInterval(m),f(new Error("Upload stalled: no progress for 10 seconds")))},1e3);l.on("state_changed",h=>{h.bytesTransferred>0&&clearInterval(m),console.log(`uploading ${t.name}: ${h.bytesTransferred} / ${h.totalBytes} bytes`),h.bytesTransferred!==c&&(c=h.bytesTransferred,u=Date.now())},h=>{clearInterval(m),f(h)},()=>{console.log(`uploaded ${a}`),clearInterval(m),d(l.snapshot)})}),LBe(s,t,n,e)}async function LBe(t,e,r,o){let n={};n.filename=e.name,n.uploadedBy=window.firebase.user.email||"unknown",n.uploadedAt=String(Math.floor(new Date().getTime()));let i=`/${t.bucket}/${t.fullPath}`,a=`https://storage.googleapis.com${i}`;if(Dte.includes(r)){let l=await $Be(e);if(n.width=l.width,n.height=l.height,!o?.disableGci&&Ate.includes(r)){let c=await BBe(i);c&&(n.gcsPath=i,a=c)}n.canvasBgColor=await HBe(e)?"dark":"light"}else if(Rte.includes(r)){let l=await zBe(a);n.width=l.width,n.height=l.height,console.log("video dimensions:",l)}let s=o?.cacheControl||"public, max-age=31536000";return await tQ(t,{cacheControl:s,customMetadata:VBe(n)}),console.log("updated meta data: ",n),{...n,src:a}}function Ch(t){return FBe(t.split(".").at(-1)||"")}function FBe(t){let e=String(t).toLowerCase();return e==="jpeg"&&(e="jpg"),e}async function BBe(t){let e=window.__ROOT_CTX.rootConfig.gci;if(!e)return"";let r=new URLSearchParams({gcs:t}),o=`${e}/_/serving_url?${r.toString()}`,n=await window.fetch(o);if(n.status!==200){let a=await n.text();throw console.error(`failed to get gci url: ${o}`),console.error(a),new Error("failed to get gci url")}return(await n.json()).servingUrl}async function $Be(t){return new Promise((e,r)=>{let o=new FileReader;o.onload=()=>{let n=new Image;n.onload=()=>{e({width:n.width,height:n.height})},n.onerror=r,n.src=String(o.result)},o.onerror=r,o.readAsDataURL(t)})}async function zBe(t){return new Promise((e,r)=>{let o=document.createElement("video");o.addEventListener("loadedmetadata",()=>{let n={width:o.videoWidth,height:o.videoHeight};e(n),document.body.removeChild(o)},!1),o.addEventListener("error",()=>{r(new Error("Failed to load video metadata")),document.body.removeChild(o)},!1),o.className="sr-only",o.src=t,o.preload="metadata",document.body.appendChild(o)})}async function UBe(t){let e=await t.arrayBuffer(),r=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}function VBe(t){let e={};return Object.entries(t).forEach(([r,o])=>{t[r]=String(o).trim()}),e}function BL(t){if(!t)return!1;if(rC(t)||t.startsWith("data:image/"))return!0;let e=Ch(t);return Dte.includes(e)}function rC(t){return t?t.startsWith(MBe):!1}function $L(t){if(!t)return!1;let e=Ch(t);return Rte.includes(e)}function Mte(t){return rC(t)?t.split("=")[0]+"=s0-d":t}function HBe(t){return new Promise((e,r)=>{let o=new Image,n=new FileReader;n.onload=()=>{o.src=n.result},o.onload=()=>{let i=document.createElement("canvas"),a=i.getContext("2d");i.width=o.width,i.height=o.height,a.drawImage(o,0,0,i.width,i.height);let{data:s}=a.getImageData(0,0,i.width,i.height),l=0,c=0,u=0,d=0;for(let m=0;m<s.length;m+=400)l+=s[m],c+=s[m+1],u+=s[m+2],d++;let f=.299*(l/d)+.587*(c/d)+.114*(u/d);e(f<128)},o.onerror=r,n.onerror=r,n.readAsDataURL(t)})}function oC(t){let[e,r]=M(""),o=W(null),n=W(null),[i,a]=M(null),[s,l]=M(!1),c=!e;function u(y){return y.endsWith(".jpg")?"image/jpeg":"image/png"}async function d(){if(!e)return;let y=[{type:"text",text:e}];i&&y.push({type:"image",image:{src:i.src,width:i.width,height:i.height,alt:i.filename}});let b=t.chat.addMessage({sender:"user",blocks:y});r(""),a(null),f();let v=[{text:e}];i&&v.push({media:{url:i.src,contentType:u(i.filename)}});let C=await t.chat.sendPrompt(b,v,t.options);t.onData&&C&&t.onData(C)}function f(){window.requestAnimationFrame(()=>{let y=o.current;y.style.height="auto",y.style.height=`${y.scrollHeight}px`})}function m(y){if(y.key==="Enter"&&!y.shiftKey){y.preventDefault(),d();return}}async function h(y){try{l(!0),f();let b=await Pu(y,{disableGci:!0});a({src:b.src,width:b.width,height:b.height,filename:b.filename}),l(!1)}catch{l(!1)}if(n.current){let b=n.current;b.value=""}}function g(y){let C=(y.target.files||[])[0];C&&h(C)}function _(){a(null),f()}return V(()=>{f()},[e]),p("div",{className:"AIPage__ChatBar",children:[p("div",{className:De("AIPage__ChatBar__prompt",(s||i)&&"AIPage__ChatBar__prompt--hasImage"),children:[p("label",{className:"AIPage__ChatBar__prompt__imageUpload",children:[p("input",{className:"AIPage__ChatBar__prompt__imageUpload__input",type:"file",accept:"image/png, image/jpeg, image/webp",onChange:g,ref:n}),p(Te,{label:"Upload image",children:p(Je,{component:"div",className:"AIPage__ChatBar__prompt__imageUpload__icon",radius:"xl",children:p(Ty,{size:18})})})]}),p("textarea",{className:"AIPage__ChatBar__prompt__textInput",ref:o,placeholder:"Enter prompt...",rows:1,onKeyDown:m,onPaste:y=>{let b=y.clipboardData?.items||[];for(let v of b)if(v.kind==="file"&&v.type.startsWith("image/")){let C=v.getAsFile();C&&h(C)}},onChange:y=>{r(y.target.value)},value:e,autofocus:!0}),(s||i)&&p("div",{className:"AIPage__ChatBar__prompt__imagePreview",children:s?p(Ze,{size:"sm"}):p(Te,{label:i.filename,transition:"pop",position:"right",withArrow:!0,children:p("button",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton",onClick:()=>_(),children:[p("img",{src:i.src,width:i.width,height:i.height,alt:"attachment"}),p("div",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton__icon",children:p(Dy,{size:24,color:"white"})})]})})}),p(Je,{className:"AIPage__ChatBar__prompt__submit",variant:"filled",color:"dark",radius:"xl",onClick:()=>d(),disabled:c,children:p(kM,{size:18})})]}),p("div",{className:"AIPage__ChatBar__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var Lte={name:"@blinkk/root-cms",version:"2.2.5",author:"s@blinkk.com",license:"MIT",engines:{node:">=16.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./client":{types:"./dist/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"tsup-node --config=./core/tsup.config.ts","//":"NOTE: esbuild is used here because tsup doesn't currently support aliases.","build:ui":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui --watch",test:"pnpm build && firebase emulators:exec 'vitest run'","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@genkit-ai/ai":"1.18.0","@genkit-ai/core":"1.18.0","@genkit-ai/vertexai":"1.18.0","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","body-parser":"1.20.2",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",genkit:"1.18.0",jsonwebtoken:"9.0.2",kleur:"4.1.5",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"3.23.8"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@mantine/spotlight":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"2.47.0","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1",concurrently:"7.6.0",esbuild:"0.25.9",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",preact:"10.27.1","preact-render-to-string":"6.6.1","preact-router":"4.1.2",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-json-view-compare":"2.0.2",tsup:"8.5.0",typescript:"5.9.2",vite:"7.1.4",vitest:"3.2.4",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"2.2.5","firebase-admin":">=11","firebase-functions":">=4",preact:">=10","preact-render-to-string":">=5"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Fte(){return p("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("g",{"clip-path":"url(#clip0_1_318)",children:[p("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),p("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),p("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),p("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),p("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),p("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),p("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),p("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),p("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),p("defs",{children:p("clipPath",{id:"clip0_1_318",children:p("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}var lc="1.5";function Be(t){return p("div",{className:"Layout",children:[p(Be.Top,{}),p(Be.Side,{}),p(Be.Main,{...t,children:t.children}),p(Be.Bottom,{})]})}Be.Top=()=>{let t=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId;return p("div",{className:"Layout__top",children:[p("a",{className:"Layout__top__logo",href:"/cms",children:p(Fte,{})}),p("div",{className:"Layout__top__version",children:["v",Lte.version]}),p("div",{className:"Layout__top__project",children:t})]})};Be.Side=()=>{let[t]=aQ(),e=t.url.replace(/\/*$/g,""),r=window.firebase.user,o=window.__ROOT_CTX.sidebar?.tools,n=window.__ROOT_CTX.experiments||{};return p("div",{className:"Layout__side",children:[p("div",{className:"Layout__side__buttons",children:[p(Be.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:p(_M,{stroke:lc})}),p(Be.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:p(vf,{stroke:lc})}),p(Be.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:p(mh,{stroke:lc})}),p(Be.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:p(aM,{stroke:lc})}),p(Be.SideButton,{label:"Assets",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:p(yS,{stroke:lc})}),p(Be.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:p(Eu,{stroke:lc})}),n.ai&&p(Be.SideButton,{label:"Root AI (experimental)",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:p(wf,{stroke:lc})}),o&&p(Ne,{children:[p("div",{className:"Layout__side__divider"}),Object.entries(o).map(([i,a])=>p(Be.SideButton,{className:"Layout__side__tool",label:a.label||"",url:`/cms/tools/${i}`,active:e.startsWith(`/cms/tools/${i}`),children:a.icon?p("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):p(eM,{stroke:lc})})),p("div",{className:"Layout__side__divider"})]}),p(Be.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:p(Ef,{stroke:lc})})]}),p("div",{className:"Layout__side__user",children:p(Te,{label:r.email,position:"right",withArrow:!0,children:p(Ca,{src:r.photoURL,alt:r.email,size:30,radius:"xl"})})})]})};Be.SideButton=t=>p(Te,{className:De("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:p("a",{className:De(t.active&&"active"),href:t.url,children:t.children})});Be.Main=t=>p("div",{className:"Layout__main",children:t.children});Be.Bottom=()=>p("div",{className:"Layout__bottom"});function ra(t){t||(t=6);let e=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=r.length;for(let n=0;n<t;n++)e.push(r.charAt(Math.floor(Math.random()*o)));return e.join("")}function Bte(t,e){return Math.random()*(e-t)+t}var GBe=[20,40];ZM.configure({ignoreUnescapedHTML:!0});function $te(){return Bte(...GBe)}function Wy(){let[t,e]=M([]),[r,o]=M(""),n=s=>{let l=0;return e(c=>{let u={sender:"bot",blocks:[{type:"pending"}],key:ra()},d=[...c,{...s,key:ra()},u];return l=d.length-1,d}),l},i=(s,l)=>{e(c=>{let u=[...c];return u[s]={...l,key:ra()},u})};return{chatId:r,messages:t,addMessage:n,updateMessage:i,sendPrompt:async(s,l,c)=>{let u="/cms/api/ai.chat";typeof window.__ROOT_CTX.experiments?.ai=="object"&&window.__ROOT_CTX.experiments.ai.endpoint&&(u=window.__ROOT_CTX.experiments.ai.endpoint);let d={prompt:l,chatId:r,options:c},f=await window.fetch(u,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(d)});if(f.status!==200){let h=await f.text();console.error("chat failed",h);let g=["Something went wrong:","```",h,"```"].join(`
|
|
65
|
+
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&n)continue;a=" ";break}default:a=String.fromCharCode(i)}n=i===-2,o.push(a)}return o.join("")}var fL={};nr(fL,{attentionMarkers:()=>hFe,contentInitial:()=>cFe,disable:()=>gFe,document:()=>lFe,flow:()=>dFe,flowInitial:()=>uFe,insideSpan:()=>mFe,string:()=>fFe,text:()=>pFe});var lFe={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:HS},cFe={91:nL},uFe={[-2]:Hy,[-1]:Hy,32:Hy},dFe={35:aL,42:Rf,45:[QS,Rf],60:lL,61:QS,95:Rf,96:WS,126:WS},fFe={38:GS,92:jS},pFe={[-5]:Gy,[-4]:Gy,[-3]:Gy,33:uL,38:GS,42:Vy,60:[tL,cL],91:dL,92:[iL,jS],93:Df,95:Vy,96:rL},mFe={null:[Vy,rte]},hFe={null:[42,95]},gFe={null:[]};function pL(t){let r=US([fL,...(t||{}).extensions||[]]),o={defined:[],lazy:{},constructs:r,content:n(Yee),document:n(Jee),flow:n(tte),string:n(ote),text:n(nte)};return o;function n(i){return a;function a(s){return ste(o,i,s)}}}function mL(t){for(;!KS(t););return t}var lte=/[\0\t\n\r]/g;function hL(){let t=1,e="",r=!0,o;return n;function n(i,a,s){let l=[],c,u,d,f,m;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,e="",r&&(i.charCodeAt(0)===65279&&d++,r=void 0);d<i.length;){if(lte.lastIndex=d,c=lte.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){e=i.slice(d);break}if(m===10&&d===f&&o)l.push(-3),o=void 0;else switch(o&&(l.push(-5),o=void 0),d<f&&(l.push(i.slice(d,f)),t+=f-d),m){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:o=!0,t=1}d=f+1}return s&&(o&&l.push(-5),e&&l.push(e),l.push(null)),l}}var _Fe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cte(t){return t.replace(_Fe,xFe)}function xFe(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){let n=r.charCodeAt(1),i=n===120||n===88;return VS(r.slice(i?2:1),i?16:10)}return vh(r)||t}function wh(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ute(t.position):"start"in t||"end"in t?ute(t):"line"in t||"column"in t?gL(t):""}function gL(t){return dte(t&&t.line)+":"+dte(t&&t.column)}function ute(t){return gL(t&&t.start)+"-"+gL(t&&t.end)}function dte(t){return t&&typeof t=="number"?t:1}var pte={}.hasOwnProperty;function _L(t,e,r){return typeof e!="string"&&(r=e,e=void 0),yFe(r)(mL(pL(r).document().write(hL()(t,e,!0))))}function yFe(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ut),autolinkProtocol:S,autolinkEmail:S,atxHeading:i(Xr),blockQuote:i(at),characterEscape:S,characterReference:S,codeFenced:i(Rt),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Rt,a),codeText:i(ut,a),codeTextData:S,data:S,codeFlowValue:S,definition:i(ht),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(yt),hardBreakEscape:i(Mt),hardBreakTrailing:i(Mt),htmlFlow:i(be,a),htmlFlowData:S,htmlText:i(be,a),htmlTextData:S,image:i(dn),label:a,link:i(Ut),listItem:i(Ur),listItemValue:f,listOrdered:i(pt,d),listUnordered:i(pt),paragraph:i(Vr),reference:U,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Xr),strong:i(Do),thematicBreak:i(ie)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:Ce,autolinkProtocol:Me,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:He,characterReference:Qe,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:T,codeIndented:l(y),codeText:l($),codeTextData:T,data:T,definition:l(),definitionDestinationString:C,definitionLabelString:b,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(P),htmlFlowData:T,htmlText:l(B),htmlTextData:T,image:l(H),label:Y,labelText:G,lineEnding:A,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ge,resourceDestinationString:L,resourceTitleString:ne,resource:ae,setextHeading:l(w),setextHeadingLineSequence:E,setextHeadingText:I,strong:l(),thematicBreak:l()}};mte(e,(t||{}).mdastExtensions||[]);let r={};return o;function o(j){let Q={type:"root",children:[]},se={stack:[Q],tokenStack:[],config:e,enter:s,exit:c,buffer:a,resume:u,data:r},Ve=[],bt=-1;for(;++bt<j.length;)if(j[bt][1].type==="listOrdered"||j[bt][1].type==="listUnordered")if(j[bt][0]==="enter")Ve.push(bt);else{let Nt=Ve.pop();bt=n(j,Nt,bt)}for(bt=-1;++bt<j.length;){let Nt=e[j[bt][0]];pte.call(Nt,j[bt][1].type)&&Nt[j[bt][1].type].call(Object.assign({sliceSerialize:j[bt][2].sliceSerialize},se),j[bt][1])}if(se.tokenStack.length>0){let Nt=se.tokenStack[se.tokenStack.length-1];(Nt[1]||fte).call(se,void 0,Nt[0])}for(Q.position={start:Nu(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Nu(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},bt=-1;++bt<e.transforms.length;)Q=e.transforms[bt](Q)||Q;return Q}function n(j,Q,se){let Ve=Q-1,bt=-1,Nt=!1,Mn,_r,Nr,Xn;for(;++Ve<=se;){let io=j[Ve];switch(io[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{io[0]==="enter"?bt++:bt--,Xn=void 0;break}case"lineEndingBlank":{io[0]==="enter"&&(Mn&&!Xn&&!bt&&!Nr&&(Nr=Ve),Xn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xn=void 0}if(!bt&&io[0]==="enter"&&io[1].type==="listItemPrefix"||bt===-1&&io[0]==="exit"&&(io[1].type==="listUnordered"||io[1].type==="listOrdered")){if(Mn){let fn=Ve;for(_r=void 0;fn--;){let pn=j[fn];if(pn[1].type==="lineEnding"||pn[1].type==="lineEndingBlank"){if(pn[0]==="exit")continue;_r&&(j[_r][1].type="lineEndingBlank",Nt=!0),pn[1].type="lineEnding",_r=fn}else if(!(pn[1].type==="linePrefix"||pn[1].type==="blockQuotePrefix"||pn[1].type==="blockQuotePrefixWhitespace"||pn[1].type==="blockQuoteMarker"||pn[1].type==="listItemIndent"))break}Nr&&(!_r||Nr<_r)&&(Mn._spread=!0),Mn.end=Object.assign({},_r?j[_r][1].start:io[1].end),j.splice(_r||Ve,0,["exit",Mn,io[2]]),Ve++,se++}if(io[1].type==="listItemPrefix"){let fn={type:"listItem",_spread:!1,start:Object.assign({},io[1].start),end:void 0};Mn=fn,j.splice(Ve,0,["enter",fn,io[2]]),Ve++,se++,Nr=void 0,Xn=!0}}}return j[Q][1]._spread=Nt,se}function i(j,Q){return se;function se(Ve){s.call(this,j(Ve),Ve),Q&&Q.call(this,Ve)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(j,Q,se){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([Q,se]),j.position={start:Nu(Q.start),end:void 0}}function l(j){return Q;function Q(se){j&&j.call(this,se),c.call(this,se)}}function c(j,Q){let se=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==j.type&&(Q?Q.call(this,j,Ve[0]):(Ve[1]||fte).call(this,j,Ve[0]));else throw new Error("Cannot close `"+j.type+"` ("+wh({start:j.start,end:j.end})+"): it\u2019s not open");se.position.end=Nu(j.end)}function u(){return eL(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(j){if(this.data.expectingFirstListItemValue){let Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function m(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=j}function h(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=j}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j.replace(/(\r?\n|\r)$/g,"")}function b(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase()}function v(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function C(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function N(j){let Q=this.stack[this.stack.length-1];if(!Q.depth){let se=this.sliceSerialize(j).length;Q.depth=se}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function E(j){let Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function S(j){let se=this.stack[this.stack.length-1].children,Ve=se[se.length-1];(!Ve||Ve.type!=="text")&&(Ve=Fe(),Ve.position={start:Nu(j.start),end:void 0},se.push(Ve)),this.stack.push(Ve)}function T(j){let Q=this.stack.pop();Q.value+=this.sliceSerialize(j),Q.position.end=Nu(j.end)}function A(j){let Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){let se=Q.children[Q.children.length-1];se.position.end=Nu(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Q.type)&&(S.call(this,j),T.call(this,j))}function R(){this.data.atHardBreak=!0}function P(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function B(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function $(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.value=j}function z(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function H(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let Q=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=Q,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function G(j){let Q=this.sliceSerialize(j),se=this.stack[this.stack.length-2];se.label=cte(Q),se.identifier=jn(Q).toLowerCase()}function Y(){let j=this.stack[this.stack.length-1],Q=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){let Ve=j.children;se.children=Ve}else se.alt=Q}function L(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.url=j}function ne(){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.title=j}function ae(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ge(j){let Q=this.resume(),se=this.stack[this.stack.length-1];se.label=Q,se.identifier=jn(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function Se(j){this.data.characterReferenceType=j.type}function He(j){let Q=this.sliceSerialize(j),se=this.data.characterReferenceType,Ve;se?(Ve=VS(Q,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=vh(Q);let bt=this.stack[this.stack.length-1];bt.value+=Ve}function Qe(j){let Q=this.stack.pop();Q.position.end=Nu(j.end)}function Me(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(j)}function Ce(j){T.call(this,j);let Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(j)}function at(){return{type:"blockquote",children:[]}}function Rt(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function yt(){return{type:"emphasis",children:[]}}function Xr(){return{type:"heading",depth:0,children:[]}}function Mt(){return{type:"break"}}function be(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function Ut(){return{type:"link",title:null,url:"",children:[]}}function pt(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function Ur(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Do(){return{type:"strong",children:[]}}function Fe(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}function Nu(t){return{line:t.line,column:t.column,offset:t.offset}}function mte(t,e){let r=-1;for(;++r<e.length;){let o=e[r];Array.isArray(o)?mte(t,o):bFe(t,o)}}function bFe(t,e){let r;for(r in e)if(pte.call(e,r))switch(r){case"canContainEols":{let o=e[r];o&&t[r].push(...o);break}case"transforms":{let o=e[r];o&&t[r].push(...o);break}case"enter":case"exit":{let o=e[r];o&&Object.assign(t[r],o);break}}}function fte(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+wh({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+wh({start:e.start,end:e.end})+") is still open")}function xL(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let o=0,n=r.indexOf(e);for(;n!==-1;)o++,n=r.indexOf(e,n+e.length);return o}function yL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Eh=(function(t){if(t==null)return EFe;if(typeof t=="function")return ZS(t);if(typeof t=="object")return Array.isArray(t)?vFe(t):IFe(t);if(typeof t=="string")return wFe(t);throw new Error("Expected function, string, or object as test")});function vFe(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Eh(t[r]);return ZS(o);function o(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function IFe(t){let e=t;return ZS(r);function r(o){let n=o,i;for(i in t)if(n[i]!==e[i])return!1;return!0}}function wFe(t){return ZS(e);function e(r){return r&&r.type===t}}function ZS(t){return e;function e(r,o,n){return!!(SFe(r)&&t.call(this,r,typeof o=="number"?o:void 0,n||void 0))}}function EFe(){return!0}function SFe(t){return t!==null&&typeof t=="object"&&"type"in t}var hte=[],gte=!0,bL=!1,_te="skip";function vL(t,e,r,o){let n;typeof e=="function"&&typeof r!="function"?(o=r,r=e):n=e;let i=Eh(n),a=o?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=hte,h,g,_;if((!e||i(l,c,u[u.length-1]||void 0))&&(m=CFe(r(l,u)),m[0]===bL))return m;if("children"in l&&l.children){let y=l;if(y.children&&m[0]!==_te)for(g=(o?y.children.length:-1)+a,_=u.concat(y);g>-1&&g<y.children.length;){let b=y.children[g];if(h=s(b,g,_)(),h[0]===bL)return h;g=typeof h[1]=="number"?h[1]:g+a}}return m}}}function CFe(t){return Array.isArray(t)?t:typeof t=="number"?[gte,t]:t==null?hte:[t]}function IL(t,e,r){let n=Eh((r||{}).ignore||[]),i=TFe(e),a=-1;for(;++a<i.length;)vL(t,"text",s);function s(c,u){let d=-1,f;for(;++d<u.length;){let m=u[d],h=f?f.children:void 0;if(n(m,h?h.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){let d=u[u.length-1],f=i[a][0],m=i[a][1],h=0,_=d.children.indexOf(c),y=!1,b=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){let C=v.index,N={index:v.index,input:v.input,stack:[...u,c]},I=m(...v,N);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?f.lastIndex=C+1:(h!==C&&b.push({type:"text",value:c.value.slice(h,C)}),Array.isArray(I)?b.push(...I):I&&b.push(I),h=C+v[0].length,y=!0),!f.global)break;v=f.exec(c.value)}return y?(h<c.value.length&&b.push({type:"text",value:c.value.slice(h)}),d.children.splice(_,1,...b)):b=[c],_+b.length}}function TFe(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!t[0]||Array.isArray(t[0])?t:[t],o=-1;for(;++o<r.length;){let n=r[o];e.push([kFe(n[0]),NFe(n[1])])}return e}function kFe(t){return typeof t=="string"?new RegExp(yL(t),"g"):t}function NFe(t){return typeof t=="function"?t:function(){return t}}function EL(){return{transforms:[MFe],enter:{literalAutolink:PFe,literalAutolinkEmail:wL,literalAutolinkHttp:wL,literalAutolinkWww:wL},exit:{literalAutolink:RFe,literalAutolinkEmail:DFe,literalAutolinkHttp:OFe,literalAutolinkWww:AFe}}}function PFe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function wL(t){this.config.enter.autolinkProtocol.call(this,t)}function OFe(t){this.config.exit.autolinkProtocol.call(this,t)}function AFe(t){this.config.exit.data.call(this,t);let e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function DFe(t){this.config.exit.autolinkEmail.call(this,t)}function RFe(t){this.exit(t)}function MFe(t){IL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LFe],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,FFe]],{ignore:["link","linkReference"]})}function LFe(t,e,r,o,n){let i="";if(!xte(n)||(/^w/i.test(e)&&(r=e+r,e="",i="http://"),!BFe(r)))return!1;let a=$Fe(r+o);if(!a[0])return!1;let s={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function FFe(t,e,r,o){return!xte(o,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function BFe(t){let e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function $Fe(t){let e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],o=r.indexOf(")"),n=xL(t,"("),i=xL(t,")");for(;o!==-1&&n>i;)t+=r.slice(0,o+1),r=r.slice(o+1),o=r.indexOf(")"),i++;return[t,r]}function xte(t,e){let r=t.input.charCodeAt(t.index-1);return(t.index===0||nl(r)||Of(r))&&(!e||r!==47)}YFe.peek=XFe;function SL(){return{enter:{gfmFootnoteDefinition:UFe,gfmFootnoteDefinitionLabelString:VFe,gfmFootnoteCall:GFe,gfmFootnoteCallString:WFe},exit:{gfmFootnoteDefinition:jFe,gfmFootnoteDefinitionLabelString:HFe,gfmFootnoteCall:KFe,gfmFootnoteCallString:qFe}}}function UFe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function VFe(){this.buffer()}function HFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function jFe(t){this.exit(t)}function GFe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function WFe(){this.buffer()}function qFe(t){let e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.label=e,r.identifier=jn(this.sliceSerialize(t)).toLowerCase()}function KFe(t){this.exit(t)}function YFe(t,e,r,o){let n=r.createTracker(o),i=n.move("[^"),a=r.enter("footnoteReference"),s=r.enter("reference");return i+=n.move(r.safe(r.associationId(t),{...n.current(),before:i,after:"]"})),s(),a(),i+=n.move("]"),i}function XFe(){return"["}eBe.peek=tBe;function CL(){return{canContainEols:["delete"],enter:{strikethrough:QFe},exit:{strikethrough:ZFe}}}function QFe(t){this.enter({type:"delete",children:[]},t)}function ZFe(t){this.exit(t)}function eBe(t,e,r,o){let n=r.createTracker(o),i=r.enter("strikethrough"),a=n.move("~~");return a+=r.containerPhrasing(t,{...n.current(),before:a,after:"~"}),a+=n.move("~~"),i(),a}function tBe(){return"~"}function kL(){return{enter:{table:oBe,tableData:yte,tableHeader:yte,tableRow:iBe},exit:{codeText:aBe,table:nBe,tableData:TL,tableHeader:TL,tableRow:TL}}}function oBe(t){let e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function nBe(t){this.exit(t),this.data.inTable=void 0}function iBe(t){this.enter({type:"tableRow",children:[]},t)}function TL(t){this.exit(t)}function yte(t){this.enter({type:"tableCell",children:[]},t)}function aBe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,sBe));let r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function sBe(t,e){return e==="|"?e:t}function NL(){return{exit:{taskListCheckValueChecked:bte,taskListCheckValueUnchecked:bte,paragraph:cBe}}}function bte(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function cBe(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let o=r.children[0];if(o&&o.type==="text"){let n=e.children,i=-1,a;for(;++i<n.length;){let s=n[i];if(s.type==="paragraph"){a=s;break}}a===r&&(o.value=o.value.slice(1),o.value.length===0?r.children.shift():r.position&&o.position&&typeof o.position.start.offset=="number"&&(o.position.start.column++,o.position.start.offset++,r.position.start=Object.assign({},o.position.start)))}}this.exit(t)}function PL(){return[EL(),SL(),CL(),kL(),NL()]}var dBe={tokenize:gBe,partial:!0},vte={tokenize:_Be,partial:!0},Ite={tokenize:xBe,partial:!0},wte={tokenize:yBe,partial:!0},fBe={tokenize:bBe,partial:!0},Ete={tokenize:mBe,previous:Cte},Ste={tokenize:hBe,previous:Tte},sc={tokenize:pBe,previous:kte},al={};function AL(){return{text:al}}var Mf=48;for(;Mf<123;)al[Mf]=sc,Mf++,Mf===58?Mf=65:Mf===91&&(Mf=97);al[43]=sc;al[45]=sc;al[46]=sc;al[95]=sc;al[72]=[sc,Ste];al[104]=[sc,Ste];al[87]=[sc,Ete];al[119]=[sc,Ete];function pBe(t,e,r){let o=this,n,i;return a;function a(d){return!OL(d)||!kte.call(o,o.previous)||DL(o.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),s(d))}function s(d){return OL(d)?(t.consume(d),s):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(fBe,u,c)(d):d===45||d===95||Uo(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),n=!0,l}function u(d){return i&&n&&zo(o.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function mBe(t,e,r){let o=this;return n;function n(a){return a!==87&&a!==119||!Cte.call(o,o.previous)||DL(o.events)?r(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(dBe,t.attempt(vte,t.attempt(Ite,i),r),r)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function hBe(t,e,r){let o=this,n="",i=!1;return a;function a(d){return(d===72||d===104)&&Tte.call(o,o.previous)&&!DL(o.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),n+=String.fromCodePoint(d),t.consume(d),s):r(d)}function s(d){if(zo(d)&&n.length<5)return n+=String.fromCodePoint(d),t.consume(d),s;if(d===58){let f=n.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):r(d)}function c(d){return d===null||Pf(d)||At(d)||nl(d)||Of(d)?r(d):t.attempt(vte,t.attempt(Ite,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function gBe(t,e,r){let o=0;return n;function n(a){return(a===87||a===119)&&o<3?(o++,t.consume(a),n):a===46&&o===3?(t.consume(a),i):r(a)}function i(a){return a===null?r(a):e(a)}}function _Be(t,e,r){let o,n,i;return a;function a(c){return c===46||c===95?t.check(wte,l,s)(c):c===null||At(c)||nl(c)||c!==45&&Of(c)?l(c):(i=!0,t.consume(c),a)}function s(c){return c===95?o=!0:(n=o,o=void 0),t.consume(c),a}function l(c){return n||o||!i?r(c):e(c)}}function xBe(t,e){let r=0,o=0;return n;function n(a){return a===40?(r++,t.consume(a),n):a===41&&o<r?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(wte,e,i)(a):a===null||At(a)||nl(a)?e(a):(t.consume(a),n)}function i(a){return a===41&&o++,t.consume(a),n}}function yBe(t,e,r){return o;function o(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(t.consume(s),o):s===38?(t.consume(s),i):s===93?(t.consume(s),n):s===60||s===null||At(s)||nl(s)?e(s):r(s)}function n(s){return s===null||s===40||s===91||At(s)||nl(s)?e(s):o(s)}function i(s){return zo(s)?a(s):r(s)}function a(s){return s===59?(t.consume(s),o):zo(s)?(t.consume(s),a):r(s)}}function bBe(t,e,r){return o;function o(i){return t.consume(i),n}function n(i){return Uo(i)?r(i):e(i)}}function Cte(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||At(t)}function Tte(t){return!zo(t)}function kte(t){return!(t===47||OL(t))}function OL(t){return t===43||t===45||t===46||t===95||Uo(t)}function DL(t){let e=t.length,r=!1;for(;e--;){let o=t[e][1];if((o.type==="labelLink"||o.type==="labelImage")&&!o._balanced){r=!0;break}if(o._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}var vBe={tokenize:kBe,partial:!0};function RL(){return{document:{91:{tokenize:SBe,continuation:{tokenize:CBe},exit:TBe}},text:{91:{tokenize:EBe},93:{add:"after",tokenize:IBe,resolveTo:wBe}}}}function IBe(t,e,r){let o=this,n=o.events.length,i=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),a;for(;n--;){let l=o.events[n][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return r(l);let c=jn(o.sliceSerialize({start:a.end,end:o.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function wBe(t,e){let r=t.length,o;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){o=t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";let n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...l),t}function EBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i=0,a;return s;function s(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!a||d===null||d===91||At(d))return r(d);if(d===93){t.exit("chunkString");let f=t.exit("gfmFootnoteCallString");return n.includes(jn(o.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return At(d)||(a=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function SBe(t,e,r){let o=this,n=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),i,a=0,s;return l;function l(h){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(h)}function u(h){if(a>999||h===93&&!s||h===null||h===91||At(h))return r(h);if(h===93){t.exit("chunkString");let g=t.exit("gfmFootnoteDefinitionLabelString");return i=jn(o.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(h),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return At(h)||(s=!0),a++,t.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(t.consume(h),a++,u):u(h)}function f(h){return h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),n.includes(i)||n.push(i),nt(t,m,"gfmFootnoteDefinitionWhitespace")):r(h)}function m(h){return e(h)}}function CBe(t,e,r){return t.check(il,e,t.attempt(vBe,e,r))}function TBe(t){t.exit("gfmFootnoteDefinition")}function kBe(t,e,r){let o=this;return nt(t,n,"gfmFootnoteDefinitionIndent",5);function n(i){let a=o.events[o.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):r(i)}}function ML(t){let r=(t||{}).singleTilde,o={tokenize:i,resolveAll:n};return r==null&&(r=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function n(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",d,s]],m=s.parser.constructs.insideSpan.null;m&&Po(f,f.length,0,ku(m,a.slice(c+1,l),s)),Po(f,f.length,0,[["exit",d,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",u,s]]),Po(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,s,l){let c=this.previous,u=this.events,d=0;return f;function f(h){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),m(h))}function m(h){let g=Ih(c);if(h===126)return d>1?l(h):(a.consume(h),d++,m);if(d<2&&!r)return l(h);let _=a.exit("strikethroughSequenceTemporary"),y=Ih(h);return _._open=!y||y===2&&!!g,_._close=!g||g===2&&!!y,s(h)}}}var eC=class{constructor(){this.map=[]}add(e,r,o){NBe(this,e,r,o)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length,o=[];for(;r>0;)r-=1,o.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];o.push([...e]),e.length=0;let n=o.pop();for(;n;)e.push(...n),n=o.pop();this.map.length=0}};function NBe(t,e,r,o){let n=0;if(!(r===0&&o.length===0)){for(;n<t.map.length;){if(t.map[n][0]===e){t.map[n][1]+=r,t.map[n][2].push(...o);return}n+=1}t.map.push([e,r,o])}}function Nte(t,e){let r=!1,o=[];for(;e<t.length;){let n=t[e];if(r){if(n[0]==="enter")n[1].type==="tableContent"&&o.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(n[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let i=o.length-1;o[i]=o[i]==="left"?"center":"right"}}else if(n[1].type==="tableDelimiterRow")break}else n[0]==="enter"&&n[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return o}function LL(){return{flow:{null:{tokenize:PBe,resolveAll:OBe}}}}function PBe(t,e,r){let o=this,n=0,i=0,a;return s;function s(T){let A=o.events.length-1;for(;A>-1;){let B=o.events[A][1].type;if(B==="lineEnding"||B==="linePrefix")A--;else break}let R=A>-1?o.events[A][1].type:null,P=R==="tableHead"||R==="tableRow"?I:l;return P===I&&o.parser.lazy[o.now().line]?r(T):P(T)}function l(T){return t.enter("tableHead"),t.enter("tableRow"),c(T)}function c(T){return T===124||(a=!0,i+=1),u(T)}function u(T){return T===null?r(T):ke(T)?i>1?(i=0,o.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),m):r(T):st(T)?nt(t,u,"whitespace")(T):(i+=1,a&&(a=!1,n+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),a=!0,u):(t.enter("data"),d(T)))}function d(T){return T===null||T===124||At(T)?(t.exit("data"),u(T)):(t.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(t.consume(T),d):d(T)}function m(T){return o.interrupt=!1,o.parser.lazy[o.now().line]?r(T):(t.enter("tableDelimiterRow"),a=!1,st(T)?nt(t,h,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):h(T))}function h(T){return T===45||T===58?_(T):T===124?(a=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),g):N(T)}function g(T){return st(T)?nt(t,_,"whitespace")(T):_(T)}function _(T){return T===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),y):T===45?(i+=1,y(T)):T===null||ke(T)?C(T):N(T)}function y(T){return T===45?(t.enter("tableDelimiterFiller"),b(T)):N(T)}function b(T){return T===45?(t.consume(T),b):T===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(T))}function v(T){return st(T)?nt(t,C,"whitespace")(T):C(T)}function C(T){return T===124?h(T):T===null||ke(T)?!a||n!==i?N(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(T)):N(T)}function N(T){return r(T)}function I(T){return t.enter("tableRow"),E(T)}function E(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),E):T===null||ke(T)?(t.exit("tableRow"),e(T)):st(T)?nt(t,E,"whitespace")(T):(t.enter("data"),w(T))}function w(T){return T===null||T===124||At(T)?(t.exit("data"),E(T)):(t.consume(T),T===92?S:w)}function S(T){return T===92||T===124?(t.consume(T),w):w(T)}}function OBe(t,e){let r=-1,o=!0,n=0,i=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,u,d,f=new eC;for(;++r<t.length;){let m=t[r],h=m[1];m[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(Pte(f,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",c,e]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(o=!0,d=void 0,i=[0,0,0,0],a=[0,r+1,0,0],s&&(s=!1,u={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},f.add(r,0,[["enter",u,e]])),n=h.type==="tableDelimiterRow"?2:u?3:1):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(o=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d),i=[0,0,0,0]),a[2]=r)):h.type==="tableCellDivider"&&(o?o=!1:(i[1]!==0&&(a[0]=a[1],d=tC(f,e,i,n,void 0,d)),i=a,a=[i[1],r,0,0])):h.type==="tableHead"?(s=!0,l=r):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=r,i[1]!==0?(a[0]=a[1],d=tC(f,e,i,n,r,d)):a[1]!==0&&(d=tC(f,e,a,n,r,d)),n=0):n&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=r)}for(l!==0&&Pte(f,e,l,c,u),f.consume(e.events),r=-1;++r<e.events.length;){let m=e.events[r];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=Nte(e.events,r))}return t}function tC(t,e,r,o,n,i){let a=o===1?"tableHeader":o===2?"tableDelimiter":"tableData",s="tableContent";r[0]!==0&&(i.end=Object.assign({},Sh(e.events,r[0])),t.add(r[0],0,[["exit",i,e]]));let l=Sh(e.events,r[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",i,e]]),r[2]!==0){let c=Sh(e.events,r[2]),u=Sh(e.events,r[3]),d={type:s,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),o!==2){let f=e.events[r[2]],m=e.events[r[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){let h=r[2]+1,g=r[3]-r[2]-1;t.add(h,g,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return n!==void 0&&(i.end=Object.assign({},Sh(e.events,n)),t.add(n,0,[["exit",i,e]]),i=void 0),i}function Pte(t,e,r,o,n){let i=[],a=Sh(e.events,r);n&&(n.end=Object.assign({},a),i.push(["exit",n,e])),o.end=Object.assign({},a),i.push(["exit",o,e]),t.add(r+1,0,i)}function Sh(t,e){let r=t[e],o=r[0]==="enter"?"start":"end";return r[1][o]}var ABe={tokenize:DBe};function FL(){return{text:{91:ABe}}}function DBe(t,e,r){let o=this;return n;function n(l){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return At(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),a):r(l)}function a(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),s):r(l)}function s(l){return ke(l)?e(l):st(l)?t.check({tokenize:RBe},e,r)(l):r(l)}}function RBe(t,e,r){return nt(t,o,"whitespace");function o(n){return n===null?r(n):e(n)}}function Ote(t){return US([AL(),RL(),ML(t),LL(),FL()])}Oe();Oe();var Ate=["bmp","gif","ico","jpeg","jpg","png","tiff","webp"],Dte=[...Ate,"svg"],Rte=["mp4","webm"],MBe="https://lh3.googleusercontent.com/";async function Pu(t,e){let r=window.__ROOT_CTX.rootConfig.projectId,o=await UBe(t),n=Ch(t.name),i=e?.preserveFilename?`${o}/${t.name}`:`${o}.${n}`,a=`${r}/uploads/${i}`,s=rQ(window.firebase.storage,a),l=eQ(s,t),c=-1,u=Date.now();return await new Promise((d,f)=>{let m=setInterval(()=>{Date.now()-u>1e4&&(clearInterval(m),f(new Error("Upload stalled: no progress for 10 seconds")))},1e3);l.on("state_changed",h=>{h.bytesTransferred>0&&clearInterval(m),console.log(`uploading ${t.name}: ${h.bytesTransferred} / ${h.totalBytes} bytes`),h.bytesTransferred!==c&&(c=h.bytesTransferred,u=Date.now())},h=>{clearInterval(m),f(h)},()=>{console.log(`uploaded ${a}`),clearInterval(m),d(l.snapshot)})}),LBe(s,t,n,e)}async function LBe(t,e,r,o){let n={};n.filename=e.name,n.uploadedBy=window.firebase.user.email||"unknown",n.uploadedAt=String(Math.floor(new Date().getTime()));let i=`/${t.bucket}/${t.fullPath}`,a=`https://storage.googleapis.com${i}`;if(Dte.includes(r)){let l=await $Be(e);if(n.width=l.width,n.height=l.height,!o?.disableGci&&Ate.includes(r)){let c=await BBe(i);c&&(n.gcsPath=i,a=c)}n.canvasBgColor=await HBe(e)?"dark":"light"}else if(Rte.includes(r)){let l=await zBe(a);n.width=l.width,n.height=l.height,console.log("video dimensions:",l)}let s=o?.cacheControl||"public, max-age=31536000";return await tQ(t,{cacheControl:s,customMetadata:VBe(n)}),console.log("updated meta data: ",n),{...n,src:a}}function Ch(t){return FBe(t.split(".").at(-1)||"")}function FBe(t){let e=String(t).toLowerCase();return e==="jpeg"&&(e="jpg"),e}async function BBe(t){let e=window.__ROOT_CTX.rootConfig.gci;if(!e)return"";let r=new URLSearchParams({gcs:t}),o=`${e}/_/serving_url?${r.toString()}`,n=await window.fetch(o);if(n.status!==200){let a=await n.text();throw console.error(`failed to get gci url: ${o}`),console.error(a),new Error("failed to get gci url")}return(await n.json()).servingUrl}async function $Be(t){return new Promise((e,r)=>{let o=new FileReader;o.onload=()=>{let n=new Image;n.onload=()=>{e({width:n.width,height:n.height})},n.onerror=r,n.src=String(o.result)},o.onerror=r,o.readAsDataURL(t)})}async function zBe(t){return new Promise((e,r)=>{let o=document.createElement("video");o.addEventListener("loadedmetadata",()=>{let n={width:o.videoWidth,height:o.videoHeight};e(n),document.body.removeChild(o)},!1),o.addEventListener("error",()=>{r(new Error("Failed to load video metadata")),document.body.removeChild(o)},!1),o.className="sr-only",o.src=t,o.preload="metadata",document.body.appendChild(o)})}async function UBe(t){let e=await t.arrayBuffer(),r=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}function VBe(t){let e={};return Object.entries(t).forEach(([r,o])=>{t[r]=String(o).trim()}),e}function BL(t){if(!t)return!1;if(rC(t)||t.startsWith("data:image/"))return!0;let e=Ch(t);return Dte.includes(e)}function rC(t){return t?t.startsWith(MBe):!1}function $L(t){if(!t)return!1;let e=Ch(t);return Rte.includes(e)}function Mte(t){return rC(t)?t.split("=")[0]+"=s0-d":t}function HBe(t){return new Promise((e,r)=>{let o=new Image,n=new FileReader;n.onload=()=>{o.src=n.result},o.onload=()=>{let i=document.createElement("canvas"),a=i.getContext("2d");i.width=o.width,i.height=o.height,a.drawImage(o,0,0,i.width,i.height);let{data:s}=a.getImageData(0,0,i.width,i.height),l=0,c=0,u=0,d=0;for(let m=0;m<s.length;m+=400)l+=s[m],c+=s[m+1],u+=s[m+2],d++;let f=.299*(l/d)+.587*(c/d)+.114*(u/d);e(f<128)},o.onerror=r,n.onerror=r,n.readAsDataURL(t)})}function oC(t){let[e,r]=M(""),o=W(null),n=W(null),[i,a]=M(null),[s,l]=M(!1),c=!e;function u(y){return y.endsWith(".jpg")?"image/jpeg":"image/png"}async function d(){if(!e)return;let y=[{type:"text",text:e}];i&&y.push({type:"image",image:{src:i.src,width:i.width,height:i.height,alt:i.filename}});let b=t.chat.addMessage({sender:"user",blocks:y});r(""),a(null),f();let v=[{text:e}];i&&v.push({media:{url:i.src,contentType:u(i.filename)}});let C=await t.chat.sendPrompt(b,v,t.options);t.onData&&C&&t.onData(C)}function f(){window.requestAnimationFrame(()=>{let y=o.current;y.style.height="auto",y.style.height=`${y.scrollHeight}px`})}function m(y){if(y.key==="Enter"&&!y.shiftKey){y.preventDefault(),d();return}}async function h(y){try{l(!0),f();let b=await Pu(y,{disableGci:!0});a({src:b.src,width:b.width,height:b.height,filename:b.filename}),l(!1)}catch{l(!1)}if(n.current){let b=n.current;b.value=""}}function g(y){let C=(y.target.files||[])[0];C&&h(C)}function _(){a(null),f()}return V(()=>{f()},[e]),p("div",{className:"AIPage__ChatBar",children:[p("div",{className:De("AIPage__ChatBar__prompt",(s||i)&&"AIPage__ChatBar__prompt--hasImage"),children:[p("label",{className:"AIPage__ChatBar__prompt__imageUpload",children:[p("input",{className:"AIPage__ChatBar__prompt__imageUpload__input",type:"file",accept:"image/png, image/jpeg, image/webp",onChange:g,ref:n}),p(Te,{label:"Upload image",children:p(Je,{component:"div",className:"AIPage__ChatBar__prompt__imageUpload__icon",radius:"xl",children:p(Ty,{size:18})})})]}),p("textarea",{className:"AIPage__ChatBar__prompt__textInput",ref:o,placeholder:"Enter prompt...",rows:1,onKeyDown:m,onPaste:y=>{let b=y.clipboardData?.items||[];for(let v of b)if(v.kind==="file"&&v.type.startsWith("image/")){let C=v.getAsFile();C&&h(C)}},onChange:y=>{r(y.target.value)},value:e,autofocus:!0}),(s||i)&&p("div",{className:"AIPage__ChatBar__prompt__imagePreview",children:s?p(Ze,{size:"sm"}):p(Te,{label:i.filename,transition:"pop",position:"right",withArrow:!0,children:p("button",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton",onClick:()=>_(),children:[p("img",{src:i.src,width:i.width,height:i.height,alt:"attachment"}),p("div",{className:"AIPage__ChatBar__prompt__imagePreview__closeButton__icon",children:p(Dy,{size:24,color:"white"})})]})})}),p(Je,{className:"AIPage__ChatBar__prompt__submit",variant:"filled",color:"dark",radius:"xl",onClick:()=>d(),disabled:c,children:p(kM,{size:18})})]}),p("div",{className:"AIPage__ChatBar__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var Lte={name:"@blinkk/root-cms",version:"2.2.6",author:"s@blinkk.com",license:"MIT",engines:{node:">=16.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./client":{types:"./dist/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"tsup-node --config=./core/tsup.config.ts","//":"NOTE: esbuild is used here because tsup doesn't currently support aliases.","build:ui":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui --watch",test:"pnpm build && firebase emulators:exec 'vitest run'","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@genkit-ai/ai":"1.18.0","@genkit-ai/core":"1.18.0","@genkit-ai/vertexai":"1.18.0","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","body-parser":"1.20.2",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",genkit:"1.18.0",jsonwebtoken:"9.0.2",kleur:"4.1.5",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"3.23.8"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@mantine/spotlight":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"2.47.0","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1",concurrently:"7.6.0",esbuild:"0.25.9",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",preact:"10.27.1","preact-render-to-string":"6.6.1","preact-router":"4.1.2",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-json-view-compare":"2.0.2",tsup:"8.5.0",typescript:"5.9.2",vite:"7.1.4",vitest:"3.2.4",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"2.2.6","firebase-admin":">=11","firebase-functions":">=4",preact:">=10","preact-render-to-string":">=5"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Fte(){return p("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("g",{"clip-path":"url(#clip0_1_318)",children:[p("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),p("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),p("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),p("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),p("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),p("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),p("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),p("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),p("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),p("defs",{children:p("clipPath",{id:"clip0_1_318",children:p("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}var lc="1.5";function Be(t){return p("div",{className:"Layout",children:[p(Be.Top,{}),p(Be.Side,{}),p(Be.Main,{...t,children:t.children}),p(Be.Bottom,{})]})}Be.Top=()=>{let t=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId;return p("div",{className:"Layout__top",children:[p("a",{className:"Layout__top__logo",href:"/cms",children:p(Fte,{})}),p("div",{className:"Layout__top__version",children:["v",Lte.version]}),p("div",{className:"Layout__top__project",children:t})]})};Be.Side=()=>{let[t]=aQ(),e=t.url.replace(/\/*$/g,""),r=window.firebase.user,o=window.__ROOT_CTX.sidebar?.tools,n=window.__ROOT_CTX.experiments||{};return p("div",{className:"Layout__side",children:[p("div",{className:"Layout__side__buttons",children:[p(Be.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:p(_M,{stroke:lc})}),p(Be.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:p(vf,{stroke:lc})}),p(Be.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:p(mh,{stroke:lc})}),p(Be.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:p(aM,{stroke:lc})}),p(Be.SideButton,{label:"Assets",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:p(yS,{stroke:lc})}),p(Be.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:p(Eu,{stroke:lc})}),n.ai&&p(Be.SideButton,{label:"Root AI (experimental)",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:p(wf,{stroke:lc})}),o&&p(Ne,{children:[p("div",{className:"Layout__side__divider"}),Object.entries(o).map(([i,a])=>p(Be.SideButton,{className:"Layout__side__tool",label:a.label||"",url:`/cms/tools/${i}`,active:e.startsWith(`/cms/tools/${i}`),children:a.icon?p("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):p(eM,{stroke:lc})})),p("div",{className:"Layout__side__divider"})]}),p(Be.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:p(Ef,{stroke:lc})})]}),p("div",{className:"Layout__side__user",children:p(Te,{label:r.email,position:"right",withArrow:!0,children:p(Ca,{src:r.photoURL,alt:r.email,size:30,radius:"xl"})})})]})};Be.SideButton=t=>p(Te,{className:De("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:p("a",{className:De(t.active&&"active"),href:t.url,children:t.children})});Be.Main=t=>p("div",{className:"Layout__main",children:t.children});Be.Bottom=()=>p("div",{className:"Layout__bottom"});function ra(t){t||(t=6);let e=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=r.length;for(let n=0;n<t;n++)e.push(r.charAt(Math.floor(Math.random()*o)));return e.join("")}function Bte(t,e){return Math.random()*(e-t)+t}var GBe=[20,40];ZM.configure({ignoreUnescapedHTML:!0});function $te(){return Bte(...GBe)}function Wy(){let[t,e]=M([]),[r,o]=M(""),n=s=>{let l=0;return e(c=>{let u={sender:"bot",blocks:[{type:"pending"}],key:ra()},d=[...c,{...s,key:ra()},u];return l=d.length-1,d}),l},i=(s,l)=>{e(c=>{let u=[...c];return u[s]={...l,key:ra()},u})};return{chatId:r,messages:t,addMessage:n,updateMessage:i,sendPrompt:async(s,l,c)=>{let u="/cms/api/ai.chat";typeof window.__ROOT_CTX.experiments?.ai=="object"&&window.__ROOT_CTX.experiments.ai.endpoint&&(u=window.__ROOT_CTX.experiments.ai.endpoint);let d={prompt:l,chatId:r,options:c},f=await window.fetch(u,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(d)});if(f.status!==200){let h=await f.text();console.error("chat failed",h);let g=["Something went wrong:","```",h,"```"].join(`
|
|
66
66
|
`);return i(s,{sender:"bot",blocks:[{type:"text",text:g}]}),{message:g,data:{},error:h}}let m=await f.json();return m.success&&m.chatId?(o(m.chatId),i(s,{sender:"bot",data:m.response?.data||{},blocks:[{type:"text",text:m.response?.message||""}]}),m.response):{message:"Sorry. Something went wrong. An unknown error occurred.",data:{},error:"Unknown error"}}}}function zte(){let t=Wy(),e=window.__ROOT_CTX.experiments?.ai||!1;return p(Be,{children:p("div",{className:"AIPage",children:e?p(Ne,{children:[p(zL,{chat:t,children:p("p",{children:"Chat with me about your website. Ask questions about the content and I can tell you about it."})}),p(oC,{chat:t})]}):p("div",{className:"AIPage__notEnabled",children:[p("div",{className:"AIPage__notEnabled__icon",children:p(wf,{size:36})}),p("div",{className:"AIPage__notEnabled__title",children:"Root AI is not enabled for this project."})]})})})}function zL(t){let e=t.chat.messages;return p("div",{className:"AIPage__ChatWindow",children:e.length>0?p("div",{className:"AIPage__ChatWindow__messages",children:t.chat.messages.map((r,o)=>p(WBe,{message:r},r.key||o))}):p("div",{className:"AIPage__ChatWindow__welcome",children:[p("div",{className:"AIPage__ChatWindow__welcome__icon",children:p(wf,{size:36})}),p("div",{className:"AIPage__ChatWindow__welcome__title",children:"Root AI is ready"}),t.children&&p("div",{className:"AIPage__ChatWindow__welcome__body",children:t.children})]})})}function WBe(t){let e=t.message,r=e.sender==="user"?"You":"Root AI",o=window.firebase.user,n=e.sender==="bot",i=W(null);return V(()=>{e.sender==="user"&&i.current.scrollIntoView({behavior:"smooth",block:"start"})},[]),p("div",{className:"AIPage__ChatMessage",ref:i,children:[p("div",{className:"AIPage__ChatMessage__side",children:p("div",{className:"AIPage__ChatMessage__side__avatar",children:e.sender==="user"?p(Ca,{src:o.photoURL,alt:o.email,size:28,radius:"xl"}):p(wf,{size:28})})}),p("div",{className:"AIPage__ChatMessage__main",children:[p("div",{className:"AIPage__ChatMessage__main__username",children:r}),p("div",{className:"AIPage__ChatMessage__main__blocks",children:p(qBe,{message:e,animated:n})})]})]})}function qBe(t){let e=t.message,[r,o]=M(t.animated?[]:e.blocks);function n(){if(r.length>=e.blocks.length)return;let i=[...r,e.blocks[r.length]];o(i)}return V(()=>{t.animated&&n()},[t.animated]),p("div",{className:"AIPage__ChatMessageBlocks",children:r.map((i,a)=>{let s=`${a}-${i.type}`;return i.type==="image"?p(JBe,{block:i,animated:t.animated,onAnimationComplete:()=>n()},s):i.type==="pending"?p(XBe,{block:i,animated:t.animated,onAnimationComplete:()=>n()},s):i.type==="text"?p(KBe,{block:i,animated:t.animated,onAnimationComplete:()=>n()},s):p("div",{children:["unknown block type: ",i.type]})})})}function Ute(t){let[e,r]=M(t.animated?[]:t.nodes),o=e.length>=t.nodes.length,n=()=>{r(a=>a.length>=t.nodes.length?t.nodes:[...a,t.nodes[a.length]])},i=()=>{if(e.length>=t.nodes.length){t.onAnimationComplete&&t.onAnimationComplete();return}window.setTimeout(()=>n(),$te())};return V(()=>{t.animated&&n()},[]),{nodes:e,next:i,complete:o}}function KBe(t){let e=ve(()=>_L(t.block.text,{extensions:[Ote()],mdastExtensions:[PL()]}),[t.block.text]),{nodes:r,next:o}=Ute({nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete});return p("div",{className:"AIPage__ChatMessageTextBlock",children:r.map((n,i)=>p(Vte,{node:n,animated:t.animated,onAnimationComplete:o},i))})}function Vte(t){let e=t.node;if(e.type==="code")return p(YBe,{text:e.value,language:e.lang,animated:t.animated,onAnimationComplete:t.onAnimationComplete});if(e.type==="heading"){let r=`h${e.depth||2}`;return p(Lf,{as:r,nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete})}if(e.type==="inlineCode")return p(Lf,{as:"code",nodes:[{type:"text",value:e.value}],animated:t.animated,onAnimationComplete:t.onAnimationComplete});if(e.type==="link")return p(Lf,{as:"a",attrs:{href:e.url,target:"_blank"},nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete});if(e.type==="list"){let r=e.ordered?"ol":"ul";return p(Lf,{as:r,nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete})}return e.type==="listItem"?p(Lf,{as:"li",nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):e.type==="paragraph"?p(Lf,{as:"p",nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):e.type==="strong"?p(Lf,{as:"b",nodes:e.children,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):e.type==="text"?p(Hte,{text:e.value,animated:t.animated,onAnimationComplete:t.onAnimationComplete}):p("div",{children:JSON.stringify(t.node)})}function Lf(t){let{nodes:e,next:r}=Ute({nodes:t.nodes,animated:t.animated,onAnimationComplete:t.onAnimationComplete}),o=t.as;return p(o,{...t.attrs,children:e.map((n,i)=>p(Vte,{node:n,animated:t.animated,onAnimationComplete:()=>r()},i))})}function Hte(t){let e=t.sep||" ",r=ve(()=>t.text.split(e),[t.text]),[o,n]=M(t.animated?0:r.length),i=o>=r.length;return V(()=>{if(!t.animated||o>=r.length)return;let a=window.setTimeout(()=>{n(o+1)},$te());return()=>window.clearTimeout(a)},[t.text,o]),V(()=>{i&&t.animated&&t.onAnimationComplete()},[i]),p(Ne,{children:[r.slice(0,o).join(e),!i&&p(jte,{})]})}function YBe(t){let e=W(null),[r,o]=M(!1);function n(){let s=e.current;ZM.highlightElement(s),console.log("highlight:",s)}async function i(){try{await navigator.clipboard.writeText(t.text),o(!0),window.setTimeout(()=>{o(!1)},2e3)}catch(s){console.error("failed to copy to clipboard:",s)}}function a(){n(),t.onAnimationComplete()}return V(()=>{t.animated||n()},[t.animated]),p("div",{className:"AIPage__CodeBlockNode",children:[p("div",{className:"AIPage__CodeBlockNode__header",children:[t.language&&p("div",{className:"AIPage__CodeBlockNode__language",children:t.language}),p(Te,{label:"Copy code",position:"bottom",transition:"pop",children:p(Je,{onClick:()=>i(),size:"xs",children:r?p(oM,{color:"#80868b","stroke-width":1.5,size:16}):p(xy,{color:"#80868b","stroke-width":1.5,size:16})})})]}),p("pre",{ref:e,class:`language-${t.language||"unknown"}`,children:p(Hte,{text:t.text,sep:`
|
|
67
67
|
`,animated:t.animated,onAnimationComplete:a})})]})}function XBe(t){return V(()=>{t.animated&&t.onAnimationComplete()},[]),p("div",{className:"AIPage__PendingMessageBlock",children:p(jte,{})})}function jte(){return p("div",{className:"AIPage__CursorDot"})}function JBe(t){let e=t.block.image;return V(()=>{t.animated&&t.onAnimationComplete()},[]),p("div",{className:"AIPage__ImageMessageBlock",children:p("img",{src:e.src,width:e.width,height:e.height,alt:e.alt})})}function Gte(t){let e=Wy();return p(Ne,{children:[p(zL,{chat:e,children:t.children}),p(oC,{chat:e,options:{mode:"edit",editData:t.editModeData},onData:t.onEditModeResponse})]})}var UL="AiEditModal";function Wte(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(UL,{...e,title:r.title||"Edit with AI (Experimental)",innerProps:r,size:"calc(min(1920px, calc(100% - 96px)))",centered:!0})},close:()=>{t.closeModal(UL)}}}function nC(t){let{innerProps:e,context:r,id:o}=t,n=W(null),i=ve(()=>JSON.stringify(e.data||{},null,2),[e.data]),[a,s]=M(i),l=ve(()=>{if(!a)return null;try{return JSON.parse(a)}catch{return null}},[a]),c=ve(()=>a!==i,[a,i]),u=qe(()=>{if(!l)return;let f=_h(l);e.onSave&&e.onSave(f)},[l]),d=qe(f=>{if(f?.data){let m=JSON.stringify(f.data,null,2);s(m),n.current?.click()}},[]);return p("div",{className:"AiEditModal",children:[p("div",{className:"AiEditModal__SplitPanel",children:[p("div",{className:"AiEditModal__SplitPanel__ChatPanel",children:p(Gte,{editModeData:l,onEditModeResponse:d,children:[p("p",{children:"Tell me what you want to change. I can make simple text edits, replace content within a module, or answer questions about the content."}),p("p",{children:"Just enter simple instructions, or attach a screenshot and ask me to use it as reference."})]})}),p("div",{className:"AiEditModal__SplitPanel__JsonPanel",children:p(Gs,{className:"AiEditModal__Tabs",grow:!0,children:[p(Gs.Tab,{label:"JSON",icon:p(yM,{size:20}),children:p("div",{className:"AiEditModal__JsonEditor",children:p(Zc,{value:a,onChange:f=>s(f),formatOnBlur:!0,height:"100%",className:"AiEditModal__JsonInput"})})}),p(Gs.Tab,{ref:n,label:"Diff",icon:p(dM,{size:20}),children:p("div",{className:"AiEditModal__JsonDiffViewer",children:e.data&&a&&p(RQ,{oldCode:i,newCode:a})})})]})})]}),p("div",{className:"AiEditModal__buttons",children:[p(re,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>r.closeModal(o),children:"Cancel"}),p(re,{variant:"default",size:"xs",type:"button",leftIcon:p(my,{size:16}),disabled:!c,onClick:()=>s(i),children:"Reset"}),p(re,{leftIcon:p(_y,{size:16}),variant:"filled",size:"xs",color:"green",disabled:!l||!c,onClick:u,children:"Accept changes"})]})]})}nC.id=UL;Oe();var QBe=/^[a-z0-9_]+(?:--?[a-z0-9_]+)*$/;function sl(t,e){e||(e=QBe);let r=typeof e=="string"?new RegExp(e):e;return!!(t&&r.test(t))}function Ou(t){return t.replace(/^[\s/]*/g,"").replace(/[\s/]*$/g,"").replace(/^\/+|\/+$/g,"").replaceAll("/","--")}Oe();function Ye(t){let{className:e,as:r,size:o,weight:n,color:i,children:a,...s}=t;return p(r||"div",{...s,className:De(e,"text",o&&`size:${o}`,n&&`weight:${n}`,i&&`color:${i}`),children:a})}function fs(t){let r=window.__ROOT_CTX.collections[t.collectionId];if(!r)throw new Error(`collection not found: ${t.collectionId}`);let o=r.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",n=VL(t);return`${o}${n}`}function VL(t){let e=window.__ROOT_CTX.collections,{collectionId:r,slug:o,locale:n}=t,i=e[r];if(!i)throw new Error(`collection not found: ${r}`);let a=window.__ROOT_CTX.rootConfig,s=a.base||"/",l="/[base]/[path]";n&&(l=a.i18n.urlFormat||"/[locale]/[base]/[path]");let c="",u=i?.url;if(u)if(o){let d=u.replace(/\[.*slug\]/,o).replaceAll("--","/").replace(/\/+/g,"/");d==="/index"&&(d="/"),c=d}else c=u;return qte(l,{base:s,path:c,locale:n||"",slug:o})}function iC(t){let e=window.__ROOT_CTX.collections,{collectionId:r,slug:o,locale:n}=t,i=e[r];if(!i)throw new Error(`collection not found: ${r}`);let a=window.__ROOT_CTX.rootConfig,s=a.base||"/",l="/[base]/[path]";n&&(l=a.i18n.urlFormat||"/[locale]/[base]/[path]");let c="",u=i?.previewUrl||i?.url;if(u)if(o){let d=u.replace(/\[.*slug\]/,o).replaceAll("--","/").replace(/\/+/g,"/");d==="/index"&&(d="/"),c=d}else c=u;return qte(l,{base:s,path:c,locale:n||"",slug:o})}function qte(t,e){let r=t.replaceAll(/\[\[?(\.\.\.)?([\w\-_]*)\]?\]/g,(o,n,i)=>e[i]??o);return ZBe(r,{trailingSlash:window.__ROOT_CTX.rootConfig.server.trailingSlash})}function ZBe(t,e){return t=t.replace(/\/+/g,"/"),e?.trailingSlash===!1&&t!=="/"&&t.endsWith("/")&&(t=t.replace(/\/*$/g,"")),(t.endsWith("/index")||t.endsWith("/index/"))&&(t=t.slice(0,-6)),t.startsWith("/")||(t=`/${t}`),e?.trailingSlash&&!t.endsWith("/")&&(t=`${t}/`),t}function aC(t){let[e,r]=M(t.collectionId||""),o=W(null),[n,i]=M(""),a=window.__ROOT_CTX.collections[e],s=[];t.collectionId&&t.collectionDisabled?s.push({value:t.collectionId,label:t.collectionId}):Object.keys(window.__ROOT_CTX.collections).forEach(d=>{s.push({value:d,label:d})});let l="";if(a?.url){if(n){let d=Ou(n),f=a?.slugRegex;sl(d,f)?l=fs({collectionId:e,slug:d}):l="INVALID SLUG"}else l=fs({collectionId:e,slug:"[slug]"});l.endsWith("/index")&&(l=l.replace(/\/index$/,"/"))}function c(d){r(d),t.onChange&&t.onChange({collectionId:d,slug:n})}function u(d){i(d),t.onChange&&t.onChange({collectionId:e,slug:d})}return p("div",{className:De(t.className,"SlugInput"),children:[p("div",{className:"SlugInput__inputs",children:[p(Er,{className:"SlugInput__collection",placeholder:"Collection",size:"xs",data:s,onChange:d=>c(d),value:e,disabled:!!t.collectionDisabled}),p("div",{className:"SlugInput__divider",children:"/"}),p(ir,{className:"SlugInput__slug",name:"slug",ref:o,value:n,onChange:d=>{u(d.currentTarget.value)},placeholder:"slug",autoComplete:"off",size:"xs"})]}),l&&p(Ye,{className:"SlugInput__urlHelp",size:"body-sm",children:l})]})}var Kte="CopyDocModal";function sC(t){let e=Ct(),r=Vt();return{open:o=>{e.openContextModal(Kte,{...r,innerProps:{...t,...o}})}}}function lC(t){let{innerProps:e,context:r,id:o}=t,[n,i]=M(""),[a,s]=M(""),[l,c]=M(""),[u,d]=M(!1),[f,m]=M(!1),h=e.fromDocId,g=h.split("/")[0],_=e.fromLabel||h;async function y(b){if(b.preventDefault(),m(!0),c(""),!g){c("Please select a collection."),m(!1);return}let v=Ou(a),C=window.__ROOT_CTX.collections[n]?.slugRegex;if(!sl(v,C)){c('Please enter a valid slug (e.g. "foo-bar-123").'),m(!1);return}let N=`${n}/${v}`;try{e.fields?await Ly(N,{fields:e.fields,overwrite:u}):await TQ(h,N,{overwrite:u}),r.closeModal(o),Ae({title:"Copied!",message:`Succesfully copied ${_} to ${N}.`,autoClose:5e3}),e.onSuccess&&e.onSuccess(N)}catch(I){let E=String(I);c(E),E.includes("already exists")&&d(!0),m(!1);return}m(!1),mo(`/cms/content/${n}/${v}`)}return p("div",{className:"CopyDocModal",children:p("form",{onSubmit:b=>y(b),children:[p("div",{className:"CopyDocModal__from",children:[p(Ye,{className:"CopyDocModal__from__label",size:"body",weight:"bold",children:"From:"}),p(Ye,{className:"CopyDocModal__from__value",size:"body-sm",children:p("code",{children:_})})]}),p("div",{className:"CopyDocModal__to",children:[p(Ye,{className:"CopyDocModal__to__label",size:"body",weight:"bold",children:"To:"}),p(aC,{className:"CopyDocModal__slug",collectionId:g,onChange:b=>{i(b.collectionId),s(b.slug)}})]}),l&&p("div",{className:"CopyDocModal__error",children:l}),p("div",{className:"CopyDocModal__buttons",children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:f,children:u?"Overwrite?":"Submit"})]})]})})}lC.id=Kte;Oe();async function Yte(){let t=window.firebase.db,e=window.__ROOT_CTX.rootConfig.projectId||"default",r=$e(t,"Projects",e),o=await ko(r);if(!o.exists)return[];let i=(o.data()||{}).roles||{},a=[];return Object.entries(i).forEach(([s,l])=>{(l==="ADMIN"||l==="EDITOR")&&a.push(s)}),a}var ll=class t{constructor(e){this.spreadsheetId=e}static async create(e){let r=e.share??!1,o={fields:"spreadsheetId"};e?.title&&(o.resource={properties:{title:e.title}});let i=(await gapi.client.sheets.spreadsheets.create(o)).result,a=new t(i.spreadsheetId);if(a.setSpreadsheet(i),e?.parent&&await gapi.client.drive.files.update({fileId:a.spreadsheetId,addParents:e.parent,removeParents:"root",fields:"id, parents",resource:{}}),!r)return a;let s=await Yte();return await a.share(s,"writer"),a}getUrl(){return Ma({spreadsheetId:this.spreadsheetId})}async getSheet(e){if(this.sheets||await this.fetchSheets(),this.sheets){for(let r=0;r<this.sheets.length;r++)if(this.sheets[r].gid===e)return this.sheets[r]}return null}async createSheet(e){console.log("createSheet",this.spreadsheetId);let r=await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheetId,resource:{requests:[{addSheet:{properties:{title:e.title}}}]}}),o=r.result.replies||[];if(o&&o.length>0){let n=o[0].addSheet?.properties?.sheetId;if(typeof n=="number")return new cC(this,n,e.title)}throw console.error(r),new Error("failed to get gid of new tab")}async fetchSheets(){let r=(await gapi.client.sheets.spreadsheets.get({spreadsheetId:this.spreadsheetId,fields:"sheets.properties"})).result;this.setSpreadsheet(r)}setSpreadsheet(e){this.spreadsheet=e,this.spreadsheet.sheets&&this.setSheets(this.spreadsheet.sheets)}setSheets(e){let r=[];e.forEach(o=>{let n=o.properties?.sheetId,i=o.properties?.title,a=new cC(this,n??0,i);r.push(a)}),this.sheets=r}async share(e,r){await Promise.all(e.map(async o=>{let n;o.startsWith("*@")?n={type:"domain",domain:o.slice(2),role:r}:n={type:"user",emailAddress:o,role:r},await gapi.client.drive.permissions.create({fileId:this.spreadsheetId,resource:n,sendNotificationEmail:!1,fields:"id"})}))}},cC=class{constructor(e,r,o){this.spreadsheet=e,this.gid=r,this.title=o}async updateValuesMap(e,r){let o=r.keyedBy,n=r.preserveColumns||[];if(!o)throw new Error('missing "keyedBy" argument');let[i,a]=await this.getValues(),s=[...i],l=[],c=-1,u=new Set;l.push(i.map((v,C)=>(v===o&&(c=C),n.includes(v)&&u.add(C),{hasChanges:!1,value:v})));function d(v){l[0].push({hasChanges:!0,value:v}),s.push(v)}c===-1&&d(o);let f={};a.forEach((v,C)=>{let N=C+1;l.push(v.map((I,E)=>(E===c&&I&&(I in f?console.warn(`multiple rows keyed by "${I}"`):f[I]=N),{hasChanges:!1,value:I})))});function m(v){for(let N in v)s.includes(N)||d(N);return s.map(N=>v[N]??null)}e.forEach(v=>{let C=m(v),N=v[o],I=f[N];if(I){let E=l[I];C.map((w,S)=>{S>=E.length?E.push({hasChanges:!0,value:w||""}):w!==null&&E[S].value!==w&&(!u.has(S)||!E[S].value)&&(E[S]={hasChanges:!0,value:w})})}else l.push(C.map(E=>({hasChanges:!!E,value:E||""})))});let h=s.length,g=l.length,_=i.length,y=a.length+1;(h>_||g>y)&&await this.resizeSheet({numCols:h+2,numRows:g+20});let b=[];l.forEach((v,C)=>{for(;v.length>0&&v.at(-1)?.hasChanges===!1;)v.pop();if(v.length!==0){if(v.every(N=>N.hasChanges)){b.push({range:`${this.title}!A${C+1}`,majorDimension:"ROWS",values:[v.map(N=>N.value||"")]});return}v.forEach((N,I)=>{if(N.hasChanges){let E=Xte(I);b.push({range:`${this.title}!${E}${C+1}`,majorDimension:"ROWS",values:[[N.value||""]]})}})}}),b.length>0&&await gapi.client.sheets.spreadsheets.values.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{data:b,valueInputOption:"RAW"}})}async replaceSheet(e,r){let o=e.length,n=r.length+1,i=[];i.push(e),i.push(...r.map(s=>e.map(l=>s[l]||""))),await this.resizeSheet({numCols:o+2,numRows:n+20}),console.log("updating cell values");let a=Xte(o-1);await gapi.client.sheets.spreadsheets.values.update({spreadsheetId:this.spreadsheet.spreadsheetId,range:`${this.title}!A1:${a}${n}`,valueInputOption:"RAW",resource:{range:`${this.title}!A1:${a}${n}`,majorDimension:"ROWS",values:i}})}async resizeSheet(e){let r=[];e.numCols&&r.push({updateSheetProperties:{properties:{sheetId:this.gid,gridProperties:{columnCount:e.numCols}},fields:"gridProperties.columnCount"}}),e.numRows&&r.push({updateSheetProperties:{properties:{sheetId:this.gid,gridProperties:{rowCount:e.numRows}},fields:"gridProperties.rowCount"}}),r.length>0&&(console.log("resizing sheet"),await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{requests:r}}))}async getValues(){let r=(await gapi.client.sheets.spreadsheets.values.get({spreadsheetId:this.spreadsheet.spreadsheetId,range:this.title})).result.values;if(!r||r.length===0)return[[],[]];let o=r[0],n=r.slice(1);return[o,n]}async getValuesMap(){let[e,r]=await this.getValues();return r.map(n=>{let i={};return n.forEach((a,s)=>{let l=e[s];l&&(i[l]=String(a||""))}),i})}async setTitle(e){await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{requests:[{updateSheetProperties:{properties:{title:e,sheetId:this.gid},fields:"title"}}]}}),this.title=e}getUrl(){return Ma({spreadsheetId:this.spreadsheet.spreadsheetId,gid:this.gid})}async applyL10nTheme(){await gapi.client.sheets.spreadsheets.batchUpdate({spreadsheetId:this.spreadsheet.spreadsheetId,resource:{requests:[{repeatCell:{range:{sheetId:this.gid,startRowIndex:0},cell:{userEnteredFormat:{textFormat:{fontFamily:"Ubuntu",fontSize:10}}},fields:"userEnteredFormat(textFormat)"}},{repeatCell:{range:{sheetId:this.gid,startRowIndex:0,endRowIndex:1},cell:{userEnteredFormat:{textFormat:{bold:!0,fontFamily:"Ubuntu",fontSize:10}}},fields:"userEnteredFormat(textFormat)"}},{updateSheetProperties:{properties:{sheetId:this.gid,gridProperties:{frozenRowCount:1}},fields:"gridProperties.frozenRowCount"}},{updateDimensionProperties:{range:{sheetId:this.gid,dimension:"COLUMNS",startIndex:0,endIndex:1},properties:{pixelSize:320},fields:"pixelSize"}},{updateDimensionProperties:{range:{sheetId:this.gid,dimension:"COLUMNS",startIndex:1},properties:{pixelSize:320},fields:"pixelSize"}},{repeatCell:{range:{sheetId:this.gid,startRowIndex:1,startColumnIndex:0},cell:{userEnteredFormat:{wrapStrategy:"WRAP"}},fields:"userEnteredFormat(wrapStrategy)"}}]}})}};function Ma(t){let r=[`https://docs.google.com/spreadsheets/d/${t.spreadsheetId}/edit`];return typeof t.gid=="number"&&r.push(`#gid=${t.gid}`),r.join("")}function Au(t){if(!t.startsWith("https://docs.google.com/spreadsheets/d/"))return null;let e=t.split("/"),r=e[e.length-2],n=t.slice(t.indexOf("#")).match(/gid=(\d+)/),i=0;return n&&n[1]&&(i=parseInt(n[1])),{spreadsheetId:r,gid:i}}function Xte(t){let e=[];for(;t>=0;){let r=t%26;e.push(String.fromCharCode(r+65)),t=(t-r-1)/26}return e.reverse().join("")}function HL(t){if(!t)return;if(!t.startsWith("https://drive.google.com/drive/folders/")){let o=t.trim();if(o.length===33&&/^[a-zA-Z0-9_-]+$/.test(o))return o}let e=t.trim().split("/");return e[e.length-1]||void 0}function Jte(t){let e=HL(t);return e?`https://drive.google.com/drive/folders/${e}`:"https://drive.google.com/drive"}async function Qte(t,e){if(!t)throw new Error("missing data source id");let r=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,n=$e(o,"Projects",r,"DataSources",t);await xu(n,{...e,id:t,createdAt:Cr(),createdBy:window.firebase.user.email}),Ot("datasource.create",{metadata:{datasourceId:t}})}async function uC(){let t=window.__ROOT_CTX.rootConfig.projectId,e=window.firebase.db,r=Zi(e,"Projects",t,"DataSources"),o=po(r),n=await ea(o),i=[];return n.forEach(a=>{i.push(a.data())}),i}async function Ff(t){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,o=$e(r,"Projects",e,"DataSources",t),n=await ko(o);return n.exists()?n.data():null}async function dC(t,e){let r=e?.mode||"draft",o=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,i=$e(n,"Projects",o,"DataSources",t,"Data",r),a=await ko(i);return a.exists()?a.data():null}async function Zte(t,e){let r=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,n=$e(o,"Projects",r,"DataSources",t);await Mr(n,e),Ot("datasource.save",{metadata:{datasourceId:t}})}async function ere(t){let e=await Ff(t);if(!e)throw new Error(`data source not found: ${t}`);if(e.type==="http"&&e.url&&!nre(e.url)){let r=await fetch("/cms/api/data.sync",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e.id})});if(r.status!==200){let o=await r.text();throw new Error(`sync failed: ${o}`)}}else{let{data:r,headers:o}=await e4e(e),n=window.__ROOT_CTX.rootConfig.projectId,i=window.firebase.db,a=$e(i,"Projects",n,"DataSources",t),s=$e(i,"Projects",n,"DataSources",t,"Data","draft"),l={...e,syncedAt:Tt.now(),syncedBy:window.firebase.user.email},c=Ci(i);c.set(s,{dataSource:l,data:r,...o?{headers:o}:{}}),c.update(a,{syncedAt:Tt.now(),syncedBy:window.firebase.user.email}),await c.commit()}console.log(`synced data source: ${t}`),Ot("datasource.sync",{metadata:{datasourceId:t}})}async function tre(t){let e=await Ff(t);if(!e)throw new Error(`data source not found: ${t}`);let r=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,n=$e(o,"Projects",r,"DataSources",t),i=$e(o,"Projects",r,"DataSources",t,"Data","draft"),a=$e(o,"Projects",r,"DataSources",t,"Data","published"),s=await dC(t,{mode:"draft"}),l={...e,publishedAt:Tt.now(),publishedBy:window.firebase.user.email},c=Ci(o);c.set(a,{dataSource:l,data:s?.data||null,...s?.headers?{headers:s.headers}:{}}),c.update(i,{dataSource:l}),c.update(n,{publishedAt:Tt.now(),publishedBy:window.firebase.user.email}),await c.commit(),console.log(`published data ${t}`),Ot("datasource.publish",{metadata:{datasourceId:t}})}async function rre(t,e){if(t.length===0)return;let r=window.firebase.db,o=window.__ROOT_CTX.rootConfig.projectId,n=e?.batch||Ci(r);for(let i of t){let a=await Ff(i);if(!a)throw new Error(`data source not found: ${i}`);let s=await dC(i,{mode:"draft"}),l=$e(r,"Projects",o,"DataSources",i),c=$e(r,"Projects",o,"DataSources",i,"Data","draft"),u=$e(r,"Projects",o,"DataSources",i,"Data","published"),d={...a,publishedAt:Cr(),publishedBy:window.firebase.user.email};n.set(u,{dataSource:d,data:s?.data||null,...s?.headers?{headers:s.headers}:{}}),n.update(c,{dataSource:d}),n.update(l,{publishedAt:Cr(),publishedBy:window.firebase.user.email}),Ot("datasource.publish",{metadata:{datasourceId:i}})}(!e?.batch||e?.commitBatch)&&await n.commit()}async function ore(t){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,o=$e(r,"Projects",e,"DataSources",t),n=$e(r,"Projects",e,"DataSources",t,"Data","draft"),i=$e(r,"Projects",e,"DataSources",t,"Data","published"),a=Ci(r);a.delete(n),a.delete(i),a.delete(o),await a.commit(),console.log(`deleted data source ${t}`),Ot("datasource.delete",{metadata:{datasourceId:t}})}async function e4e(t){if(t.type==="http")return{data:await r4e(t)};if(t.type==="gsheet")return await t4e(t);throw new Error(`unsupported data source: ${t.type}`)}async function t4e(t){let e=Au(t.url);if(!e?.spreadsheetId)throw new Error(`failed to parse google sheet url: ${t.url}`);let o=await new ll(e.spreadsheetId).getSheet(e.gid??0);if(!o)throw new Error(`could not find sheet: ${t.url}`);let n=t.dataFormat||"map",[i,a]=await o.getValues();return n==="array"?{data:[i,a],headers:i}:{data:a.map(l=>{let c={};return l.forEach((u,d)=>{let f=i[d];f&&(c[f]=String(u||""))}),c}),headers:i}}async function r4e(t){if(!nre(t.url))throw new Error(`unsupported url: ${t.url}`);let e=await fetch(t.url,{method:t.httpOptions?.method||"GET",headers:t.httpOptions?.headers||[],body:t.httpOptions?.body||void 0});if(e.status!==200){let o=await e.text();throw new Error(`req failed: ${o}`)}return String(e.headers.get("content-type")).includes("application/json")?await e.json():e.text()}function nre(t){return t&&t.startsWith("/")}var jL="DataSourceSelectModal";function ire(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(jL,{...e,innerProps:r,size:"600px",overflow:"inside"})},close:()=>{t.closeModal(jL)}}}function fC(t){let{innerProps:e}=t,[r,o]=M(!0),[n,i]=M([]),a=e.selectedDataSourceIds||[];V(()=>{async function c(){let u=await uC();i(u),o(!1)}c()},[]);function s(c){e.onChange&&e.onChange(c,!0)}function l(c){e.onChange&&e.onChange(c,!1)}return p("div",{className:"DataSourceSelectModal",children:r?p("div",{className:"DataSourceSelectModal__loading",children:p(Ze,{color:"gray",size:"xl"})}):n.length===0?p("div",{className:"DataSourceSelectModal__empty",children:"No data sources."}):p("div",{className:"DataSourceSelectModal__list",children:n.map(c=>p("div",{className:"DataSourceSelectModal__item",children:[p("div",{className:"DataSourceSelectModal__item__info",children:[p("div",{className:"DataSourceSelectModal__item__id",children:c.id}),p("div",{className:"DataSourceSelectModal__item__description",children:c.description||""})]}),p("div",{className:"DataSourceSelectModal__item__action",children:a.includes(c.id)?p(re,{variant:"light",color:"blue",size:"xs",onClick:()=>l(c.id),children:"Unselect"}):p(re,{variant:"filled",color:"blue",size:"xs",onClick:()=>s(c.id),children:"Select"})})]},c.id))})})}fC.id=jL;Oe();Oe();async function er(t){try{await t()}catch(e){console.error(e);let r;typeof e=="object"&&e.body?r=String(e.body):r=String(e),Ae({title:"Error",message:r,color:"red",autoClose:!1})}}xo();Oe();var GL=ft(null);function Th(){let t=lt(GL);if(!t)throw new Error("useFirebase() should be called within a <FirebaseProvider>");return t}function kh(t,e){let[r,o]=M([]),[n,i]=M(!0),s=Th().db,l=window.__ROOT_CTX.rootConfig.projectId||"default",c=async()=>{i(!0);let u=Zi(s,"Projects",l,"Collections",t,"Drafts"),d=u,f=e.orderBy;if(f==="modifiedAt")d=po(u,Si("sys.modifiedAt","desc"));else if(f==="newest")d=po(u,Si("sys.createdAt","desc"));else if(f==="oldest")d=po(u,Si("sys.createdAt"));else if(f==="slug")d=po(u,Si(ny()));else if(f==="slugDesc")d=po(u,Si(ny(),"desc"));else{let h=window.__ROOT_CTX.collections[t]?.sortOptions?.find(g=>g.id===f);h&&(d=h.direction==="desc"?po(u,Si(h.field,"desc")):po(u,Si(h.field)))}await er(async()=>{let m=await ea(d),h=[];m.docs.forEach(g=>{let _=g.data(),y=g.id,b=`${t}/${y}`,v={..._,id:b,slug:y};h.push(v),My(b,v)}),o(h)}),i(!1)};return V(()=>{i(!0),c()},[t,e.orderBy]),[n,c,r]}function La(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}function Qo(t,e){if(Array.isArray(e)){for(let n of e){let i=Qo(t,n);if(i!=null)return i}return}let r=e.split("."),o=t;for(let n of r){if(o==null)return;o=o4e(o,n)}return o}function o4e(t,e){if(!e)return t;let r=/([^\[\]]+)|\[(\d+)\]/g,o=t,n;for(;n=r.exec(e);){if(o==null)return;let i=n[1],a=n[2];if(i!==void 0){o=o[i];continue}if(a===void 0)return;let s=Number(a);if(Array.isArray(o)){o=o[s];continue}if(La(o)&&Array.isArray(o._array)){let l=o._array[s];if(l===void 0)return;o=o[l];continue}if(La(o)&&Object.prototype.hasOwnProperty.call(o,String(s))){o=o[String(s)];continue}return}return o}function are(t,e){return t.sort((r,o)=>{let n=r[e],i=o[e];return n<i?-1:n>i?1:0})}function qy(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!qy(t[n],e[n]))return!1;return!0}let r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(let n of r)if(!qy(t[n],e[n]))return!1;return!0}var WL="DocPickerModal";function sre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(WL,{...e,innerProps:r,size:"700px",overflow:"inside"})},close:()=>{t.closeModal(WL)}}}function Du(t){let{innerProps:e}=t,r=Object.keys(window.__ROOT_CTX.collections);e.collections?.length&&(r=r.filter(s=>e.collections?.includes(s)));let o=[{value:"",label:"Select"}];r.forEach(s=>{o.push({value:s,label:s})});let[n,i]=M(e.initialCollection||(r.length===1?r[0]:""));function a(s){e.onChange&&e.onChange(s.id)}return p("div",{className:"DocPickerModal",children:[r.length===0&&p("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),r.length>1&&p("div",{className:"DocPickerModal__collection__select",children:[p("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),p(Er,{data:o,value:n,placeholder:"Select",onChange:s=>{i(s||"")},size:"xs",radius:0,dropdownComponent:"div"})]}),n&&p(Du.DocsList,{collection:n,onDocSelected:a})]})}Du.DocsList=t=>{let[e,,r]=kh(t.collection,{orderBy:"slug"});return p("div",{className:"DocPickerModal__DocsList",children:e?p("div",{className:"DocPickerModal__DocsList__loading",children:p(Ze,{color:"gray",size:"xl"})}):r.length===0?p("div",{className:"DocPickerModal__DocsList__empty",children:"Collection is empty."}):p("div",{className:"DocPickerModal__DocsList__docs",children:r.map(o=>p(Du.DocCard,{doc:o,onDocSelected:t.onDocSelected},o.id))})})};Du.DocCard=t=>{let e=t.doc,[r,o]=e.id.split("/"),n=e.fields||{},i=window.__ROOT_CTX.collections[r],a=fs({collectionId:r,slug:o}),s=Qo(n,i.preview?.title||"meta.title"),l=Qo(n,i.preview?.image||"meta.image")||i.preview?.defaultImage;return p("div",{className:"DocPickerModal__DocCard",children:[p("div",{className:"DocPickerModal__DocCard__image",children:p(Qc,{src:l?.src,width:120,height:90,withPlaceholder:!l?.src})}),p("div",{className:"DocPickerModal__DocCard__content",children:[p("div",{className:"DocPickerModal__DocCard__content__header",children:p("div",{className:"DocPickerModal__DocCard__content__header__docId",children:e.id})}),p("div",{className:"DocPickerModal__DocCard__content__title",children:s||"[UNTITLED]"}),p("div",{className:"DocPickerModal__DocCard__content__url",children:a})]}),p("div",{className:"DocPickerModal__DocCard__controls",children:p(re,{color:"blue",size:"xs",onClick:()=>t.onDocSelected(t.doc),children:"Select"})})]})};Du.id=WL;Oe();function Nh(t){let{file:e,width:r,height:o,withPlaceholder:n,className:i,alt:a}=t,s=typeof e=="string"?e:e?.src;return n4e(e)?p(i4e,{className:i,src:s,width:r,height:o}):p(Qc,{className:i,src:s,width:r,height:o,withPlaceholder:n,alt:a})}function n4e(t){if(!t)return!1;if(typeof t=="string")return/\.mp4($|\?)/i.test(t);if(typeof t.mimeType=="string")return t.mimeType.toLowerCase()==="video/mp4";let e=t.src;return typeof e!="string"?!1:/\.mp4($|\?)/i.test(e)}function i4e(t){return p("video",{className:t.className,src:t.src,width:t.width,height:t.height,muted:!0,playsInline:!0,preload:"metadata",style:{width:`${t.width}px`,height:`${t.height}px`,backgroundColor:"#f1f3f5",objectFit:"cover",display:"block"}})}var qL="DocSelectModal";function pC(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(qL,{...e,innerProps:r,size:"700px",overflow:"inside"})},close:()=>{t.closeModal(qL)}}}function Ru(t){let{innerProps:e}=t,r=Object.keys(window.__ROOT_CTX.collections);e.collections?.length&&(r=r.filter(l=>e.collections?.includes(l)));let o=[{value:"",label:"Select"}];r.forEach(l=>{o.push({value:l,label:l})});let[n,i]=M(e.initialCollection||(r.length===1?r[0]:""));function a(l){e.onChange&&e.onChange(l.id,!0)}function s(l){e.onChange&&e.onChange(l.id,!1)}return p("div",{className:"DocSelectModal",children:[r.length===0&&p("div",{className:"DocSelectModal__noCollections",children:"No collections matching schema field definition."}),r.length>1&&p("div",{className:"DocSelectModal__collection__select",children:[p("div",{className:"DocSelectModal__collection__select__label",children:"Content Type:"}),p(Er,{data:o,value:n,placeholder:"Select",onChange:l=>{i(l||"")},size:"xs",radius:0,dropdownComponent:"div"})]}),n&&p(Ru.DocsList,{collection:n,onDocSelected:a,onDocUnselected:s,selectedDocIds:e.selectedDocIds})]})}Ru.DocsList=t=>{let[e,,r]=kh(t.collection,{orderBy:"slug"}),o=t.selectedDocIds||[];return p("div",{className:"DocSelectModal__DocsList",children:e?p("div",{className:"DocSelectModal__DocsList__loading",children:p(Ze,{color:"gray",size:"xl"})}):r.length===0?p("div",{className:"DocSelectModal__DocsList__empty",children:"Collection is empty."}):p("div",{className:"DocSelectModal__DocsList__docs",children:r.map(n=>p(Ru.DocCard,{doc:n,onDocSelected:t.onDocSelected,onDocUnselected:t.onDocUnselected,selected:o.includes(n.id)},n.id))})})};Ru.DocCard=t=>{let[e,r]=M(!!t.selected),o=t.doc,[n,i]=o.id.split("/"),a=o.fields||{},s=window.__ROOT_CTX.collections[n],l=fs({collectionId:n,slug:i}),c=Qo(a,s.preview?.title||"meta.title"),u=Qo(a,s.preview?.image||"meta.image")||s.preview?.defaultImage;return p("div",{className:"DocSelectModal__DocCard",children:[p("div",{className:"DocSelectModal__DocCard__image",children:p(Nh,{file:u,width:120,height:90,withPlaceholder:!u?.src})}),p("div",{className:"DocSelectModal__DocCard__content",children:[p("div",{className:"DocSelectModal__DocCard__content__header",children:p("div",{className:"DocSelectModal__DocCard__content__header__docId",children:o.id})}),p("div",{className:"DocSelectModal__DocCard__content__title",children:c||"[UNTITLED]"}),p("div",{className:"DocSelectModal__DocCard__content__url",children:l})]}),p("div",{className:"DocSelectModal__DocCard__controls",children:e?p(re,{variant:"light",color:"blue",size:"xs",onClick:()=>{r(!1),t.onDocUnselected(t.doc)},children:"Unselect"}):p(re,{variant:"filled",color:"blue",size:"xs",onClick:()=>{r(!0),t.onDocSelected(t.doc)},children:"Select"})})]})};Ru.id=qL;Oe();var KL="EditJsonModal";function mC(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(KL,{...e,title:r.title||"Edit JSON",innerProps:r,size:"680px",centered:!0})},close:()=>{t.closeModal(KL)}}}function hC(t){let{innerProps:e,context:r,id:o}=t,n=JSON.stringify(e.data||{},null,2),[i,a]=M(n),[s,l]=M(!0),[c,u]=M(!1),[d,f]=M(!1);function m(_){a(_),u(!1);try{JSON.parse(_),l(!0)}catch{l(!1)}f(_!==n)}function h(){navigator.clipboard.writeText(i).then(()=>u(!0))}function g(){let _=JSON.parse(i),y=_h(_);e.onSave&&e.onSave(y)}return p("div",{className:"EditJsonModal",children:[p(Zc,{value:i,onChange:m,formatOnBlur:!0,autosize:!0,minRows:4,maxRows:25}),p("div",{className:"EditJsonModal__buttons",children:[p(re,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>r.closeModal(o),children:"Cancel"}),p(re,{leftIcon:p(xy,{size:16}),variant:"filled",size:"xs",color:"dark",disabled:!s,type:"button",onClick:h,children:c?"Copied!":"Copy"}),p(re,{variant:"default",size:"xs",type:"button",leftIcon:p(my,{size:16}),disabled:!d,onClick:()=>{a(n),l(!0),f(!1)},children:"Reset"}),p(re,{leftIcon:p(yy,{size:16}),variant:"filled",size:"xs",color:"blue",disabled:!s||!d,onClick:g,children:"Save"})]})]})}hC.id=KL;Oe();function et(t){let{className:e,as:r,size:o,weight:n,color:i,children:a,...s}=t;return p(r||"h2",{...s,className:De(e,"heading",o&&`size:${o}`,n&&`weight:${n}`,i&&`color:${i}`),children:a})}var YL="EditTranslationsModal";function lre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(YL,{...e,innerProps:r,size:"900px",title:"Edit translations",overflow:"inside",className:"EditTranslationsModalWrap"})},close:()=>{t.closeModal(YL)}}}function Ph(t){let{innerProps:e,context:r,id:o}=t,n=e.strings||[],a=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],[s,l]=M({}),[c,u]=M([]),[d,f]=M(!1),[m,h]=M(!1),[g,_]=M(!0);V(()=>{Su({tags:[e.docId]}).then(v=>{let C={};Object.values(v).forEach(N=>{C[N.source]=N}),l(C),_(!1)})},[e.docId]);async function y(){h(!0),await er(async()=>{console.log("EditTranslationsModal.onSave()");let v=`edit-translations-${e.docId}`;Ae({id:v,loading:!0,title:"Saving translations",message:`Updating for ${e.docId}...`,autoClose:!1,disallowClose:!0});let C=[];c.forEach(N=>{let I=s[N];C.push(I)}),await Tf(e.docId,C),Ht({id:v,title:"Saved translations",message:`Updated translations for ${e.docId}!`,autoClose:!1})}),h(!1)}function b(v){l(C=>{let N={...C};return N[v.source]=v,N}),u(C=>{let N=new Set(C);return N.add(v.source),Array.from(N)}),f(!0)}return p("div",{className:"EditTranslationsModal",children:[p("div",{className:"EditTranslationsModal__header",children:p(re,{component:"a",href:`/cms/translations/${e.docId}`,target:"_blank",variant:"default",size:"xs",children:"Open Translations Editor"})}),g?p(Ze,{}):p("table",{className:"EditTranslationsModal__table",children:[p("thead",{children:p("tr",{children:[p("th",{children:p(et,{size:"h4",weight:"semi-bold",children:"SOURCE"})}),p("th",{children:p(et,{size:"h4",weight:"semi-bold",children:"TRANSLATIONS"})})]})}),p("tbody",{children:n.map(v=>p("tr",{children:[p("td",{children:p("div",{className:"EditTranslationsModal__table__source",children:v})}),p("td",{children:p(Ph.StringsEditor,{source:v,locales:a,translations:s[v]||{},onChange:b})})]}))})]}),p("div",{className:"EditTranslationsModal__footer",children:[e.l10nSheet&&p("div",{className:"EditTranslationsModal__footer__gsheet",children:[p("strong",{children:"NOTE:"})," Translations for this doc are managed in"," ",p("a",{href:Ma(e.l10nSheet),target:"_blank",rel:"noopener noreferrer",children:"Google Sheets"})]}),p("div",{className:"EditTranslationsModal__footer__buttons",children:[p(re,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>r.closeModal(o),children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"dark",onClick:()=>y(),disabled:!d,loading:m,children:"Save"})]})]})]})}Ph.StringsEditor=t=>{let e=t.locales,[r,o]=M(t.translations||{}),[n,i]=M(!1);function a(s,l){i(!0),o(c=>{let u={...c,source:t.source};return u[s]=l,u})}return V(()=>{n&&t.onChange(r)},[n,r]),p("div",{className:"EditTranslationsModal__StringsEditor",children:e.map(s=>p("div",{className:"EditTranslationsModal__StringsEditor__row",children:[p("div",{className:"EditTranslationsModal__StringsEditor__row__locale",children:s}),p("div",{className:De("EditTranslationsModal__StringsEditor__row__translation",r[s]?"hasValue":"empty"),children:p(br,{size:"xs",radius:0,autosize:!0,minRows:1,maxRows:10,value:r[s],onChange:l=>{a(s,l.currentTarget.value)}})})]}))})};Ph.id=YL;Rl();Oe();Oe();var ZL=["https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/spreadsheets"],a4e=["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest","https://sheets.googleapis.com/$discovery/rest?version=v4"];function Mu(){let t=window.__ROOT_CTX.rootConfig.projectId,e=!!(window.__ROOT_CTX.gapi?.apiKey&&window.__ROOT_CTX.gapi?.clientId),[r,o]=M(e),[n,i]=M(0),[a,s]=BN({key:`root-cms::${t}::gapi-user-consent`,defaultValue:{}});async function l(){await Promise.all([l4e(),c4e()]),o(!1)}V(()=>{e&&l()},[]);function c(){return new Promise(d=>{let f=window.__ROOT_CTX.gapi.clientId,m=google.accounts.oauth2.initTokenClient({client_id:f,scope:ZL.join(" "),callback:async h=>{let g=XL()+parseInt(h.expires_in);i(g),s({at:XL(),clientId:f,scopes:ZL}),d()}});a&&s4e(a)?(console.log("requesting token without prompt"),m.requestAccessToken({prompt:""})):(console.log("requesting token with prompt"),m.requestAccessToken({prompt:"consent"}))})}function u(){return XL()<n}return{enabled:e,loading:r,isLoggedIn:u,login:c}}function s4e(t){if(!t||!t.at)return!1;let e=window.__ROOT_CTX.gapi?.clientId;if(t.clientId!==e)return!1;let r=t.scopes||[];return ZL.every(o=>r.includes(o))}function XL(){return Math.floor(new Date().getTime()/1e3)}var JL=null;async function l4e(){return JL||(JL=new Promise((t,e)=>{let r=document.createElement("script");r.src="https://apis.google.com/js/api.js",r.onload=()=>{gapi.load("client",async()=>{try{await gapi.client.init({}),await Promise.all(a4e.map(o=>gapi.client.load(o))),console.log("gapi loaded"),t()}catch(o){console.error("Error initializing gapi:",o),e(o)}})},r.onerror=()=>{console.error("gapi script failed to load"),e(new Error("gapi script failed to load"))},document.head.appendChild(r)})),JL}var QL=null;async function c4e(){return QL||(QL=new Promise((t,e)=>{let r=document.createElement("script");r.src="https://accounts.google.com/gsi/client",r.onload=()=>{t()},r.onerror=()=>{console.error("gis script failed to load"),e(new Error("gis script failed to load"))},document.head.appendChild(r)})),QL}xo();Oe();var cre=[{name:"Google Drive Folder",key:"googleDriveFolder",placeholder:"https://drive.google.com/drive/folders/...",description:`Where Google Sheets created by Root CMS's localization process are stored. If unspecified, they will be created in your "My Drive".`,ui:t=>p(re,{disabled:!t,variant:"outline",size:"compact-sm",color:"dark",rightIcon:p(by,{size:16}),onClick:()=>{t&&window.open(t,Jte(t))},children:"Open"})}],ure=ft(null);function dre(t){let{db:e,user:r}=Th(),o=window.__ROOT_CTX.rootConfig.projectId,[n,i]=M({});V(()=>{let s=$e(e,"Projects",o),l=yu(s,c=>{if(c.exists()){let u=c.data()||{};i(u.settings||{})}else i({})},c=>{console.error("Failed to subscribe to site settings:",c)});return()=>l()},[e,o,r.uid]);let a=qe(async(s,l)=>{let c=$e(e,"Projects",o);try{await Mr(c,new Pn("settings",s),l)}catch(u){console.error("Failed to set setting",s,u)}},[e,o,r.uid]);return p(ure.Provider,{value:{settings:n,setSettings:a},children:t.children})}function gC(){let t=lt(ure);if(!t)throw new Error("useSiteSettings must be used within a <SiteSettingsProvider>");return t}var fre="ExportSheetModal";function pre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(fre,{...e,title:"Export to Google Sheet",innerProps:r,size:"650px"})}}}function Oh(t){let{innerProps:e,context:r,id:o}=t,[n,i]=M(!1),[a,s]=M("new-sheet"),[l,c]=M(""),[u,d]=M(!1),f=Mu(),m=gC(),h=W(),g=HL(m.settings.googleDriveFolder),_=[{value:"new-sheet",label:"Create Google Sheet",help:"Creates a new Google Sheet and exports strings to the sheet."},{value:"add-tab",label:"Add tab in Google Sheet",help:"Adds a new tab in an existing Google Sheet and exports strings to the sheet."},{value:"link-sheet",label:"Link Google Sheet",help:"Links an existing Google Sheet without exporting strings."}],y=!1;(a==="add-tab"||a==="link-sheet")&&(y=!0,l&&Au(l)?.spreadsheetId&&(y=!1));async function b(E,w){let S=w?.isNew||!1,{headers:T,rows:A}=e.csvData;S?(await E.replaceSheet(T,A),await E.applyL10nTheme()):await E.updateValuesMap(A,{keyedBy:"source",preserveColumns:e.locales})}async function v(){f.isLoggedIn()||await f.login();let E=window.__ROOT_CTX.rootConfig,w=E.projectName||E.projectId||"Root CMS",S,T,A="create-google-sheet";try{if(Ae({id:A,loading:!0,title:"Creating Google Sheet...",message:"Creating Google Sheet for localization.",autoClose:!1,disallowClose:!0}),S=await ll.create({title:`${w} Localization`,parent:g,share:h.current?.checked}),T=await S.getSheet(0),!T)throw new Error("could not find sheet gid=0");T.setTitle(e.docId)}catch(R){console.error(R);let P=R;typeof R=="object"&&R.body&&(P=String(R.body)),Ht({id:A,title:"Failed to create Google Sheet",message:String(P),color:"red",autoClose:!1});return}try{Ht({id:A,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let R={spreadsheetId:S.spreadsheetId,gid:0};await TS(e.docId,R)}catch(R){console.error(R),Ht({id:A,title:"Failed to link Google Sheet",message:String(R),color:"red",autoClose:!1});return}try{Ht({id:A,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await b(T,{isNew:!0})}catch(R){console.error(R);let P=R;typeof R=="object"&&R.body&&(P=String(R.body)),Ht({id:A,title:"Failed to export strings to Google Sheet",message:P,color:"red",autoClose:!1});return}c(T.getUrl()),d(!0),Ht({id:A,title:"Done! Exported strings to Google Sheet.",message:S.getUrl(),autoClose:!1})}async function C(){f.isLoggedIn()||await f.login();let E=Au(l);if(!E?.spreadsheetId)throw new Error("failed to parse spreadsheet id");let w=new ll(E.spreadsheetId),S,T="add-tab-google-sheet";try{Ae({id:T,loading:!0,title:"Creating tab in Google Sheet...",message:"Adding tab in existing Google Sheet",autoClose:!1,disallowClose:!0}),S=await w.createSheet({title:e.docId})}catch(A){console.error(A);let R=A;typeof A=="object"&&A.body&&(R=String(A.body)),Ht({id:T,title:"Failed to create Google Sheet",message:String(R),color:"red",autoClose:!1});return}try{Ht({id:T,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let A={spreadsheetId:w.spreadsheetId,gid:S.gid};await TS(e.docId,A)}catch(A){console.error(A),Ht({id:T,title:"Failed to link Google Sheet",message:String(A),color:"red",autoClose:!1});return}try{Ht({id:T,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await b(S,{isNew:!0})}catch(A){console.error(A);let R=A;typeof A=="object"&&A.body&&(R=String(A.body)),Ht({id:T,title:"Failed to export strings to Google Sheet",message:R,color:"red",autoClose:!1});return}d(!0),Ht({id:T,title:"Done! Exported strings to Google Sheet.",message:S.getUrl(),autoClose:!1})}async function N(){let E="link-google-sheet",w=Au(l);if(!w?.spreadsheetId)throw new Error("failed to parse spreadsheet id");try{Ae({id:E,loading:!0,title:"Link Google Sheet",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0}),await TS(e.docId,w)}catch(S){console.error(S),Ht({id:E,title:"Failed to link Google Sheet",message:String(S),color:"red",autoClose:!1});return}d(!0),Ht({id:E,title:`Done! Linked ${e.docId} to Google Sheet.`,message:Ma(w),autoClose:!1})}async function I(){console.log(a),i(!0),a==="new-sheet"?await er(v):a==="add-tab"?await er(C):a==="link-sheet"&&await er(N),i(!1)}return p("div",{className:"ExportSheetModal",children:p("div",{className:"ExportSheetModal__content",children:[p("div",{className:"ExportSheetModal__content__body",children:"Export strings to Google Sheet or link an existing Google Sheet for managing translations."}),p("form",{className:"ExportSheetModal__form",children:[p("div",{className:"ExportSheetModal__form__section",children:[p("div",{className:"ExportSheetModal__form__description",children:"Export options:"}),p(Er,{disabled:u||n,itemComponent:Oh.SelectItem,data:_,onChange:E=>{s(E),E==="new-sheet"&&c("")},value:a})]}),p("div",{className:"ExportSheetModal__form__section",children:[p("div",{className:"ExportSheetModal__form__description",children:"Google Sheet URL:"}),a==="new-sheet"?p(ir,{disabled:!0,placeholder:m.settings.googleDriveFolder?"A new Google Sheet will be created in the project's Google Drive folder.":'A new Google Sheet will be created in your "My Drive" folder.'}):p(ir,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:l,disabled:u||n,onChange:E=>c(E.currentTarget.value)})]}),a==="new-sheet"&&p("div",{className:"ExportSheetModal__form__section",children:p(Te,{label:"Whether to share the Google Sheet with Admins and Editors upon creation. If your site has a Google Drive folder configured, the sheet will be created within it and inherit its permissions.",wrapLines:!0,width:320,withArrow:!0,position:"bottom",children:p(Xc,{disabled:u||n,ref:h,name:"share",value:"true",label:"Share Google Sheet with collaborators",checked:!g})})}),p("div",{className:"ExportSheetModal__form__buttons",children:u?p(Ne,{children:[p(re,{component:"a",target:"_blank",rel:"noopener noreferrer",href:l,variant:"default",size:"xs",color:"dark",rightIcon:p(by,{size:16}),children:"Open Google Sheet"}),p(re,{variant:"filled",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"primary",children:"Done"})]}):p(Ne,{children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"primary",loading:n,disabled:y,onClick:()=>I(),children:a==="link-sheet"?"Link Google Sheet":"Export to Google Sheet"})]})})]})]})})}Oh.SelectItem=ee(t=>{let{label:e,help:r,...o}=t;return p("div",{className:"ExportSheetModal__SelectItem",...o,children:[p(Ye,{className:"ExportSheetModal__SelectItem__label",size:"body",children:e}),p(Ye,{className:"ExportSheetModal__SelectItem__help",size:"body-sm",children:r})]})});Oh.id=fre;Oe();async function Ah(t){if(!window.__ROOT_CTX.collections[t])throw new Error(`collection not found: ${t}`);let r=await window.fetch("/cms/api/collection.get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collectionId:t})});if(r.status!==200){let n=await r.text();throw new Error(n)}return(await r.json()).data}async function _C(t){let e=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,n]=t.split("/",2),i=await Ah(o),a=$e(e,"Projects",r,"Collections",o,"Drafts",n),l=(await ko(a)).data()||{},c=new Set;return Ky(c,i.fields,l.fields||{},i.types||{}),Array.from(c)}function Ky(t,e,r,o={}){e.forEach(n=>{if(!n.id)return;let i=r[n.id];xC(t,n,i,o)})}function xC(t,e,r,o={}){if(!r)return;function n(i){let a=ic(i);a&&t.add(a)}if(e.type==="object")Ky(t,e.fields||[],r,o);else if(e.type==="array"){let i=r._array||[];for(let a of i)xC(t,e.of,r[a],o)}else if(e.type==="string"||e.type==="select")e.translate&&n(r);else if(e.type==="image")e.translate&&r&&r.alt&&e.alt!==!1&&n(r.alt);else if(e.type==="multiselect"){if(e.translate&&Array.isArray(r))for(let i of r)n(i)}else if(e.type==="oneof"){let i=e.types||[],a;typeof i[0]=="string"?i.includes(r._type)&&(a=o[r._type]):a=i.find(s=>s.name===r._type),a&&Ky(t,a.fields||[],r,o)}else e.type==="richtext"?e.translate&&u4e(t,r):console.log(`extract: ignoring field, id=${e.id}, type=${e.type}`)}function u4e(t,e){(e?.blocks||[]).forEach(o=>{d4e(t,o)})}function d4e(t,e){if(!e?.type)return;function r(n){if(!n)return;let i=ic(n);i&&t.add(i)}function o(n){n&&n.forEach(i=>{r(i.content),o(i.items)})}e.type==="heading"||e.type==="paragraph"?r(e.data?.text):e.type==="orderedList"||e.type==="unorderedList"?o(e.data?.items):e.type==="html"&&r(e.data?.html)}var mre="LocalizationModal";function hre(){let t=Ct(),e=Vt();return{open:r=>{t.openContextModal(mre,{...e,innerProps:r,size:"clamp(80%, 1024px, 1280px)",onClose:()=>{r.draft.flush()}})}}}function oa(t){let e=t.innerProps;return p("div",{className:"LocalizationModal",children:p("div",{className:"LocalizationModal__layout",children:[p(oa.ConfigLocales,{...e}),p(oa.Translations,{...e})]})})}oa.id=mre;oa.ConfigLocales=t=>{let[e,r]=M(()=>t.draft?t.draft.getLocales():["en"]),o=window.__ROOT_CTX.rootConfig.i18n||{},n=o.locales||["en"],i=o.groups||{default:{label:"",locales:n}};function a(c){return e.filter(u=>(i[c].locales||[]).includes(u))}function s(c,u){let d=new Set(e),f=i[c].locales||[];for(let h of f)u.includes(h)?d.add(h):d.delete(h);let m=Array.from(d.values()).sort();l(m)}function l(c){r(c),t.draft.setLocales(c)}return p("div",{className:"LocalizationModal__locales",children:p(tu,{spacing:30,children:[p(as,{children:[p(et,{className:"LocalizationModal__iconTitle LocalizationModal__locales__title",size:"h2",children:[p(EM,{strokeWidth:1.5}),p("span",{children:"Locales"})]}),p(oa.AllNoneButtons,{onAllClicked:()=>l(n),onNoneClicked:()=>l([])})]}),p(tu,{spacing:40,children:Object.keys(i).map(c=>{let u=i[c],d=a(c);return p(oa.LocaleGroup,{group:u,groupEnabledLocales:d,allEnabledLocales:e,onChange:f=>s(c,f)})})})]})})};oa.LocaleGroup=t=>{let e=t.groupEnabledLocales||[],r=t.group.locales||[],o=t.allEnabledLocales||[];function n(a){t.onChange&&t.onChange(a)}function i(a){let s=e.indexOf(a);s===-1?e.push(a):e.splice(s,1),n(e)}return p(tu,{spacing:16,children:[t.group.label&&p(as,{position:"apart",children:[p(et,{size:"h4",weight:"semi-bold",children:t.group.label}),p(oa.AllNoneButtons,{onAllClicked:()=>n(r),onNoneClicked:()=>n([])})]}),p(as,{children:r.map(a=>{let s=e.includes(a),l=o.length<=1&&s;return p(Xc,{value:a,checked:s,disabled:l,label:gre(a),onChange:()=>i(a),size:"xs"})})})]})};oa.AllNoneButtons=t=>p(as,{spacing:"8px",children:[p(re,{variant:"subtle",size:"xs",compact:!0,onClick:t.onAllClicked,sx:e=>({"&:hover":{backgroundColor:e.colors.gray[0]}}),children:"All"}),"/",p(re,{variant:"subtle",size:"xs",compact:!0,onClick:t.onNoneClicked,sx:e=>({"&:hover":{backgroundColor:e.colors.gray[0]}}),children:"None"})]});oa.Translations=t=>{let[e,r]=M(!0),[o,n]=M([]),i=window.__ROOT_CTX.rootConfig.i18n?.locales||[],a=i.find(P=>P!=="en")||"en",[s,l]=M(a),[c,u]=M({}),[d,f]=M({}),m=Mu(),[h,g]=M(null),_=pre(),y=ve(()=>{let P={};return Object.values(d).forEach(B=>{P[B.source]=B}),P},[d]),b=i.map(P=>({value:P,label:gre(P)}));V(()=>{r(!0),Promise.all([_C(t.docId),Su(),kS(t.docId)]).then(([P,B,$])=>{n(P),f(B),g($),r(!1)})},[t.docId]),V(()=>{if(!s){u({});return}let P={};Object.values(d).forEach(B=>{P[B.source]=B[s]||""}),u(P)},[s,d]);function v(P,B){let $=y[P];return $&&$[B]||""}function C(){let P=i.filter(z=>z!=="en"),B=["source","en",...P],$=[];return o.forEach(z=>{let H={source:z,en:v(z,"en")||z};P.forEach(G=>{H[G]=v(z,G)}),$.push(H)}),{headers:B,rows:$}}async function N(){let{headers:P,rows:B}=C(),$=await window.fetch("/cms/api/csv.download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:P,rows:B})});if($.status!==200){console.error("csv.download failed:");let G=await $.text();console.error(G)}let z=await $.blob(),H=window.URL.createObjectURL(z);window.location.assign(H),window.URL.revokeObjectURL(H)}async function I(){let P=document.createElement("input");P.type="file",P.accept=".csv",P.addEventListener("change",async()=>{let B=P.files?.[0];if(B){let $=new FormData;$.append("file",B);try{let z=await fetch("/cms/api/csv.import",{method:"POST",body:$});if(z.status!==200){let Y=await z.text();throw new Error(`RPCError: ${Y}`)}let H=(await z.json()).data,G=await Tf(t.docId,H);f(Y=>Object.assign({},Y,G)),Ae({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}catch(z){console.error(z),Ae({title:"Failed to import CSV",message:String(z),color:"red",autoClose:!1})}}}),P.click()}async function E(){if(m.isLoggedIn()||await m.login(),!h?.spreadsheetId)throw new Error("no sheet linked");let B=await new ll(h.spreadsheetId).getSheet(h.gid??0);if(!B)throw new Error(`sheet not found: ${JSON.stringify(h)}`);await w(B),Ae({title:"Exported strings to Google Sheet",message:B.getUrl(),autoClose:!1})}async function w(P,B){let $=B?.isNew||!1,{headers:z,rows:H}=C();$?(await P.replaceSheet(z,H),await P.applyL10nTheme()):await P.updateValuesMap(H,{keyedBy:"source",preserveColumns:i}),Ot("doc.export_to_sheet",{metadata:{docId:t.docId,sheetId:{spreadsheetId:P.spreadsheet.spreadsheetId,gid:P.gid}}})}async function S(){if(m.isLoggedIn()||await m.login(),!h?.spreadsheetId)throw new Error("no sheet linked");let B=await new ll(h.spreadsheetId).getSheet(h.gid??0);if(!B)throw new Error(`sheet not found: ${JSON.stringify(h)}`);console.log("importing google sheet");let $=await B.getValuesMap(),z=await Tf(t.docId,$);f(H=>Object.assign({},H,z)),Ae({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}async function T(){await PQ(t.docId),g(null),Ae({title:"Unlinked Google Sheet",message:`${t.docId} is no longer connected to a Google Sheet.`,autoClose:5e3})}async function A(P){try{await P()}catch(B){console.error(B);let $;typeof B=="object"&&B.body?$=String(B.body):$=String(B),Ae({title:"Error",message:$,color:"red",autoClose:!1})}}function R(P){switch(P){case"EXPORT_DOWNLOAD_CSV":{A(N);return}case"EXPORT_GOOGLE_SHEET_LINKED":{A(E);return}case"EXPORT_GOOGLE_SHEET_SHOW_OPTIONS":{_.open({docId:t.docId,csvData:C(),locales:i});return}case"IMPORT_CSV":{A(I);return}case"IMPORT_GOOGLE_SHEET_LINKED":{A(S);return}case"UNLINK_GOOGLE_SHEET":{A(T);return}default:console.log("unhandled action: "+P)}}return e?p("div",{className:"LocalizationModal__translations__loading",children:p(Ze,{color:"gray",size:"xl"})}):p("div",{className:"LocalizationModal__translations",children:[p("div",{className:"LocalizationModal__translations__header",children:[p("div",{className:"LocalizationModal__translations__titleWrap",children:[p(et,{className:"LocalizationModal__translations__title LocalizationModal__iconTitle",size:"h2",children:[p(Eu,{strokeWidth:1.5})," ",p("span",{children:"Translations"})]}),p(re,{component:"a",href:`/cms/translations/${t.docId}`,target:"_blank",variant:"default",size:"xs",children:"Open Translations Editor"})]}),p("div",{className:"LocalizationModal__translations__header__buttons",children:[m.enabled&&h?.spreadsheetId&&p(Te,{label:"Open Google Sheet",children:p(Je,{component:"a",href:Ma(h),target:"_blank",variant:"filled",color:"green",size:"sm",children:p(Sf,{size:16,strokeWidth:2.25})})}),p(f4e,{onAction:R,gapiClient:m,linkedSheet:h}),p(p4e,{onAction:R,gapiClient:m,linkedSheet:h})]})]}),p("table",{className:"LocalizationModal__translations__table",children:[p("tr",{className:"LocalizationModal__translations__table__row LocalizationModal__translations__table__row--header",children:[p("th",{className:"LocalizationModal__translations__table__header",children:p(et,{size:"h4",weight:"semi-bold",children:"SOURCE STRING"})}),p("th",{className:"LocalizationModal__translations__table__header",children:p(et,{className:"LocalizationModal__translations__localeSelect",size:"h4",weight:"semi-bold",children:[p("span",{children:"LOCALE: "})," ",p(Er,{data:b,size:"xs",placeholder:"select locale",allowDeselect:!0,value:s,onChange:P=>l(P)})]})})]}),o.map((P,B)=>p("tr",{className:"LocalizationModal__translations__table__row",children:[p("td",{className:"LocalizationModal__translations__table__col",children:p(_e,{sx:$=>({backgroundColor:$.colors.gray[0],border:`1px solid ${$.colors.gray[3]}`,padding:"10px 20px",borderRadius:4,height:"100%"}),children:p(Gr,{size:"xs",sx:{whiteSpace:"pre-wrap"},children:P})})}),p("td",{className:"LocalizationModal__translations__table__col",children:p(_e,{sx:$=>({backgroundColor:$.colors.gray[0],border:`1px solid ${$.colors.gray[3]}`,padding:"10px 20px",borderRadius:4,height:"100%"}),children:p(Gr,{size:"xs",sx:{whiteSpace:"pre-wrap"},children:c[P]||" "})})})]},B))]})]})};function f4e(t){function e(o){t.onAction&&t.onAction(o)}let r=t.linkedSheet;return p(je,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"end",control:p(re,{variant:"default",color:"dark",size:"xs",leftIcon:p(ol,{size:16,strokeWidth:1.75}),rightIcon:p(wu,{size:16,strokeWidth:1.75}),children:"Import"}),children:[t.gapiClient.enabled&&p(Ne,{children:[p(je.Label,{children:"Google Sheets"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",disabled:!r?.spreadsheetId,onClick:()=>e("IMPORT_GOOGLE_SHEET_LINKED"),children:"Import Google Sheet"}),p(Ea,{})]}),p(je.Label,{children:"File"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("IMPORT_CSV"),children:"Import .csv"})]})}function p4e(t){async function e(n){t.onAction&&t.onAction(n)}let o=!!t.linkedSheet?.spreadsheetId;return p(je,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"start",control:p(re,{variant:"default",color:"dark",size:"xs",leftIcon:p(bf,{size:16,strokeWidth:1.75}),rightIcon:p(wu,{size:16,strokeWidth:1.75}),children:"Export"}),children:[t.gapiClient.enabled&&p(Ne,{children:[p(je.Label,{children:"Google Sheets"}),o?p(Ne,{children:p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_LINKED"),children:"Export to Google Sheet"})}):p(Ne,{children:p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_SHOW_OPTIONS"),children:"Export to Google Sheet"})}),p(Ea,{})]}),p(je.Label,{children:"File"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_DOWNLOAD_CSV"),children:"Download .csv"}),o&&p(Ne,{children:[p(Ea,{}),p(je.Label,{children:"Danger zone"}),p(je.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("UNLINK_GOOGLE_SHEET"),color:"red",children:"Unlink Google Sheet"})]})]})}function gre(t){let e=t.split("_"),r=e[0];if(r==="ALL"){let i=String(e[1]).toUpperCase();return`${new Intl.DisplayNames(["en"],{type:"region"}).of(i)||t} (${t})`}return`${new Intl.DisplayNames(["en"],{type:"language"}).of(r)||t} (${t})`}Oe();var _re="LockPublishingModal";function xre(t){let e=Ct(),r=Vt();return{open:o=>{let i={...t,...o}.unlock?`Unlock publishing for ${t.docId}`:`Lock publishing for ${t.docId}`;e.openContextModal(_re,{...r,title:i,innerProps:{...t,...o},size:"600px"})}}}function Lu(t){let{innerProps:e}=t;return e.unlock?p(Lu.Unlock,{...t}):p(Lu.Lock,{...t})}Lu.Lock=t=>{let{innerProps:e,context:r,id:o}=t,[n,i]=M(""),[a,s]=M(0),[l,c]=M(!1),u=Ct();function d(m){return m?Math.floor(new Date(m).getTime()):0}async function f(m){m.preventDefault(),c(!0),await er(async()=>{await SQ(e.docId,{reason:n,until:a}),Ae({title:"Locked!",message:`Publishing is locked for ${e.docId}.`,autoClose:1e4}),u.closeModal(o),e.onChange&&e.onChange("locked")})}return p("div",{className:"LockPublishingModal LockPublishingModal--lock",children:[p(Ye,{className:"LockPublishingModal__body",children:"Are you sure you want to lock publishing? Content editors will not be able to publish until publishing is unlocked."}),p("form",{className:"LockPublishingModal__form",onSubmit:m=>f(m),children:[p("div",{className:"LockPublishingModal__form__section",children:p(ir,{name:"reason",label:"Reason",description:"Specify a short reason so other content editors know why publishing is locked.",size:"xs",radius:0,onChange:m=>{i(m.currentTarget.value)}})}),p("div",{className:"LockPublishingModal__form__section",children:p(kn,{label:"Lock until",description:"Optional. Publishing is unlocked at the specified time. If not provided, publishing will be locked indefinitely.",size:"xs",children:p("div",{className:"DocEditor__DateTimeField",children:[p("input",{name:"until",type:"datetime-local",min:gh(),onChange:m=>{let g=m.target.value;s(d(g))}}),p("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})})}),p("div",{className:"LockPublishingModal__buttons",children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"dark",leftIcon:p(If,{size:14}),disabled:!n,type:"submit",loading:l,children:"Lock"})]})]})]})};Lu.Unlock=t=>{let{innerProps:e,context:r,id:o}=t,[n,i]=M(!1),a=Ct();async function s(){i(!0),await er(async()=>{await CQ(e.docId),Ae({title:"Unlocked!",message:`Publishing is unlocked for ${e.docId}.`,autoClose:1e4}),a.closeModal(o),e.onChange&&e.onChange("unlocked")})}return p("div",{className:"LockPublishingModal LockPublishingModal--unlock",children:[p(Ye,{className:"LockPublishingModal__body",children:["Are you sure you want to unlock publishing for ",e.docId,"? This will re-enable content editors to publish the doc."]}),p("div",{className:"LockPublishingModal__buttons",children:[p(re,{variant:"outline",onClick:()=>r.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),p(re,{variant:"filled",size:"xs",color:"dark",leftIcon:p(Sy,{size:14}),loading:n,onClick:()=>s(),children:"Unlock"})]})]})};Lu.id=_re;Oe();var o2=t=>{if(typeof t>"u"||t===null||typeof t=="bigint"||Number.isNaN(t)||t===1/0||t===-1/0)return;if(["string","number","boolean"].includes(typeof t))return t;if(Array.isArray(t))return t.map(o2).filter(r=>typeof r<"u");let e={};for(let[r,o]of Object.entries(t)){let n=o2(o);typeof n<"u"&&(e[r]=n)}return e},yre=o2,m4e=(t,e,r=!1)=>{if(!Array.isArray(t)||!Array.isArray(e))throw new Error("Both arguments should be arrays.");let o=t.length,n=e.length,i=o+n,a=new Array(i);if(r){for(let s=0;s<n;s++)a[s]=e[n-s-1];for(let s=0;s<o;s++)a[s+n]=t[s];return a}for(let s=0;s<o;s++)a[s]=t[s];for(let s=0;s<n;s++)a[s+o]=e[s];return a},kr=m4e,n2=(t,e=new Map)=>{if(typeof t!="object"||t===null)return!1;if(e.has(t))return!0;if(e.set(t,!0),Array.isArray(t)){for(let r=0;r<t.length;r++)if(n2(t[r],e))return!0;return!1}for(let r in t)if(n2(t[r],e))return!0;return!1},h4e=n2,i2=(t,e,r,o=1/0,n)=>{if(!t||typeof t!="object"){let a;if(!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&typeof t!="bigint"&&(a=JSON.stringify(t,e,r)),a===void 0)switch(n){case Jy.throw:throw new Error(`Value is not valid in JSON, got ${String(t)}`);case Jy.stringify:return g4e(t);default:throw new Error("Should not reach here, please report this bug.")}return a}let i=o<1?'"..."':Array.isArray(t)?`[${t.map(a=>i2(a,e,r,o-1,n)).join(",")}]`:`{${Object.keys(t).map(a=>`"${a}": ${i2(t[a],e,r,o-1,n)}`).join(", ")}}`;return JSON.stringify(JSON.parse(i),e,r)},g4e=t=>t===void 0?"undefined":t===1/0?"Infinity":t===-1/0?"-Infinity":Number.isNaN(t)?"NaN":typeof t=="bigint"?`${t}n`:String(t),Zo=i2,_4e=(t,e=1/0,r=!1,o=Jy.stringify)=>t===null?"null":Array.isArray(t)||typeof t=="object"?Zo(t,void 0,r?1:void 0,e,o):Zo(t,void 0,void 0,void 0,o),Fa=_4e,bre=t=>typeof t=="boolean"?0:typeof t=="number"?1:typeof t=="string"?2:t===null?3:Array.isArray(t)?4:typeof t=="object"?5:typeof t=="symbol"?6:typeof t=="function"?7:typeof t=="bigint"?8:-1,x4e=(t,e,r)=>{let o=r.keyOrdersMap?.get(t),n=r.keyOrdersMap?.get(e);if(o!==void 0&&n!==void 0)return o-n;let i=bre(t),a=bre(e);if(i!==a)return i-a;if(t===null&&e===null||Array.isArray(t)&&Array.isArray(e)||i===5&&a===5)return 0;switch(typeof t){case"number":return Number.isNaN(t)&&Number.isNaN(e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0?0:t-e;case"string":return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t<e?-1:t>e?1:0;case"boolean":return+t-+e;case"symbol":case"function":return String(t).localeCompare(String(e))}if(typeof t=="bigint"&&typeof e=="bigint"){let s=BigInt(t)-BigInt(e);return s<0?-1:s>0?1:0}return String(t).localeCompare(String(e))},Qy=x4e,y4e=t=>Array.isArray(t)?"array":t===null?"null":typeof t,ps=y4e,b4e=(t,e,r,o,n,i,a,s)=>{let l={ignoreCase:s.ignoreCase},c=Fa(n,s.maxDepth,!0,s.undefinedBehavior).split(`
|
|
68
68
|
`),u=Fa(i,s.maxDepth,!0,s.undefinedBehavior).split(`
|
|
@@ -242,7 +242,7 @@ ${He.current.stack}
|
|
|
242
242
|
`.concat(g):g)}return d.join(`
|
|
243
243
|
`)}})(t,r)(e)}var zr=P3,qqt=zr.$convertFromMarkdownString,Kqt=zr.$convertToMarkdownString,Yqt=zr.BOLD_ITALIC_STAR,Xqt=zr.BOLD_ITALIC_UNDERSCORE,Jqt=zr.BOLD_STAR,Qqt=zr.BOLD_UNDERSCORE,Zqt=zr.CHECK_LIST,eKt=zr.CODE,tKt=zr.ELEMENT_TRANSFORMERS,Wme=zr.HEADING,rKt=zr.HIGHLIGHT,oKt=zr.INLINE_CODE,nKt=zr.ITALIC_STAR,iKt=zr.ITALIC_UNDERSCORE,aKt=zr.LINK,sKt=zr.MULTILINE_ELEMENT_TRANSFORMERS,qme=zr.ORDERED_LIST,lKt=zr.QUOTE,cKt=zr.STRIKETHROUGH,uKt=zr.TEXT_FORMAT_TRANSFORMERS,dKt=zr.TEXT_MATCH_TRANSFORMERS,Kme=zr.TRANSFORMERS,Yme=zr.UNORDERED_LIST,Xme=zr.registerMarkdownShortcuts;var O3={};nr(O3,{useLexicalNodeSelection:()=>UZe});X();function Jme(t,e){return t.getEditorState().read((()=>{let r=xl(e);return r!==null&&r.isSelected()}))}function UZe(t){let[e]=or(),[r,o]=M((()=>Jme(e,t)));return V((()=>{let n=!0,i=e.registerUpdateListener((()=>{n&&o(Jme(e,t))}));return()=>{n=!1,i()}}),[e,t]),[r,qe((n=>{e.update((()=>{let i=he();ro(i)||(i=Eue(),fa(i)),ro(i)&&(n?i.add(t):i.delete(t))}))}),[e,t]),qe((()=>{e.update((()=>{let n=he();ro(n)&&n.clear()}))}),[e])]}var VZe=O3,Qme=VZe.useLexicalNodeSelection;var D3={};nr(D3,{$createHorizontalRuleNode:()=>A3,$isHorizontalRuleNode:()=>WZe,HorizontalRuleNode:()=>Av,INSERT_HORIZONTAL_RULE_COMMAND:()=>HZe});X();var HZe=Ja("INSERT_HORIZONTAL_RULE_COMMAND");function jZe({nodeKey:t}){let[e]=or(),[r,o,n]=Qme(t);return V((()=>gr(e.registerCommand(Lg,(i=>{let a=e.getElementByKey(t);return i.target===a&&(i.shiftKey||n(),o(!r),!0)}),rr))),[n,e,r,t,o]),V((()=>{let i=e.getElementByKey(t),a=e._config.theme.hrSelected??"selected";i!==null&&(r?Yn(i,a):Ip(i,a))}),[e,r,t]),null}var Av=class t extends H1{static getType(){return"horizontalrule"}static clone(e){return new t(e.__key)}static importJSON(e){return A3().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:GZe,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){let r=document.createElement("hr");return Yn(r,e.theme.hr),r}getTextContent(){return`
|
|
244
244
|
`}isInline(){return!1}updateDOM(){return!1}decorate(){return p(jZe,{nodeKey:this.__key})}};function GZe(){return{node:A3()}}function A3(){return Kn(new Av)}function WZe(t){return t instanceof Av}var Sk=D3,Zme=Sk.$createHorizontalRuleNode,ehe=Sk.$isHorizontalRuleNode,the=Sk.HorizontalRuleNode,wKt=Sk.INSERT_HORIZONTAL_RULE_COMMAND;var R3={};nr(R3,{DEFAULT_TRANSFORMERS:()=>rhe,MarkdownShortcutPlugin:()=>qZe});X();var rhe=[{dependencies:[the],export:t=>ehe(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,r,o)=>{let n=Zme();o||t.getNextSibling()!=null?t.replace(n):t.insertBefore(n),n.selectNext()},type:"element"},...Kme];function qZe({transformers:t=rhe}){let[e]=or();return V((()=>Xme(e,t)),[e,t]),null}var ohe=R3,NKt=ohe.DEFAULT_TRANSFORMERS,nhe=ohe.MarkdownShortcutPlugin;function ihe(){return p(nhe,{transformers:[Wme,Yme,qme]})}var M3={};nr(M3,{OnChangePlugin:()=>YZe});X();var KZe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ft:V;function YZe({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[o]=or();return KZe((()=>{if(r)return o.registerUpdateListener((({editorState:n,dirtyElements:i,dirtyLeaves:a,prevEditorState:s,tags:l})=>{e&&i.size===0&&a.size===0||t&&l.has(Bg)||s.isEmpty()||r(n,o,l)}))}),[o,t,e,r]),null}var XZe=M3,ahe=XZe.OnChangePlugin;Oe();function Ck(t){return t.getChildren().map(JZe).join("")}function JZe(t){if(Kr(t))return"<br>";if(_o(t))return`<a href="${t.getURL()}">${Ck(t)}</a>`;if(!Ke(t))return console.log("unhandled node"),console.log(t),"";let e=t.getTextContent();if(!e)return"";let r={s:t.hasFormat("strikethrough"),u:t.hasFormat("underline"),i:t.hasFormat("italic"),b:t.hasFormat("bold"),sup:t.hasFormat("superscript")};return QZe(e,r)}function QZe(t,e){let r=[];return Object.entries(e).forEach(([o,n])=>{n&&r.push(`<${o}>`)}),r.push(tet(t)),Object.entries(e).forEach(([o,n])=>{n&&r.push(`</${o}>`)}),r.join("")}function she(t){let e=[];return t.getChildren().forEach(r=>{Cv(r)&&e.push(ZZe(r))}),e}function ZZe(t){let e=t.getFirstChild();return e&&$i(e)?{itemsType:e.getTag()==="ol"?"orderedList":"unorderedList",items:she(e)}:{content:Ck(t)}}function lhe(){let t=[];for($r().getChildren().forEach(o=>{if(Cs(o)){let n={type:"paragraph",data:{text:Ck(o)}};t.push(n)}else if(fd(o)){let n=o.getTag().slice(1),i={type:"heading",data:{text:Ck(o),level:parseInt(n)}};t.push(i)}else if($i(o)){let n=o.getTag(),i={type:n==="ol"?"orderedList":"unorderedList",data:{style:n==="ol"?"ordered":"unordered",items:she(o)}};t.push(i)}});eet(t);)t.pop();return t.length===0?null:{time:Date.now(),blocks:t,version:"lexical-0.31.2"}}function eet(t){let e=t.length>0&&t.at(-1);return!!(e&&e.type==="paragraph"&&!e.data?.text)}function tet(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function che(t){let e=$r();e.clear();let r=t?.blocks||[];for(let o of r)if(o.type==="paragraph"){let n=hr();if(o.data.text){let i=L3(o.data.text);n.append(...i)}e.append(n)}else if(o.type==="heading"){let n=`h${o.data?.level||2}`,i=Jg(n);if(o.data.text){let a=L3(o.data.text);i.append(...a)}e.append(i)}else if(o.type==="orderedList"||o.type==="unorderedList"){let n=o.data.style==="ordered"?"number":"bullet",i=Sv(n);for(let a of o.data.items)i.append(...uhe(a,n));e.append(i)}}function L3(t){let e=document.createElement("template");e.innerHTML=t;let r=e.content,o=[];function n(i){if(i.nodeType===Node.TEXT_NODE)return xi(i.textContent||"");if(i.nodeType===Node.ELEMENT_NODE){let a=i,s=Array.from(a.childNodes).map(n).filter(l=>!!l).flat();switch(a.tagName.toLowerCase()){case"b":case"strong":return s.map(l=>(l.toggleFormat("bold"),l));case"i":case"em":return s.map(l=>(l.toggleFormat("italic"),l));case"u":return s.map(l=>(l.toggleFormat("underline"),l));case"s":return s.map(l=>(l.toggleFormat("strikethrough"),l));case"sup":return s.map(l=>(l.toggleFormat("superscript"),l));case"a":return[Kn(Hg(a.getAttribute("href")||"").append(...s))];default:return console.log("unhandled tag: "+a.tagName),console.log(s),s}}return null}return r.childNodes.forEach(i=>{let a=n(i);Array.isArray(a)?o.push(...a):a&&o.push(a)}),o}function uhe(t,e){let r=[];if(t.content){let o=ret(t,e);r.push(o)}if(t.items&&t.items.length>0){let o=oet(t,e);r.push(o)}return r}function ret(t,e){let r=Ev();if(t.content){let o=L3(t.content);r.append(...o)}return r}function oet(t,e){let r=Ev();if(t.items&&t.items.length>0){let o=e;t.itemsType==="orderedList"?o="number":t.itemsType==="unorderedList"&&(o="bullet");let n=Sv(o);for(let i of t.items)n.append(...uhe(i,o));r.append(n)}return r}function dhe(t){let[e]=or(),r=W(t.value?.time||0),o=W(!1);return V(()=>{let i=t.value?.time||0;i>r.current&&(r.current=i,e.update(()=>{o.current=!0,che(t.value)}))},[e,t.value]),p(ahe,{onChange:i=>{if(o.current){o.current=!1;return}i.read(()=>{let a=lhe();r.current=a?.time||0,t.onChange&&t.onChange(a)})},ignoreSelectionChange:!0})}Oe();function fhe(t){let{editor:e,setIsLinkEditMode:r}=t,{toolbarState:o}=dk();return V(()=>{let n=i=>{if(Mi(i,{}))return!1;if(Jpe(i))e_(e);else if(Qpe(i)){let{code:a}=i,s=`h${a[a.length-1]}`;hd(e,o.blockType,s)}else if(eme(i))xk(e,o.blockType);else if(Zpe(i))yk(e,o.blockType);else if(tme(i))e.dispatchCommand(un,"strikethrough");else if(rme(i))e.dispatchCommand(Ri,void 0);else if(ome(i))e.dispatchCommand(Xa,void 0);else if(nme(i))e.dispatchCommand(un,"subscript");else if(ime(i))e.dispatchCommand(un,"superscript");else if(ame(i))fme(e);else if(sme(i)){let a=o.isLink?null:Cp("https://");r(!o.isLink),e.dispatchCommand(Fi,a)}else return!1;return i.preventDefault(),!0};return e.registerCommand(rde,n,Hue)},[e,o.isLink,o.blockType,r]),null}var net={namespace:"RootCMS",theme:kpe,nodes:[ofe,ck,Gg,wl,dd],onError:t=>{throw console.error("[LexicalEditor] error:",t),t}};function mhe(t){return p(Nfe,{initialConfig:net,children:p(Epe,{children:p(Tpe,{children:p("div",{className:De(t.className,"LexicalEditor"),children:p(iet,{placeholder:t.placeholder,value:t.value,onChange:t.onChange,onFocus:t.onFocus,onBlur:t.onBlur})})})})})}function iet(t){let{historyState:e}=Spe(),[r]=or(),[o,n]=M(r),[i,a]=M(!1),[s,l]=M(null),c=u=>{u&&l(u)};return p(Ne,{children:[p(dhe,{value:t.value,onChange:t.onChange}),p(mme,{editor:r,activeEditor:o,setActiveEditor:n,setIsLinkEditMode:a}),p(fhe,{editor:o,setIsLinkEditMode:a}),p(jfe,{externalHistoryState:e}),p(ype,{contentEditable:p("div",{className:"LexicalEditor__scroller",children:p("div",{className:"LexicalEditor__root",ref:c,children:p(Lfe,{className:"LexicalEditor__editor",placeholder:p(set,{placeholder:t.placeholder})})})}),ErrorBoundary:Bfe}),p(Wfe,{}),p(qfe,{}),p(Ipe,{maxIndent:7}),p(ihe,{}),s&&p(Ne,{children:[p(hme,{anchorElem:s,setIsLinkEditMode:a}),p(Ope,{anchorElem:s,isLinkEditMode:i,setIsLinkEditMode:a})]})]})}var phe=["Once upon a placeholder...","Start writing something legendary...","Words go here. Preferably brilliant ones...","Compose like nobody\u2019s watching...","Your masterpiece begins here...","Add text that makes Hemingway jealous...","Here lies your unwritten brilliance..."];function aet(){let t=Math.floor(Math.random()*phe.length);return phe[t]}function set(t){let e=ve(()=>t.placeholder||aet(),[]);return p("div",{className:"LexicalEditor__placeholder",children:e})}function hhe(t){return UC().preferences.EnableLexicalEditor?p(mhe,{...t}):p(Xse,{...t})}function ghe(t){let e=t.field,[r,o]=M(null),n=Wn().controller,i=a=>{o(s=>(s?.time!==a?.time&&n.updateKey(t.deepKey,a),a))};return ul(t.deepKey,a=>{o(a)}),p(hhe,{value:r,placeholder:e.placeholder,onChange:i,onFocus:t.onFocus,onBlur:t.onBlur})}Oe();function _he(t){let e=t.field,[r,o]=rn(t.deepKey,""),n=ve(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return p("div",{className:"DocEditor__SelectField",children:p(Er,{data:n,placeholder:e.placeholder,value:r,onChange:i=>o(i||""),size:"xs",radius:0,searchable:e.searchable??!0,dropdownComponent:"div"})})}function xhe(t){let e=t.field,[r,o]=rn(t.deepKey,""),n=s=>{o(s.currentTarget.value)},i=s=>{t.onFocus?.(s),Va(t.deepKey,{scroll:!0})},a=s=>{t.onBlur?.(s),Va(null)};return e.variant==="textarea"?p(br,{size:"xs",radius:0,autosize:!1,minRows:4,maxRows:e.maxRows||12,value:r,onChange:n,onFocus:i,onBlur:a}):p(ir,{size:"xs",radius:0,value:r,onChange:n,onFocus:i,onBlur:a})}var bhe=ft({});function kk(){return lt(bhe)}function wr(t){let e=t.docId.split("/")[0],r=HC(e),o=Wn(),n=r.loading||o.loading,i=r.schema?.fields||[];return p(bhe.Provider,{value:r?.schema?.types||{},children:p(aae,{children:p("div",{className:"DocEditor",children:[p(ka,{visible:n,loaderProps:{color:"gray",size:"xl"}}),!n&&p(wr.StatusBar,{...t,draft:o,collection:r.schema}),p("div",{className:"DocEditor__fields",children:i.map(a=>p(wr.Field,{field:a,deepKey:`fields.${a.id}`},a.id))})]})})})}wr.StatusBar=t=>{let e=t.draft,[r,o]=M(e.controller.getData());ul("sys",l=>{o({sys:l})});let n=qe(l=>{if(l.action==="delete"){let c=t.docId.split("/")[0];mo(`/cms/content/${c}`)}else l.action==="unlocked"&&e.controller.removePublishingLock()},[t.docId]),i=Poe({docId:t.docId}),a=hre(),s=!r?.sys;return s?null:p("div",{className:"DocEditor__statusBar",children:[p("div",{className:"DocEditor__statusBar__viewers",children:p(_ae,{id:`doc/${t.docId}`})}),p(wr.SaveState,{}),r?.sys&&p("div",{className:"DocEditor__statusBar__statusBadges",children:p(Hh,{doc:r})}),p("div",{className:"DocEditor__statusBar__i18n",children:p(re,{variant:"default",color:"dark",size:"xs",leftIcon:p(CM,{size:16}),onClick:()=>a.open({docId:t.docId,collection:t.collection,draft:e.controller}),children:"Localization"})}),p("div",{className:"DocEditor__statusBar__publishButton",children:s?p(re,{color:"dark",size:"xs",onClick:()=>i.open(),loading:!0,disabled:!0,children:"Publish"}):CS(r)?p(Te,{label:`Scheduled ${IS(r.sys.scheduledAt)} by ${r.sys.scheduledBy}`,transition:"pop",children:p(re,{color:"dark",size:"xs",leftIcon:p(mh,{size:16}),disabled:!0,children:"Publish"})}):Cf(r)?p(Te,{label:`Locked by ${r.sys.publishingLocked.lockedBy}: "${r.sys.publishingLocked.reason}"`,transition:"pop",children:p(re,{color:"dark",size:"xs",leftIcon:p(If,{size:16}),disabled:!0,children:"Publish"})}):p(re,{color:"dark",size:"xs",leftIcon:p(mh,{size:16}),onClick:()=>i.open(),children:"Publish"})}),p("div",{className:"DocEditor__statusBar__actionsMenu",children:p(VC,{docId:t.docId,data:r,onAction:n})})]})};wr.SaveState=()=>{let[t,e]=M("NO_CHANGES");return fae(r=>{e(r)}),p("div",{className:"DocEditor__statusBar__saveState",children:[t==="SAVED"&&"saved!",t==="SAVING"&&"saving...",t==="UPDATE_PENDING"&&"saving...",t==="ERROR"&&"error saving"]})};wr.Field=t=>{let e=t.field,r=t.level??0,n=wb().value===t.deepKey,i=W(null),[a,s]=M(!0),l=kk(),c=ve(()=>e.type==="object"&&(e.variant||"drawer")==="drawer"?!1:!t.hideHeader&&!e.hideLabel,[t.hideHeader,e]);return ul(t.deepKey,u=>{s(Zh(e,u,l))}),V(()=>{n&&IF(i.current)},[n]),e.deprecated&&a?null:p("div",{className:De("DocEditor__field",e.deprecated&&"DocEditor__field--deprecated",n&&"deeplink-target"),"data-type":e.type,"data-level":r,id:t.deepKey,ref:i,children:[c&&p(wr.FieldHeader,{...t}),p("div",{className:"DocEditor__field__input",children:e.type==="array"?p(wr.ArrayField,{...t}):e.type==="boolean"?p(xae,{...t}):e.type==="date"?p(yae,{...t}):e.type==="datetime"?p(bae,{...t}):e.type==="file"?p(fi,{...t}):e.type==="image"?p(Eae,{...t}):e.type==="multiselect"?p(Sae,{...t}):e.type==="number"?p(Cae,{...t}):e.type==="object"?p(wr.ObjectField,{...t}):e.type==="oneof"?p(wr.OneOfField,{...t}):e.type==="reference"?p(eg,{...t}):e.type==="references"?p(Tae,{...t}):e.type==="richtext"?p(ghe,{...t}):e.type==="select"?p(_he,{...t}):e.type==="string"?p(xhe,{...t}):p("div",{className:"DocEditor__field__input__unknown",children:["Unknown field type: ",e.type]})})]})};wr.FieldHeader=t=>{let e=t.field,r=e.label||e.id,[o,n]=M(null),i=wb(),a=ve(()=>sae(t.deepKey||""),[t.deepKey]);return ul(t.deepKey,s=>{n(s)}),p("div",{className:De(t.className,"DocEditor__FieldHeader"),children:[e.deprecated?p("div",{className:"DocEditor__FieldHeader__label",children:["DEPRECATED: ",r]}):p("div",{className:"DocEditor__FieldHeader__label",children:[p("span",{children:r}),t.deepKey&&p("a",{className:"DocEditor__FieldHeader__label__deeplink",href:a,title:"Link to field",onClick:s=>{s.preventDefault(),window.history.replaceState({},"",a),i.setValue(t.deepKey)},children:"#"})]}),e.help&&p("div",{className:"DocEditor__FieldHeader__help",children:e.help}),p(wr.FieldHeaderTranslationsActionIcon,{field:e,value:o})]})};wr.FieldHeaderTranslationsActionIcon=t=>{let e=t.field,r=t.value,o=!!e.translate,i=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],a=lre(),s=Wn(),l=kk(),c=ve(()=>!o||Zh(e,r,l),[e,r]);return!o||i.length<=1?null:p("div",{className:"DocEditor__FieldHeader__translate",children:c?p("div",{className:"DocEditor__FieldHeader__translate__iconDisabled",children:p(Eu,{size:16})}):p(Te,{label:"Show translations",children:p(Je,{size:"xs",onClick:()=>{let u=s.controller.getData();if(!u)return;let d=new Set;xC(d,e,r,l);let f=Array.from(d);a.open({docId:s.controller.docId,strings:f,l10nSheet:u?.sys?.l10nSheet})},children:p(Eu,{size:16})})})})};wr.ObjectField=t=>{let e=t.field,r=e.variant;return r||(t.isArrayChild?r="inline":r="drawer"),r==="drawer"?p(wr.ObjectFieldDrawer,{...t}):p("div",{className:"DocEditor__ObjectField",children:p("div",{className:"DocEditor__ObjectField__fields",children:e.fields.map(o=>p(wr.Field,{field:o,deepKey:`${t.deepKey}.${o.id}`},o.id))})})};wr.ObjectFieldDrawer=t=>{let e=t.field,r=e.drawerOptions?.collapsed||!1,o=e.drawerOptions?.inline||!1,n=o?"left":"right",i=wb(),a=!r||i.value.includes(t.deepKey);return p("div",{className:De("DocEditor__ObjectFieldDrawer",o&&"DocEditor__ObjectFieldDrawer--inline"),children:p("details",{className:"DocEditor__ObjectFieldDrawer__drawer",open:a,children:[p("summary",{className:De("DocEditor__ObjectFieldDrawer__drawer__toggle",`DocEditor__ObjectFieldDrawer__drawer__toggle--icon-${n}`),children:[p(wr.FieldHeader,{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__header",field:e,deepKey:t.deepKey}),p("div",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__icon",children:p(wu,{size:16})})]}),p("div",{className:"DocEditor__ObjectFieldDrawer__drawer__content DocEditor__ObjectFieldDrawer__fields",children:e.fields.map(s=>p(wr.Field,{field:s,deepKey:`${t.deepKey}.${s.id}`},s.id))})]})})};function cet(t,e){switch(e.type){case"update":{let r=t._new||[];return{...e.newValue,_new:r}}case"updateItem":{let r=t??{},n=[...r._array||[]][e.index],i=e.newValue??{};return e.draft.updateKey(`${e.deepKey}.${n}`,i),{...r,[n]:i}}case"add":{let r=t??{},o=ra(),n=[...r._array||[],o];e.draft.updateKeys({[`${e.deepKey}._array`]:n,[`${e.deepKey}.${o}`]:{}});let i=t._new||[];return{...r,[o]:{},_array:n,_new:[...i,o]}}case"insertBefore":{let r=t??{},o=[...r._array||[]],n=ra();o.splice(e.index,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:{}});let i=t._new||[];return{...r,[n]:{},_array:o,_new:[...i,n]}}case"insertAfter":{let r=t??{},o=[...r._array||[]],n=ra();o.splice(e.index+1,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:{}});let i=t._new||[];return{...r,[n]:{},_array:o,_new:[...i,n]}}case"duplicate":{let r=t??{},o=[...r._array||[]],n=ra(),i=structuredClone(e.value);o.splice(e.index+1,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:i});let a=t._new||[];return{...r,[n]:i,_array:o,_new:[...a,n]}}case"moveUp":{if(e.index===0)return t;let r=t??{},o=[...r._array||[]];return yhe(o,e.index,e.index-1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...r,_array:o,_moved:o[e.index-1]}}case"moveDown":{let r=t??{},o=[...r._array||[]];return e.index>=o.length-1?t:(yhe(o,e.index,e.index+1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...r,_array:o,_moved:o[e.index+1]})}case"moveTo":{let r=t??{},o=[...r._array||[]];if(e.fromIndex<0||e.fromIndex>=o.length||e.toIndex<0||e.toIndex>=o.length)return console.error("Invalid moveTo index",e),t;let n=o[e.fromIndex];return uet(o,e.fromIndex,e.toIndex),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...r,_array:o,_moved:n}}case"removeAt":{let r={...t??{}},n=[...r._array||[]],i=n[e.index];return delete r[i],n.splice(e.index,1),e.draft.updateKeys({[`${e.deepKey}._array`]:n}),e.draft.removeKey(`${e.deepKey}.${i}`),{...r,_array:n}}case"pasteAfter":{let r=t??{},o=[...r._array||[]],n=ra(),i=e.data;if(!i)return Ae({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index+1,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:i});let a=t._new||[];return{...r,[n]:i,_array:o,_new:[...a,n]}}case"pasteBefore":{let r=t??{},o=[...r._array||[]],n=ra(),i=e.data;if(!i)return Ae({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index,0,n),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${n}`]:i});let a=t._new||[];return{...r,[n]:i,_array:o,_new:[...a,n]}}default:return console.error("unknown action",e),t}}wr.ArrayField=t=>{let e=Wn().controller,r=t.field,[o,n]=Qn(cet,{_array:[]}),i=wb(),a=pae(),s=window.__ROOT_CTX.experiments||{},c=(o??{})._array||[],u=o._new||[];ul(t.deepKey,B=>{n({type:"update",newValue:B})}),V(()=>{o._moved&&v(t.deepKey,c.indexOf(o._moved))},[o]);let d=B=>{let $=c[B],z=`${t.deepKey}.${$}`;return e.getValue(z)||{}},f=()=>{n({type:"add",draft:e,deepKey:t.deepKey})},m=(B,$)=>{n({type:"pasteBefore",draft:e,deepKey:t.deepKey,index:B,data:$})},h=(B,$)=>{n({type:"pasteAfter",draft:e,deepKey:t.deepKey,index:B,data:$})},g=B=>{n({type:"insertBefore",draft:e,deepKey:t.deepKey,index:B})},_=B=>{n({type:"insertAfter",draft:e,deepKey:t.deepKey,index:B})},y=B=>{n({type:"duplicate",draft:e,deepKey:t.deepKey,index:B,value:d(B)})},b=B=>{n({type:"removeAt",draft:e,deepKey:t.deepKey,index:B})},v=(B,$)=>{document.getElementById(`summary-for-${B}.${c[$]}`)?.focus()},C=B=>{B>0&&n({type:"moveUp",draft:e,deepKey:t.deepKey,index:B})},N=B=>{B<c.length-1&&n({type:"moveDown",draft:e,deepKey:t.deepKey,index:B})},I=B=>{let $=d(B);a.set($)},E=mC(),w=Wte(),S=B=>{let $=d(B);E.open({data:$,onSave:z=>{console.log("[edit json] onSave()",z),n({type:"updateItem",draft:e,index:B,newValue:z,deepKey:t.deepKey}),E.close()}})},T=B=>{let $=d(B);w.open({data:$,onSave:z=>{console.log("[ai edit] onSave()",z),n({type:"updateItem",draft:e,index:B,newValue:z,deepKey:t.deepKey}),w.close()}})};function A(B){return!!i.value.startsWith(`${t.deepKey}.${B}`)}let R=qe((B,$)=>{B.target&&(B.key==="ArrowUp"?(B.preventDefault(),C(c.indexOf($))):B.key==="ArrowDown"?(B.preventDefault(),N(c.indexOf($))):B.key==="ArrowLeft"?B.target.closest("details").open=!1:B.key==="ArrowRight"&&(B.target.closest("details").open=!0))},[t.deepKey]),P=p("div",{className:"DocEditor__ArrayField__add",children:p(re,{color:"dark",size:"xs",leftIcon:p(ph,{size:16}),onClick:()=>f(),children:r.buttonLabel||"Add"})});return c.length===0&&!o._new?p("div",{className:"DocEditor__ArrayField",children:[p("div",{className:"DocEditor__ArrayField__items",children:p("div",{className:"DocEditor__ArrayField__items__empty",children:"No items"})}),P]}):p("div",{className:"DocEditor__ArrayField",children:[p(sT,{onDragEnd:B=>{let{source:$,destination:z}=B;z&&n({type:"moveTo",fromIndex:$.index,toIndex:z.index,draft:e,deepKey:t.deepKey})},children:p(cT,{droppableId:"dnd-list",direction:"vertical",children:B=>p("div",{...B.droppableProps,ref:B.innerRef,className:"DocEditor__ArrayField__items",children:[c.map(($,z)=>p(lT,{index:z,draggableId:$,children:(H,G)=>p("div",{ref:H.innerRef,...H.draggableProps,className:De("DocEditor__ArrayField__item__wrapper",G.isDragging&&"DocEditor__ArrayField__item__wrapper--dragging"),children:[p("div",{className:"DocEditor__ArrayField__item__handle",...H.dragHandleProps,children:p(vy,{size:18,stroke:"1.5"})}),p("details",{className:"DocEditor__ArrayField__item",open:u.includes($)||A($),onToggle:Y=>{Y.target.open?Va(`${t.deepKey}.${c[z]}`,{scroll:!0}):Va(null)},onMouseEnter:()=>{Va(`${t.deepKey}.${c[z]}`)},onMouseLeave:()=>{Va(null)},children:[p("summary",{id:`summary-for-${t.deepKey}.${c[z]}`,className:"DocEditor__ArrayField__item__header",onKeyDown:Y=>R(Y,$),tabIndex:0,children:[p("div",{className:"DocEditor__ArrayField__item__header__icon",children:p(NM,{size:6})}),p(wr.ArrayFieldPreview,{field:r,deepKey:`${t.deepKey}.${$}`,index:z}),p("div",{className:"DocEditor__ArrayField__item__header__controls",children:[p("div",{className:"DocEditor__ArrayField__item__header__controls__arrows",children:[p("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--up",onClick:()=>C(z),children:p(rM,{size:20,strokeWidth:1.75})}),p("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--down",onClick:()=>N(z),children:p(tM,{size:20,strokeWidth:1.75})})]}),p(je,{className:"DocEditor__ArrayField__item__header__controls__menu",position:"bottom",transitionDuration:0,control:p(Je,{className:"DocEditor__ArrayField__item__header__controls__dots",children:p(yf,{size:16})}),children:[p(je.Label,{children:"INSERT"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(vS,{size:18}),onClick:()=>g(z),children:"Add before"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(bS,{size:18}),onClick:()=>_(z),children:"Add after"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(nc,{size:18}),onClick:()=>y(z),children:"Duplicate"}),p(je.Label,{children:"CLIPBOARD"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(nM,{size:18}),onClick:()=>I(z),children:"Copy"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(vS,{size:18}),onClick:async()=>m(z,await a.get()),children:"Paste before"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(bS,{size:18}),onClick:async()=>h(z,await a.get()),children:"Paste after"}),p(je.Label,{children:"CODE"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(gy,{size:18}),onClick:()=>S(z),children:"Edit JSON"}),s.ai&&p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(ky,{size:18,stroke:"1.75"}),onClick:()=>T(z),children:"Edit with AI"}),p(je.Label,{children:"REMOVE"}),p(je.Item,{className:"DocEditor__ArrayField__item__header__controls__menu__item",icon:p(Hn,{size:18}),onClick:()=>b(z),children:"Remove"})]})]})]}),p("div",{className:"DocEditor__ArrayField__item__body",children:p(wr.Field,{field:r.of,deepKey:`${t.deepKey}.${$}`,hideHeader:!0,isArrayChild:!0,onFocus:()=>{Va(`${t.deepKey}.${$}`,{scroll:!0})},onBlur:()=>{Va(null)}},`${t.deepKey}.${$}`)})]},$)]})},$)),B.placeholder]})})}),P]})};wr.ArrayFieldPreview=t=>{let e=Wn().controller,[r,o]=M(e.getValue(t.deepKey)),n=ve(()=>fet(t.field,r),[r]),i=ve(()=>pet(t.field,r,t.index),[r,t.index]),a=qe(uT(()=>{let s=e.getValue(t.deepKey);o({...s})},250),[t.deepKey,e]);return V(()=>e.on("VALUE_CHANGE",(s,l)=>{s===t.deepKey?o(l):s.startsWith(t.deepKey)&&a()}),[t.deepKey,e]),p("div",{className:"DocEditor__ArrayField__item__header__preview",children:[n&&p("div",{className:"DocEditor__ArrayField__item__header__preview__image",children:p("img",{src:n,alt:"",className:"DocEditor__ArrayField__item__header__preview__image__img",loading:"lazy"})}),p("div",{className:"DocEditor__ArrayField__item__header__preview__title",children:i})]})};wr.OneOfField=t=>{let e=t.field,[r,o]=M(""),n=kk(),i={},a=[{value:"",label:e.placeholder||"Select type"}];e.types.forEach(f=>{typeof f=="string"?(i[f]=n[f],a.push({value:f,label:f})):(i[f.name]=f,a.push({value:f.name,label:f.name}))});let s=i[r||""],l=Wn().controller,c=ve(()=>({}),[]);async function u(f){let m={};if(f){if(f in c){let h=c[f];Object.assign(m,h)}else if(f in i){let h=tb(i[f]);Object.assign(m,h)}}m._type=f,await l.updateKey(t.deepKey,m),o(f)}ul(t.deepKey,f=>{f?._type&&(o(f._type||""),c[f._type]=f)});function d(f){let m=f.target;m&&m.select&&m.select()}return p("div",{className:"DocEditor__OneOfField",children:[p("div",{className:"DocEditor__OneOfField__select",children:[p("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),p(Er,{data:a,value:r,placeholder:e.placeholder,onChange:f=>u(f||""),onFocus:d,size:"xs",radius:0,searchable:!0,dropdownComponent:"div"})]}),s&&p("div",{className:"DocEditor__OneOfField__fields",children:s.fields.map(f=>p(wr.Field,{field:f,deepKey:`${t.deepKey}.${f.id}`,onBlur:()=>{Va(null)},onFocus:()=>{Va(`${t.deepKey}.${f.id}`,{scroll:!0})}},`${r}::${f.id}`))})]})};function yhe(t,e,r){if(t.length<=1)return t;let o=t[e];return t[e]=t[r],t[r]=o,t}function uet(t,e,r){let[o]=t.splice(e,1);t.splice(r,0,o)}function vhe(t,e,r="title"){let o=kk();if(t.type==="oneof"){let n=t,i=e?._type;if(i){let a,s=n.types||[];return typeof s[0]=="string"?a=o[i]:a=s.find(l=>l.name===i),a?.preview?.[r]||null}}return null}function det(t){let e=t?.blocks||[];for(let r of e)if(r.type==="paragraph"){let o=r.data?.text||"";o=o.replace(/<br\s*\/?>/gi,`
|
|
245
|
-
`),o=o.replace(/<[^>]+>/g,"").replace(/ /g," ");let n=o.split(/\r?\n/)[0].trim();if(n)return n}}var Tk=class extends Error{};function F3(t,e,r){let o=Array.isArray(t)?t:[t],n=i=>{if(r!==void 0){if(i==="_index"||i==="_index0")return String(r);if(i==="_index1")return String(r+1);if(i==="_index:02")return String(r).padStart(2,"0");if(i==="_index:03")return String(r).padStart(3,"0")}let a=Qo(e,i);if(!a)throw new Tk(i);if(hh(a)){let s=det(a);if(s)return s}return String(a)};for(let i of o)try{return mae(i,n)}catch(a){if(a instanceof Tk)continue;throw a}}function fet(t,e){let r=vhe(t.of,e,"image");if(r)return F3(r,e)}function pet(t,e,r){let o=vhe(t.of,e,"title");if(o){let n=F3(o,e,r);if(n)return n}return t.preview?F3(t.preview,e,r)??`item ${r}`:`item ${r}`}function Nk(t,e,r=""){let o=iC({collectionId:t,slug:e}),n=new URLSearchParams(window.location.search);n.set("preview","true"),n.has("locale")&&n.delete("locale");let i=`${n.toString()}${window.location.hash}`;return r?`${iC({collectionId:t,slug:e,locale:r})}?${i}`:`${o}?${i}`}function Pk(t){let e=t.collection,r=t.slug,o=`${e}/${r}`;return p(dae,{docId:o,children:p(met,{...t})})}function met(t){let e=t.collection,r=t.slug,o=`${e}/${r}`,n=window.__ROOT_CTX.collections[e],i=Wn(),[a,s]=Hf(`root::DocumentPage::previewVisible::${e}`,!0);if(!n)return p("div",{children:"Could not find collection."});function l(){let f=Nk(e,r),m=window.open(f,"_blank","noopener,noreferrer");m&&m.focus()}let c=qe(()=>{i.controller&&i.controller.flush()},[i.controller]),u=mC(),d=qe(()=>{u.open({data:i.controller?.getData()||{},onSave:f=>{i.controller&&f&&typeof f=="object"&&(i.controller.updateKey("fields",f),i.controller.flush()),u.close()}})},[i.controller]);return UN([["mod+S",c]]),p(Be,{children:p(fc,{className:"DocumentPage",localStorageId:"DocumentPage",children:[p(fc.Item,{className:De("DocumentPage__side",!a&&"DocumentPage__side--expanded"),children:[p("div",{className:"DocumentPage__side__header",children:[p("div",{className:"DocumentPage__side__header__nav",children:[p("a",{href:`/cms/content/${e}`,children:p(Je,{className:"DocumentPage__side__header__back",children:p(QR,{size:16})})}),p("div",{className:"DocumentPage__side__header__docId",children:o})]}),p("div",{className:"DocumentPage__side__header__buttons",children:[p(re,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:p(yy,{size:16}),onClick:()=>c(),children:"Save"}),p(Te,{label:"Edit JSON",children:p(Je,{className:"DocumentPage__side__header__editJson",onClick:()=>d(),children:p(gy,{size:14})})}),p(Te,{label:a?"Hide preview":"Show preview",children:p(Je,{className:"DocumentPage__side__header__previewToggle",onClick:()=>s(!a),children:a?p(bM,{size:16}):p(vM,{size:16})})}),!a&&p(Te,{label:"Open preview in new tab",children:p(Je,{className:"DocumentPage__side__header__openNewTab",onClick:l,children:p(Iu,{size:16})})})]})]}),p("div",{className:De("DocumentPage__side__editor",!a&&"DocumentPage__side__editor--centered"),children:p(wr,{docId:o})})]}),p(fc.Item,{className:De("DocumentPage__main",!a&&"DocumentPage__main--hidden"),fluid:!0,children:a&&p(Pk.Preview,{docId:o},o)})]})})}var Ihe={mobile:[360,800],tablet:[768,1024],desktop:[1440,800]};function het(t){let e=new Intl.DisplayNames(["en"],{type:"language"}),o=t.split("_")[0];return`${e.of(o)||t} (${t})`}Pk.Preview=t=>{let e=Wn();if(e.loading)return null;let[r,o]=t.docId.split("/"),i=window.__ROOT_CTX.collections[r];if(!i)throw new Error(`collection not found: ${r}`);let a=i.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",s=VL({collectionId:r,slug:o}),l=iC({collectionId:r,slug:o}),c=`${a}${s}`,[u,d]=M(c),[f,m]=Hf("root::DocumentPage::preview::device",""),[h,g]=M({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[_,y]=ane("locale",""),b=W(null),v=e.controller.getLocales()||[],C=tne(),N=Nk(r,o),I=Nk(r,o,_),E=[{value:"",label:"Select locale"},...v.map(P=>({value:P,label:het(P)}))];function w(){let P=b.current;P.src="about:blank",window.setTimeout(()=>{P.src!==I?P.src=I:P.contentWindow.location.reload()},30)}V(()=>{let P=b.current;function B(){let z=P.contentWindow;if(z&&l===s&&!z.location.href.startsWith("about:blank")){let H=z.location.pathname;d(`${a}${H}`)}}P.addEventListener("load",B);let $=e.controller?.onFlush(()=>{w()});return()=>{$(),P.removeEventListener("load",B)}},[]),V(()=>{let P=b.current;P.src=I},[_]);function S(P){m(B=>B===P?"":P)}function T(){e.controller&&e.controller.flush().then(()=>w())}function A(){let P=Nk(r,o,_),B=window.open(P,"_blank","noopener,noreferrer");B&&B.focus()}function R(){if(f===""){g({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"});return}let $=b.current.parentElement.parentElement.getBoundingClientRect(),[z,H]=Ihe[f],G=20,Y=1;(z>$.width-2*G||H>$.height-2*G)&&(Y=Math.min(($.width-2*G)/z,($.height-2*G)/H)),g({"--iframe-width":`${z}px`,"--iframe-height":`${H}px`,"--iframe-scale":String(Y)})}return V(()=>{R();let P=C.onResize(R);return window.addEventListener("resize",R),()=>{P(),window.removeEventListener("resize",R)}},[f,C]),p("div",{className:"DocumentPage__main__preview",children:[p("div",{className:"DocumentPage__main__previewBar",children:[p("div",{className:"DocumentPage__main__previewBar__devices",children:[p(Te,{label:"Mobile",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="mobile"&&"active"),onClick:()=>S("mobile"),children:p(cM,{size:16})})}),p(Te,{label:"Tablet",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="tablet"&&"active"),onClick:()=>S("tablet"),children:p(lM,{size:16})})}),p(Te,{label:"Desktop",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="desktop"&&"active"),onClick:()=>S("desktop"),children:p(sM,{size:16})})})]}),p("div",{className:"DocumentPage__main__previewBar__navbar",children:p("div",{className:"DocumentPage__main__previewBar__navbar__url",children:u})}),p("div",{className:"DocumentPage__main__previewBar__locales",children:p(Er,{data:E,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:p(PM,{size:16,strokeWidth:1.5}),value:_,onChange:P=>{y(P)}})}),p("div",{className:"DocumentPage__main__previewBar__buttons",children:[p(Te,{label:"Reload",children:p(Je,{className:"DocumentPage__main__previewBar__button DocumentPage__main__previewBar__button--reload",onClick:()=>T(),children:p(TM,{size:16})})}),p(Te,{label:"Open new tab",children:p(Je,{className:"DocumentPage__main__previewBar__button DocumentPage__main__previewBar__button--openNewTab",onClick:()=>A(),children:p(Iu,{size:16})})})]})]}),p("div",{className:"DocumentPage__main__previewFrame","data-device":f||"full",style:h,children:[f&&p("div",{className:"DocumentPage__main__previewFrame__deviceLabel",children:`${f}: ${Ihe[f].join("x")}`}),p("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:p("iframe",{ref:b,src:N,title:"iframe preview"})})]})]})};Oe();var get="Enter the URL to make the HTTP request.",_et="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function Ok(t){let e=W(null),r=Mu(),[o,n]=M(!1),[i,a]=M(r.enabled?"gsheet":"http"),[s,l]=M("map"),[c,u]=M("GET"),[d,f]=M(""),[m,h]=M(!!t.dataSourceId),[g,_]=M(null),y="";i==="http"?y=get:i==="gsheet"&&(y=_et);async function b(N){await er(async()=>{let I=await Ff(N);_(I),a(I?.type||"http"),l(I?.dataFormat||"map")}),h(!1)}V(()=>{t.dataSourceId&&(h(!0),b(t.dataSourceId))},[t.dataSourceId]);async function v(){f("");let N=e.current;function I(T){let A=N.elements[T];return A?A.value.trim():""}let E=t.dataSourceId||I("id");if(!E){f("missing id");return}if(!sl(E)){f("id is invalid (alphanumeric characters and dashes only)");return}let w=I("url");if(!w){f("missing url");return}let S={id:E,description:I("description"),type:i,url:w,previewUrl:I("previewUrl")};if(i==="http"){if(!xet(w)){f("invalid url");return}S.httpOptions={method:c};let T=I("httpHeaders");if(T&&(S.httpOptions.headers=yet(T)),c==="POST"){let A=I("httpBody");A&&(S.httpOptions.body=A)}}else if(i==="gsheet"){if(!Au(w)?.spreadsheetId){f("failed to parse spreadsheet url");return}S.dataFormat=s||"map"}try{_(S),n(!0),t.dataSourceId?(await Zte(t.dataSourceId,S),Ae({title:"Saved data source",message:`Successfully updated ${E}`,autoClose:5e3}),n(!1)):(await Qte(E,S),Ae({title:"Added data source",message:`Successfully added ${E}`,autoClose:5e3}),n(!1),mo(`/cms/data/${E}`))}catch(T){console.error(T),Ae({title:"Failed to save data source",message:String(T),color:"red",autoClose:!1}),n(!1)}}let C=[{value:"http",label:"HTTP"}];return(r.enabled||i==="gsheet")&&C.push({value:"gsheet",label:"Google Sheet"}),p("form",{className:"DataSourceForm",ref:e,onSubmit:N=>{N.preventDefault(),v()},children:[p(ka,{visible:m}),p("div",{className:"DataSourceForm__input",children:p(Er,{name:"type",label:"Type",data:C,value:i,onChange:N=>a(N),size:"xs",radius:0,dropdownComponent:"div"})}),p(ir,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.dataSourceId,disabled:!!t.dataSourceId}),p(br,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:g?.description}),p(ir,{className:"DataSourceForm__input",name:"url",label:"URL",description:y,size:"xs",radius:0,value:g?.url}),i==="http"&&p(Ne,{children:[p("div",{className:"DataSourceForm__input",children:p(Er,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:c,onChange:N=>u(N),size:"xs",radius:0,dropdownComponent:"div"})}),p(br,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:bet(g?.httpOptions?.headers||{})}),c==="POST"&&p(br,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:g?.httpOptions?.body})]}),i==="gsheet"&&p("div",{className:"DataSourceForm__input",children:[p(Er,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:s,onChange:N=>l(N),size:"xs",radius:0,dropdownComponent:"div"}),s==="array"&&p("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",p("code",{children:"[[header1, header2], [foo, bar]]"})]}),s==="map"&&p("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",p("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),p(ir,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:g?.previewUrl}),p(re,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:o,children:t.buttonLabel||"Save"}),d&&p("div",{className:"DataSourceForm__error",children:["Error: ",d]})]})}function xet(t){let e,r=t.startsWith("/")?"http://localhost":void 0;try{e=new URL(t,r)}catch(o){return console.error(o),!1}return e.protocol==="http:"||e.protocol==="https:"}function yet(t){let e={};return t.split(`
|
|
245
|
+
`),o=o.replace(/<[^>]+>/g,"").replace(/ /g," ");let n=o.split(/\r?\n/)[0].trim();if(n)return n}}var Tk=class extends Error{};function F3(t,e,r){let o=Array.isArray(t)?t:[t],n=i=>{if(r!==void 0){if(i==="_index"||i==="_index0")return String(r);if(i==="_index1")return String(r+1);if(i==="_index:02")return String(r).padStart(2,"0");if(i==="_index:03")return String(r).padStart(3,"0")}let a=Qo(e,i);if(!a)throw new Tk(i);if(hh(a)){let s=det(a);if(s)return s}return String(a)};for(let i of o)try{return mae(i,n)}catch(a){if(a instanceof Tk)continue;throw a}}function fet(t,e){let r=vhe(t.of,e,"image");if(r)return F3(r,e)}function pet(t,e,r){let o=vhe(t.of,e,"title");if(o){let n=F3(o,e,r);if(n)return n}return t.preview?F3(t.preview,e,r)??`item ${r}`:`item ${r}`}function Nk(t,e,r=""){let o=iC({collectionId:t,slug:e}),n=new URLSearchParams(window.location.search);n.set("preview","true"),n.has("locale")&&n.delete("locale");let i=`${n.toString()}${window.location.hash}`;return r?`${iC({collectionId:t,slug:e,locale:r})}?${i}`:`${o}?${i}`}function Pk(t){let e=t.collection,r=t.slug,o=`${e}/${r}`;return p(dae,{docId:o,children:p(met,{...t})})}function met(t){let e=t.collection,r=t.slug,o=`${e}/${r}`,n=window.__ROOT_CTX.collections[e],i=Wn(),[a,s]=Hf(`root::DocumentPage::previewVisible::${e}`,!0);if(!n)return p("div",{children:"Could not find collection."});function l(){let f=Nk(e,r),m=window.open(f,"_blank","noopener,noreferrer");m&&m.focus()}let c=qe(()=>{i.controller&&i.controller.flush()},[i.controller]),u=mC(),d=qe(()=>{let f=i.controller?.getData()?.fields||{};u.open({data:f,onSave:m=>{i.controller&&m&&typeof m=="object"&&(i.controller.updateKey("fields",m),i.controller.flush()),u.close()}})},[i.controller]);return UN([["mod+S",c]]),p(Be,{children:p(fc,{className:"DocumentPage",localStorageId:"DocumentPage",children:[p(fc.Item,{className:De("DocumentPage__side",!a&&"DocumentPage__side--expanded"),children:[p("div",{className:"DocumentPage__side__header",children:[p("div",{className:"DocumentPage__side__header__nav",children:[p("a",{href:`/cms/content/${e}`,children:p(Je,{className:"DocumentPage__side__header__back",children:p(QR,{size:16})})}),p("div",{className:"DocumentPage__side__header__docId",children:o})]}),p("div",{className:"DocumentPage__side__header__buttons",children:[p(re,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:p(yy,{size:16}),onClick:()=>c(),children:"Save"}),p(Te,{label:"Edit JSON",children:p(Je,{className:"DocumentPage__side__header__editJson",onClick:()=>d(),children:p(gy,{size:14})})}),p(Te,{label:a?"Hide preview":"Show preview",children:p(Je,{className:"DocumentPage__side__header__previewToggle",onClick:()=>s(!a),children:a?p(bM,{size:16}):p(vM,{size:16})})}),!a&&p(Te,{label:"Open preview in new tab",children:p(Je,{className:"DocumentPage__side__header__openNewTab",onClick:l,children:p(Iu,{size:16})})})]})]}),p("div",{className:De("DocumentPage__side__editor",!a&&"DocumentPage__side__editor--centered"),children:p(wr,{docId:o})})]}),p(fc.Item,{className:De("DocumentPage__main",!a&&"DocumentPage__main--hidden"),fluid:!0,children:a&&p(Pk.Preview,{docId:o},o)})]})})}var Ihe={mobile:[360,800],tablet:[768,1024],desktop:[1440,800]};function het(t){let e=new Intl.DisplayNames(["en"],{type:"language"}),o=t.split("_")[0];return`${e.of(o)||t} (${t})`}Pk.Preview=t=>{let e=Wn();if(e.loading)return null;let[r,o]=t.docId.split("/"),i=window.__ROOT_CTX.collections[r];if(!i)throw new Error(`collection not found: ${r}`);let a=i.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",s=VL({collectionId:r,slug:o}),l=iC({collectionId:r,slug:o}),c=`${a}${s}`,[u,d]=M(c),[f,m]=Hf("root::DocumentPage::preview::device",""),[h,g]=M({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[_,y]=ane("locale",""),b=W(null),v=e.controller.getLocales()||[],C=tne(),N=Nk(r,o),I=Nk(r,o,_),E=[{value:"",label:"Select locale"},...v.map(P=>({value:P,label:het(P)}))];function w(){let P=b.current;P.src="about:blank",window.setTimeout(()=>{P.src!==I?P.src=I:P.contentWindow.location.reload()},30)}V(()=>{let P=b.current;function B(){let z=P.contentWindow;if(z&&l===s&&!z.location.href.startsWith("about:blank")){let H=z.location.pathname;d(`${a}${H}`)}}P.addEventListener("load",B);let $=e.controller?.onFlush(()=>{w()});return()=>{$(),P.removeEventListener("load",B)}},[]),V(()=>{let P=b.current;P.src=I},[_]);function S(P){m(B=>B===P?"":P)}function T(){e.controller&&e.controller.flush().then(()=>w())}function A(){let P=Nk(r,o,_),B=window.open(P,"_blank","noopener,noreferrer");B&&B.focus()}function R(){if(f===""){g({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"});return}let $=b.current.parentElement.parentElement.getBoundingClientRect(),[z,H]=Ihe[f],G=20,Y=1;(z>$.width-2*G||H>$.height-2*G)&&(Y=Math.min(($.width-2*G)/z,($.height-2*G)/H)),g({"--iframe-width":`${z}px`,"--iframe-height":`${H}px`,"--iframe-scale":String(Y)})}return V(()=>{R();let P=C.onResize(R);return window.addEventListener("resize",R),()=>{P(),window.removeEventListener("resize",R)}},[f,C]),p("div",{className:"DocumentPage__main__preview",children:[p("div",{className:"DocumentPage__main__previewBar",children:[p("div",{className:"DocumentPage__main__previewBar__devices",children:[p(Te,{label:"Mobile",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="mobile"&&"active"),onClick:()=>S("mobile"),children:p(cM,{size:16})})}),p(Te,{label:"Tablet",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="tablet"&&"active"),onClick:()=>S("tablet"),children:p(lM,{size:16})})}),p(Te,{label:"Desktop",children:p(Je,{className:De("DocumentPage__main__previewBar__device",f==="desktop"&&"active"),onClick:()=>S("desktop"),children:p(sM,{size:16})})})]}),p("div",{className:"DocumentPage__main__previewBar__navbar",children:p("div",{className:"DocumentPage__main__previewBar__navbar__url",children:u})}),p("div",{className:"DocumentPage__main__previewBar__locales",children:p(Er,{data:E,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:p(PM,{size:16,strokeWidth:1.5}),value:_,onChange:P=>{y(P)}})}),p("div",{className:"DocumentPage__main__previewBar__buttons",children:[p(Te,{label:"Reload",children:p(Je,{className:"DocumentPage__main__previewBar__button DocumentPage__main__previewBar__button--reload",onClick:()=>T(),children:p(TM,{size:16})})}),p(Te,{label:"Open new tab",children:p(Je,{className:"DocumentPage__main__previewBar__button DocumentPage__main__previewBar__button--openNewTab",onClick:()=>A(),children:p(Iu,{size:16})})})]})]}),p("div",{className:"DocumentPage__main__previewFrame","data-device":f||"full",style:h,children:[f&&p("div",{className:"DocumentPage__main__previewFrame__deviceLabel",children:`${f}: ${Ihe[f].join("x")}`}),p("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:p("iframe",{ref:b,src:N,title:"iframe preview"})})]})]})};Oe();var get="Enter the URL to make the HTTP request.",_et="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function Ok(t){let e=W(null),r=Mu(),[o,n]=M(!1),[i,a]=M(r.enabled?"gsheet":"http"),[s,l]=M("map"),[c,u]=M("GET"),[d,f]=M(""),[m,h]=M(!!t.dataSourceId),[g,_]=M(null),y="";i==="http"?y=get:i==="gsheet"&&(y=_et);async function b(N){await er(async()=>{let I=await Ff(N);_(I),a(I?.type||"http"),l(I?.dataFormat||"map")}),h(!1)}V(()=>{t.dataSourceId&&(h(!0),b(t.dataSourceId))},[t.dataSourceId]);async function v(){f("");let N=e.current;function I(T){let A=N.elements[T];return A?A.value.trim():""}let E=t.dataSourceId||I("id");if(!E){f("missing id");return}if(!sl(E)){f("id is invalid (alphanumeric characters and dashes only)");return}let w=I("url");if(!w){f("missing url");return}let S={id:E,description:I("description"),type:i,url:w,previewUrl:I("previewUrl")};if(i==="http"){if(!xet(w)){f("invalid url");return}S.httpOptions={method:c};let T=I("httpHeaders");if(T&&(S.httpOptions.headers=yet(T)),c==="POST"){let A=I("httpBody");A&&(S.httpOptions.body=A)}}else if(i==="gsheet"){if(!Au(w)?.spreadsheetId){f("failed to parse spreadsheet url");return}S.dataFormat=s||"map"}try{_(S),n(!0),t.dataSourceId?(await Zte(t.dataSourceId,S),Ae({title:"Saved data source",message:`Successfully updated ${E}`,autoClose:5e3}),n(!1)):(await Qte(E,S),Ae({title:"Added data source",message:`Successfully added ${E}`,autoClose:5e3}),n(!1),mo(`/cms/data/${E}`))}catch(T){console.error(T),Ae({title:"Failed to save data source",message:String(T),color:"red",autoClose:!1}),n(!1)}}let C=[{value:"http",label:"HTTP"}];return(r.enabled||i==="gsheet")&&C.push({value:"gsheet",label:"Google Sheet"}),p("form",{className:"DataSourceForm",ref:e,onSubmit:N=>{N.preventDefault(),v()},children:[p(ka,{visible:m}),p("div",{className:"DataSourceForm__input",children:p(Er,{name:"type",label:"Type",data:C,value:i,onChange:N=>a(N),size:"xs",radius:0,dropdownComponent:"div"})}),p(ir,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.dataSourceId,disabled:!!t.dataSourceId}),p(br,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:g?.description}),p(ir,{className:"DataSourceForm__input",name:"url",label:"URL",description:y,size:"xs",radius:0,value:g?.url}),i==="http"&&p(Ne,{children:[p("div",{className:"DataSourceForm__input",children:p(Er,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:c,onChange:N=>u(N),size:"xs",radius:0,dropdownComponent:"div"})}),p(br,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:bet(g?.httpOptions?.headers||{})}),c==="POST"&&p(br,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:g?.httpOptions?.body})]}),i==="gsheet"&&p("div",{className:"DataSourceForm__input",children:[p(Er,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:s,onChange:N=>l(N),size:"xs",radius:0,dropdownComponent:"div"}),s==="array"&&p("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",p("code",{children:"[[header1, header2], [foo, bar]]"})]}),s==="map"&&p("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",p("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),p(ir,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:g?.previewUrl}),p(re,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:o,children:t.buttonLabel||"Save"}),d&&p("div",{className:"DataSourceForm__error",children:["Error: ",d]})]})}function xet(t){let e,r=t.startsWith("/")?"http://localhost":void 0;try{e=new URL(t,r)}catch(o){return console.error(o),!1}return e.protocol==="http:"||e.protocol==="https:"}function yet(t){let e={};return t.split(`
|
|
246
246
|
`).forEach(o=>{let n=o.indexOf(":");if(n===-1)return;let i=o.slice(0,n).trim(),a=o.slice(n+1).trim();i&&a&&(e[i]=a)}),e}function bet(t){let e=[];for(let r in t){let o=t[r];e.push(`${r}: ${o}`)}return e.join(`
|
|
247
247
|
`)}function whe(t){let e=Ct(),r=Vt();function o(){let n=`delete-data-source-${t.id}`,i=e.openConfirmModal({...r,title:"Delete data source",children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",p("code",{children:t.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{Ae({id:n,title:"Deleting data source",message:`Deleting ${t.id} and synced data...`,loading:!0,autoClose:!1}),await ore(t.id),Ht({id:n,title:"Deleted data source",message:`Successfully deleted ${t.id}`,loading:!1,autoClose:5e3}),e.closeModal(i),mo("/cms/data")}})}return p(Be,{children:p("div",{className:"EditDataSourcePage",children:[p("div",{className:"EditDataSourcePage__header",children:[p(Io,{className:"EditDataSourcePage__header__breadcrumbs",children:[p("a",{href:"/cms/data",children:"Data Sources"}),p("a",{href:`/cms/data/${t.id}`,children:t.id}),p("div",{children:"Edit"})]}),p("div",{className:"EditDataSourcePage__header__titleWrap",children:[p(et,{size:"h1",children:["Edit Data Source: ",t.id]}),p("div",{className:"EditDataSourcePage__header__controls",children:p(Te,{label:"Delete",children:p(Je,{onClick:o,children:p(Oy,{size:20,stroke:"1.5"})})})})]})]}),p(Ok,{dataSourceId:t.id})]})})}Oe();function _d(t){let e=W(null),[r,o]=M(!1),[n,i]=M(""),[a,s]=M(!!t.releaseId),[l,c]=M(null),[u,d]=M([]),[f,m]=M([]),h=pC(),g=ire();async function _(I){console.log(I),await er(async()=>{let E=await Vf(I);c(E),d(E?.docIds||[]),m(E?.dataSourceIds||[])}),s(!1)}V(()=>{t.releaseId&&(s(!0),_(t.releaseId))},[t.releaseId]);async function y(){i("");let I=e.current;function E(T){let A=I.elements[T];return A?A.value.trim():""}let w=t.releaseId||E("id");if(!w){i("missing id");return}if(!sl(w)){i("id is invalid (alphanumeric characters and dashes only)");return}let S={id:w,description:E("description"),docIds:u,dataSourceIds:f};try{c(S),o(!0),t.releaseId?(await Doe(t.releaseId,S),Ae({title:"Saved release",message:`Updated ${w}`,autoClose:5e3}),o(!1)):(await Ooe(w,S),Ae({title:"Added release",message:`Successfully added ${w}`,autoClose:5e3}),o(!1)),mo(`/cms/releases/${w}`)}catch(T){console.error(T),Ae({title:"Failed to save release",message:String(T),color:"red",autoClose:!1}),o(!1)}}function b(){h.open({selectedDocIds:u,onChange:(I,E)=>{d(w=>{let S=[...w];if(E)S.push(I);else{let T=S.findIndex(A=>A===I);T>-1&&S.splice(T,1)}return console.log(S),S.sort()})}})}function v(){g.open({selectedDataSourceIds:f,onChange:(I,E)=>{m(w=>{let S=[...w];if(E)S.push(I);else{let T=S.indexOf(I);T>-1&&S.splice(T,1)}return S.sort()})}})}function C(I){console.log("onRemoveDoc()",I),d(E=>{let w=[...E],S=w.indexOf(I);return S!==-1&&w.splice(S,1),console.log(w),w})}function N(I){m(E=>{let w=[...E],S=w.indexOf(I);return S!==-1&&w.splice(S,1),w})}return p("form",{className:"ReleaseForm",ref:e,onSubmit:I=>{I.preventDefault(),y()},children:[p(ka,{visible:a}),p(ir,{className:"ReleaseForm__input",name:"id",label:"ID",description:"Unique identifier for the release. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.releaseId,disabled:!!t.releaseId}),p(br,{className:"ReleaseForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:l?.description}),p(kn,{className:"ReleaseForm__input",label:"Docs",description:"Select one or more docs to add to the release. Note: you can add or edit this list at a later time, if needed.",size:"xs",children:[u.length>0&&p(_d.DocPreviewCards,{docIds:u,onRemoveDoc:C}),p(re,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>b(),children:"Select"})]}),p(kn,{className:"ReleaseForm__input",label:"Data Sources",description:"Optional. Data sources to publish with the release.",size:"xs",children:[f.length>0&&p(_d.DataSourceIds,{ids:f,onRemove:N}),p(re,{className:"ReleaseForm__docSelectButton",color:"dark",size:"xs",onClick:()=>v(),children:"Select"})]}),p("div",{className:"ReleaseForm__submit__buttons",children:p(re,{className:"ReleaseForm__submit",color:"blue",size:"xs",type:"submit",loading:r,children:t.buttonLabel||"Save"})}),n&&p("div",{className:"ReleaseForm__error",children:["Error: ",n]})]})}_d.DocPreviewCards=t=>p("div",{className:"ReleaseForm__DocPreviewCards",children:t.docIds.map(e=>p("div",{className:"ReleaseForm__DocPreviewCards__card",children:[p(tg,{className:"ReleaseForm__DocPreviewCards__card__preview",docId:e}),p("div",{className:"ReleaseForm__DocPreviewCards__card__controls",children:[p("div",{className:"ReleaseForm__DocPreviewCards__card__controls__remove",children:p(Te,{label:"Remove",children:p(Je,{className:"ReleaseForm__DocPreviewCards__card__controls__remove__icon",onClick:()=>t.onRemoveDoc(e),children:p(Hn,{size:16})})})}),p("div",{className:"ReleaseForm__DocPreviewCards__card__controls__open",children:p(Te,{label:"Open",children:p(Je,{component:"a",className:"ReleaseForm__DocPreviewCards__card__controls__open__icon",href:`/cms/content/${e}`,target:"_blank",children:p(Iu,{size:16})})})})]})]},e))});_d.DataSourceIds=t=>p("div",{className:"ReleaseForm__DataSourceIds",children:t.ids.map(e=>p("div",{className:"ReleaseForm__DataSourceIds__item",children:[p("span",{className:"ReleaseForm__DataSourceIds__item__id",children:e}),p(Je,{className:"ReleaseForm__DataSourceIds__item__remove",onClick:()=>t.onRemove(e),children:p(Hn,{size:16})})]},e))});function Ehe(t){let e=Ct(),r=Vt();function o(){let n=`delete-release-${t.id}`,i=e.openConfirmModal({...r,title:"Delete release",children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete release ",p("code",{children:t.id}),"? There is no undo. This will only delete the release; the docs in the release will remain unchanged."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{Ae({id:n,title:"Deleting release",message:`Deleting ${t.id}...`,loading:!0,autoClose:!1}),await Roe(t.id),Ht({id:n,title:"Deleted release",message:`Successfully deleted ${t.id}`,loading:!1,autoClose:5e3}),e.closeModal(i),mo("/cms/releases")}})}return p(Be,{children:p("div",{className:"EditReleasePage",children:[p("div",{className:"EditReleasePage__header",children:[p(Io,{className:"EditReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("a",{href:`/cms/releases/${t.id}`,children:t.id}),p("div",{children:"Edit"})]}),p("div",{className:"EditReleasePage__header__titleWrap",children:[p(et,{size:"h1",children:["Edit Release: ",t.id]}),p("div",{className:"EditReleasePage__header__controls",children:p(Te,{label:"Delete",children:p(Je,{onClick:o,children:p(Oy,{size:20,stroke:"1.5"})})})})]})]}),p(_d,{releaseId:t.id})]})})}Oe();function Ak(t){let e=t.limit||40,[r,o]=M(!0),[n,i]=M([]);async function a(){let s=await hQ({limit:e});i(s),o(!1)}return V(()=>{a()},[]),r?p("div",{className:"ActionsLog ActionsLog--loading",children:p(Ze,{color:"gray",size:"xl"})}):p("div",{className:"ActionsLog",children:p(fo,{className:"ActionsLog__table",children:[p("thead",{children:p("tr",{className:"ActionsLogs__table__row ActionsLogs__table__row--header",children:[p("th",{className:"ActionsLogs__table__header",children:"timestamp"}),p("th",{className:"ActionsLogs__table__header",children:"user"}),p("th",{className:"ActionsLogs__table__header",children:"action"}),p("th",{className:"ActionsLogs__table__header",children:"quick links"})]})}),p("tbody",{children:n.map(s=>p("tr",{className:"ActionsLogs__table__row",children:[p("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:vet(s.timestamp)}),p("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:s.by}),p("td",{className:"ActionsLogs__table__col",children:[s.action," ",Iet(s.metadata)]}),p("td",{className:"ActionsLogs__table__col",children:p("div",{className:"ActionsLogs__table__buttons",children:[s.action!=="doc.delete"&&s.metadata?.docId&&p(Te,{transition:"pop",label:s.metadata.docId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${s.metadata?.docId}`,children:"Open doc"})}),s.action!=="datasource.delete"&&s.metadata?.datasourceId&&p(Te,{transition:"pop",label:s.metadata.datasourceId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${s.metadata?.datasourceId}`,children:"Open release"})}),s.action!=="release.delete"&&s.metadata?.releaseId&&p(Te,{transition:"pop",label:s.metadata.releaseId,children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${s.metadata?.releaseId}`,children:"Open release"})}),s.metadata?.sheetId&&p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:Ma(s.metadata.sheetId),target:"_blank",children:"Open sheet"}),s.action.startsWith("acls.")&&p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:"Open settings"})]})})]}))})]})})}function vet(t){return t.toDate().toLocaleString("sv-SE",{dateStyle:"short",timeStyle:"medium"})}function Iet(t){function e(r){return r===null?"null":typeof r>"u"?"undefined":typeof r=="string"?`"${r.replaceAll('"','\\"')}"`:typeof r!="object"?String(r):Array.isArray(r)?`[${r.map(e).join(", ")}]`:`{${Object.entries(r).map(([n,i])=>`${n}: ${e(i)}`).join(", ")}}`}return e(t)}var She=250;function Che(){return p(Be,{children:p("div",{className:"LogsPage",children:[p("div",{className:"LogsPage__header",children:[p(et,{size:"h1",children:"Action Logs"}),p(Ye,{as:"p",children:["The latest ",She," actions are displayed here. View all past actions in the"," ",p("a",{href:wet(),target:"_blank",children:"Firebase Console"}),"."]})]}),p(Ak,{limit:She})]})})}function wet(){let t=window.__ROOT_CTX.firebaseConfig,e=t.projectId,r=window.__ROOT_CTX.rootConfig.projectId,o=t.databaseId||"-default-",n=`/Projects/${r}/ActionLogs`.replaceAll("/","~2F");return`https://console.firebase.google.com/project/${e}/firestore/databases/${o}/data/${n}`}function The(){return p(Be,{children:p("div",{className:"NewDataSourcePage",children:[p("div",{className:"NewDataSourcePage__header",children:[p(Io,{className:"NewDataSourcePage__header__breadcrumbs",children:[p("a",{href:"/cms/data",children:"Data Sources"}),p("div",{children:"New"})]}),p(et,{size:"h1",children:"Add Data Source"})]}),p(Ok,{buttonLabel:"Create data source"})]})})}function khe(){return p(Be,{children:p("div",{className:"NewReleasePage",children:[p("div",{className:"NewReleasePage__header",children:[p(Io,{className:"NewReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("div",{children:"New"})]}),p(et,{size:"h1",children:"Add Release"})]}),p(_d,{buttonLabel:"Create release"})]})})}function Nhe(){return p(Be,{children:p("div",{className:"NotFoundPage",children:[p("div",{className:"NotFoundPage__icon",children:p(Cy,{size:60})}),p("h2",{className:"NotFoundPage__title",children:"Not Found"}),p("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",p("a",{href:"/cms",children:"go home"}),"."]})]})})}function Dk(){let t=window.__ROOT_CTX.rootConfig.projectName||"Root CMS";return p(Be,{children:p("div",{className:"ProjectPage",children:[p("div",{className:"ProjectPage__headline",children:p(et,{className:"ProjectPage__title",size:"h1",children:t})}),p("div",{className:"ProjectPage__section",children:[p(et,{className:"ProjectPage__section__title",size:"h2",children:"Content"}),p(Dk.CollectionList,{})]}),p("div",{className:"ProjectPage__section",children:[p(et,{className:"ProjectPage__section__title ProjectPage__section__title--flex",size:"h2",children:[p("div",{children:"Recent actions"}),p("div",{children:p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})})]}),p(Ak,{limit:20})]})]})})}Dk.CollectionList=()=>{let t=Object.keys(window.__ROOT_CTX.collections).map(e=>({...window.__ROOT_CTX.collections[e],id:e}));return p("div",{className:"ProjectPage__collectionList",children:[t.map(e=>p("a",{className:"ProjectPage__collectionList__collection",href:`/cms/content/${e.id}`,children:[p("div",{className:"ProjectPage__collectionList__collection__icon",children:p(vf,{size:20,strokeWidth:"1.75"})}),p("div",{className:"ProjectPage__collectionList__collection__name",children:e.name||e.id}),e.description&&p("div",{className:"ProjectPage__collectionList__collection__desc",children:e.description})]},e.id)),t.length===0&&p("div",{className:"ProjectPage__collectionList__collections__empty",children:"No collections match your query."})]})};Oe();var Phe={transition:"pop"};function Rk(t){let e=t.release;return e.scheduledAt?p(Te,{...Phe,label:`Scheduled ${Cet(e.scheduledAt)} by ${e.scheduledBy}`,wrapLines:!0,width:240,children:p(is,{size:"xs",variant:"gradient",gradient:{from:"grape",to:"pink",deg:35},children:"Scheduled"})}):e.publishedAt?p(Te,{...Phe,label:`Published ${Eet(e.publishedAt)} by ${e.publishedBy}`,children:p(is,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):p(is,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function Eet(t){return t?Da(t.toMillis()):Da(new Date().getTime())}function Cet(t){return new Date(t.toMillis()).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function xd(t){let[e,r]=M(!0),[o,n]=M(null),[i,a]=M(0),s=t.id;async function l(){r(!0),await er(async()=>{let u=await Vf(s);n(u),a(Ry())}),r(!1)}V(()=>{l()},[]);function c(u){console.log("onAction()",u),l()}return p(Be,{children:p("div",{className:"ReleasePage",children:[p("div",{className:"ReleasePage__header",children:[p(Io,{className:"ReleasePage__header__breadcrumbs",children:[p("a",{href:"/cms/releases",children:"Releases"}),p("div",{children:s})]}),p("div",{className:"ReleasePage__header__titleWrap",children:[p(et,{size:"h1",children:["Release: ",s]}),p("div",{className:"ReleasePage__header__controls",children:p(Te,{label:"Configure",children:p(Je,{component:"a",href:`/cms/releases/${t.id}/edit`,children:p(Ef,{size:24,stroke:"1.5"})})})})]}),o?.description&&p(Ye,{as:"p",children:o.description})]}),e?p(Ze,{color:"gray",size:"xl"}):p(Ne,{children:[o&&p(xd.PublishStatus,{release:o,onAction:c}),o&&o.docIds&&o.docIds.length>0&&p(xd.DocsList,{release:o},`docs-list-${i}`),o&&o.dataSourceIds&&o.dataSourceIds.length>0&&p(xd.DataSourcesList,{release:o},`data-sources-${i}`)]})]})})}xd.PublishStatus=t=>{let e=t.release,[r,o]=M(!1),n=Ct(),i=Vt(),a=$oe({releaseId:e.id,onScheduled:()=>{t.onAction("scheduled")}});function s(){let d=e.docIds||[],f=e.dataSourceIds||[],m=d.length+f.length;if(m===0){Ae({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}n.openConfirmModal({...i,title:`Publish release: ${e.id}`,children:p(Ye,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",m," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{l()}})}async function l(){o(!0),await er(async()=>{let d=`publish-release-${e.id}`,f=e.docIds?.length||0,m=e.dataSourceIds?.length||0,h=f+m;Ae({id:d,title:"Publishing release",message:`Publishing ${h} items...`,loading:!0,autoClose:!1}),await Moe(e.id),Ht({id:d,title:"Published release!",message:`Successfully published ${h} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),o(!1)}function c(){a.open()}async function u(){await Foe(e.id),t.onAction("cancel-schedule")}return p("div",{className:"ReleasePage__PublishStatus",children:[p(et,{size:"h2",children:"Status"}),p(fo,{verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"status"}),p("th",{children:"actions"})]})}),p("tbody",{children:p("tr",{children:[p("td",{children:p(Rk,{release:e})}),p("td",{children:p("div",{className:"ReleasePage__PublishStatus__actions",children:[!e.scheduledAt&&p(Te,{label:"Publish the release immediately",position:"bottom",withArrow:!0,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>s(),loading:r,children:e.publishedAt?"Re-publish":"Publish"})}),e.scheduledAt?p(Te,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>u(),children:"Cancel Schedule"})}):p(Te,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,children:p(re,{variant:"default",size:"xs",compact:!0,onClick:()=>c(),children:"Schedule"})})]})})]})})]})]})};xd.DocsList=t=>{let e=t.release,r=e.docIds||[];return p("div",{className:"ReleasePage__DocsList",children:[p("div",{className:"ReleasePage__DocsList__header",children:[p(et,{size:"h2",children:"Docs"}),p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.id}/edit`,children:"Edit"})]}),p("div",{className:"ReleasePage__DocsList__cards",children:r.map(o=>p("div",{className:"ReleasePage__DocsList__card",children:p("a",{href:`/cms/content/${o}`,children:p(tg,{docId:o,statusBadges:!0})})},o))})]})};xd.DataSourcesList=t=>{let e=t.release,r=e.dataSourceIds||[];return p("div",{className:"ReleasePage__DataSourcesList",children:[p("div",{className:"ReleasePage__DataSourcesList__header",children:[p(et,{size:"h2",children:"Data Sources"}),p(re,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.id}/edit`,children:"Edit"})]}),p("div",{className:"ReleasePage__DataSourcesList__items",children:r.map(o=>p("div",{className:"ReleasePage__DataSourcesList__item",children:p("a",{href:`/cms/data/${o}`,children:o})},o))})]})};Oe();function Mk(){return p(Be,{children:p("div",{className:"ReleasesPage",children:[p("div",{className:"ReleasesPage__header",children:[p(et,{size:"h1",children:"Releases"}),p(Ye,{as:"p",children:"Create a release for publishing content in a batch."}),p("div",{className:"ReleasesPage__header__buttons",children:p(re,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",children:"New release"})})]}),p(Mk.ReleasesTable,{})]})})}Mk.ReleasesTable=()=>{let[t,e]=M(!0),[r,o]=M([]);async function n(){let i=await Aoe();o(i),e(!1)}return V(()=>{n()},[]),p("div",{className:"ReleasesPage__ReleasesTable",children:[t&&p(Ze,{color:"gray",size:"xl"}),r.length>0&&p(fo,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"id"}),p("th",{children:"description"}),p("th",{children:"content"}),p("th",{children:"status"})]})}),p("tbody",{children:r.map(i=>p("tr",{children:[p("td",{children:p("a",{href:`/cms/releases/${i.id}`,children:i.id})}),p("td",{children:i.description||""}),p("td",{children:(i.docIds||[]).map(a=>p("div",{children:p("a",{href:`/cms/content/${a}`,children:a})}))}),p("td",{children:p("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:p(Rk,{release:i})})})]},i.id))})]})]})};Oe();function Tet(t){let e=window.firebase.user.email;if(!e)return null;if(e in t)return t[e];let o=`*@${e.split("@").at(-1)}`;return o in t?t[o]:null}function ket(t){return Tet(t)==="ADMIN"}function Lk(t){let[e,r]=M(!0),[o,n]=M({}),[i,a]=M(""),s=window.firebase.db,l=window.__ROOT_CTX.rootConfig.projectId||"default",c=$e(s,"Projects",l),u=ket(o);V(()=>{ko(c).then(h=>{let g=h.data()||{};n(g.roles||{}),r(!1)})},[]);async function d(h,g){r(!0),await er(async()=>{g==="REMOVE"?(await Mr(c,new Pn("roles",h),$o()),n(_=>{let y={..._};return delete y[h],y}),Ot("acls.remove_user",{metadata:{user:h}})):(await Mr(c,new Pn("roles",h),g),n(_=>({..._,[h]:g})),Ot("acls.update_user",{metadata:{user:h,role:g}}))}),r(!1)}async function f(h){a(""),r(!0),await er(async()=>{await Mr(c,new Pn("roles",h),"EDITOR"),n(g=>({...g,[h]:"VIEWER"}))}),Ot("acls.add_user",{metadata:{user:h,role:"VIEWER"}}),r(!1)}let m=are(Object.keys(o).map(h=>({email:h,role:o[h]})),"email");return p("div",{className:De(t.className,"ShareBox"),children:[e&&p(ka,{visible:!0,loaderProps:{color:"gray",size:"xl"}}),p("form",{className:"ShareBox__addUser",onSubmit:h=>{h.preventDefault(),f(i)},children:[p(ir,{className:"ShareBox__addUser__email",placeholder:"grogu@example.com",type:"email",value:i,onChange:h=>a(h.target.value),radius:0,size:"xs"}),p(re,{className:"ShareBox__addUser__button",size:"xs",radius:0,color:"dark",type:"submit",disabled:!u,children:"Add user"})]}),p("div",{className:"ShareBox__users",children:m.map(h=>p(Lk.User,{...h,currentUserIsAdmin:u,onChange:d},h.email))})]})}Lk.User=t=>{let e=t.email===window.firebase.user.email;return p("div",{className:"ShareBox__user",children:[p(Ye,{className:"ShareBox__user__email",size:"body-sm",weight:"semi-bold",color:"gray",children:[t.email,e&&" (you)"]}),p("div",{className:"ShareBox__user__roleSelect",children:p(Er,{data:[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"VIEWER",label:"VIEWER"},{value:"REMOVE",label:"REMOVE"}],value:t.role,radius:0,size:"xs",disabled:e||!t.currentUserIsAdmin,onChange:r=>{t.onChange(t.email,r)}})})]})};function Ohe(){let t=UC(),e=gC();return p(Be,{children:p("div",{className:"SettingsPage",children:[p("div",{className:"SettingsPage__section SettingsPage__section__users",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"Share"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:[p("p",{children:"Share access to the CMS. To share with everyone in a domain, use *@example.com."}),p("ul",{children:[p("li",{children:"VIEWER: view docs but not edit"}),p("li",{children:"EDITOR: view and edit docs"}),p("li",{children:"ADMIN: all of the above and change sharing settings"})]})]})]}),p("div",{className:"SettingsPage__section__right",children:[p(et,{className:"SettingsPage__section__right__title",size:"h3",children:"Users"}),p(Lk,{className:"SettingsPage__section__users__sharebox"})]})]}),p("div",{className:"SettingsPage__section",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"Site Settings"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:"These settings apply to the project. Only admins can change them."})})]}),p("div",{className:"SettingsPage__section__right",children:cre.map(r=>p("div",{className:"SettingsPage__section__setting",children:[p(Ye,{size:"body",weight:"semi-bold",children:r.name}),p(Ye,{size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:r.description})}),p(br,{autosize:!0,minRows:2,maxRows:4,value:e.settings[r.key]||"",placeholder:r.placeholder,onChange:o=>e.setSettings(r.key,o.currentTarget.value)}),r.ui&&p("div",{children:r.ui(e.settings[r.key])})]},r.key))})]}),p("div",{className:"SettingsPage__section",children:[p("div",{className:"SettingsPage__section__left",children:[p(et,{className:"SettingsPage__section__left__title",children:"User Preferences"}),p(Ye,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:"These settings are for you only."})})]}),p("div",{className:"SettingsPage__section__right",children:p("div",{className:"SettingsPage__section__userPref",children:[p("div",{className:"SettingsPage__section__userPref__description",children:[p(Ye,{className:"SettingsPage__section__userPref__description__title",size:"body",weight:"semi-bold",children:"Enable Lexical Editor (experimental)"}),p(Ye,{className:"SettingsPage__section__userPref__description__body",size:"body-sm",weight:"semi-bold",color:"gray",children:p("p",{children:["Replaces the"," ",p("a",{href:"https://editorjs.io/",target:"_blank",rel:"noopener noreferrer nofollow",children:"EditorJS"})," ","rich text editor with the"," ",p("a",{href:"https://lexical.dev/",target:"_blank",rel:"noopener noreferrer nofollow",children:"Lexical"})," ","version. The data saved by the Lexical version is backwards compatible but the editor may be missing a few features."]})})]}),p("div",{className:"SettingsPage__section__userPref__input",children:p(mE,{color:"dark",checked:t.preferences.EnableLexicalEditor,onChange:r=>{let o=r.currentTarget.checked;t.setPreference("EnableLexicalEditor",o)}})})]})})]})]})})}function Ahe(t){let r=(window.__ROOT_CTX.sidebar?.tools||{})[t.id];return r?r.iframeUrl?p(Be,{children:p("div",{className:"SidebarToolsPage",children:p("iframe",{src:r.iframeUrl})})}):p(Be,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",t.id]})}):p(Be,{children:p("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",t.id]})})}Rl();var Fk=class{constructor(){this.data={}}setMeta(e){Object.entries(e).forEach(([r,o])=>{r.startsWith("@@")||(r=`@@${r}`),this.data[r]=o})}add(e,r,o){this.data[e]=r,o&&(this.data[`@${e}`]=o)}get(e){let r=this.data[e];return r?{source:r,meta:this.data[`@${e}`]}:null}list(){let e=[];return Object.entries(this.data).forEach(([r])=>{if(r.startsWith("@@"))return;let o=this.data[r],n=this.data[`@${r}`];e.push({key:r,source:o,meta:n})}),e}toJson(){return{...this.data}}toString(){return JSON.stringify(this.toJson(),null,2)}};function t_(){return p(Be,{children:p("div",{className:"TranslationsArbPage",children:[p("div",{className:"TranslationsArbPage__header",children:[p(Io,{className:"TranslationsArbPage__header__breadcrumbs",children:[p("a",{href:"/cms/translations",children:"Translations"}),p("div",{children:"ARB"})]}),p(et,{size:"h1",children:"ARB Translations"}),p(Ye,{as:"p",children:"Enter doc ids below (separated by newlines) to include in an ARB file."})]}),p(t_.RequestForm,{})]})})}t_.RequestForm=()=>{let[t,e]=M(""),[r,o]=M(!1),[n,i]=M(""),[a,s]=M(null);async function l(d){let f=await MM(d),m=new Fk,h=window.__ROOT_CTX.rootConfig,g=[h.domain];h.base&&h.base!=="/"&&g.push(h.base);let _=g.join("");m.setMeta({locale:"en",context:_,last_modified:new Date().toISOString()}),console.log(f);for(let y in f){let b=f[y],v=new Set,C=y.split("/")[0],N=await Ah(C);Ky(v,N.fields,b.fields||{},N.types||{});for(let I of v){let E=await ES(I),w=m.get(E)?.meta;if(w){let S=w.context.split(", ");S.push(y),S.sort(),w.context=S.join(", ")}else w={context:y};m.add(E,I,w)}}return m}async function c(){try{let d=Dhe(t),f=await l(d);s(f)}catch(d){console.error(d),i(`failed to preview arb: ${d}`)}}async function u(){try{o(!0),console.log("download arb");let d=Dhe(t),m=(await l(d)).toString(),g=await new Response(m).blob(),_=document.createElement("a");_.href=window.URL.createObjectURL(g),_.download=Pet(d),document.body.appendChild(_),_.click(),document.body.removeChild(_),window.URL.revokeObjectURL(_.href),o(!1)}catch(d){console.error(d),i(`failed to download arb: ${d}`)}}return p("form",{className:"TranslationsArbPage__RequestForm",onSubmit:d=>{d.preventDefault(),u()},children:[p("div",{className:"TranslationsArbPage__RequestForm__textareaWrapper",children:p(br,{required:!0,size:"xs",radius:0,autosize:!0,minRows:8,maxRows:20,value:t,placeholder:"Pages/index",onChange:d=>{e(d.currentTarget.value||"")}})}),p("div",{className:"TranslationsArbPage__RequestForm__submit",children:[p(re,{variant:"default",color:"dark",size:"xs",onClick:c,children:"Preview"}),p(re,{color:"blue",size:"xs",loading:r,type:"submit",leftIcon:p(bf,{size:16,strokeWidth:1.75}),children:"Download ARB"})]}),n&&p(Ye,{as:"p",className:"TranslationsArbPage__RequestForm__error",children:n}),a&&p(t_.Preview,{arb:a})]})};t_.Preview=t=>{let e=t.arb.list().filter(r=>!!r.meta);return console.log(e),p(fo,{verticalSpacing:"xs",highlightOnHover:!0,fontSize:"xs",children:[p("thead",{children:p("tr",{children:[p("th",{children:"source"}),p("th",{children:"context"})]})}),p("tbody",{children:e.map(r=>p("tr",{class:"TranslationsArbPage__Preview__Table__row",children:[p("td",{children:r.source}),p("td",{children:[r.meta?.context,r.meta?.description&&p(Ne,{children:["/ ",r.meta.description]})]})]},r.source))})]})};function Dhe(t){return t.split(`
|
|
248
248
|
`).map(e=>e.trim()).filter(e=>Net(e))}function Net(t){return!!t&&t.includes("/")&&t.split("/").length===2}function Pet(t){let e=new Date,r=a=>a.toString().padStart(2,"0"),o=`${e.getFullYear()}${r(e.getMonth()+1)}${r(e.getDate())}t${r(e.getHours())}${r(e.getMinutes())}`,n=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId,i=[Rhe(n)];return t.length===1&&i.push(Rhe(t[0])),i.push(o),`${i.join("_")}.arb`}function Rhe(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}Oe();function Bk(t){let e=t.hash,[r,o]=M(!1),[n,i]=M(!1),[a,s]=M({source:""});async function l(){o(!0);let u=await _Q(e);if(o(!1),!u?.source){i(!0);return}s(u)}async function c(u){console.log(u),o(!0),await xQ(e,u),s(d=>({...d,...u})),o(!1),Ae({title:"Saved translations",message:`Updated translations for ${e}.`,autoClose:5e3})}return V(()=>{l()},[t.hash]),p(Be,{children:p("div",{className:"TranslationsEditPage",children:[p("div",{className:"TranslationsEditPage__header",children:[p(Io,{className:"TranslationsEditPage__header__breadcrumbs",children:[p("a",{href:"/cms/translations",children:"Translations"}),p("div",{children:t.hash})]}),p(et,{size:"h1",children:"Edit Translations"})]}),r?p(Ze,{color:"gray",size:"xl"}):n?p("div",{className:"TranslationsEditPage__notFound",children:"Not Found"}):p(Bk.Form,{hash:t.hash,translations:a,onChange:c})]})})}Bk.Form=t=>{let e=t.translations,o=(window.__ROOT_CTX.rootConfig.i18n.locales||[]).filter(n=>n!=="en");return p("form",{className:"TranslationsEditPage__Form",onSubmit:n=>{n.preventDefault();let i=n.currentTarget,a=["en",...o],s={};a.forEach(l=>{let c=i.elements[l].value;s[l]=ic(c)}),t.onChange(s)},children:[p(ir,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"hash",label:"hash",value:t.hash,disabled:!0}),p(br,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"source",label:"source",value:e.source,disabled:!0}),p(br,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"en",label:"en",value:e.en}),o.map(n=>p(br,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:n,label:n,value:e[n]||""},n)),p(re,{className:"TranslationsEditPage__Form__input__submit",color:"blue",size:"xs",type:"submit",children:"Save"})]})};Oe();function $k(){return p(Be,{children:p("div",{className:"TranslationsPage",children:[p("div",{className:"TranslationsPage__header",children:[p(et,{size:"h1",children:"Translations"}),p("div",{className:"TranslationsPage__header__buttons",children:p(re,{component:"a",color:"blue",size:"xs",href:"/cms/translations/arb",children:"Download ARB"})})]}),p($k.TranslationsTable,{})]})})}$k.TranslationsTable=()=>{let[t,e]=M(!0),[r,o]=M([]),i=(window.__ROOT_CTX.rootConfig.i18n?.locales||[]).filter(l=>l!=="en"),a=["hash","source","en",...i,"tags"];async function s(){e(!0),await er(async()=>{let l=await Su(),c=[];Object.entries(l).forEach(([u,d])=>{let f=i.map(m=>d[m]||"");c.push([u,d.source,d.en,...f,(d.tags||[]).join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blinkk/root-cms",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"author": "s@blinkk.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
"vite": "7.1.4",
|
|
134
134
|
"vitest": "3.2.4",
|
|
135
135
|
"yjs": "13.6.27",
|
|
136
|
-
"@blinkk/root": "2.2.
|
|
136
|
+
"@blinkk/root": "2.2.6"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
|
-
"@blinkk/root": "2.2.
|
|
139
|
+
"@blinkk/root": "2.2.6",
|
|
140
140
|
"firebase-admin": ">=11",
|
|
141
141
|
"firebase-functions": ">=4",
|
|
142
142
|
"preact": ">=10",
|