@tryghost/admin-toolbar 0.1.0 → 0.1.2
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/package.json +27 -20
- package/umd/admin-toolbar.min.js +2 -2
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/admin-toolbar",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/TryGhost/Ghost"
|
|
8
|
+
},
|
|
6
9
|
"author": "Ghost Foundation",
|
|
7
10
|
"files": [
|
|
8
11
|
"umd/",
|
|
@@ -14,24 +17,14 @@
|
|
|
14
17
|
"registry": "https://registry.npmjs.org/"
|
|
15
18
|
},
|
|
16
19
|
"dependencies": {
|
|
17
|
-
"preact": "
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "pnpm exec vite build",
|
|
21
|
-
"build:watch": "pnpm exec vite build --watch",
|
|
22
|
-
"dev": "concurrently --kill-others --names preview,build \"pnpm exec vite preview -l silent\" \"pnpm build:watch\"",
|
|
23
|
-
"lint": "pnpm exec eslint src --ext .js --cache",
|
|
24
|
-
"test": "pnpm run build && pnpm exec mocha --exit --trace-warnings --timeout=60000 \"test/**/*.test.js\"",
|
|
25
|
-
"preship": "pnpm lint",
|
|
26
|
-
"ship": "node ../../.github/scripts/release-apps.js",
|
|
27
|
-
"prepublishOnly": "pnpm build"
|
|
20
|
+
"preact": "^10.29.2"
|
|
28
21
|
},
|
|
29
22
|
"devDependencies": {
|
|
30
|
-
"concurrently": "
|
|
31
|
-
"eslint": "
|
|
32
|
-
"jsdom": "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
23
|
+
"concurrently": "10.0.3",
|
|
24
|
+
"eslint": "8.57.1",
|
|
25
|
+
"jsdom": "29.1.1",
|
|
26
|
+
"vite": "7.3.2",
|
|
27
|
+
"vitest": "4.1.8"
|
|
35
28
|
},
|
|
36
29
|
"eslintConfig": {
|
|
37
30
|
"ignorePatterns": [
|
|
@@ -56,9 +49,13 @@
|
|
|
56
49
|
"test/**/*.js"
|
|
57
50
|
],
|
|
58
51
|
"env": {
|
|
59
|
-
"mocha": true,
|
|
60
52
|
"node": true
|
|
61
53
|
},
|
|
54
|
+
"globals": {
|
|
55
|
+
"afterEach": "readonly",
|
|
56
|
+
"describe": "readonly",
|
|
57
|
+
"it": "readonly"
|
|
58
|
+
},
|
|
62
59
|
"parserOptions": {
|
|
63
60
|
"sourceType": "script"
|
|
64
61
|
}
|
|
@@ -71,5 +68,15 @@
|
|
|
71
68
|
false
|
|
72
69
|
]
|
|
73
70
|
}
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "pnpm exec vite build",
|
|
74
|
+
"build:watch": "pnpm exec vite build --watch",
|
|
75
|
+
"dev": "concurrently --kill-others --names preview,build \"pnpm exec vite preview -l silent\" \"pnpm build:watch\"",
|
|
76
|
+
"lint": "pnpm exec eslint src --ext .js --cache",
|
|
77
|
+
"test": "pnpm test:unit",
|
|
78
|
+
"test:unit": "pnpm run build && pnpm exec vitest run",
|
|
79
|
+
"preship": "pnpm lint",
|
|
80
|
+
"ship": "node ../../.github/scripts/release-apps.js"
|
|
74
81
|
}
|
|
75
|
-
}
|
|
82
|
+
}
|
package/umd/admin-toolbar.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";var I,b,me,E,pe,he,fe,Z,P,N,be,Q,ee,te,L={},C=[],je=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,D=Array.isArray;function T(e,t){for(var n in t)e[n]=t[n];return e}function ne(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function d(e,t,n){var r,i,o,l={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:l[o]=t[o];if(arguments.length>2&&(l.children=arguments.length>3?I.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)l[o]===void 0&&(l[o]=e.defaultProps[o]);return R(e,l,r,i,null)}function R(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++me,__i:-1,__u:0};return i==null&&b.vnode!=null&&b.vnode(o),o}function F(e){return e.children}function O(e,t){this.props=e,this.context=t}function $(e,t){if(t==null)return e.__?$(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?$(e):null}function qe(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=T({},t);o.__v=t.__v+1,b.vnode&&b.vnode(o),oe(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??$(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,ze(r,o,i),t.__e=t.__=null,o.__e!=n&&ge(o)}}function ge(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ge(e)}function ve(e){(!e.__d&&(e.__d=!0)&&E.push(e)&&!B.__r++||pe!=b.debounceRendering)&&((pe=b.debounceRendering)||he)(B)}function B(){try{for(var e,t=1;E.length;)E.length>t&&E.sort(fe),e=E.shift(),t=E.length,qe(e)}finally{E.length=B.__r=0}}function ye(e,t,n,r,i,o,l,_,m,s,u){var a,p,c,x,g,w,f,h=r&&r.__k||C,M=t.length;for(m=Ge(n,t,h,m,M),a=0;a<M;a++)(c=n.__k[a])!=null&&(p=c.__i!=-1&&h[c.__i]||L,c.__i=a,w=oe(e,c,p,i,o,l,_,m,s,u),x=c.__e,c.ref&&p.ref!=c.ref&&(p.ref&&ie(p.ref,null,c),u.push(c.ref,c.__c||x,c)),g==null&&x!=null&&(g=x),(f=!!(4&c.__u))||p.__k===c.__k?(m=xe(c,m,e,f),f&&p.__e&&(p.__e=null)):typeof c.type=="function"&&w!==void 0?m=w:x&&(m=x.nextSibling),c.__u&=-7);return n.__e=g,m}function Ge(e,t,n,r,i){var o,l,_,m,s,u=n.length,a=u,p=0;for(e.__k=new Array(i),o=0;o<i;o++)(l=t[o])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[o]=R(null,l,null,null,null):D(l)?l=e.__k[o]=R(F,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[o]=R(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[o]=l,m=o+p,l.__=e,l.__b=e.__b+1,_=null,(s=l.__i=Ve(l,n,m,a))!=-1&&(a--,(_=n[s])&&(_.__u|=2)),_==null||_.__v==null?(s==-1&&(i>u?p--:i<u&&p++),typeof l.type!="function"&&(l.__u|=4)):s!=m&&(s==m-1?p--:s==m+1?p++:(s>m?p--:p++,l.__u|=4))):e.__k[o]=null;if(a)for(o=0;o<u;o++)(_=n[o])!=null&&(2&_.__u)==0&&(_.__e==r&&(r=$(_)),Ee(_,_));return r}function xe(e,t,n,r){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=xe(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=$(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ve(e,t,n,r){var i,o,l,_=e.key,m=e.type,s=t[n],u=s!=null&&(2&s.__u)==0;if(s===null&&_==null||u&&_==s.key&&m==s.type)return n;if(r>(u?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((s=t[l=i>=0?i--:o++])!=null&&(2&s.__u)==0&&_==s.key&&m==s.type)return l}return-1}function we(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||je.test(t)?n:n+"px"}function W(e,t,n,r,i){var o,l;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||we(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||we(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(be,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[N]=r[N]:(n[N]=Q,e.addEventListener(t,o?te:ee,o)):e.removeEventListener(t,o?te:ee,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ke(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[P]==null)t[P]=Q++;else if(t[P]<n[N])return;return n(b.event?b.event(t):t)}}}function oe(e,t,n,r,i,o,l,_,m,s){var u,a,p,c,x,g,w,f,h,M,S,H,We,K,ue,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(m=!!(32&n.__u),o=[_=t.__e=n.__e]),(u=b.__b)&&u(t);e:if(typeof z=="function")try{if(f=t.props,h=z.prototype&&z.prototype.render,M=(u=z.contextType)&&r[u.__c],S=u?M?M.props.value:u.__:r,n.__c?w=(a=t.__c=n.__c).__=a.__E:(h?t.__c=a=new z(f,S):(t.__c=a=new O(f,S),a.constructor=z,a.render=Xe),M&&M.sub(a),a.state||(a.state={}),a.__n=r,p=a.__d=!0,a.__h=[],a._sb=[]),h&&a.__s==null&&(a.__s=a.state),h&&z.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=T({},a.__s)),T(a.__s,z.getDerivedStateFromProps(f,a.__s))),c=a.props,x=a.state,a.__v=t,p)h&&z.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),h&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(h&&z.getDerivedStateFromProps==null&&f!==c&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(f,S),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(f,a.__s,S)===!1){t.__v!=n.__v&&(a.props=f,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(U){U&&(U.__=t)}),C.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&l.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(f,a.__s,S),h&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(c,x,g)})}if(a.context=S,a.props=f,a.__P=e,a.__e=!1,H=b.__r,We=0,h)a.state=a.__s,a.__d=!1,H&&H(t),u=a.render(a.props,a.state,a.context),C.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,H&&H(t),u=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++We<25);a.state=a.__s,a.getChildContext!=null&&(r=T(T({},r),a.getChildContext())),h&&!p&&a.getSnapshotBeforeUpdate!=null&&(g=a.getSnapshotBeforeUpdate(c,x)),K=u!=null&&u.type===F&&u.key==null?Te(u.props.children):u,_=ye(e,D(K)?K:[K],t,n,r,i,o,l,_,m,s),a.base=t.__e,t.__u&=-161,a.__h.length&&l.push(a),w&&(a.__E=a.__=null)}catch(U){if(t.__v=null,m||o!=null)if(U.then){for(t.__u|=m?160:128;_&&_.nodeType==8&&_.nextSibling;)_=_.nextSibling;o[o.indexOf(_)]=null,t.__e=_}else{for(ue=o.length;ue--;)ne(o[ue]);re(t)}else t.__e=n.__e,t.__k=n.__k,U.then||re(t);b.__e(U,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):_=t.__e=Ye(n.__e,t,n,r,i,o,l,m,s);return(u=b.diffed)&&u(t),128&t.__u?void 0:_}function re(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(re))}function ze(e,t,n){for(var r=0;r<n.length;r++)ie(n[r],n[++r],n[++r]);b.__c&&b.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){b.__e(o,i.__v)}})}function Te(e){return typeof e!="object"||e==null||e.__b>0?e:D(e)?e.map(Te):e.constructor!==void 0?null:T({},e)}function Ye(e,t,n,r,i,o,l,_,m){var s,u,a,p,c,x,g,w=n.props||L,f=t.props,h=t.type;if(h=="svg"?i="http://www.w3.org/2000/svg":h=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(s=0;s<o.length;s++)if((c=o[s])&&"setAttribute"in c==!!h&&(h?c.localName==h:c.nodeType==3)){e=c,o[s]=null;break}}if(e==null){if(h==null)return document.createTextNode(f);e=document.createElementNS(i,h,f.is&&f),_&&(b.__m&&b.__m(t,o),_=!1),o=null}if(h==null)w===f||_&&e.data==f||(e.data=f);else{if(o=h=="textarea"&&f.defaultValue!=null?null:o&&I.call(e.childNodes),!_&&o!=null)for(w={},s=0;s<e.attributes.length;s++)w[(c=e.attributes[s]).name]=c.value;for(s in w)c=w[s],s=="dangerouslySetInnerHTML"?a=c:s=="children"||s in f||s=="value"&&"defaultValue"in f||s=="checked"&&"defaultChecked"in f||W(e,s,null,c,i);for(s in f)c=f[s],s=="children"?p=c:s=="dangerouslySetInnerHTML"?u=c:s=="value"?x=c:s=="checked"?g=c:_&&typeof c!="function"||w[s]===c||W(e,s,c,w[s],i);if(u)_||a&&(u.__html==a.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(a&&(e.innerHTML=""),ye(t.type=="template"?e.content:e,D(p)?p:[p],t,n,r,h=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,l,o?o[0]:n.__k&&$(n,0),_,m),o!=null)for(s=o.length;s--;)ne(o[s]);_&&h!="textarea"||(s="value",h=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[s]||h=="progress"&&!x||h=="option"&&x!=w[s])&&W(e,s,x,w[s],i),s="checked",g!=null&&g!=e[s]&&W(e,s,g,w[s],i))}return e}function ie(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){b.__e(i,n)}}function Ee(e,t,n){var r,i;if(b.unmount&&b.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ie(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){b.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ee(r[i],t,n||typeof e.type!="function");n||ne(e.__e),e.__c=e.__=e.__e=void 0}function Xe(e,t,n){return this.constructor(e,n)}function Je(e,t,n){var r,i,o,l;t==document&&(t=document.documentElement),b.__&&b.__(e,t),i=(r=!1)?null:t.__k,o=[],l=[],oe(t,e=t.__k=d(F,null,[e]),i||L,L,t.namespaceURI,i?null:t.firstChild?I.call(t.childNodes):null,o,i?i.__e:t.firstChild,r,l),ze(o,e,l)}I=C.slice,b={__e:function(e,t,n,r){for(var i,o,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),l=i.__d),l)return i.__E=i}catch(_){e=_}throw e}},me=0,O.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=T({},this.state),typeof e=="function"&&(e=e(T({},n),this.props)),e&&T(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ve(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ve(this))},O.prototype.render=F,E=[],he=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fe=function(e,t){return e.__v.__b-t.__v.__b},B.__r=0,Z=Math.random().toString(8),P="__d"+Z,N="__a"+Z,be=/(PointerCapture)$|Capture$/i,Q=0,ee=ke(!1),te=ke(!0);const j="ghost-admin-toolbar-root",Me="--gh-admin-toolbar-bottom-offset",Ke=2e3,Se="ghost-admin-toolbar-display",q="minimized",ae="expanded";function Ze(e){const t=document.createElement("iframe");return t.dataset.frame="admin-auth",t.src=`${e}auth-frame/`,t.title="Ghost admin authentication",t.tabIndex=-1,t.style.cssText="display:none;width:0;height:0;border:0;",document.body.appendChild(t),t}function Qe(e,t){let n=0;const r={},i=new URL(e).origin;window.addEventListener("message",function(l){if(l.origin!==i)return;let _;try{_=JSON.parse(l.data)}catch{return}const m=r[_.uid];m&&(delete r[_.uid],m(_.error,_.result))});function o(l,_){return new Promise((m,s)=>{n+=1;const u=n,a=window.setTimeout(()=>{delete r[u],s(new Error("Admin authentication timed out"))},Ke);r[u]=(p,c)=>{window.clearTimeout(a),p?s(new Error(p)):m(c)},t.contentWindow?.postMessage(JSON.stringify({uid:u,action:l,..._}),i)})}return{getUser:async()=>(await o("getUser"))?.users?.[0]||null}}function et(e){const t=new Set(["owner","administrator","editor"]);return(e?.roles||[]).some(n=>t.has((n?.name||"").toLowerCase()))}let $e=null;function tt(e){$e===null&&($e=document.body.style.paddingBottom||"");const t=`${e+24}px`;document.documentElement.style.setProperty(Me,t),document.body.style.paddingBottom=`calc(var(${Me}) + env(safe-area-inset-bottom, 0px))`}function nt(){return document.currentScript||document.querySelector("script[data-ghost-admin-toolbar]")}function ot(e){return e?e.endsWith("/")?e:`${e}/`:null}function rt(e){const t=e?.dataset||{},n=ot(t.ghostAdminToolbar);return n?{adminUrl:n,siteTitle:t.siteTitle||"Ghost",pageContext:t.pageContext||"",resourceType:t.resourceType||"",resourceId:t.resourceId||"",resourceSlug:t.resourceSlug||"",siteAnalyticsEnabled:t.siteAnalyticsEnabled==="true",activityPubEnabled:t.activitypubEnabled==="true",membersEnabled:t.membersEnabled==="true",commentsEnabled:t.commentsEnabled!=="false"}:null}var A,v,le,Ae,G=0,Ue=[],y=b,Ne=y.__b,He=y.__r,Ie=y.diffed,Pe=y.__c,Le=y.unmount,Ce=y.__;function V(e,t){y.__h&&y.__h(v,e,G||t),G=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return G=1,it(Fe,e)}function it(e,t,n){var r=V(A++,2);if(r.t=e,!r.__c&&(r.__=[Fe(void 0,t),function(_){var m=r.__N?r.__N[0]:r.__[0],s=r.t(m,_);m!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.__f)){var i=function(_,m,s){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(p){return p.__c});if(u.every(function(p){return!p.__N}))return!o||o.call(this,_,m,s);var a=r.__c.props!==_;return u.some(function(p){if(p.__N){var c=p.__[0];p.__=p.__N,p.__N=void 0,c!==p.__[0]&&(a=!0)}}),o&&o.call(this,_,m,s)||a};v.__f=!0;var o=v.shouldComponentUpdate,l=v.componentWillUpdate;v.componentWillUpdate=function(_,m,s){if(this.__e){var u=o;o=void 0,i(_,m,s),o=u}l&&l.call(this,_,m,s)},v.shouldComponentUpdate=i}return r.__N||r.__}function at(e,t){var n=V(A++,3);!y.__s&&_e(n.__H,t)&&(n.__=e,n.u=t,v.__H.__h.push(n))}function lt(e,t){var n=V(A++,4);!y.__s&&_e(n.__H,t)&&(n.__=e,n.u=t,v.__h.push(n))}function De(e){return G=5,st(function(){return{current:e}},[])}function st(e,t){var n=V(A++,7);return _e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function _t(){for(var e;e=Ue.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(X),t.__h.some(se),t.__h=[]}catch(n){t.__h=[],y.__e(n,e.__v)}}}y.__b=function(e){v=null,Ne&&Ne(e)},y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ce&&Ce(e,t)},y.__r=function(e){He&&He(e),A=0;var t=(v=e.__c).__H;t&&(le===v?(t.__h=[],v.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(X),t.__h.some(se),t.__h=[],A=0)),le=v},y.diffed=function(e){Ie&&Ie(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ue.push(t)!==1&&Ae===y.requestAnimationFrame||((Ae=y.requestAnimationFrame)||dt)(_t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),le=v=null},y.__c=function(e,t){t.some(function(n){try{n.__h.some(X),n.__h=n.__h.filter(function(r){return!r.__||se(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],y.__e(r,n.__v)}}),Pe&&Pe(e,t)},y.unmount=function(e){Le&&Le(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{X(r)}catch(i){t=i}}),n.__H=void 0,t&&y.__e(t,n.__v))};var Re=typeof requestAnimationFrame=="function";function dt(e){var t,n=function(){clearTimeout(r),Re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Re&&(t=requestAnimationFrame(n))}function X(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function se(e){var t=v;e.__c=e.__(),v=t}function _e(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Fe(e,t){return typeof t=="function"?t(e):t}function k(e,t){const n=t.replace(/^\/+/,"");return`${e}#/${n}`}function ct(e,t){return k(e,`comments?filter=${encodeURIComponent(`post_id:${t}`)}`)}function ut(){const e=new URL(window.location.href);return e.searchParams.set("admin","0"),`${e.pathname}${e.search}${e.hash}`}function mt(e){return e.pageContext==="home"?pt(e):e.resourceType==="post"&&e.resourceId?ht(e):e.resourceType==="tag"&&e.resourceSlug?[{href:k(e.adminUrl,`tags/${encodeURIComponent(e.resourceSlug)}`),icon:"edit",label:"Edit"}]:e.resourceType&&e.resourceId?[{href:k(e.adminUrl,`editor/${e.resourceType}/${e.resourceId}`),icon:"edit",label:"Edit"}]:[]}function pt(e){const t=[];return e.siteAnalyticsEnabled&&t.push({href:k(e.adminUrl,"analytics"),icon:"siteAnalytics",label:"Analytics"}),e.activityPubEnabled&&t.push({href:k(e.adminUrl,"activitypub"),icon:"network",label:"Network"}),t.push({href:k(e.adminUrl,"posts/"),icon:"posts",label:"Posts"}),e.membersEnabled&&t.push({href:k(e.adminUrl,"members"),icon:"members",label:"Members"}),t.push({href:k(e.adminUrl,"settings"),icon:"settings",label:"Settings"}),t}function ht(e){const t=[{href:k(e.adminUrl,`posts/analytics/${e.resourceId}`),icon:"analytics",label:"Analytics"},{href:k(e.adminUrl,`editor/${e.resourceType}/${e.resourceId}`),icon:"edit",label:"Edit"}];return e.commentsEnabled&&t.push({href:ct(e.adminUrl,e.resourceId),icon:"comments",label:"Comments"}),t}const ft={analytics:[d("path",{d:"M4 19V5"}),d("path",{d:"M4 19h16"}),d("path",{d:"M8 16v-5"}),d("path",{d:"M12 16V8"}),d("path",{d:"M16 16v-3"})],comments:[d("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"})],edit:[d("path",{d:"M12 20h9"}),d("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})],members:[d("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),d("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),d("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),d("circle",{cx:"9",cy:"7",r:"4"})],network:[d("circle",{cx:"5",cy:"19",r:"2"}),d("circle",{cx:"19",cy:"5",r:"2"}),d("circle",{cx:"12",cy:"12",r:"4"}),d("path",{d:"M8.8 21.5a10 10 0 0 0 12.7-12.7"}),d("path",{d:"M2.5 15.2A10 10 0 0 1 15.2 2.5"})],posts:[d("path",{d:"M13 21h8"}),d("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"})],siteAnalytics:[d("path",{d:"M16 7h6v6"}),d("path",{d:"m22 7-8.5 8.5-5-5L2 17"})],settings:[d("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),d("circle",{cx:"12",cy:"12",r:"3"})],more:[d("circle",{cx:"12",cy:"5",r:"1"}),d("circle",{cx:"12",cy:"12",r:"1"}),d("circle",{cx:"12",cy:"19",r:"1"})],moreHorizontal:[d("circle",{cx:"5",cy:"12",r:"1"}),d("circle",{cx:"12",cy:"12",r:"1"}),d("circle",{cx:"19",cy:"12",r:"1"})]};function de({name:e}){return d("svg",{"aria-hidden":"true",className:`gh-admin-toolbar-icon gh-admin-toolbar-icon-${e}`,fill:"none",height:"20",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24",width:"20"},ft[e])}function bt(){try{return window.localStorage?.getItem(Se)===q?q:ae}catch{return ae}}function Oe(e){try{window.localStorage?.setItem(Se,e)}catch{}}function gt(e){return e?.name||e?.email||"Staff"}function vt(e){return e?.profile_image||""}function J({children:e}){return d("span",{className:"gh-admin-toolbar-sr-only"},e)}function ce({children:e,label:t}){return d("span",{className:"gh-admin-toolbar-tooltip-wrap"},[e,d("span",{className:"gh-admin-toolbar-tooltip",role:"tooltip"},t)])}function yt({href:e,icon:t,label:n}){const r=d("a",{className:"gh-admin-toolbar-link",href:e,"aria-label":n},[d(de,{name:t}),d(J,null,n)]);return d(ce,{label:n},r)}function xt({isMinimized:e,isOpen:t,onMaximize:n,onMinimize:r,setIsOpen:i}){const o="More",l=d("button",{type:"button",className:"gh-admin-toolbar-button","aria-expanded":t?"true":"false","aria-haspopup":"menu","aria-label":o,onClick:()=>{i(!t)},onKeyDown:_=>{_.key==="Escape"&&i(!1)}},[d(de,{name:"more"}),d(J,null,o)]);return d("div",{className:"gh-admin-toolbar-menu-wrap",onFocusOut:_=>{_.currentTarget.contains(_.relatedTarget)||i(!1)}},[d(ce,{label:o},l),t?d("div",{className:"gh-admin-toolbar-menu"},[d("button",{type:"button",className:"gh-admin-toolbar-menu-item",onClick:e?n:r},e?"Maximize":"Minimize"),d("a",{className:"gh-admin-toolbar-menu-item",href:ut()},"Hide toolbar")]):null])}function wt({adminUrl:e,siteTitle:t,user:n}){const r=gt(n),i=vt(n),o=d("a",{className:"gh-admin-toolbar-user",href:k(e,""),"aria-label":`Open Ghost Admin for ${r} on ${t}`},[d("span",{className:"gh-admin-toolbar-avatar","aria-hidden":"true"},[d("span",{className:"gh-admin-toolbar-avatar-fallback"},r.slice(0,1).toUpperCase()),i?d("img",{alt:"",className:"gh-admin-toolbar-avatar-image",loading:"lazy",onError:l=>{l.currentTarget.remove()},referrerPolicy:"no-referrer",src:i}):null]),d(J,null,"Admin")]);return d(ce,{label:"Admin"},o)}function kt({config:e,user:t}){const[n,r]=Y(!1),[i,o]=Y(()=>bt()===q),[l,_]=Y(!1),[m,s]=Y(null),u=De(null),a=De(null),p=mt(e);function c(){_(!0)}function x(){n||(r(!1),_(!1))}return lt(()=>{if(!u.current||!a.current)return;if(i){s({height:Math.max(a.current.scrollHeight+12,44),width:a.current.scrollWidth+8});return}const g=u.current.getBoundingClientRect();s({height:g.height,width:g.width})},[i,p.length]),at(()=>{const g=document.getElementById(j);if(g)return g.classList.toggle("gh-admin-toolbar-menu-open",n),g.classList.toggle("gh-admin-toolbar-is-minimized",i&&!l),()=>{g.classList.remove("gh-admin-toolbar-menu-open"),g.classList.remove("gh-admin-toolbar-is-minimized")}},[n,i,l]),d("nav",{className:`gh-admin-toolbar${i?" gh-admin-toolbar-minimized-mode":""}${l?" gh-admin-toolbar-minimized-expanded":""}`,onFocusOut:g=>{i&&!g.currentTarget.contains(g.relatedTarget)&&x()},onMouseLeave:()=>{x()},onMouseEnter:()=>{i&&c()},onMouseOver:()=>{i&&c()},onPointerEnter:()=>{i&&c()},ref:u,role:"navigation",style:i?{"--gh-admin-toolbar-expanded-height":`${m?.height||44}px`,"--gh-admin-toolbar-expanded-width":`${m?.width||178}px`}:null,"aria-label":"Ghost admin toolbar"},[d("button",{type:"button",className:"gh-admin-toolbar-minimized-pill","aria-label":"Show admin toolbar",onClick:c},[d(de,{name:"moreHorizontal"}),d(J,null,"Show admin toolbar")]),d("div",{className:"gh-admin-toolbar-section",ref:a},[d(wt,{adminUrl:e.adminUrl,siteTitle:e.siteTitle,user:t}),...p.map(g=>d(yt,g)),d(xt,{isMinimized:i,isOpen:n,onMaximize:()=>{Oe(ae),r(!1),o(!1),_(!1)},onMinimize:()=>{Oe(q),r(!1),o(!0),_(!1)},setIsOpen:r})])])}function zt(){return`
|
|
1
|
+
(function(){"use strict";var I,b,me,E,he,pe,fe,Z,L,N,be,Q,ee,te,C={},P=[],We=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,D=Array.isArray;function T(e,t){for(var n in t)e[n]=t[n];return e}function ne(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function d(e,t,n){var r,i,o,l={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:l[o]=t[o];if(arguments.length>2&&(l.children=arguments.length>3?I.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)l[o]===void 0&&(l[o]=e.defaultProps[o]);return R(e,l,r,i,null)}function R(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++me,__i:-1,__u:0};return i==null&&b.vnode!=null&&b.vnode(o),o}function F(e){return e.children}function O(e,t){this.props=e,this.context=t}function $(e,t){if(t==null)return e.__?$(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?$(e):null}function Be(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=T({},t);o.__v=t.__v+1,b.vnode&&b.vnode(o),oe(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??$(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,ze(r,o,i),t.__e=t.__=null,o.__e!=n&&ge(o)}}function ge(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ge(e)}function ve(e){(!e.__d&&(e.__d=!0)&&E.push(e)&&!W.__r++||he!=b.debounceRendering)&&((he=b.debounceRendering)||pe)(W)}function W(){try{for(var e,t=1;E.length;)E.length>t&&E.sort(fe),e=E.shift(),t=E.length,Be(e)}finally{E.length=W.__r=0}}function xe(e,t,n,r,i,o,l,_,m,s,u){var a,h,c,y,g,w,f,p=r&&r.__k||P,M=t.length;for(m=je(n,t,p,m,M),a=0;a<M;a++)(c=n.__k[a])!=null&&(h=c.__i!=-1&&p[c.__i]||C,c.__i=a,w=oe(e,c,h,i,o,l,_,m,s,u),y=c.__e,c.ref&&h.ref!=c.ref&&(h.ref&&ie(h.ref,null,c),u.push(c.ref,c.__c||y,c)),g==null&&y!=null&&(g=y),(f=!!(4&c.__u))||h.__k===c.__k?(m=ye(c,m,e,f),f&&h.__e&&(h.__e=null)):typeof c.type=="function"&&w!==void 0?m=w:y&&(m=y.nextSibling),c.__u&=-7);return n.__e=g,m}function je(e,t,n,r,i){var o,l,_,m,s,u=n.length,a=u,h=0;for(e.__k=new Array(i),o=0;o<i;o++)(l=t[o])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[o]=R(null,l,null,null,null):D(l)?l=e.__k[o]=R(F,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[o]=R(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[o]=l,m=o+h,l.__=e,l.__b=e.__b+1,_=null,(s=l.__i=qe(l,n,m,a))!=-1&&(a--,(_=n[s])&&(_.__u|=2)),_==null||_.__v==null?(s==-1&&(i>u?h--:i<u&&h++),typeof l.type!="function"&&(l.__u|=4)):s!=m&&(s==m-1?h--:s==m+1?h++:(s>m?h--:h++,l.__u|=4))):e.__k[o]=null;if(a)for(o=0;o<u;o++)(_=n[o])!=null&&(2&_.__u)==0&&(_.__e==r&&(r=$(_)),Ee(_,_));return r}function ye(e,t,n,r){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=ye(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=$(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function qe(e,t,n,r){var i,o,l,_=e.key,m=e.type,s=t[n],u=s!=null&&(2&s.__u)==0;if(s===null&&_==null||u&&_==s.key&&m==s.type)return n;if(r>(u?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((s=t[l=i>=0?i--:o++])!=null&&(2&s.__u)==0&&_==s.key&&m==s.type)return l}return-1}function we(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||We.test(t)?n:n+"px"}function B(e,t,n,r,i){var o,l;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||we(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||we(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(be,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[N]=r[N]:(n[N]=Q,e.addEventListener(t,o?te:ee,o)):e.removeEventListener(t,o?te:ee,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ke(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[L]==null)t[L]=Q++;else if(t[L]<n[N])return;return n(b.event?b.event(t):t)}}}function oe(e,t,n,r,i,o,l,_,m,s){var u,a,h,c,y,g,w,f,p,M,S,H,Oe,K,ue,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(m=!!(32&n.__u),o=[_=t.__e=n.__e]),(u=b.__b)&&u(t);e:if(typeof z=="function")try{if(f=t.props,p=z.prototype&&z.prototype.render,M=(u=z.contextType)&&r[u.__c],S=u?M?M.props.value:u.__:r,n.__c?w=(a=t.__c=n.__c).__=a.__E:(p?t.__c=a=new z(f,S):(t.__c=a=new O(f,S),a.constructor=z,a.render=Ve),M&&M.sub(a),a.state||(a.state={}),a.__n=r,h=a.__d=!0,a.__h=[],a._sb=[]),p&&a.__s==null&&(a.__s=a.state),p&&z.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=T({},a.__s)),T(a.__s,z.getDerivedStateFromProps(f,a.__s))),c=a.props,y=a.state,a.__v=t,h)p&&z.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),p&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(p&&z.getDerivedStateFromProps==null&&f!==c&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(f,S),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(f,a.__s,S)===!1){t.__v!=n.__v&&(a.props=f,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(A){A&&(A.__=t)}),P.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&l.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(f,a.__s,S),p&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(c,y,g)})}if(a.context=S,a.props=f,a.__P=e,a.__e=!1,H=b.__r,Oe=0,p)a.state=a.__s,a.__d=!1,H&&H(t),u=a.render(a.props,a.state,a.context),P.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,H&&H(t),u=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++Oe<25);a.state=a.__s,a.getChildContext!=null&&(r=T(T({},r),a.getChildContext())),p&&!h&&a.getSnapshotBeforeUpdate!=null&&(g=a.getSnapshotBeforeUpdate(c,y)),K=u!=null&&u.type===F&&u.key==null?Te(u.props.children):u,_=xe(e,D(K)?K:[K],t,n,r,i,o,l,_,m,s),a.base=t.__e,t.__u&=-161,a.__h.length&&l.push(a),w&&(a.__E=a.__=null)}catch(A){if(t.__v=null,m||o!=null)if(A.then){for(t.__u|=m?160:128;_&&_.nodeType==8&&_.nextSibling;)_=_.nextSibling;o[o.indexOf(_)]=null,t.__e=_}else{for(ue=o.length;ue--;)ne(o[ue]);re(t)}else t.__e=n.__e,t.__k=n.__k,A.then||re(t);b.__e(A,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):_=t.__e=Ge(n.__e,t,n,r,i,o,l,m,s);return(u=b.diffed)&&u(t),128&t.__u?void 0:_}function re(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(re))}function ze(e,t,n){for(var r=0;r<n.length;r++)ie(n[r],n[++r],n[++r]);b.__c&&b.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){b.__e(o,i.__v)}})}function Te(e){return typeof e!="object"||e==null||e.__b>0?e:D(e)?e.map(Te):e.constructor!==void 0?null:T({},e)}function Ge(e,t,n,r,i,o,l,_,m){var s,u,a,h,c,y,g,w=n.props||C,f=t.props,p=t.type;if(p=="svg"?i="http://www.w3.org/2000/svg":p=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(s=0;s<o.length;s++)if((c=o[s])&&"setAttribute"in c==!!p&&(p?c.localName==p:c.nodeType==3)){e=c,o[s]=null;break}}if(e==null){if(p==null)return document.createTextNode(f);e=document.createElementNS(i,p,f.is&&f),_&&(b.__m&&b.__m(t,o),_=!1),o=null}if(p==null)w===f||_&&e.data==f||(e.data=f);else{if(o=p=="textarea"&&f.defaultValue!=null?null:o&&I.call(e.childNodes),!_&&o!=null)for(w={},s=0;s<e.attributes.length;s++)w[(c=e.attributes[s]).name]=c.value;for(s in w)c=w[s],s=="dangerouslySetInnerHTML"?a=c:s=="children"||s in f||s=="value"&&"defaultValue"in f||s=="checked"&&"defaultChecked"in f||B(e,s,null,c,i);for(s in f)c=f[s],s=="children"?h=c:s=="dangerouslySetInnerHTML"?u=c:s=="value"?y=c:s=="checked"?g=c:_&&typeof c!="function"||w[s]===c||B(e,s,c,w[s],i);if(u)_||a&&(u.__html==a.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(a&&(e.innerHTML=""),xe(t.type=="template"?e.content:e,D(h)?h:[h],t,n,r,p=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,l,o?o[0]:n.__k&&$(n,0),_,m),o!=null)for(s=o.length;s--;)ne(o[s]);_&&p!="textarea"||(s="value",p=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[s]||p=="progress"&&!y||p=="option"&&y!=w[s])&&B(e,s,y,w[s],i),s="checked",g!=null&&g!=e[s]&&B(e,s,g,w[s],i))}return e}function ie(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){b.__e(i,n)}}function Ee(e,t,n){var r,i;if(b.unmount&&b.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ie(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){b.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ee(r[i],t,n||typeof e.type!="function");n||ne(e.__e),e.__c=e.__=e.__e=void 0}function Ve(e,t,n){return this.constructor(e,n)}function Xe(e,t,n){var r,i,o,l;t==document&&(t=document.documentElement),b.__&&b.__(e,t),i=(r=!1)?null:t.__k,o=[],l=[],oe(t,e=t.__k=d(F,null,[e]),i||C,C,t.namespaceURI,i?null:t.firstChild?I.call(t.childNodes):null,o,i?i.__e:t.firstChild,r,l),ze(o,e,l)}I=P.slice,b={__e:function(e,t,n,r){for(var i,o,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),l=i.__d),l)return i.__E=i}catch(_){e=_}throw e}},me=0,O.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=T({},this.state),typeof e=="function"&&(e=e(T({},n),this.props)),e&&T(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ve(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ve(this))},O.prototype.render=F,E=[],pe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fe=function(e,t){return e.__v.__b-t.__v.__b},W.__r=0,Z=Math.random().toString(8),L="__d"+Z,N="__a"+Z,be=/(PointerCapture)$|Capture$/i,Q=0,ee=ke(!1),te=ke(!0);const j="ghost-admin-toolbar-root",Ye=2e3,Me="ghost-admin-toolbar-display",q="minimized",ae="expanded";function Je(e){const t=document.createElement("iframe");return t.dataset.frame="admin-auth",t.src=`${e}auth-frame/`,t.title="Ghost admin authentication",t.tabIndex=-1,t.style.cssText="display:none;width:0;height:0;border:0;",document.body.appendChild(t),t}function Ke(e,t){let n=0;const r={},i=new URL(e).origin;window.addEventListener("message",function(l){if(l.origin!==i)return;let _;try{_=JSON.parse(l.data)}catch{return}const m=r[_.uid];m&&(delete r[_.uid],m(_.error,_.result))});function o(l,_){return new Promise((m,s)=>{n+=1;const u=n,a=window.setTimeout(()=>{delete r[u],s(new Error("Admin authentication timed out"))},Ye);r[u]=(h,c)=>{window.clearTimeout(a),h?s(new Error(h)):m(c)},t.contentWindow?.postMessage(JSON.stringify({uid:u,action:l,..._}),i)})}return{getUser:async()=>(await o("getUser"))?.users?.[0]||null}}function Ze(e){const t=new Set(["owner","administrator","editor"]);return(e?.roles||[]).some(n=>t.has((n?.name||"").toLowerCase()))}function Qe(){return document.currentScript||document.querySelector("script[data-ghost-admin-toolbar]")}function et(e){return e?e.endsWith("/")?e:`${e}/`:null}function tt(e){const t=e?.dataset||{},n=et(t.ghostAdminToolbar);return n?{adminUrl:n,siteTitle:t.siteTitle||"Ghost",pageContext:t.pageContext||"",resourceType:t.resourceType||"",resourceId:t.resourceId||"",resourceSlug:t.resourceSlug||"",siteAnalyticsEnabled:t.siteAnalyticsEnabled==="true",activityPubEnabled:t.activitypubEnabled==="true",membersEnabled:t.membersEnabled==="true",commentsEnabled:t.commentsEnabled!=="false"}:null}var U,v,le,Se,G=0,$e=[],x=b,Ue=x.__b,Ae=x.__r,Ne=x.diffed,He=x.__c,Ie=x.unmount,Le=x.__;function V(e,t){x.__h&&x.__h(v,e,G||t),G=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function X(e){return G=1,nt(De,e)}function nt(e,t,n){var r=V(U++,2);if(r.t=e,!r.__c&&(r.__=[De(void 0,t),function(_){var m=r.__N?r.__N[0]:r.__[0],s=r.t(m,_);m!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.__f)){var i=function(_,m,s){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(h){return h.__c});if(u.every(function(h){return!h.__N}))return!o||o.call(this,_,m,s);var a=r.__c.props!==_;return u.some(function(h){if(h.__N){var c=h.__[0];h.__=h.__N,h.__N=void 0,c!==h.__[0]&&(a=!0)}}),o&&o.call(this,_,m,s)||a};v.__f=!0;var o=v.shouldComponentUpdate,l=v.componentWillUpdate;v.componentWillUpdate=function(_,m,s){if(this.__e){var u=o;o=void 0,i(_,m,s),o=u}l&&l.call(this,_,m,s)},v.shouldComponentUpdate=i}return r.__N||r.__}function ot(e,t){var n=V(U++,3);!x.__s&&_e(n.__H,t)&&(n.__=e,n.u=t,v.__H.__h.push(n))}function rt(e,t){var n=V(U++,4);!x.__s&&_e(n.__H,t)&&(n.__=e,n.u=t,v.__h.push(n))}function Ce(e){return G=5,it(function(){return{current:e}},[])}function it(e,t){var n=V(U++,7);return _e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function at(){for(var e;e=$e.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Y),t.__h.some(se),t.__h=[]}catch(n){t.__h=[],x.__e(n,e.__v)}}}x.__b=function(e){v=null,Ue&&Ue(e)},x.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Le&&Le(e,t)},x.__r=function(e){Ae&&Ae(e),U=0;var t=(v=e.__c).__H;t&&(le===v?(t.__h=[],v.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Y),t.__h.some(se),t.__h=[],U=0)),le=v},x.diffed=function(e){Ne&&Ne(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($e.push(t)!==1&&Se===x.requestAnimationFrame||((Se=x.requestAnimationFrame)||lt)(at)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),le=v=null},x.__c=function(e,t){t.some(function(n){try{n.__h.some(Y),n.__h=n.__h.filter(function(r){return!r.__||se(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],x.__e(r,n.__v)}}),He&&He(e,t)},x.unmount=function(e){Ie&&Ie(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Y(r)}catch(i){t=i}}),n.__H=void 0,t&&x.__e(t,n.__v))};var Pe=typeof requestAnimationFrame=="function";function lt(e){var t,n=function(){clearTimeout(r),Pe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Pe&&(t=requestAnimationFrame(n))}function Y(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function se(e){var t=v;e.__c=e.__(),v=t}function _e(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function De(e,t){return typeof t=="function"?t(e):t}function k(e,t){const n=t.replace(/^\/+/,"");return`${e}#/${n}`}function st(e,t){return k(e,`comments?filter=${encodeURIComponent(`post_id:${t}`)}`)}function _t(){const e=new URL(window.location.href);return e.searchParams.set("admin","0"),`${e.pathname}${e.search}${e.hash}`}function dt(e){return e.pageContext==="home"?ct(e):e.resourceType==="post"&&e.resourceId?ut(e):e.resourceType==="tag"&&e.resourceSlug?[{href:k(e.adminUrl,`tags/${encodeURIComponent(e.resourceSlug)}`),icon:"edit",label:"Edit"}]:e.resourceType&&e.resourceId?[{href:k(e.adminUrl,`editor/${e.resourceType}/${e.resourceId}`),icon:"edit",label:"Edit"}]:[]}function ct(e){const t=[];return e.siteAnalyticsEnabled&&t.push({href:k(e.adminUrl,"analytics"),icon:"siteAnalytics",label:"Analytics"}),e.activityPubEnabled&&t.push({href:k(e.adminUrl,"activitypub"),icon:"network",label:"Network"}),t.push({href:k(e.adminUrl,"posts/"),icon:"posts",label:"Posts"}),e.membersEnabled&&t.push({href:k(e.adminUrl,"members"),icon:"members",label:"Members"}),t.push({href:k(e.adminUrl,"settings"),icon:"settings",label:"Settings"}),t}function ut(e){const t=[{href:k(e.adminUrl,`posts/analytics/${e.resourceId}`),icon:"analytics",label:"Analytics"},{href:k(e.adminUrl,`editor/${e.resourceType}/${e.resourceId}`),icon:"edit",label:"Edit"}];return e.commentsEnabled&&t.push({href:st(e.adminUrl,e.resourceId),icon:"comments",label:"Comments"}),t}const mt={analytics:[d("path",{d:"M4 19V5"}),d("path",{d:"M4 19h16"}),d("path",{d:"M8 16v-5"}),d("path",{d:"M12 16V8"}),d("path",{d:"M16 16v-3"})],comments:[d("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"})],edit:[d("path",{d:"M12 20h9"}),d("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})],members:[d("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),d("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),d("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),d("circle",{cx:"9",cy:"7",r:"4"})],network:[d("circle",{cx:"5",cy:"19",r:"2"}),d("circle",{cx:"19",cy:"5",r:"2"}),d("circle",{cx:"12",cy:"12",r:"4"}),d("path",{d:"M8.8 21.5a10 10 0 0 0 12.7-12.7"}),d("path",{d:"M2.5 15.2A10 10 0 0 1 15.2 2.5"})],posts:[d("path",{d:"M13 21h8"}),d("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"})],siteAnalytics:[d("path",{d:"M16 7h6v6"}),d("path",{d:"m22 7-8.5 8.5-5-5L2 17"})],settings:[d("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),d("circle",{cx:"12",cy:"12",r:"3"})],more:[d("circle",{cx:"12",cy:"5",r:"1"}),d("circle",{cx:"12",cy:"12",r:"1"}),d("circle",{cx:"12",cy:"19",r:"1"})],moreHorizontal:[d("circle",{cx:"5",cy:"12",r:"1"}),d("circle",{cx:"12",cy:"12",r:"1"}),d("circle",{cx:"19",cy:"12",r:"1"})]};function de({name:e}){return d("svg",{"aria-hidden":"true",className:`gh-admin-toolbar-icon gh-admin-toolbar-icon-${e}`,fill:"none",height:"20",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24",width:"20"},mt[e])}function ht(){try{return window.localStorage?.getItem(Me)===q?q:ae}catch{return ae}}function Re(e){try{window.localStorage?.setItem(Me,e)}catch{}}function pt(e){return e?.name||e?.email||"Staff"}function ft(e){return e?.profile_image||""}function J({children:e}){return d("span",{className:"gh-admin-toolbar-sr-only"},e)}function ce({children:e,label:t}){return d("span",{className:"gh-admin-toolbar-tooltip-wrap"},[e,d("span",{className:"gh-admin-toolbar-tooltip",role:"tooltip"},t)])}function bt({href:e,icon:t,label:n}){const r=d("a",{className:"gh-admin-toolbar-link",href:e,"aria-label":n},[d(de,{name:t}),d(J,null,n)]);return d(ce,{label:n},r)}function gt({isMinimized:e,isOpen:t,onMaximize:n,onMinimize:r,setIsOpen:i}){const o="More",l=d("button",{type:"button",className:"gh-admin-toolbar-button","aria-expanded":t?"true":"false","aria-haspopup":"menu","aria-label":o,onClick:()=>{i(!t)},onKeyDown:_=>{_.key==="Escape"&&i(!1)}},[d(de,{name:"more"}),d(J,null,o)]);return d("div",{className:"gh-admin-toolbar-menu-wrap",onFocusOut:_=>{_.currentTarget.contains(_.relatedTarget)||i(!1)}},[d(ce,{label:o},l),t?d("div",{className:"gh-admin-toolbar-menu"},[d("button",{type:"button",className:"gh-admin-toolbar-menu-item",onClick:e?n:r},e?"Maximize":"Minimize"),d("a",{className:"gh-admin-toolbar-menu-item",href:_t()},"Hide toolbar")]):null])}function vt({adminUrl:e,siteTitle:t,user:n}){const r=pt(n),i=ft(n),o=d("a",{className:"gh-admin-toolbar-user",href:k(e,""),"aria-label":`Open Ghost Admin for ${r} on ${t}`},[d("span",{className:"gh-admin-toolbar-avatar","aria-hidden":"true"},[d("span",{className:"gh-admin-toolbar-avatar-fallback"},r.slice(0,1).toUpperCase()),i?d("img",{alt:"",className:"gh-admin-toolbar-avatar-image",loading:"lazy",onError:l=>{l.currentTarget.remove()},referrerPolicy:"no-referrer",src:i}):null]),d(J,null,"Admin")]);return d(ce,{label:"Admin"},o)}function xt({config:e,user:t}){const[n,r]=X(!1),[i,o]=X(()=>ht()===q),[l,_]=X(!1),[m,s]=X(null),u=Ce(null),a=Ce(null),h=dt(e);function c(){_(!0)}function y(){n||(r(!1),_(!1))}return rt(()=>{if(!u.current||!a.current)return;if(i){s({height:Math.max(a.current.scrollHeight+12,44),width:a.current.scrollWidth+8});return}const g=u.current.getBoundingClientRect();s({height:g.height,width:g.width})},[i,h.length]),ot(()=>{const g=document.getElementById(j);if(g)return g.classList.toggle("gh-admin-toolbar-menu-open",n),g.classList.toggle("gh-admin-toolbar-is-minimized",i&&!l),()=>{g.classList.remove("gh-admin-toolbar-menu-open"),g.classList.remove("gh-admin-toolbar-is-minimized")}},[n,i,l]),d("nav",{className:`gh-admin-toolbar${i?" gh-admin-toolbar-minimized-mode":""}${l?" gh-admin-toolbar-minimized-expanded":""}`,onFocusOut:g=>{i&&!g.currentTarget.contains(g.relatedTarget)&&y()},onMouseLeave:()=>{y()},onMouseEnter:()=>{i&&c()},onMouseOver:()=>{i&&c()},onPointerEnter:()=>{i&&c()},ref:u,role:"navigation",style:i?{"--gh-admin-toolbar-expanded-height":`${m?.height||44}px`,"--gh-admin-toolbar-expanded-width":`${m?.width||178}px`}:null,"aria-label":"Ghost admin toolbar"},[d("button",{type:"button",className:"gh-admin-toolbar-minimized-pill","aria-label":"Show admin toolbar",onClick:c},[d(de,{name:"moreHorizontal"}),d(J,null,"Show admin toolbar")]),d("div",{className:"gh-admin-toolbar-section",ref:a},[d(vt,{adminUrl:e.adminUrl,siteTitle:e.siteTitle,user:t}),...h.map(g=>d(bt,g)),d(gt,{isMinimized:i,isOpen:n,onMaximize:()=>{Re(ae),r(!1),o(!1),_(!1)},onMinimize:()=>{Re(q),r(!1),o(!0),_(!1)},setIsOpen:r})])])}function yt(){return`
|
|
2
2
|
:host {
|
|
3
3
|
all: initial;
|
|
4
4
|
color-scheme: light;
|
|
@@ -373,4 +373,4 @@
|
|
|
373
373
|
transition: none;
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
`}const
|
|
376
|
+
`}const wt=5e3;function kt(e){return new Promise((t,n)=>{let r;function i(){window.clearTimeout(r),e.removeEventListener("load",o),e.removeEventListener("error",l)}function o(){i(),t()}function l(){i(),n(new Error("auth_frame_load_error"))}r=window.setTimeout(()=>{i(),n(new Error("auth_frame_load_timeout"))},wt),e.addEventListener("load",o),e.addEventListener("error",l)})}function zt({config:e,user:t,frame:n}){if(document.getElementById(j))return;const r=document.createElement("div");r.id=j;const i=r.attachShadow({mode:"open"}),o=document.createElement("style"),l=document.createElement("div");o.textContent=yt(),i.append(o,l),document.body.appendChild(r),Xe(d(xt,{config:e,user:t}),l),n.dataset.toolbarMounted="true"}async function Fe(){if(!document.body||document.getElementById(j)||new URLSearchParams(window.location.search).get("admin_toolbar")==="0")return;const t=tt(Qe());if(!t)return;const n=Je(t.adminUrl),r=Ke(t.adminUrl,n);try{await kt(n);const i=await r.getUser();if(!i||!Ze(i)){n.remove();return}zt({config:t,user:i,frame:n})}catch{n.remove()}}function Tt(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Fe,{once:!0}):Fe()}typeof document<"u"&&Tt()})();
|