@blinkk/root-cms 3.0.2 → 3.0.4
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 +5 -5
- package/dist/{chunk-2BSW7SIH.js → chunk-N4K6ICFR.js} +4 -4
- package/dist/{chunk-BGTUWIV6.js → chunk-PNLLZXVY.js} +4 -4
- package/dist/{chunk-3HARN4U6.js → chunk-RLZFZT42.js} +176 -83
- package/dist/{chunk-C245C557.js → chunk-RXWDB3K4.js} +3 -3
- package/dist/{chunk-XLX37FRL.js → chunk-TEKMLYXS.js} +3 -4
- package/dist/cli/cli.d.ts +12 -0
- package/dist/cli/docs.d.ts +49 -0
- package/dist/cli/export.d.ts +11 -0
- package/dist/cli/generate-types.d.ts +6 -0
- package/dist/cli/import.d.ts +13 -0
- package/dist/cli/init-firebase.d.ts +7 -0
- package/dist/cli/utils.d.ts +27 -0
- package/dist/cli.js +10 -10
- package/dist/client.js +1 -1
- package/dist/core/ai-tools.d.ts +156 -0
- package/dist/core/ai.d.ts +330 -0
- package/dist/core/api.d.ts +21 -0
- package/dist/core/app.d.ts +16 -0
- package/dist/core/checks-translations.d.ts +13 -0
- package/dist/core/checks.d.ts +48 -0
- package/dist/core/client.d.ts +715 -0
- package/dist/core/core.d.ts +5 -0
- package/dist/core/cron.d.ts +19 -0
- package/dist/core/csv.d.ts +5 -0
- package/dist/core/functions.d.ts +9 -0
- package/dist/core/plugin.d.ts +357 -0
- package/dist/{project.d.ts → core/project.d.ts} +8 -12
- package/dist/core/richtext.d.ts +101 -0
- package/dist/{core.d.ts → core/route.d.ts} +13 -66
- package/dist/core/runtime.d.ts +46 -0
- package/dist/{schema-Db_xODoi.d.ts → core/schema.d.ts} +47 -100
- package/dist/core/search-extract.d.ts +70 -0
- package/dist/core/search-index.d.ts +182 -0
- package/dist/core/search-query.d.ts +68 -0
- package/dist/core/security.d.ts +6 -0
- package/dist/core/server-version.d.ts +5 -0
- package/dist/core/services-notifications.d.ts +57 -0
- package/dist/core/services.d.ts +44 -0
- package/dist/core/sse.d.ts +10 -0
- package/dist/core/translations-manager.d.ts +187 -0
- package/dist/core/translations.d.ts +83 -0
- package/dist/core/url-safety.d.ts +19 -0
- package/dist/core/validation.d.ts +30 -0
- package/dist/core/values.d.ts +9 -0
- package/dist/core/versions.d.ts +48 -0
- package/dist/core.js +1 -1
- package/dist/edit-M4PN4SGX.js +7 -0
- package/dist/functions.js +4 -4
- package/dist/{generate-types-SPV7I3A5.js → generate-types-JWIG4QVI.js} +1 -1
- package/dist/plugin.js +128 -133
- package/dist/shared/marshal.d.ts +68 -0
- package/dist/shared/objects.d.ts +9 -0
- package/dist/shared/richtext.d.ts +74 -0
- package/dist/shared/safe-json.d.ts +11 -0
- package/dist/shared/sanitize.d.ts +12 -0
- package/dist/shared/slug.d.ts +19 -0
- package/dist/shared/sse.d.ts +16 -0
- package/dist/shared/strings.d.ts +23 -0
- package/dist/ui/AIPage-YI3RFK5F.js +1 -0
- package/dist/ui/AssetsPage-4JNAOFYF.js +1 -0
- package/dist/ui/CollectionPage-JWHH5G55.js +1 -0
- package/dist/ui/ComparePage-YZE3EMU4.js +1 -0
- package/dist/ui/DataPage-VRCQSZZG.js +1 -0
- package/dist/ui/DataSourcePage-WMSPBZ3W.js +1 -0
- package/dist/ui/DocTranslationsPage-RY2LOZBX.js +1 -0
- package/dist/ui/DocumentPage-EEGTJMIW.js +1 -0
- package/dist/ui/EditDataSourcePage-LLCX6K4J.js +1 -0
- package/dist/ui/EditReleasePage-WQYXXMZQ.js +1 -0
- package/dist/ui/ImageEditorDialog-4H665KK2.js +81 -0
- package/dist/ui/ImageEditorDialog-4H665KK2.js.LEGAL.txt +17 -0
- package/dist/ui/LogsPage-IP2DKEYR.js +1 -0
- package/dist/ui/NewDataSourcePage-RDYJC4DH.js +1 -0
- package/dist/ui/NewReleasePage-DGMFU2JN.js +1 -0
- package/dist/ui/NotFoundPage-WDZ2K7EF.js +1 -0
- package/dist/ui/ProjectPage-HYJOQUWR.js +1 -0
- package/dist/ui/ReleasePage-2KSF23TK.js +1 -0
- package/dist/ui/ReleasesPage-NZIBBXU4.js +1 -0
- package/dist/ui/SettingsPage-36XFWV62.js +1 -0
- package/dist/ui/SidebarToolsPage-5C6YBWJ7.js +1 -0
- package/dist/ui/TaskPage-SPIFPGPP.js +1 -0
- package/dist/ui/TasksPage-ZOXRPBQV.js +1 -0
- package/dist/ui/TranslationsArbPage-UHANA7JD.js +2 -0
- package/dist/ui/TranslationsEditPage-PQY6W5YG.js +1 -0
- package/dist/ui/TranslationsPage-V2PQFCN5.js +162 -0
- package/dist/ui/ai-tools-5E5ELLZX.js +1 -0
- package/dist/ui/chunk-3IYZCUPI.js +1 -0
- package/dist/ui/chunk-4KE2SZKH.js +1 -0
- package/dist/ui/chunk-4W73RW5I.js +1 -0
- package/dist/ui/chunk-54DVDYU6.js +1 -0
- package/dist/ui/chunk-5MV6XVGA.js +1 -0
- package/dist/ui/chunk-62UWGWON.js +1 -0
- package/dist/ui/chunk-767BAQ53.js +1 -0
- package/dist/ui/chunk-AFWBSIPL.js +1 -0
- package/dist/ui/chunk-AL3TN2KI.js +1 -0
- package/dist/ui/chunk-BZIRGB4W.js +1 -0
- package/dist/ui/chunk-C5NH23G4.js +3 -0
- package/dist/ui/chunk-CGCKJFL4.js +1 -0
- package/dist/ui/chunk-DEGMKEHP.js +1 -0
- package/dist/ui/chunk-DTMZLUNY.js +15 -0
- package/dist/ui/chunk-DTMZLUNY.js.LEGAL.txt +237 -0
- package/dist/ui/chunk-DUJYIOLE.js +5 -0
- package/dist/ui/chunk-E2RCCK2T.js +1 -0
- package/dist/ui/chunk-EGEB6N4J.js +22 -0
- package/dist/ui/chunk-EGEB6N4J.js.LEGAL.txt +1059 -0
- package/dist/ui/chunk-FBJURT7Z.js +1 -0
- package/dist/ui/chunk-GXSAEPU3.js +1 -0
- package/dist/ui/chunk-HHMG665Z.js +1 -0
- package/dist/ui/chunk-HKINZLMW.js +84 -0
- package/dist/ui/chunk-HLMBCVRX.js +1 -0
- package/dist/ui/chunk-HRGYNHZ3.js +1 -0
- package/dist/ui/chunk-I6ICVKEC.js +1 -0
- package/dist/ui/chunk-JDW4UORS.js +1 -0
- package/dist/ui/chunk-JHBAMPGB.js +1 -0
- package/dist/ui/chunk-JT5L6GPZ.js +141 -0
- package/dist/ui/chunk-JT5L6GPZ.js.LEGAL.txt +106 -0
- package/dist/ui/chunk-JYFLU7DM.js +19 -0
- package/dist/ui/chunk-JZFTZ4X4.js +87 -0
- package/dist/ui/chunk-JZFTZ4X4.js.LEGAL.txt +9 -0
- package/dist/ui/chunk-KFAZBEPV.js +1 -0
- package/dist/ui/chunk-KKEWCXVV.js +1 -0
- package/dist/ui/chunk-KUCVLANF.js +1 -0
- package/dist/ui/chunk-KYDOSLTO.js +1 -0
- package/dist/ui/chunk-L4RHGQUG.js +1 -0
- package/dist/ui/chunk-MDUBCXU2.js +1 -0
- package/dist/ui/chunk-NXQVLOTK.js +1 -0
- package/dist/ui/chunk-NZHF733K.js +7 -0
- package/dist/ui/chunk-NZHF733K.js.LEGAL.txt +146 -0
- package/dist/ui/chunk-ONTGW2VA.js +1 -0
- package/dist/ui/chunk-ORXEMIQC.js +1 -0
- package/dist/ui/chunk-P3NETZZP.js +1 -0
- package/dist/ui/chunk-PHBMVORG.js +1 -0
- package/dist/ui/chunk-PJA7YP4A.js +1 -0
- package/dist/ui/chunk-PVAE643M.js +1 -0
- package/dist/ui/chunk-PWKJDYE2.js +1 -0
- package/dist/ui/chunk-RSVO46S3.js +1 -0
- package/dist/ui/chunk-SKEP5WYH.js +10 -0
- package/dist/ui/chunk-SKEP5WYH.js.LEGAL.txt +176 -0
- package/dist/ui/chunk-SQRKKWRG.js +3 -0
- package/dist/ui/chunk-TJBVMFNQ.js +1 -0
- package/dist/ui/chunk-V7S4IAGB.js +1 -0
- package/dist/ui/chunk-VMT7JFAM.js +1 -0
- package/dist/ui/chunk-W3BJ2EZX.js +1 -0
- package/dist/ui/chunk-W3HIZQ4Z.js +1 -0
- package/dist/ui/chunk-X2WHBGTP.js +1 -0
- package/dist/ui/chunk-XOQ3KDSR.js +3 -0
- package/dist/ui/chunk-YDO2EDVY.js +1 -0
- package/dist/ui/chunk-YFA6U2CV.js +1 -0
- package/dist/ui/gcs-L33FIRZU.js +1 -0
- package/dist/ui/prerender-Q4YSDCPB.js +1 -0
- package/dist/ui/signin.js +1 -1
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -630
- package/dist/ui/ui.js.LEGAL.txt +19 -732
- package/package.json +20 -20
- package/dist/client-1puwLgNx.d.ts +0 -1552
- package/dist/client.d.ts +0 -5
- package/dist/edit-MT4B37QK.js +0 -7
- package/dist/functions.d.ts +0 -13
- package/dist/plugin.d.ts +0 -5
- package/dist/richtext.d.ts +0 -104
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f}from"./chunk-KKEWCXVV.js";import"./chunk-CGCKJFL4.js";import{a as g}from"./chunk-VMT7JFAM.js";import"./chunk-ONTGW2VA.js";import{c as T,d as N}from"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as h}from"./chunk-PJA7YP4A.js";import"./chunk-I6ICVKEC.js";import{a as A}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as W,b as H}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Dc as k,Ea as D,Ga as p,Ha as a,Kc as z,V as y,W as m,a as _,c as b,da as v,ea as P,j as B,oa as x,pa as w}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function r(t){W(`Data Source: ${t.id}`);let[o,l]=_(!0),[e,u]=_(null),[n,c]=_(null),i=t.id;async function d(){let s=await T(i);if(u(s),s){let I=await N(i,{mode:"draft"});c(I)}l(!1)}b(()=>{d()},[]);function S(s){s==="sync"&&d()}return a(H,{children:a("div",{className:"DataSourcePage",children:[a("div",{className:"DataSourcePage__header",children:[a(v,{className:"DataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data"}),a("div",{children:i})]}),a("div",{className:"DataSourcePage__header__titleWrap",children:[a(g,{size:"h1",children:["Data Source: ",i]}),a("div",{className:"DataSourcePage__header__controls",children:a(p,{label:"Configure",children:a(m,{component:"a",href:`/cms/data/${t.id}/edit`,children:a(k,{size:24,stroke:"1.5"})})})})]}),e?.description&&a(A,{as:"p",children:e.description})]}),e&&a(r.SyncStatus,{dataSource:e,onAction:S}),o?a(y,{color:"gray",size:"xl"}):e?a(r.DataSection,{dataSource:e,data:n}):a("div",{className:"DataSourcePage__notFound",children:"Not Found"})]})})}r.SyncStatus=t=>{let o=t.dataSource;return a("div",{className:"DataSourcePage__SyncStatus",children:[a(g,{size:"h2",children:"Status"}),a(h,{className:"DataSourcePage__SyncStatus__content",children:a(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"last synced"}),a("th",{children:"last published"})]})}),a("tbody",{children:a("tr",{children:[a("td",{children:a(f,{dataSource:o,action:"sync",onAction:()=>{t.onAction&&t.onAction("sync")}})}),a("td",{children:a(f,{dataSource:o,action:"publish"})})]})})]})})]})};r.DataSection=t=>{let{data:o,headers:l}=t.data||{},e=t.dataSource;if(!o)return null;let u=e.dataFormat||"map";if(e.type==="gsheet"){let n=l,c=[];if(u==="array")c=o;else if(u==="map"){let i=o;if(!n){let d=new Set;i.forEach(S=>{for(let s in S)s&&d.add(s)}),n=Array.from(d)}i.forEach(d=>{c.push(n.map(S=>d[S]||""))})}return a(r.DataSectionWrap,{dataSource:e,children:a(r.DataTable,{headers:n,rows:c})})}return e.type==="http"?a(r.DataSectionWrap,{dataSource:e,children:a(r.DefaultDataDisplay,{data:o})}):(console.log(`unsupported data type: ${e.type}`),null)};r.DataSectionWrap=t=>a("div",{className:"DataSourcePage__DataSection",children:[a("div",{className:"DataSourcePage__DataSection__header",children:[a(g,{size:"h2",children:"Data"}),a("div",{className:"DataSourcePage__DataSection__header__actions",children:[t.dataSource.url?.startsWith("https://docs.google.com/spreadsheets/")&&a(p,{label:"Open spreadsheet",children:a(m,{component:"a",href:t.dataSource.url,target:"_blank",variant:"filled",color:"green",children:a(z,{size:16,stroke:"2.25"})})}),t.dataSource.previewUrl&&a(P,{component:"a",variant:"default",size:"xs",href:t.dataSource.previewUrl,target:"_blank",children:"Preview"})]})]}),a(h,{className:"DataSourcePage__DataSection__content",children:t.children})]});r.DataTable=t=>{let o=t.headers||[],l=t.rows||[];return a("div",{className:"DataSourcePage__DataTable",children:a(D,{className:"DataSourcePage__DataTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[o.length>0&&a("thead",{children:a("tr",{children:o.map(e=>a("th",{children:e},e))})}),a("tbody",{children:l.map((e,u)=>a("tr",{children:e.map((n,c)=>a("td",{children:n},c))},u))})]})})};r.DefaultDataDisplay=t=>{let o=t.data;return typeof o=="object"?a(w,{value:JSON.stringify(o,null,2),minRows:20,maxRows:100}):a(x,{value:String(o),minRows:12,maxRows:100})};export{r as DataSourcePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as na}from"./chunk-767BAQ53.js";import{a as ea}from"./chunk-4W73RW5I.js";import{a as aa}from"./chunk-P3NETZZP.js";import{a as Z}from"./chunk-VMT7JFAM.js";import"./chunk-HRGYNHZ3.js";import{b as j}from"./chunk-W3HIZQ4Z.js";import"./chunk-YDO2EDVY.js";import{A as V,t as U}from"./chunk-AFWBSIPL.js";import{b as G}from"./chunk-XOQ3KDSR.js";import{b as O}from"./chunk-62UWGWON.js";import{a as W,b as B}from"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as oa,b as S}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as y}from"./chunk-AL3TN2KI.js";import{Ab as q,Ga as p,Ha as a,Kc as Q,Oc as Y,V as E,W as w,a as r,c as k,da as R,e as $,ea as f,g as A,hc as J,j as _a,ra as C,zb as X,zc as K}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";_a();function u(e){oa(`Translations: ${e.collection}/${e.slug}`);let[_,l]=r(!0),[h,g]=r(!1),[o,t]=r([]),[s,c]=r({}),[M,ta]=r(null),[sa,N]=r(!1),[I,L]=r({}),[ra,z]=r(!1),m=e.collection,b=e.slug,i=`${m}/${b}`,ia=ea(),P=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||[],[F,H]=na("locale",P);async function la(){try{let[n,d,T]=await Promise.all([aa(i),G(),V(i)]);t(n),c(d),ta(T),l(!1)}catch(n){console.error(n),l(!1),g(!0)}}if(k(()=>{la()},[]),h)return a(u.NotFound,{docId:i});function ca(n,d,T){N(!0),L(x=>{let D={...x},v=D[n]??{};return v.source=n,v[d]=T,D[n]=v,D})}async function da(){z(!0),await O(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;W({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(I);console.log(d),await U(i,d),B({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),L({}),N(!1)}),z(!1)}function ga(n){F.length===P.length?H([n]):H(P)}return a(S,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(R,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${m}`,children:m}),a("a",{href:`/cms/content/${m}/${b}`,children:b}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(Z,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[M&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(p,{label:"Open Google Sheet",children:a(w,{component:"a",href:j(M),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(Q,{size:16,strokeWidth:2.25})})}),a(f,{variant:"default",size:"xs",leftIcon:a(q,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(f,{variant:"default",size:"xs",leftIcon:a(X,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(C,{className:"DocTranslationsPage__toolsMenu",control:a(p,{label:"Tools",children:a(w,{variant:"default",children:a(Y,{size:16})})}),size:220,children:a(C.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(K,{size:16}),onClick:()=>ia.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(x=>delete T[x]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:y("DocTranslationsPage__content",_&&"DocTranslationsPage__content--loading"),children:_?a(E,{color:"gray",size:"xl"}):a(u.Table,{locales:F,sourceStrings:o,translationsMap:s,onChange:ca,changesMap:I,onSelectLocale:n=>ga(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(f,{variant:"filled",color:"dark",disabled:!sa,loading:ra,onClick:()=>da(),children:"Save"})})})]})})}u.NotFound=e=>a(S,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(J,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let l=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||[],h=A(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function g(o,t){return{translation:(h[o]||{})[t]||"",hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(p,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=g(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let _=$(null),[l,h]=r(e.value),g=null;e.locale in(e.changesMap[e.source]||{})&&(g=e.changesMap[e.source][e.locale]);let o=g!==null&&g!==e.value;function t(){window.requestAnimationFrame(()=>{let s=_.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return k(()=>{t()},[l]),a("textarea",{ref:_,className:y("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as je}from"./chunk-767BAQ53.js";import{c as Le,i as Ve,j as $e,k as We,m as Fe}from"./chunk-JT5L6GPZ.js";import"./chunk-HHMG665Z.js";import"./chunk-YFA6U2CV.js";import"./chunk-4W73RW5I.js";import"./chunk-P3NETZZP.js";import"./chunk-V7S4IAGB.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a as Ue}from"./chunk-JYFLU7DM.js";import"./chunk-PHBMVORG.js";import{d as Ee}from"./chunk-JZFTZ4X4.js";import"./chunk-HKINZLMW.js";import{a as Me,d as Ae,f as X,h as Oe}from"./chunk-TJBVMFNQ.js";import"./chunk-CGCKJFL4.js";import"./chunk-VMT7JFAM.js";import"./chunk-SKEP5WYH.js";import"./chunk-GXSAEPU3.js";import{b as Re,c as ae,g as Te}from"./chunk-NXQVLOTK.js";import"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import{a as T}from"./chunk-X2WHBGTP.js";import{b as Be,c as se}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as ze}from"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as He,b as Xe}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{f as I}from"./chunk-AL3TN2KI.js";import{Aa as _e,Ac as Ie,Ga as L,Ha as e,Ja as pe,P as me,Pa as ge,Ra as oe,Ta as fe,Tc as Ne,Uc as ne,Va as ve,Vb as De,W as E,Wb as Ce,_a as Pe,a as y,c as x,ca as he,e as P,ea as H,g as M,h as C,j as te,pc as Se,qb as we,rb as xe,sb as be,tb as ke,tc as ye}from"./chunk-NZHF733K.js";import{d as V,j as ue,k as et}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";te();te();async function qe(t,o){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:o})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function Ke(t){let o=window.__ROOT_CTX.checks||[],n=t.docId.split("/")[0],a=o.filter(c=>!c.collections||c.collections.includes(n)),[i,r]=y({}),s=C(async c=>{r(m=>({...m,[c]:{loading:!0}}));try{let m=await qe(c,t.docId);r(h=>({...h,[c]:{loading:!1,result:m}}))}catch(m){r(h=>({...h,[c]:{loading:!1,error:m.message||"Unknown error."}}))}},[t.docId]),l=C(async()=>{let c={};for(let m of a)c[m.id]={loading:!0};r(c);for(let m of a)try{let h=await qe(m.id,t.docId);r(_=>({..._,[m.id]:{loading:!1,result:h}}))}catch(h){r(_=>({..._,[m.id]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId,a]);return e("div",{className:"ChecksPanel",children:[e("div",{className:"ChecksPanel__header",children:[e("div",{className:"ChecksPanel__header__title",children:"Checks"}),e(H,{variant:"default",size:"xs",compact:!0,leftIcon:e(Se,{size:12}),onClick:l,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(c=>{let m=i[c.id];return e(tt,{check:c,state:m,onRun:()=>s(c.id)},c.id)})})})]})}function tt(t){let{check:o,state:n,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[o.label,n?.result&&e(at,{status:n.result.status})]}),e(H,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:n?.loading,onClick:a,children:"Run"})]}),o.description&&e("div",{className:"ChecksPanel__check__description",children:o.description}),n?.result&&e("div",{className:I("ChecksPanel__check__result",`ChecksPanel__check__result--${n.result.status}`),children:e(Ee,{code:n.result.message})}),n?.error&&e("div",{className:"ChecksPanel__check__error",children:n.error})]})}var ot={success:"green",warning:"yellow",error:"red"},nt={success:Pe,warning:pe,error:ne};function at(t){let o=ot[t.status],n=nt[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(he,{className:"ChecksPanel__statusBadge",color:o,size:"sm",variant:"filled",leftSection:e(n,{size:10}),children:a})}function Je(t){let{device:o,expandVertically:n,iframeUrl:a,localeOptions:i,selectedLocale:r,onToggleDevice:s,onToggleExpandVertically:l,onReloadClick:c,onOpenNewTab:m,onLocaleChange:h}=t;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(L,{label:"Mobile",children:e(E,{className:I("DocumentPagePreviewBar__device",o==="mobile"&&"active"),onClick:()=>s("mobile"),children:e(ke,{size:16})})}),e(L,{label:"Tablet",children:e(E,{className:I("DocumentPagePreviewBar__device",o==="tablet"&&"active"),onClick:()=>s("tablet"),children:e(be,{size:16})})}),e(L,{label:"Desktop",children:e(E,{className:I("DocumentPagePreviewBar__device",o==="desktop"&&"active"),onClick:()=>s("desktop"),children:e(we,{size:16})})}),e(L,{label:"Expand",children:e(E,{className:I("DocumentPagePreviewBar__device",n&&"active"),"aria-pressed":n,disabled:o==="",onClick:l,children:e(fe,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:a})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(_e,{data:i,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(Ne,{size:16,strokeWidth:1.5}),value:r,onChange:_=>{h(_)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(L,{label:"Reload",children:e(E,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:c,children:e(ye,{size:16})})}),e(L,{label:"Open new tab",children:e(E,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:m,children:e(oe,{size:16})})})]})]})}te();function Ye(t){let o=t.docId.split("/")[0],n=Te(o),a=X(),i=P(null),[r,s]=y(""),[l,c]=y([]),[m,h]=y(!1),_=P("");_.current=r;let g=P(n.schema?.fields||[]);g.current=n.schema?.fields||[];let k=P(n.schema?.types||{});k.current=n.schema?.types||{};let w=M(()=>Me(d=>{let b=d.trim();if(!b){c([]),h(!1);return}let S=a.controller?.getData()?.fields||{},z=We(b,S,g.current,k.current);c(z),h(!0)},150),[a.controller]);x(()=>{w(r)},[r,w]),Oe(()=>{_.current.trim()&&w(_.current)}),x(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),x(()=>{let d=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",d),()=>window.removeEventListener("root:focus-search",d)},[]);let p=d=>{ct(d)};return e("div",{className:"SearchPanel",children:[e("div",{className:"SearchPanel__header",children:[e("div",{className:"SearchPanel__header__title",children:"Search"}),t.onClose&&e(E,{size:"xs",onClick:t.onClose,title:"Close search",children:e(ne,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ie,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:r,onInput:d=>s(d.currentTarget.value),onKeyDown:d=>{d.key==="Escape"&&t.onClose&&(d.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!m&&!r.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),m&&l.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:r}),"."]}),l.length>0&&e(V,{children:[e("div",{className:"SearchPanel__resultsCount",children:[l.length," ",l.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:l.map((d,b)=>e(it,{result:d,onClick:()=>p(d)},`${d.deepKey}:${b}`))})]})]})]})}function it(t){let{result:o}=t;return e("li",{className:"SearchPanel__result",children:e("button",{type:"button",className:"SearchPanel__result__button",onClick:t.onClick,children:[e("div",{className:"SearchPanel__result__label",children:o.label}),e("div",{className:"SearchPanel__result__snippet",children:rt(o.snippet,o.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:o.fieldType}),o.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),o.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function rt(t,o){if(!o||o.length===0)return t;let n=[],a=0;for(let i of o)i.start>a&&n.push({text:t.slice(a,i.start),match:!1}),n.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&n.push({text:t.slice(a),match:!1}),n.map((i,r)=>i.match?e("mark",{children:i.text},r):e("span",{children:i.text},r))}function ct(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let o=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ve,{detail:o}))},350)}else if(t.richTextInline){let o=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent($e,{detail:o}))},350)}}et();te();var st=ue(null);function j(t){let{className:o,localStorageId:n,children:a}=t,[i,r]=T(`root::SplitPanel:${n}`,350),[s,l]=y(!1),[c,m]=y(0),h=M(()=>new Set,[]),_=P(null),g=P(null),k={onResize:p=>(h.add(p),()=>{h.delete(p)})};if(x(()=>{let p=()=>l(!1);window.addEventListener("mouseup",p);let d=_.current;return d&&m(d.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",p)},[]),x(()=>{let p=d=>{let b=d.clientX-c;r(b),h.forEach(S=>S())};return s&&window.addEventListener("mousemove",p),()=>window.removeEventListener("mousemove",p)},[s]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let w={"--panel-size":`${i}px`};return e(st.Provider,{value:k,children:e("div",{className:I(o,"SplitPanel",s&&"dragging"),ref:_,style:w,children:[a[0],e("div",{className:"SplitPanel__divider",ref:g,onMouseDown:()=>l(!0)}),a[1]]})})}j.Item=t=>e("div",{className:I("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function le(t,o,n=""){let a=ae({collectionId:t,slug:o}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let r=`${i.toString()}${window.location.hash}`;return n?`${ae({collectionId:t,slug:o,locale:n})}?${r}`:`${a}?${r}`}function Ge(t){let o=t.collection,n=t.slug,a=`${o}/${n}`,{roles:i}=ze(),r=window.firebase.user.email||"",s=Be(i,r);return e(Ae,{docId:a,readOnly:!s,children:e(lt,{...t,canEdit:s})})}function lt(t){let o=t.canEdit,n=t.collection,a=t.slug,i=`${n}/${a}`;He(i);let r=window.__ROOT_CTX.collections[n],s=X(),l=!!r?.url,[c,m]=T(`root::DocumentPage::previewVisible::${n}`,l),h=M(()=>(window.__ROOT_CTX.checks||[]).some(f=>!f.collections||f.collections.includes(n)),[n]),[_,g]=T("root::DocumentPage::checksVisible",!1),k=P(_);k.current=_;let[w,p]=T("root::DocumentPage::searchVisible",!1),d=P(w);d.current=w;let b=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai),[S,z]=T("root::DocumentPage::aiVisible",!1),O=P(S);O.current=S,x(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:_}))},[_]),x(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:w}))},[w]),x(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:S}))},[S]);let[F,q]=T("root::DocumentPage::searchPanelWidth",360),[U,K]=y(F),[$,J]=y(!1),Y=P(null);if(x(()=>{let v=()=>{let f=!k.current;g(()=>f),f&&(p(()=>!1),z(()=>!1))};return window.addEventListener("root:toggle-checks",v),()=>window.removeEventListener("root:toggle-checks",v)},[]),x(()=>{let v=()=>{let f=!d.current;p(()=>f),f&&(g(()=>!1),z(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",v),()=>window.removeEventListener("root:toggle-search",v)},[]),x(()=>{let v=()=>{let f=!O.current;z(()=>f),f&&(g(()=>!1),p(()=>!1))};return window.addEventListener("root:toggle-ai",v),()=>window.removeEventListener("root:toggle-ai",v)},[]),x(()=>{if(!$)return;let v=A=>{let G=Y.current;if(!G)return;let re=G.getBoundingClientRect(),ce=Math.max(240,Math.min(re.right-A.clientX,800));K(ce)},f=()=>{J(!1),K(A=>(q(()=>A),A))};return window.addEventListener("mousemove",v),window.addEventListener("mouseup",f),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",f)}},[$]),!r)return e("div",{children:"Could not find collection."});let ie=C(()=>{if(!l)return;let v=le(n,a),f=window.open(v,"_blank","noopener,noreferrer");f&&f.focus()},[l,n,a]),Q=C(()=>{o&&s.controller&&s.controller.flush()},[o,s.controller]),W=Le(),u=C(()=>{let v=s.controller?.getData()?.fields||{};W.open({data:v,onSave:f=>{s.controller&&f&&typeof f=="object"&&(s.controller.updateKey("fields",f),s.controller.flush()),W.close()}})},[s.controller]),D=C(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),N=C(()=>{b&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[b]),R=C(()=>{z(()=>!1)},[z]);return me([["mod+S",Q],["mod+shift+F",D],["mod+I",N]]),e(Xe,{children:e("div",{className:I("DocumentPage__layout",$&&"DocumentPage__layout--dragging"),ref:Y,children:[e(j,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(j.Item,{className:I("DocumentPage__side",(!l||!c)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${n}`,children:e(E,{className:"DocumentPage__side__header__back",children:e(ge,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(se,{label:"You don't have access to edit this document",condition:!o,children:e(H,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(xe,{size:16}),onClick:()=>Q(),disabled:!o,children:"Save"})}),e(se,{label:"You don't have access to edit this document",condition:!o,children:e(L,{label:"Edit JSON",disabled:!o,children:e(E,{className:"DocumentPage__side__header__editJson",onClick:()=>u(),disabled:!o,children:e(ve,{size:14})})})}),l&&e(V,{children:[e(L,{label:c?"Hide preview":"Show preview",children:e(E,{className:"DocumentPage__side__header__previewToggle",onClick:()=>m(!c),children:c?e(De,{size:16}):e(Ce,{size:16})})}),!c&&e(L,{label:"Open preview in new tab",children:e(E,{className:"DocumentPage__side__header__openNewTab",onClick:ie,children:e(oe,{size:16})})})]})]})]}),e("div",{className:I("DocumentPage__side__editor",(!l||!c)&&!_&&!w&&!S&&"DocumentPage__side__editor--centered"),children:e(Fe,{docId:i})})]}),e(j.Item,{className:I("DocumentPage__main",(!l||!c)&&"DocumentPage__main--hidden"),fluid:!0,children:l&&c&&e(Ge.Preview,{docId:i},i)})]}),h&&_&&e(ut,{docId:i}),w&&e(V,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>J(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${U}px`},children:e(Ye,{docId:i,autoFocus:!0,onClose:()=>p(()=>!1)})})]}),b&&S&&e(dt,{docId:i,onClose:R})]})})}function dt(t){let[o,n]=T("root::DocumentPage::aiPanelWidth",420),[a,i]=y(o),r=P(null),s=P(a),l=P(),c=M(()=>e(Ue,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;s.current=a,h.classList.add("DocumentPage__layout--dragging");let _=w=>{let p=r.current?.parentElement;if(!p)return;let d=p.getBoundingClientRect(),b=Math.max(280,Math.min(d.right-w.clientX,800));s.current=b,i(b)},g=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",k),l.current=void 0},k=()=>{g(),n(()=>s.current)};l.current=g,window.addEventListener("mousemove",_),window.addEventListener("mouseup",k)},[a,n]);return x(()=>()=>l.current?.(),[]),e(V,{children:[e("div",{className:"DocumentPage__aiDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:c})]})}function ut(t){let[o,n]=T("root::DocumentPage::checksPanelWidth",360),[a,i]=y(o),r=P(null),s=P(a),l=P(),c=M(()=>e(Ke,{docId:t.docId}),[t.docId]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;s.current=a,h.classList.add("DocumentPage__layout--dragging");let _=w=>{let p=r.current?.parentElement;if(!p)return;let d=p.getBoundingClientRect(),b=Math.max(200,Math.min(d.right-w.clientX,800));s.current=b,i(b)},g=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",k),l.current=void 0},k=()=>{g(),n(()=>s.current)};l.current=g,window.addEventListener("mousemove",_),window.addEventListener("mouseup",k)},[a,n]);return x(()=>()=>l.current?.(),[]),e(V,{children:[e("div",{className:"DocumentPage__checksDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:c})]})}var Qe={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]};function mt(t){let o=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${o.of(a)||t} (${t})`}Ge.Preview=t=>{let o=X();if(o.loading)return null;let[n,a]=t.docId.split("/"),r=window.__ROOT_CTX.collections[n];if(!r)throw new Error(`collection not found: ${n}`);if(!r.url)return null;let s=r.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",l=Re({collectionId:n,slug:a}),c=ae({collectionId:n,slug:a}),m=`${s}${l}`,[h,_]=y(m),[g,k]=T("root::DocumentPage::preview::device",""),[w,p]=T("root::DocumentPage::preview::expandVertically",!1),[d,b]=y({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[S,z]=je("locale",""),O=P(null),F=P(null),q=o.controller.getLocales()||[],U=le(n,a,S),K=M(()=>[{value:"",label:"Select locale"},...q.map(u=>({value:u,label:mt(u)}))],[q]);function $(){if(document.hidden)return;let u=O.current;u.src="about:blank",window.requestAnimationFrame(()=>{u.src!==U?u.src=U:u.contentWindow.location.reload()})}x(()=>{let u=O.current;function D(){let R=u.contentWindow;if(R&&c===l&&!R.location.href.startsWith("about:blank")){let v=R.location.pathname;_(`${s}${v}`)}}u.addEventListener("load",D);let N=o.controller?.onFlush(()=>{$()});return()=>{N(),u.removeEventListener("load",D)}},[]),x(()=>{let u=O.current;u.src=U},[S]);let J=C(u=>{k(D=>{let N=D===u?"":u;return N===""&&p(!1),N})},[k,p]),Y=C(()=>{k(u=>(u&&p(D=>!D),u))},[k,p]),ie=C(()=>{o.controller&&o.controller.flush().then(()=>$())},[o.controller]),Q=C(()=>{let u=le(n,a,S),D=window.open(u,"_blank","noopener,noreferrer");D&&D.focus()},[n,a,S]),W=C(()=>{if(g===""){let B={"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"};b(ee=>ee["--iframe-width"]===B["--iframe-width"]&&ee["--iframe-height"]===B["--iframe-height"]&&ee["--iframe-scale"]===B["--iframe-scale"]?ee:B);return}let u=F.current;if(!u)return;let D=u.getBoundingClientRect(),[N,R]=Qe[g],v=20,f=Math.max(D.width-2*v,0),A=Math.max(D.height-2*v,0),G=f>0&&N>0?f/N:1,re=A>0&&R>0?A/R:1,ce=Math.min(G,re,1),de=Number(ce.toFixed(4))||1,Ze=w?`${A/de}px`:`${R}px`,Z={"--iframe-width":`${N}px`,"--iframe-height":Ze,"--iframe-scale":String(de)};b(B=>B["--iframe-width"]===Z["--iframe-width"]&&B["--iframe-height"]===Z["--iframe-height"]&&B["--iframe-scale"]===Z["--iframe-scale"]?B:Z)},[g,w]);return x(()=>{W();let u=F.current;if(!u)return;let D=0,N=()=>{window.cancelAnimationFrame(D),D=window.requestAnimationFrame(W)},R=new window.ResizeObserver(N);return R.observe(u),window.addEventListener("resize",N),()=>{window.cancelAnimationFrame(D),R.disconnect(),window.removeEventListener("resize",N)}},[W]),e("div",{className:"DocumentPage__main__preview",children:[e(Je,{device:g,expandVertically:w,iframeUrl:h,localeOptions:K,selectedLocale:S,onToggleDevice:J,onToggleExpandVertically:Y,onReloadClick:ie,onOpenNewTab:Q,onLocaleChange:z}),e("div",{className:"DocumentPage__main__previewFrame","data-device":g||"full",ref:F,style:d,children:[e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",style:{display:g?void 0:"none"},children:g?`${g}: ${Qe[g].join("x")}`:""}),e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:O,title:"iframe preview"})})]})]})};export{Ge as DocumentPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as H}from"./chunk-C5NH23G4.js";import"./chunk-CGCKJFL4.js";import{a as M}from"./chunk-VMT7JFAM.js";import{a as B,c as _}from"./chunk-ONTGW2VA.js";import{c as u,f as A,g as E,j as T,l as z}from"./chunk-4KE2SZKH.js";import{a as N}from"./chunk-L4RHGQUG.js";import{a as w,c as p}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import{a as F}from"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import{a as s,b as r}from"./chunk-I6ICVKEC.js";import{a as m}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as O,b as L}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import{d as y}from"./chunk-AL3TN2KI.js";import{Ga as n,Ha as e,Ma as I,W as l,Xc as $,a as D,c as x,da as P,j as K,jb as k,uc as U}from"./chunk-NZHF733K.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";K();function ve(a){O(`Edit Data Source: ${a.id}`);let{route:b}=y(),[v,h]=D(null),i=w(),f=p(),{roles:g}=N(),R=window.firebase.user.email||"",t=B(g,R);x(()=>{u(a.id).then(o=>{h(o)})},[a.id]);function W(){let o=`delete-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Delete data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",e("code",{children:a.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()=>{s({id:o,title:"Deleting data source",message:`Deleting ${a.id} and synced data...`,loading:!0,autoClose:!1}),await z(a.id),r({id:o,title:"Deleted data source",message:`Successfully deleted ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b("/cms/data")}})}function Y(){let o=`archive-data-source-${a.id}`,d=!!v?.publishedAt,c=i.openConfirmModal({...f,title:"Archive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive data source ",e("code",{children:a.id}),"? Archived data sources cannot be synced or published.",d&&e(S,{children:[" ","Note: previously published data will remain available until the data source is unpublished."]})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Archiving data source",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await A(a.id);let J=await u(a.id);h(J),r({id:o,title:"Archived data source",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(c),b("/cms/data")}})}function j(){let o=`unarchive-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unarchive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive data source ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unarchiving data source",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unarchived data source",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b(`/cms/data/${a.id}`)}})}function q(){let o=`unpublish-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unpublish data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unpublish data source ",e("code",{children:a.id}),"? The published data will be removed and will no longer be available to production. There is no undo."]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unpublishing data source",message:`Unpublishing ${a.id}...`,loading:!0,autoClose:!1}),await T(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unpublished data source",message:`Successfully unpublished ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d)}})}let G=!!v?.publishedAt,C=!!v?.archivedAt;return e(L,{children:e("div",{className:"EditDataSourcePage",children:[e("div",{className:"EditDataSourcePage__header",children:[e(P,{className:"EditDataSourcePage__header__breadcrumbs",children:[e("a",{href:"/cms/data",children:"Data Sources"}),e("a",{href:`/cms/data/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditDataSourcePage__header__titleWrap",children:[e(M,{size:"h1",children:["Edit Data Source: ",a.id]}),e("div",{className:"EditDataSourcePage__header__controls",children:[G&&!C&&e(_,{label:"You don't have access to unpublish data sources",condition:!t,children:e(n,{label:"Unpublish",disabled:!t,children:e(l,{onClick:q,loading:!g,disabled:!t,children:e(k,{size:20,stroke:"1.5"})})})}),e(_,{label:"You don't have access to archive data sources",condition:!t,children:C?e(n,{label:"Unarchive",disabled:!t,children:e(l,{onClick:j,loading:!g,disabled:!t,children:e(U,{size:20,stroke:"1.5"})})}):e(n,{label:"Archive",disabled:!t,children:e(l,{onClick:Y,loading:!g,disabled:!t,children:e(I,{size:20,stroke:"1.5"})})})}),e(n,{label:"Delete",children:e(l,{onClick:W,children:e($,{size:20,stroke:"1.5"})})})]})]})]}),e(F,{className:"EditDataSourcePage__form",children:e(H,{dataSourceId:a.id})})]})})}export{ve as EditDataSourcePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k}from"./chunk-MDUBCXU2.js";import"./chunk-JHBAMPGB.js";import"./chunk-V7S4IAGB.js";import{a as A}from"./chunk-VMT7JFAM.js";import"./chunk-NXQVLOTK.js";import"./chunk-3IYZCUPI.js";import{c as s,e as E,f as w}from"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import{a as z,c as I}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as T}from"./chunk-L4RHGQUG.js";import{a as x,c as P}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import{a as h,b as f}from"./chunk-I6ICVKEC.js";import{a as g}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as $,b as U}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import{d as C}from"./chunk-AL3TN2KI.js";import{Ga as m,Ha as e,Ma as y,W as c,a as v,c as R,da as b,j as B,uc as p}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function se(i){$(`Edit Release: ${i.id}`);let{route:u}=C(),[N,t]=v(null),l=x(),_=P(),{roles:d}=T(),M=window.firebase.user.email||"",o=z(d,M);R(()=>{s(i.id).then(a=>{t(a)})},[i.id]);function L(){let a=`archive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Archive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Archiving release",message:`Archiving ${i.id}...`,loading:!0,autoClose:!1}),await E(i.id);let r=await s(i.id);t(r),f({id:a,title:"Archived release",message:`Successfully archived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u("/cms/releases")}})}function S(){let a=`unarchive-release-${i.id}`,n=l.openConfirmModal({..._,title:"Unarchive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive release ",e("code",{children:i.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:a,title:"Unarchiving release",message:`Unarchiving ${i.id}...`,loading:!0,autoClose:!1}),await w(i.id);let r=await s(i.id);t(r),f({id:a,title:"Unarchived release",message:`Successfully unarchived ${i.id}`,loading:!1,autoClose:5e3}),l.closeModal(n),u(`/cms/releases/${i.id}`)}})}return e(U,{children:e("div",{className:"EditReleasePage",children:[e("div",{className:"EditReleasePage__header",children:[e(b,{className:"EditReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("a",{href:`/cms/releases/${i.id}`,children:i.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditReleasePage__header__titleWrap",children:[e(A,{size:"h1",children:["Edit Release: ",i.id]}),e("div",{className:"EditReleasePage__header__controls",children:e(I,{label:"You don't have access to archive releases",condition:!o,children:N?.archivedAt?e(m,{label:"Unarchive",disabled:!o,children:e(c,{onClick:S,loading:!d,disabled:!o,children:e(p,{size:20,stroke:"1.5"})})}):e(m,{label:"Archive",disabled:!o,children:e(c,{onClick:L,loading:!d,disabled:!o,children:e(y,{size:20,stroke:"1.5"})})})})})]})]}),e(k,{releaseId:i.id})]})})}export{se as EditReleasePage};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import{e as ye}from"./chunk-SKEP5WYH.js";import{A as le,Ba as de,Ca as me,Ga as $,Ha as h,Sa as ge,Ta as ve,W as K,Y as pe,_a as we,a as C,c as Y,ea as N,g as ue,ga as P,h as q,ha as he,j as qe,sa as fe,wa as J,y as Ke}from"./chunk-NZHF733K.js";import{b as E,c as L,e as ce}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import{b as O,d as Ye}from"./chunk-PVAE643M.js";var Pe=O((yt,Ee)=>{"use strict";var Ce=!1,x,ee,te,Z,H,_e,G,re,oe,ne,Se,ie,ae,xe,Re;function y(){if(!Ce){Ce=!0;var r=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(r),e=/(Mac OS X)|(Windows)|(Linux)/.exec(r);if(ie=/\b(iPhone|iP[ao]d)/.exec(r),ae=/\b(iP[ao]d)/.exec(r),ne=/Android/i.exec(r),xe=/FBAN\/\w+;/i.exec(r),Re=/Mobile/i.exec(r),Se=!!/Win64/.exec(r),n){x=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,x&&document&&document.documentMode&&(x=document.documentMode);var t=/(?:Trident\/(\d+.\d+))/.exec(r);_e=t?parseFloat(t[1])+4:x,ee=n[2]?parseFloat(n[2]):NaN,te=n[3]?parseFloat(n[3]):NaN,Z=n[4]?parseFloat(n[4]):NaN,Z?(n=/(?:Chrome\/(\d+\.\d+))/.exec(r),H=n&&n[1]?parseFloat(n[1]):NaN):H=NaN}else x=ee=te=H=Z=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(r);G=o?parseFloat(o[1].replace("_",".")):!0}else G=!1;re=!!e[2],oe=!!e[3]}else G=re=oe=!1}}var se={ie:function(){return y()||x},ieCompatibilityMode:function(){return y()||_e>x},ie64:function(){return se.ie()&&Se},firefox:function(){return y()||ee},opera:function(){return y()||te},webkit:function(){return y()||Z},safari:function(){return se.webkit()},chrome:function(){return y()||H},windows:function(){return y()||re},osx:function(){return y()||G},linux:function(){return y()||oe},iphone:function(){return y()||ie},mobile:function(){return y()||ie||ae||ne||Re},nativeApp:function(){return y()||xe},android:function(){return y()||ne},ipad:function(){return y()||ae}};Ee.exports=se});var ze=O((bt,De)=>{"use strict";var k=!!(typeof window<"u"&&window.document&&window.document.createElement),Je={canUseDOM:k,canUseWorkers:typeof Worker<"u",canUseEventListeners:k&&!!(window.addEventListener||window.attachEvent),canUseViewport:k&&!!window.screen,isInWorker:!k};De.exports=Je});var Te=O((Ct,Oe)=>{"use strict";var Me=ze(),Ae;Me.canUseDOM&&(Ae=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function $e(r,n){if(!Me.canUseDOM||n&&!("addEventListener"in document))return!1;var e="on"+r,t=e in document;if(!t){var o=document.createElement("div");o.setAttribute(e,"return;"),t=typeof o[e]=="function"}return!t&&Ae&&r==="wheel"&&(t=document.implementation.hasFeature("Events.wheel","3.0")),t}Oe.exports=$e});var Ne=O((_t,Le)=>{"use strict";var Qe=Pe(),et=Te(),Ie=10,We=40,je=800;function Fe(r){var n=0,e=0,t=0,o=0;return"detail"in r&&(e=r.detail),"wheelDelta"in r&&(e=-r.wheelDelta/120),"wheelDeltaY"in r&&(e=-r.wheelDeltaY/120),"wheelDeltaX"in r&&(n=-r.wheelDeltaX/120),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(n=e,e=0),t=n*Ie,o=e*Ie,"deltaY"in r&&(o=r.deltaY),"deltaX"in r&&(t=r.deltaX),(t||o)&&r.deltaMode&&(r.deltaMode==1?(t*=We,o*=We):(t*=je,o*=je)),t&&!n&&(n=t<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:n,spinY:e,pixelX:t,pixelY:o}}Fe.getEventType=function(){return Qe.firefox()?"DOMMouseScroll":et("wheel")?"wheel":"mousewheel"};Le.exports=Fe});var He=O((St,Ze)=>{"use strict";Ze.exports=Ne()});qe();var Q=function(r,n){return Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},Q(r,n)};function be(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");Q(r,n);function e(){this.constructor=r}r.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var g=function(){return g=Object.assign||function(n){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},g.apply(this,arguments)};Ke();var Xe=Ye(He(),1);function tt(r,n,e,t,o,i){i===void 0&&(i=0);var s=D(r,n,i),a=s.width,c=s.height,u=Math.min(a,e),l=Math.min(c,t);return u>l*o?{width:l*o,height:l}:{width:u,height:u/o}}function rt(r){return r.width>r.height?r.width/r.naturalWidth:r.height/r.naturalHeight}function T(r,n,e,t,o){o===void 0&&(o=0);var i=D(n.width,n.height,o),s=i.width,a=i.height;return{x:Ge(r.x,s,e.width,t),y:Ge(r.y,a,e.height,t)}}function Ge(r,n,e,t){var o=n*t/2-e/2;return U(r,-o,o)}function ke(r,n){return Math.sqrt(Math.pow(r.y-n.y,2)+Math.pow(r.x-n.x,2))}function Be(r,n){return Math.atan2(n.y-r.y,n.x-r.x)*180/Math.PI}function ot(r,n,e,t,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var a=s?nt:it,c=D(n.width,n.height,i),u=D(n.naturalWidth,n.naturalHeight,i),l={x:a(100,((c.width-e.width/o)/2-r.x/o)/c.width*100),y:a(100,((c.height-e.height/o)/2-r.y/o)/c.height*100),width:a(100,e.width/c.width*100/o),height:a(100,e.height/c.height*100/o)},d=Math.round(a(u.width,l.width*u.width/100)),p=Math.round(a(u.height,l.height*u.height/100)),m=u.width>=u.height*t,v=m?{width:Math.round(p*t),height:p}:{width:d,height:Math.round(d/t)},w=g(g({},v),{x:Math.round(a(u.width-v.width,l.x*u.width/100)),y:Math.round(a(u.height-v.height,l.y*u.height/100))});return{croppedAreaPercentages:l,croppedAreaPixels:w}}function nt(r,n){return Math.min(r,Math.max(0,n))}function it(r,n){return n}function at(r,n,e,t,o,i){var s=D(n.width,n.height,e),a=U(t.width/s.width*(100/r.width),o,i),c={x:a*s.width/2-t.width/2-s.width*a*(r.x/100),y:a*s.height/2-t.height/2-s.height*a*(r.y/100)};return{crop:c,zoom:a}}function st(r,n,e){var t=rt(n);return e.height>e.width?e.height/(r.height*t):e.width/(r.width*t)}function ct(r,n,e,t,o,i){e===void 0&&(e=0);var s=D(n.naturalWidth,n.naturalHeight,e),a=U(st(r,n,t),o,i),c=t.height>t.width?t.height/r.height:t.width/r.width,u={x:((s.width-r.width)/2-r.x)*c,y:((s.height-r.height)/2-r.y)*c};return{crop:u,zoom:a}}function Ue(r,n){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function ut(r){return r*Math.PI/180}function D(r,n,e){var t=ut(e);return{width:Math.abs(Math.cos(t)*r)+Math.abs(Math.sin(t)*n),height:Math.abs(Math.sin(t)*r)+Math.abs(Math.cos(t)*n)}}function U(r,n,e){return Math.min(Math.max(r,n),e)}function B(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var lt=`.reactEasyCrop_Container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
user-select: none;
|
|
9
|
+
touch-action: none;
|
|
10
|
+
cursor: move;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.reactEasyCrop_Image,
|
|
17
|
+
.reactEasyCrop_Video {
|
|
18
|
+
will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.reactEasyCrop_Contain {
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
max-height: 100%;
|
|
24
|
+
margin: auto;
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
bottom: 0;
|
|
28
|
+
left: 0;
|
|
29
|
+
right: 0;
|
|
30
|
+
}
|
|
31
|
+
.reactEasyCrop_Cover_Horizontal {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: auto;
|
|
34
|
+
}
|
|
35
|
+
.reactEasyCrop_Cover_Vertical {
|
|
36
|
+
width: auto;
|
|
37
|
+
height: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.reactEasyCrop_CropArea {
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 50%;
|
|
43
|
+
top: 50%;
|
|
44
|
+
transform: translate(-50%, -50%);
|
|
45
|
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
box-shadow: 0 0 0 9999em;
|
|
48
|
+
color: rgba(0, 0, 0, 0.5);
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.reactEasyCrop_CropAreaRound {
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.reactEasyCrop_CropAreaGrid::before {
|
|
57
|
+
content: ' ';
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
position: absolute;
|
|
60
|
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
61
|
+
top: 0;
|
|
62
|
+
bottom: 0;
|
|
63
|
+
left: 33.33%;
|
|
64
|
+
right: 33.33%;
|
|
65
|
+
border-top: 0;
|
|
66
|
+
border-bottom: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.reactEasyCrop_CropAreaGrid::after {
|
|
70
|
+
content: ' ';
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
position: absolute;
|
|
73
|
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
74
|
+
top: 33.33%;
|
|
75
|
+
bottom: 33.33%;
|
|
76
|
+
left: 0;
|
|
77
|
+
right: 0;
|
|
78
|
+
border-left: 0;
|
|
79
|
+
border-right: 0;
|
|
80
|
+
}
|
|
81
|
+
`,pt=1,ht=3,ft=1,Ve=(function(r){be(n,r);function n(){var e=r!==null&&r.apply(this,arguments)||this;return e.cropperRef=L(),e.imageRef=L(),e.videoRef=L(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var t=!0;e.resizeObserver=new window.ResizeObserver(function(o){if(t){t=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(t){return t.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var t=e.computeSizes();t&&(e.previousCropSize=t,e.emitCropData(),e.setInitialCrop(t),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(t){if(e.props.initialCroppedAreaPercentages){var o=at(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=o.crop,s=o.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}else if(e.props.initialCroppedAreaPixels){var a=ct(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,t,e.props.minZoom,e.props.maxZoom),i=a.crop,s=a.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}},e.computeSizes=function(){var t,o,i,s,a,c,u=e.imageRef.current||e.videoRef.current;if(u&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var l=e.containerRect.width/e.containerRect.height,d=((t=e.imageRef.current)===null||t===void 0?void 0:t.naturalWidth)||((o=e.videoRef.current)===null||o===void 0?void 0:o.videoWidth)||0,p=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=e.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,m=u.offsetWidth<d||u.offsetHeight<p,v=d/p,w=void 0;if(m)switch(e.state.mediaObjectFit){default:case"contain":w=l>v?{width:e.containerRect.height*v,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/v};break;case"horizontal-cover":w={width:e.containerRect.width,height:e.containerRect.width/v};break;case"vertical-cover":w={width:e.containerRect.height*v,height:e.containerRect.height};break}else w={width:u.offsetWidth,height:u.offsetHeight};e.mediaSize=g(g({},w),{naturalWidth:d,naturalHeight:p}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var b=e.props.cropSize?e.props.cropSize:tt(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((a=e.state.cropSize)===null||a===void 0?void 0:a.height)!==b.height||((c=e.state.cropSize)===null||c===void 0?void 0:c.width)!==b.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(b),e.setState({cropSize:b},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(b),b}},e.saveContainerPosition=function(){if(e.containerRef){var t=e.containerRef.getBoundingClientRect();e.containerPosition={x:t.left,y:t.top}}},e.onMouseDown=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(n.getMousePoint(t)))},e.onMouseMove=function(t){return e.onDrag(n.getMousePoint(t))},e.onScroll=function(t){e.currentDoc&&(t.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(t){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(t))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),t.touches.length===2?e.onPinchStart(t):t.touches.length===1&&e.onDragStart(n.getTouchPoint(t.touches[0]))))},e.onTouchMove=function(t){t.preventDefault(),t.touches.length===2?e.onPinchMove(t):t.touches.length===1&&e.onDrag(n.getTouchPoint(t.touches[0]))},e.onGestureStart=function(t){e.currentDoc&&(t.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(t){if(t.preventDefault(),!e.isTouching){var o=n.getMousePoint(t),i=e.gestureZoomStart-1+t.scale;if(e.setNewZoom(i,o,{shouldUpdatePosition:!0}),e.props.onRotationChange){var s=e.gestureRotationStart+t.rotation;e.props.onRotationChange(s)}}},e.onGestureEnd=function(t){e.cleanEvents()},e.onDragStart=function(t){var o,i,s=t.x,a=t.y;e.dragStartPosition={x:s,y:a},e.dragStartCrop=g({},e.props.crop),(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o)},e.onDrag=function(t){var o=t.x,i=t.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(o===void 0||i===void 0)){var s=o-e.dragStartPosition.x,a=i-e.dragStartPosition.y,c={x:e.dragStartCrop.x+s,y:e.dragStartCrop.y+a},u=e.props.restrictPosition?T(c,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):c;e.props.onCropChange(u)}}))},e.onDragStopped=function(){var t,o;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(o=(t=e.props).onInteractionEnd)===null||o===void 0||o.call(t)},e.onWheel=function(t){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(t))){t.preventDefault();var o=n.getMousePoint(t),i=(0,Xe.default)(t).pixelY,s=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(s,o,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var a,c;return(c=(a=e.props).onInteractionStart)===null||c===void 0?void 0:c.call(a)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var a,c;return(c=(a=e.props).onInteractionEnd)===null||c===void 0?void 0:c.call(a)})},250)}},e.getPointOnContainer=function(t,o){var i=t.x,s=t.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-o.x),y:e.containerRect.height/2-(s-o.y)}},e.getPointOnMedia=function(t){var o=t.x,i=t.y,s=e.props,a=s.crop,c=s.zoom;return{x:(o+a.x)/c,y:(i+a.y)/c}},e.setNewZoom=function(t,o,i){var s=i===void 0?{}:i,a=s.shouldUpdatePosition,c=a===void 0?!0:a;if(!(!e.state.cropSize||!e.props.onZoomChange)){var u=U(t,e.props.minZoom,e.props.maxZoom);if(c){var l=e.getPointOnContainer(o,e.containerPosition),d=e.getPointOnMedia(l),p={x:d.x*u-l.x,y:d.y*u-l.y},m=e.props.restrictPosition?T(p,e.mediaSize,e.state.cropSize,u,e.props.rotation):p;e.props.onCropChange(m)}e.props.onZoomChange(u)}},e.getCropData=function(){if(!e.state.cropSize)return null;var t=e.props.restrictPosition?T(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return ot(t,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(o,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.emitCropAreaChange=function(){var t=e.getCropData();if(t){var o=t.croppedAreaPercentages,i=t.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.recomputeCropPosition=function(){var t,o;if(e.state.cropSize){var i=e.props.crop;if(e.isInitialized&&(!((t=e.previousCropSize)===null||t===void 0)&&t.width)&&(!((o=e.previousCropSize)===null||o===void 0)&&o.height)){var s=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(s){var a=e.state.cropSize.width/e.previousCropSize.width,c=e.state.cropSize.height/e.previousCropSize.height;i={x:e.props.crop.x*a,y:e.props.crop.y*c}}}var u=e.props.restrictPosition?T(i,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):i;e.previousCropSize=e.state.cropSize,e.props.onCropChange(u),e.emitCropData()}},e.onKeyDown=function(t){var o,i,s=e.props,a=s.crop,c=s.onCropChange,u=s.keyboardStep,l=s.zoom,d=s.rotation,p=u;if(e.state.cropSize){t.shiftKey&&(p*=.2);var m=g({},a);switch(t.key){case"ArrowUp":m.y-=p,t.preventDefault();break;case"ArrowDown":m.y+=p,t.preventDefault();break;case"ArrowLeft":m.x-=p,t.preventDefault();break;case"ArrowRight":m.x+=p,t.preventDefault();break;default:return}e.props.restrictPosition&&(m=T(m,e.mediaSize,e.state.cropSize,l,d)),t.repeat||(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o),c(m)}},e.onKeyUp=function(t){var o,i;switch(t.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":t.preventDefault();break;default:return}e.emitCropData(),(i=(o=e.props).onInteractionEnd)===null||i===void 0||i.call(o)},e}return n.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=lt,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},n.prototype.componentWillUnmount=function(){var e,t;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((t=this.styleRef.parentNode)===null||t===void 0||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},n.prototype.componentDidUpdate=function(e){var t,o,i,s,a,c,u,l,d;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((t=e.cropSize)===null||t===void 0?void 0:t.height)!==((o=this.props.cropSize)===null||o===void 0?void 0:o.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((s=this.props.cropSize)===null||s===void 0?void 0:s.width)?this.computeSizes():(((a=e.crop)===null||a===void 0?void 0:a.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((u=e.crop)===null||u===void 0?void 0:u.y)!==((l=this.props.crop)===null||l===void 0?void 0:l.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((d=this.videoRef.current)===null||d===void 0||d.load());var p=this.getObjectFit();p!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:p},this.computeSizes)},n.prototype.getAspect=function(){var e=this.props,t=e.cropSize,o=e.aspect;return t?t.width/t.height:o},n.prototype.getObjectFit=function(){var e,t,o,i;if(this.props.objectFit==="cover"){var s=this.imageRef.current||this.videoRef.current;if(s&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var a=this.containerRect.width/this.containerRect.height,c=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((t=this.videoRef.current)===null||t===void 0?void 0:t.videoWidth)||0,u=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,l=c/u;return l<a?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},n.prototype.onPinchStart=function(e){var t=n.getTouchPoint(e.touches[0]),o=n.getTouchPoint(e.touches[1]);this.lastPinchDistance=ke(t,o),this.lastPinchRotation=Be(t,o),this.onDragStart(Ue(t,o))},n.prototype.onPinchMove=function(e){var t=this;if(!(!this.currentDoc||!this.currentWindow)){var o=n.getTouchPoint(e.touches[0]),i=n.getTouchPoint(e.touches[1]),s=Ue(o,i);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var a=ke(o,i),c=t.props.zoom*(a/t.lastPinchDistance);t.setNewZoom(c,s,{shouldUpdatePosition:!1}),t.lastPinchDistance=a;var u=Be(o,i),l=t.props.rotation+(u-t.lastPinchRotation);t.props.onRotationChange&&t.props.onRotationChange(l),t.lastPinchRotation=u})}},n.prototype.render=function(){var e=this,t,o=this.props,i=o.image,s=o.video,a=o.mediaProps,c=o.cropperProps,u=o.transform,l=o.crop,d=l.x,p=l.y,m=o.rotation,v=o.zoom,w=o.cropShape,b=o.showGrid,R=o.roundCropAreaPixels,z=o.style,I=z.containerStyle,W=z.cropAreaStyle,j=z.mediaStyle,M=o.classes,X=M.containerClassName,V=M.cropAreaClassName,F=M.mediaClassName,_=(t=this.state.mediaObjectFit)!==null&&t!==void 0?t:this.getObjectFit();return E("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(f){return e.containerRef=f},"data-testid":"container",style:I,className:B("reactEasyCrop_Container",X)},i?E("img",g({alt:"",className:B("reactEasyCrop_Image",_==="contain"&&"reactEasyCrop_Contain",_==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",_==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",F)},a,{src:i,ref:this.imageRef,style:g(g({},j),{transform:u||"translate(".concat(d,"px, ").concat(p,"px) rotate(").concat(m,"deg) scale(").concat(v,")")}),onLoad:this.onMediaLoad})):s&&E("video",g({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:B("reactEasyCrop_Video",_==="contain"&&"reactEasyCrop_Contain",_==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",_==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",F)},a,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:g(g({},j),{transform:u||"translate(".concat(d,"px, ").concat(p,"px) rotate(").concat(m,"deg) scale(").concat(v,")")}),controls:!1}),(Array.isArray(s)?s:[{src:s}]).map(function(A){return E("source",g({key:A.src},A))})),this.state.cropSize&&E("div",g({ref:this.cropperRef,style:g(g({},W),{width:R?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:R?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:B("reactEasyCrop_CropArea",w==="round"&&"reactEasyCrop_CropAreaRound",b&&"reactEasyCrop_CropAreaGrid",V)},c)))},n.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:ht,minZoom:pt,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:ft},n.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},n.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},n})(ce);var dt=Ve;function Wt(r){let n=le(),[e,t]=C(r.src),[o,i]=C({x:0,y:0}),[s,a]=C(1),[c,u]=C(null),[l,d]=C(!1),[p,m]=C(r.initialWidth||0),[v,w]=C(r.initialHeight||0),b=ue(()=>e.startsWith(ye)?e.includes("=")?e.split("=")[0]+"=s0":e+"=s0":e,[e]),R=r.filename?mt(r.filename):"jpg",z=R==="png"?"image/png":"image/jpeg",I=R==="jpg"||R==="jpeg"||r.src.toLowerCase().endsWith(".jpg")||r.src.toLowerCase().endsWith(".jpeg"),[W,j]=C("#ffffff");Y(()=>{t(r.src)},[r.src]),Y(()=>{r.initialWidth&&m(r.initialWidth),r.initialHeight&&w(r.initialHeight)},[r.initialWidth,r.initialHeight]);let M=q((f,S)=>{u(S)},[]),X=q(f=>{m(S=>S>0?S:f.naturalWidth),w(S=>S>0?S:f.naturalHeight)},[]),V=async()=>{if(c){d(!0);try{let f=await gt(b,c,{width:p||800,height:v||600},r.filename,z,I?W:void 0);f&&r.onSave(f)}catch(f){console.error(f)}finally{d(!1)}}},F=()=>{i(f=>({...f,x:0}))},_=()=>{i(f=>({...f,y:0}))},A=()=>{r.originalSrc&&(t(r.originalSrc),m(0),w(0),i({x:0,y:0}),a(1))};return h(fe,{opened:r.opened,onClose:r.onClose,title:"Edit Image",size:"xl",centered:!0,overlayColor:n.colorScheme==="dark"?n.colors.dark[9]:n.colors.gray[2],children:h(me,{spacing:"md",children:[h(P,{grow:!0,children:[h(J,{label:"Width",value:p||void 0,placeholder:"Width",onChange:f=>m(typeof f=="number"?f:0)}),h(J,{label:"Height",value:v||void 0,placeholder:"Height",onChange:f=>w(typeof f=="number"?f:0)}),I&&h(he,{label:"Background Color",value:W,onChange:j})]}),h("div",{className:"ImageEditorDialog__CropperContainer",children:h(dt,{image:b,crop:o,zoom:s,aspect:p&&v?p/v:void 0,minZoom:.1,restrictPosition:!1,onCropChange:i,onCropComplete:M,onZoomChange:a,onMediaLoaded:X})}),h(P,{children:[h(pe,{size:"sm",children:"Zoom"}),h(de,{className:"ImageEditorDialog__ZoomSlider",value:(s-1)*100,min:-100,max:200,step:1,label:f=>`${Math.round(f)}%`,onChange:f=>a(1+f/100)}),h(P,{spacing:"xs",children:[h($,{label:"Center horizontally",withArrow:!0,children:h(K,{variant:"default",onClick:F,size:"lg",children:h(ge,{size:20})})}),h($,{label:"Center vertically",withArrow:!0,children:h(K,{variant:"default",onClick:_,size:"lg",children:h(ve,{size:20})})})]})]}),h(P,{position:r.originalSrc&&e!==r.originalSrc?"apart":"right",mt:"md",children:[r.originalSrc&&e!==r.originalSrc&&h(N,{variant:"default",onClick:A,disabled:l,children:"Restore Original"}),h(P,{children:[h(N,{variant:"default",onClick:r.onClose,disabled:l,children:"Discard"}),h(N,{onClick:V,loading:l,leftIcon:h(we,{}),children:"Save"})]})]})]})})}function mt(r){return r.split(".").pop()?.toLowerCase()||""}async function gt(r,n,e,t="image.jpg",o="image/jpeg",i){let s=await vt(r),a=document.createElement("canvas"),c=a.getContext("2d");return c?(a.width=e.width,a.height=e.height,i&&(c.fillStyle=i,c.fillRect(0,0,a.width,a.height)),c.drawImage(s,n.x,n.y,n.width,n.height,0,0,e.width,e.height),new Promise(u=>{a.toBlob(l=>{if(!l){u(null);return}let d=new File([l],t,{type:o});u(d)},o)})):null}function vt(r){return new Promise((n,e)=>{let t=new Image;t.addEventListener("load",()=>n(t)),t.addEventListener("error",o=>e(o)),t.setAttribute("crossOrigin","anonymous"),t.src=r})}export{Wt as ImageEditorDialog};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Bundled license information:
|
|
2
|
+
|
|
3
|
+
normalize-wheel/src/isEventSupported.js:
|
|
4
|
+
/**
|
|
5
|
+
* Checks if an event is supported in the current execution environment.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
8
|
+
* `reset`, `load`, `error`, and `select`.
|
|
9
|
+
*
|
|
10
|
+
* Borrows from Modernizr.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
13
|
+
* @param {?boolean} capture Check if the capture phase is supported.
|
|
14
|
+
* @return {boolean} True if the event is supported.
|
|
15
|
+
* @internal
|
|
16
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
17
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-E2RCCK2T.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a}from"./chunk-VMT7JFAM.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-PJA7YP4A.js";import"./chunk-ORXEMIQC.js";import{a as g,b as i}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as o}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return g("Action Logs"),o(i,{children:o("div",{className:"LogsPage",children:[o("div",{className:"LogsPage__header",children:o(a,{size:"h1",children:"Action Logs"})}),o(e,{})]})})}export{L as LogsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-C5NH23G4.js";import"./chunk-CGCKJFL4.js";import{a as r}from"./chunk-VMT7JFAM.js";import"./chunk-4KE2SZKH.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a as t,b as o}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as a,da as e}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(){return t("New Data Source"),a(o,{children:a("div",{className:"NewDataSourcePage",children:[a("div",{className:"NewDataSourcePage__header",children:[a(e,{className:"NewDataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data Sources"}),a("div",{children:"New"})]}),a(r,{size:"h1",children:"Add Data Source"})]}),a(d,{buttonLabel:"Create data source"})]})})}export{n as NewDataSourcePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./chunk-MDUBCXU2.js";import"./chunk-JHBAMPGB.js";import"./chunk-V7S4IAGB.js";import{a as r}from"./chunk-VMT7JFAM.js";import"./chunk-NXQVLOTK.js";import"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as s,b as d}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as e,da as a}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return s("New Release"),e(d,{children:e("div",{className:"NewReleasePage",children:[e("div",{className:"NewReleasePage__header",children:[e(a,{className:"NewReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:"New"})]}),e(r,{size:"h1",children:"Add Release"})]}),e(m,{buttonLabel:"Create release"})]})})}export{w as NewReleasePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as n}from"./chunk-FBJURT7Z.js";import"./chunk-AL3TN2KI.js";import{Ha as o,hc as t}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";function l(){return e("Not Found"),o(n,{children:o("div",{className:"NotFoundPage",children:[o("div",{className:"NotFoundPage__icon",children:o(t,{size:60})}),o("h2",{className:"NotFoundPage__title",children:"Not Found"}),o("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",o("a",{href:"/cms",children:"go home"}),"."]})]})})}export{l as NotFoundPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./chunk-SQRKKWRG.js";import"./chunk-DUJYIOLE.js";import{a as s}from"./chunk-E2RCCK2T.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a as r}from"./chunk-W3BJ2EZX.js";import"./chunk-X2WHBGTP.js";import"./chunk-W3HIZQ4Z.js";import{a as n}from"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a,b as c}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as e,ea as i}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function o(){a("Home");let t=!!window.__ROOT_CTX.experiments?.taskManager;return e(c,{children:e("div",{className:"ProjectPage",children:e("div",{className:"ProjectPage__main",children:[t&&e(l,{}),e("div",{className:"ProjectPage__section",children:[e(o.Collections,{}),e(o.ActionLogs,{})]})]})})})}o.SectionTitle=t=>e("div",{className:"ProjectPage__sectionTitle",children:t.children});o.Collections=()=>{let t=window.__ROOT_CTX.collections,m=window.__ROOT_CTX.rootConfig.projectId;return e("div",{className:"ProjectPage__collections",children:e(r,{collections:t,projectId:m})})};o.ActionLogs=()=>e("div",{className:"ProjectPage__actionLogs",children:[e("div",{className:"ProjectPage__actionLogs__header",children:[e(o.SectionTitle,{children:"Recent actions"}),e(i,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})]}),e(n,{children:e(s,{limit:10,compact:!0})})]});export{o as ProjectPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as F}from"./chunk-PWKJDYE2.js";import{a as O}from"./chunk-DEGMKEHP.js";import{a as m}from"./chunk-VMT7JFAM.js";import{f as M}from"./chunk-3IYZCUPI.js";import{c as B,g as E,j as H}from"./chunk-RSVO46S3.js";import{a as W,c as f}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as U}from"./chunk-L4RHGQUG.js";import{a as I,c as k}from"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import{a as y}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{b as v}from"./chunk-62UWGWON.js";import{a as x,b as z}from"./chunk-I6ICVKEC.js";import{a as S}from"./chunk-HLMBCVRX.js";import{c as $}from"./chunk-ORXEMIQC.js";import{a as j,b as q}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Dc as Y,Ea as N,Ga as u,Ha as e,V as w,W as A,a as c,c as D,da as T,ea as r,j as Q}from"./chunk-NZHF733K.js";import{d as C}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Q();function d(t){let[o,i]=c(!0),[a,s]=c(null),[_,h]=c(0),l=t.id;j(`Release: ${l}`);async function p(){i(!0),await v(async()=>{let n=await B(l);s(n),h($())}),i(!1)}D(()=>{p()},[]);function P(n){console.log("onAction()",n),p()}return e(q,{children:e("div",{className:"ReleasePage",children:[e("div",{className:"ReleasePage__header",children:[e(T,{className:"ReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:l})]}),e("div",{className:"ReleasePage__header__titleWrap",children:[e(m,{size:"h1",children:["Release: ",l]}),e("div",{className:"ReleasePage__header__controls",children:e(u,{label:"Configure",children:e(A,{component:"a",href:`/cms/releases/${t.id}/edit`,children:e(Y,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(S,{as:"p",children:a.description})]}),o?e(w,{color:"gray",size:"xl"}):e(C,{children:[a&&e(d.PublishStatus,{release:a,onAction:P}),a&&a.docIds&&a.docIds.length>0&&e(d.DocsList,{release:a},`docs-list-${_}`),a&&a.dataSourceIds&&a.dataSourceIds.length>0&&e(d.DataSourcesList,{release:a},`data-sources-${_}`)]})]})})}d.PublishStatus=t=>{let{roles:o}=U(),i=window.firebase.user.email||"",a=W(o,i),s=t.release,[_,h]=c(!1),l=I(),p=k(),P=O({releaseId:s.id,onScheduled:()=>{t.onAction("scheduled")}});function n(){let g=s.docIds||[],R=s.dataSourceIds||[],b=g.length+R.length;if(b===0){x({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}l.openConfirmModal({...p,title:`Publish release: ${s.id}`,children:e(S,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",b," 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:()=>{G()}})}async function G(){h(!0),await v(async()=>{let g=`publish-release-${s.id}`,R=s.docIds?.length||0,b=s.dataSourceIds?.length||0,L=R+b;x({id:g,title:"Publishing release",message:`Publishing ${L} items...`,loading:!0,autoClose:!1}),await E(s.id),z({id:g,title:"Published release!",message:`Successfully published ${L} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),h(!1)}function J(){P.open()}async function K(){await H(s.id),t.onAction("cancel-schedule")}return e("div",{className:"ReleasePage__PublishStatus",children:[e(m,{size:"h2",children:"Status"}),e(y,{children:e(N,{className:"ReleasePage__PublishStatus__table",verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"status"}),e("th",{children:"actions"})]})}),e("tbody",{children:e("tr",{children:[e("td",{children:e(F,{release:s})}),e("td",{children:e("div",{className:"ReleasePage__PublishStatus__actions",children:[!s.archivedAt&&!s.scheduledAt&&e(f,{label:"You don't have access to publish this release",condition:!a,children:e(u,{label:"Publish the release immediately",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>n(),loading:_,disabled:!a,children:s.publishedAt?"Re-publish":"Publish"})})}),!s.archivedAt&&(s.scheduledAt?e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>K(),disabled:!a,children:"Cancel Schedule"})})}):e(f,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(u,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,disabled:!a,children:e(r,{variant:"default",size:"xs",compact:!0,onClick:()=>J(),disabled:!a,children:"Schedule"})})}))]})})]})})]})})]})};d.DocsList=t=>{let o=t.release,i=o.docIds||[];return e("div",{className:"ReleasePage__DocsList",children:[e("div",{className:"ReleasePage__DocsList__header",children:[e(m,{size:"h2",children:"Docs"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e(y,{className:"ReleasePage__DocsList__cards",children:i.map(a=>e("div",{className:"ReleasePage__DocsList__card",children:e("a",{href:`/cms/content/${a}`,children:e(M,{docId:a,statusBadges:!0,hideReleases:!0})})},a))})]})};d.DataSourcesList=t=>{let o=t.release,i=o.dataSourceIds||[];return e("div",{className:"ReleasePage__DataSourcesList",children:[e("div",{className:"ReleasePage__DataSourcesList__header",children:[e(m,{size:"h2",children:"Data Sources"}),e(r,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${o.id}/edit`,children:"Edit"})]}),e("div",{className:"ReleasePage__DataSourcesList__items",children:i.map(a=>e("div",{className:"ReleasePage__DataSourcesList__item",children:e("a",{href:`/cms/data/${a}`,children:a})},a))})]})};export{d as ReleasePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as w}from"./chunk-PWKJDYE2.js";import{a as R}from"./chunk-VMT7JFAM.js";import{b as f}from"./chunk-RSVO46S3.js";import{a as P,c as T}from"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import{a as v}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as S}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{a as d}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as x,b as y}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ea as _,Ha as e,V as h,a as o,c as m,ea as b,g as p,j as A,za as g}from"./chunk-NZHF733K.js";import{d as c}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";A();function N(){x("Releases");let{roles:i}=v(),r=window.firebase.user.email||"",t=P(i,r);return e(y,{children:e("div",{className:"ReleasesPage",children:[e("div",{className:"ReleasesPage__header",children:[e(R,{size:"h1",children:"Releases"}),e(d,{as:"p",children:"Bundle one or more documents and publish them together. Schedule a release to go live at a specific time, or publish manually when you're ready."}),e("div",{className:"ReleasesPage__header__buttons",children:e(T,{label:"You don't have access to create new releases",condition:!t,children:e(b,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",disabled:!t,style:t?void 0:{pointerEvents:"none"},children:"New release"})})})]}),e(N.ReleasesTable,{})]})})}N.ReleasesTable=()=>{let[i,r]=o(!0),[t,L]=o([]),[l,B]=o("active");async function z(){let a=await f();L(a),r(!1)}let n=p(()=>t.filter(a=>{let s=!!a.archivedAt,u=!!a.publishedAt;return l==="active"?!s:l==="unpublished"?!s&&!u:l==="published"?!s&&u:s}),[t,l]);return m(()=>{z()},[]),e("div",{className:"ReleasesPage__ReleasesTable",children:[i&&e(h,{color:"gray",size:"xl"}),!i&&e(c,{children:[e("div",{className:"ReleasesPage__ReleasesTable__filters",children:e(g,{size:"sm",value:l,onChange:a=>B(a),data:[{label:"Active",value:"active"},{label:"Unpublished",value:"unpublished"},{label:"Published",value:"published"},{label:"Archived",value:"archived"}]})}),n.length>0&&e(S,{children:e(_,{className:"ReleasesPage__ReleasesTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"content"}),e("th",{children:"status"})]})}),e("tbody",{children:n.map(a=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/releases/${a.id}`,children:a.id})}),e("td",{children:a.description||""}),e("td",{children:(a.docIds||[]).map(s=>e("div",{children:e("a",{href:`/cms/content/${s}`,children:s})},s))}),e("td",{children:e("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:e(w,{release:a})})})]},a.id))})]})}),n.length===0&&e(d,{as:"p",children:"No releases found for this filter."})]})]})};export{N as ReleasesPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as ae}from"./chunk-BZIRGB4W.js";import{a as te,c as ne,e as me}from"./chunk-HHMG665Z.js";import{b as ce,c as O,d as de,f as z}from"./chunk-KYDOSLTO.js";import{a as y}from"./chunk-VMT7JFAM.js";import"./chunk-54DVDYU6.js";import{a as le}from"./chunk-L4RHGQUG.js";import"./chunk-W3HIZQ4Z.js";import{a as I}from"./chunk-PJA7YP4A.js";import{b as ee}from"./chunk-62UWGWON.js";import{a as U}from"./chunk-I6ICVKEC.js";import{a as u}from"./chunk-HLMBCVRX.js";import{f as oe}from"./chunk-ORXEMIQC.js";import{a as ue,b as _e}from"./chunk-FBJURT7Z.js";import{c as se}from"./chunk-5MV6XVGA.js";import{c as V,n as Y,p as Q,q as Z}from"./chunk-EGEB6N4J.js";import{f as w}from"./chunk-AL3TN2KI.js";import{Aa as A,Da as q,Ha as e,Pc as ie,U as L,Uc as re,W as $,a as g,c as B,ca as J,e as W,ea as v,g as C,j as T,oa as F,qa as K,ta as X,va as G}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";T();T();var be={ADMIN:4,EDITOR:3,CONTRIBUTOR:2,VIEWER:1};function ge(o){return be[o]??0}function Se(o,s){return ge(o)>=ge(s)?o:s}function H(o,s,a){let t=o[s];o[s]=t?Se(t,a):a}function pe(o,s={}){let a={...s},t={};for(let n of o){let d=(n.users||[]).filter(Boolean);if(d.length===0)continue;let _=(n.collections||[]).filter(Boolean);if(_.length===0)for(let c of d)H(a,c,n.role);else{for(let c of d)H(a,c,"VIEWER");for(let c of _){t[c]||(t[c]={});for(let p of d)H(t[c],p,n.role)}}}return{projectRoles:a,collectionRoles:t}}function fe(o={}){return{id:o.id||`g_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,name:o.name||"",role:o.role||"VIEWER",collections:o.collections?[...o.collections]:[],users:o.users?[...o.users]:[]}}T();function k(o){let s=o.size||28,[a,t]=g(!1),n=o.profile?.photoURL||"",d=o.profile?.displayName||o.email,_=w("EmailAvatar",o.className),c={width:s,height:s};return n&&!a?e("img",{className:_,style:c,src:n,alt:d,onError:()=>t(!0)}):e("svg",{className:_,style:c,viewBox:"0 0 28 28",role:"img","aria-label":d,children:[e("circle",{cx:"14",cy:"14",r:"14",fill:de(o.email)}),e("text",{x:"14",y:"14",textAnchor:"middle",dominantBaseline:"central",fill:"#fff",fontSize:"13",fontWeight:"600",children:ce(o.email)})]})}var ye=[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"}];function xe(o){let{groups:s,onChange:a,collections:t,disabled:n}=o,d=C(()=>t.map(l=>({value:l,label:l})),[t]),[_,c]=g({});function p(l,i){a(s.map(m=>m.id===l?i(m):m))}function f(l){a(s.filter(i=>i.id!==l))}function P(){let l=s.length;a([...s,fe({name:"New group"})]),c(i=>({...i,[l]:!0}))}return e("div",{className:w(o.className,"PermissionGroupsBox"),children:[s.length===0?e("div",{className:"PermissionGroupsBox__empty",children:e(u,{size:"body-sm",weight:"semi-bold",color:"gray",children:"No permission groups yet. Create one to organize users by role and optionally scope access to specific collections."})}):e(L,{className:"PermissionGroupsBox__accordion",offsetIcon:!1,multiple:!0,state:_,onChange:c,children:s.map(l=>e(L.Item,{label:e("div",{className:"PermissionGroupsBox__trigger",children:[e("span",{className:"PermissionGroupsBox__trigger__name",children:l.name||"Untitled group"}),e(J,{color:"gray",radius:"sm",size:"xs",variant:"light",className:"PermissionGroupsBox__trigger__badge",children:[l.users.length," ",l.users.length===1?"user":"users"]})]}),children:e(Re,{group:l,collectionOptions:d,disabled:n,onChange:i=>p(l.id,()=>i),onDelete:()=>f(l.id)})},l.id))}),e("div",{className:"PermissionGroupsBox__addGroup",children:e(v,{variant:"default",size:"xs",radius:0,disabled:n,onClick:P,children:"+ Add group"})})]})}function Re(o){let{group:s,collectionOptions:a,disabled:t}=o,[n,d]=g(""),_=s.users.filter(r=>!O(r)),{profiles:c}=z(_);function p(r){o.onChange({...s,name:r})}function f(r){o.onChange({...s,role:r})}function P(r){o.onChange({...s,collections:r})}function l(r){let x=r.trim();if(!x||s.users.includes(x)){d("");return}o.onChange({...s,users:[...s.users,x]}),d("")}function i(r){o.onChange({...s,users:s.users.filter(x=>x!==r)})}function m(){window.confirm(`Delete the "${s.name||"Untitled group"}" group? This will remove its role assignments on next save.`)&&o.onDelete()}return e("div",{className:"PermissionGroupsBox__editor",children:[e("div",{className:"PermissionGroupsBox__editor__row",children:[e(G,{className:"PermissionGroupsBox__editor__name",label:"Group name",placeholder:"e.g. Blog Post Editors",value:s.name,radius:0,size:"xs",disabled:t,onChange:r=>p(r.target.value)}),e(A,{className:"PermissionGroupsBox__editor__role",label:"Role",data:ye,value:s.role,radius:0,size:"xs",disabled:t,onChange:r=>f(r)})]}),e(X,{className:"PermissionGroupsBox__editor__collections",label:"Collections",description:"Leave empty to apply project-wide. Otherwise restrict the group's role to the selected collections.",data:a,value:s.collections,radius:0,size:"xs",searchable:!0,clearable:!0,placeholder:"All collections (project-wide)",disabled:t,onChange:r=>P(r),dropdownComponent:"div"}),e("div",{className:"PermissionGroupsBox__editor__users",children:[e(u,{size:"body-sm",weight:"semi-bold",children:"Users"}),e("form",{className:"PermissionGroupsBox__editor__addUser",onSubmit:r=>{r.preventDefault(),l(n)},children:[e(G,{className:"PermissionGroupsBox__editor__addUser__email",placeholder:"grogu@example.com",type:"email",value:n,onChange:r=>d(r.target.value),radius:0,size:"xs",disabled:t}),e(v,{size:"xs",radius:0,color:"dark",type:"submit",disabled:t||!n.trim(),children:"Add user"})]}),s.users.length>0&&e("ul",{className:"PermissionGroupsBox__editor__userList",children:s.users.map(r=>{let x=c.get(r.toLowerCase())||null;return e("li",{className:"PermissionGroupsBox__editor__userItem",children:[e(k,{className:"PermissionGroupsBox__editor__userItem__avatar",email:r,profile:x,size:24}),e("span",{className:"PermissionGroupsBox__editor__userItem__email",children:r}),e($,{size:"sm",variant:"transparent",disabled:t,onClick:()=>i(r),title:`Remove ${r}`,children:e(re,{size:14})})]},r)})})]}),e("div",{className:"PermissionGroupsBox__editor__footer",children:e(v,{variant:"subtle",size:"xs",color:"red",compact:!0,disabled:t,leftIcon:e(ie,{size:14}),onClick:m,children:"Delete group"})})]})}T();function D(o){let{roles:s,onChange:a,currentUserIsAdmin:t}=o,[n,d]=g(""),_=Object.keys(s).filter(i=>!O(i)),{profiles:c}=z(_);function p(i,m){a({...s,[i]:m})}function f(i){let m={...s};delete m[i],a(m)}function P(i){let m=i.trim();d(""),!(!m||m in s)&&a({...s,[m]:"EDITOR"})}let l=se(Object.keys(s).map(i=>({email:i,role:s[i],profile:c.get(i.toLowerCase())||null})),"email");return e("div",{className:w(o.className,"ShareBox"),children:[e("form",{className:"ShareBox__addUser",onSubmit:i=>{i.preventDefault(),P(n)},children:[e(G,{className:"ShareBox__addUser__email",placeholder:"grogu@example.com",type:"email",value:n,onChange:i=>d(i.target.value),radius:0,size:"xs",disabled:!t}),e(v,{className:"ShareBox__addUser__button",size:"xs",radius:0,color:"dark",type:"submit",disabled:!t,children:"Add user"})]}),e("div",{className:"ShareBox__users",children:l.map(i=>e(D.User,{...i,currentUserIsAdmin:t,onRoleChange:p,onRemove:f},i.email))})]})}D.User=o=>{let s=o.email===window.firebase.user.email;return e("div",{className:"ShareBox__user",children:[e(k,{className:"ShareBox__user__avatar",email:o.email,profile:o.profile,size:24}),e(u,{className:"ShareBox__user__email",size:"body-sm",weight:"semi-bold",color:"gray",children:[o.email,s&&" (you)"]}),e("div",{className:"ShareBox__user__roleSelect",children:e(A,{data:[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"},{value:"REMOVE",label:"REMOVE"}],value:o.role,radius:0,size:"xs",disabled:s||!o.currentUserIsAdmin,onChange:a=>{a==="REMOVE"?o.onRemove(o.email):o.onRoleChange(o.email,a)}})})]})};function we(o){if(!o)return"never";let s=Date.now()-o;return s<6e4?"just now":s<60*6e4?`${Math.floor(s/6e4)} min ago`:s<1440*6e4?`${Math.floor(s/(60*6e4))} hr ago`:new Date(o).toLocaleString()}function he(o){let s=window.firebase?.user?.email;if(!s)return!1;if(o[s]==="ADMIN")return!0;let a=s.split("@").at(-1);return!!(a&&o[`*@${a}`]==="ADMIN")}function Ne(){let o=ae(),[s,a]=g(!1),[t,n]=g(!1),[d,_]=g(!1),c=W(null);function p(){c.current!==null&&(window.clearInterval(c.current),c.current=null),n(!1),_(!1)}B(()=>p,[]),B(()=>{t&&o.running&&_(!0)},[t,o.running]);async function f(x){if(!(s||t)){a(!0);try{let S=await fetch("/cms/api/search.rebuild",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:x})});if(!S.ok){let j=await S.text().catch(()=>"");throw new Error(`HTTP ${S.status}: ${j||"rebuild failed"}`)}U({title:"Search index",message:x?"Full rebuild started.":"Incremental rebuild started.",color:"blue",autoClose:4e3}),n(!0),c.current=window.setInterval(()=>{o.refresh()},2e3),window.setTimeout(p,10*6e4)}catch(S){U({title:"Error",message:S?.message||String(S),color:"red",autoClose:!1})}finally{a(!1)}}}B(()=>{t&&d&&!o.running&&(p(),U({title:"Search index",message:"Rebuild complete.",color:"green",autoClose:3e3}))},[t,d,o.running]);let P=o.status.lastRun,l=o.status.docCount,i=o.status.fieldCount,m=o.status.shardCount,r=o.running||s;return e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(y,{className:"SettingsPage__section__left__title",children:"Site Admin"}),e(u,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"Project-wide administrative actions. Only admins see this section."})})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__section__setting",children:[e(u,{size:"body",weight:"semi-bold",children:"Search index"}),e(u,{size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"Powers the Cmd+K global search. Rebuilds run automatically on a schedule; trigger a manual rebuild here if you want immediate results (e.g. after a schema change)."})}),e("div",{className:"SettingsPage__siteAdmin__searchStats",children:[e("div",{children:[e("strong",{children:"Last indexed:"})," ",we(P)]}),e("div",{children:[e("strong",{children:"Indexed docs:"})," ",l.toLocaleString()]}),e("div",{children:[e("strong",{children:"Indexed fields:"})," ",i.toLocaleString()]}),e("div",{children:[e("strong",{children:"Shards:"})," ",m]})]}),e("div",{className:"SettingsPage__siteAdmin__searchButtons",children:[e(v,{variant:"default",size:"xs",compact:!0,loading:r,onClick:()=>f(!1),children:"Rebuild incremental"}),e(v,{variant:"default",size:"xs",compact:!0,loading:r,onClick:()=>{window.confirm("Force a full rebuild? This wipes the existing index and reindexes every doc from scratch.")&&f(!0)},children:"Force full rebuild"})]})]})})]})}function Be(o,s){return JSON.stringify(o)===JSON.stringify(s)}function Ge(){let o=window.__ROOT_CTX.rootConfig.projectId||"default",s=window.__ROOT_CTX.collections||{},a=C(()=>Object.keys(s).sort(),[s]),t=window.firebase.db,n=V(t,"Projects",o),[d,_]=g(!0),[c,p]=g(!1),[f,P]=g({roles:{},permissionGroups:[]}),[l,i]=g({roles:{},permissionGroups:[]});B(()=>{Y(n).then(h=>{let b=h.data()||{},N={roles:b.roles||{},permissionGroups:b.permissionGroups||[]};P(N),i({roles:{...N.roles},permissionGroups:N.permissionGroups.map(E=>({...E}))}),_(!1)})},[]);let m=he(f.roles),r=!Be(f,l);function x(h){i(b=>({...b,roles:h}))}function S(h){i(b=>({...b,permissionGroups:h}))}function j(){i({roles:{...f.roles},permissionGroups:f.permissionGroups.map(h=>({...h}))})}async function ve(){c||!r||(p(!0),await ee(async()=>{let{projectRoles:h,collectionRoles:b}=pe(l.permissionGroups,l.roles);await Z(n,{roles:h,permissionGroups:l.permissionGroups});let N=f.permissionGroups.flatMap(R=>R.collections||[]),E=new Set([...Object.keys(b),...N]);for(let R of E){let Pe=V(t,"Projects",o,"Collections",R);await Q(Pe,{roles:b[R]||{}},{merge:!0})}let M={roles:h,permissionGroups:l.permissionGroups};P(M),i({roles:{...M.roles},permissionGroups:M.permissionGroups.map(R=>({...R}))}),oe("acls.save_groups",{metadata:{groupCount:l.permissionGroups.length,userCount:Object.keys(h).length,collections:Array.from(E)}}),U({title:"Saved",message:"Sharing settings updated.",color:"green",autoClose:3e3})}),p(!1))}return e("div",{className:"SettingsPage__section SettingsPage__section__users",children:[e("div",{className:"SettingsPage__section__left",children:[e(y,{className:"SettingsPage__section__left__title",children:"Share"}),e(u,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:[e("p",{children:"Share access to the CMS. To share with everyone in a domain, use *@example.com."}),e("ul",{children:[e("li",{children:"VIEWER: view docs but not edit"}),e("li",{children:"CONTRIBUTOR: view and edit docs, but not publish"}),e("li",{children:"EDITOR: view, edit, and publish docs"}),e("li",{children:"ADMIN: all of the above and change sharing settings"})]}),e("p",{children:["Use ",e("strong",{children:"groups"})," to manage many users at once and optionally scope a role to specific collections."]})]})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__share",children:[e(K,{visible:d,loaderProps:{color:"gray",size:"xl"}}),e("div",{className:"SettingsPage__share__subsection",children:[e(y,{className:"SettingsPage__section__right__title",size:"h3",children:"Users"}),e(D,{className:"SettingsPage__section__users__sharebox",roles:l.roles,onChange:x,currentUserIsAdmin:m})]}),e("div",{className:"SettingsPage__share__subsection",children:[e(y,{className:"SettingsPage__section__right__title",size:"h3",children:"Groups"}),e(xe,{groups:l.permissionGroups,onChange:S,collections:a,disabled:!m})]}),e("div",{className:"SettingsPage__share__saveBar",children:[e(u,{size:"body-sm",weight:"semi-bold",color:"gray",children:r?"You have unsaved changes.":"All changes saved."}),e("div",{className:"SettingsPage__share__saveBar__actions",children:[e(v,{variant:"default",size:"xs",radius:0,disabled:!r||c,onClick:j,children:"Discard"}),e(v,{size:"xs",radius:0,color:"dark",loading:c,disabled:!r||!m,onClick:ve,children:"Save changes"})]})]})]})})]})}function Do(){ue("Settings");let o=me(),s=ne(),a=le(),t=!a.loading&&he(a.roles);return e(_e,{children:e("div",{className:"SettingsPage",children:[e(Ge,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(y,{className:"SettingsPage__section__left__title",children:"Site Settings"}),e(u,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"These settings apply to the project. Only admins can change them."})})]}),e(I,{className:"SettingsPage__section__right",children:te.map(n=>e("div",{className:"SettingsPage__section__setting",children:[e(u,{size:"body",weight:"semi-bold",children:n.name}),e(u,{size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:n.description})}),e(F,{autosize:!0,minRows:2,maxRows:4,value:s.settings[n.key]||"",placeholder:n.placeholder,onChange:d=>s.setSettings(n.key,d.currentTarget.value)}),n.ui&&e("div",{children:n.ui(s.settings[n.key])})]},n.key))})]}),t&&e(Ne,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(y,{className:"SettingsPage__section__left__title",children:"User Preferences"}),e(u,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"These settings are for you only."})})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__section__userPref",children:[e("div",{className:"SettingsPage__section__userPref__description",children:[e(u,{className:"SettingsPage__section__userPref__description__title",size:"body",weight:"semi-bold",children:"Enable EditorJS Editor (legacy)"}),e(u,{className:"SettingsPage__section__userPref__description__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:["Replaces the"," ",e("a",{href:"https://lexical.dev/",target:"_blank",rel:"noopener noreferrer nofollow",children:"Lexical"})," ","(default) rich text editor with the"," ",e("a",{href:"https://editorjs.io/",target:"_blank",rel:"noopener noreferrer nofollow",children:"EditorJS"})," ","(legacy) version."]})})]}),e("div",{className:"SettingsPage__section__userPref__input",children:e(q,{color:"dark",checked:o.preferences.EnableEditorJSEditor,onChange:n=>{let d=n.currentTarget.checked;o.setPreference("EnableEditorJSEditor",d)}})})]})})]})]})})}export{Do as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t,b as a}from"./chunk-FBJURT7Z.js";import"./chunk-AL3TN2KI.js";import{Ha as e,c as d,j as l}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";l();function u(o){let r=(window.__ROOT_CTX.sidebar?.tools||{})[o.id];t(r?.label||o.id);let i=r?.cmsUrl,s=r?.externalUrl;return d(()=>{i?.startsWith("/cms/")&&window.location.replace(i)},[i]),d(()=>{s&&window.open(s,"_blank","noopener,noreferrer")?.focus()},[s]),r?s?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:e("a",{href:s,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||o.id," in a new tab"]})})}):i?.startsWith("/cms/")?e(a,{children:e("div",{className:"SidebarToolsPage",children:"redirecting..."})}):i?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",o.id]})}):r.iframeUrl?e(a,{children:e("div",{className:"SidebarToolsPage",children:e("iframe",{src:r.iframeUrl})})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",o.id]})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",o.id]})})}export{u as SidebarToolsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as C,f as oe,g as re,h as le,i as ce,j as me,k as de,l as _e,m as ge,n as pe,o as ue,p as ke,q as fe,r as Te,s as he}from"./chunk-DUJYIOLE.js";import{l as ie}from"./chunk-JT5L6GPZ.js";import"./chunk-HHMG665Z.js";import"./chunk-YFA6U2CV.js";import"./chunk-4W73RW5I.js";import"./chunk-P3NETZZP.js";import"./chunk-V7S4IAGB.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import"./chunk-PHBMVORG.js";import{c as R,d as ae}from"./chunk-JZFTZ4X4.js";import"./chunk-HKINZLMW.js";import"./chunk-TJBVMFNQ.js";import"./chunk-CGCKJFL4.js";import{a as W}from"./chunk-VMT7JFAM.js";import{f as te}from"./chunk-SKEP5WYH.js";import"./chunk-GXSAEPU3.js";import"./chunk-NXQVLOTK.js";import"./chunk-3IYZCUPI.js";import"./chunk-RSVO46S3.js";import"./chunk-54DVDYU6.js";import"./chunk-X2WHBGTP.js";import"./chunk-ONTGW2VA.js";import"./chunk-4KE2SZKH.js";import"./chunk-L4RHGQUG.js";import"./chunk-HRGYNHZ3.js";import"./chunk-W3HIZQ4Z.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import{a as I}from"./chunk-PJA7YP4A.js";import"./chunk-AFWBSIPL.js";import"./chunk-XOQ3KDSR.js";import{a as k}from"./chunk-62UWGWON.js";import{a as f}from"./chunk-I6ICVKEC.js";import"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as ne,b as se}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import{a as Y}from"./chunk-EGEB6N4J.js";import{f as x}from"./chunk-AL3TN2KI.js";import{Aa as L,Db as J,Ga as P,Ha as e,Pc as M,Sc as ee,Uc as A,V,W as h,Xa as X,_a as b,a as d,c as y,da as U,e as O,ea as T,fc as Q,g as D,j as Ie,jc as F,kc as w,nb as B,oa as G,va as S,xb as Z}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Ie();function H(a){return e(ie,{className:x("TaskCommentEditor",a.className),placeholder:a.placeholder,value:a.value,onChange:a.onChange,autoFocus:a.autoFocus,autosize:!0,variant:"comment"})}var we=[{value:"new",label:"New"},{value:"in-progress",label:"In progress"},{value:"in-review",label:"In review"},{value:"closed",label:"Closed"}],Ce=[{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"normal",label:"Normal"}];function yt(a){let t=a.id,[i,o]=d(null),[_,g]=d([]),[r,l]=d([]),[n,m]=d(!0),[c,s]=d("");return ne(i?`Task: ${i.title}`:`Task: ${t}`),y(()=>{m(!0),s("");let u=[oe(t,p=>{o(p),m(!1)},p=>{s(k(p)),m(!1)}),re(t,p=>g(p),p=>s(k(p))),le(t,p=>l(p),p=>s(k(p)))];return()=>u.forEach(p=>p())},[t]),e(se,{children:e("div",{className:"TaskPage",children:[e("div",{className:"TaskPage__header",children:[e(U,{className:"TaskPage__header__breadcrumbs",children:[e("a",{href:"/cms/tasks",children:"Tasks"}),e("div",{children:t})]}),e("div",{className:"TaskPage__header__titleWrap",children:[e(Ne,{task:i,taskId:t}),i&&e("span",{className:x("TaskPage__statusBadge",`TaskPage__statusBadge--${je(i.status)}`),children:$e(i.status)})]})]}),n&&e("div",{className:"TaskPage__loading",children:e(V,{color:"gray",size:"xl"})}),!n&&c&&e("div",{className:"TaskPage__error",children:c}),!n&&!c&&!i&&e(I,{className:"TaskPage__notFound",children:"Task not found."}),!n&&!c&&i&&e("div",{className:"TaskPage__body",children:[e("main",{className:"TaskPage__main",children:[e(ze,{task:i}),e(Ae,{task:i}),e(De,{task:i,comments:_,events:r}),e(ye,{taskId:i.id})]}),e("aside",{className:"TaskPage__side",children:e(Ee,{task:i})})]})]})})}function Ne(a){let{task:t}=a,[i,o]=d(!1),[_,g]=d(t?.title||""),[r,l]=d(!1);y(()=>{i||g(t?.title||"")},[t?.title,i]);async function n(){if(!t)return;let m=_.trim();if(!m){f({title:"Could not update title",message:"Task title is required.",color:"red"});return}if(m===t.title){g(t.title),o(!1);return}l(!0);try{await me(t.id,m),o(!1)}catch(c){f({title:"Could not update title",message:k(c),color:"red",autoClose:!1})}finally{l(!1)}}return t?i?e("form",{className:"TaskPage__header__titleForm",onSubmit:m=>{m.preventDefault(),n()},children:[e(S,{autoFocus:!0,className:"TaskPage__header__titleInput",disabled:r,value:_,onChange:m=>g(m.currentTarget.value),onKeyDown:m=>{m.key==="Escape"&&(g(t.title),o(!1))}}),e(T,{compact:!0,size:"xs",color:"dark",type:"submit",loading:r,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),children:"Save"}),e(T,{compact:!0,size:"xs",variant:"default",type:"button",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{g(t.title),o(!1)},children:"Cancel"})]}):e("div",{className:"TaskPage__header__titleContent",children:[e(W,{size:"h1",children:t.title}),e(P,{label:"Edit title",children:e(h,{size:"sm",onClick:()=>o(!0),children:e(w,{size:16,strokeWidth:"1.8"})})})]}):e(W,{size:"h1",children:`Task #${a.taskId}`})}function ze(a){let{task:t}=a,[i,o]=d(!1),[_,g]=d(t.description||""),[r,l]=d(!1);y(()=>{i||g(t.description||"")},[t.description,i]);async function n(){l(!0);try{await pe(t.id,_.trim()),o(!1)}catch(m){f({title:"Could not update description",message:k(m),color:"red",autoClose:!1})}finally{l(!1)}}return e(I,{className:"TaskPage__description",children:[e("div",{className:"TaskPage__description__top",children:[e("div",{className:"TaskPage__description__label",children:"Description"}),!i&&e(h,{size:"sm",onClick:()=>o(!0),children:e(w,{size:16,strokeWidth:"1.8"})})]}),i?e("div",{className:"TaskPage__description__edit",children:[e(G,{autosize:!0,autoFocus:!0,minRows:4,value:_,placeholder:"Add task details, scope, and acceptance criteria.",onChange:m=>g(m.currentTarget.value)}),e("div",{className:"TaskPage__description__editActions",children:[e(T,{compact:!0,size:"xs",variant:"default",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{o(!1),g(t.description||"")},children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",loading:r,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),onClick:n,children:"Save"})]})]}):e("div",{className:x("TaskPage__description__content",!t.description&&"TaskPage__description__content--empty"),children:t.description||"No description provided."})]})}function Ae(a){let{task:t}=a,i=O(null),[o,_]=d(!1),[g,r]=d(""),l=t.attachments||[];async function n(c){let s=Array.from(c);if(s.length!==0){_(!0);try{for(let u of s){let p=await te(u);await ue(t.id,{...p,filename:p.filename||u.name,contentType:u.type||void 0,size:u.size})}f({message:s.length===1?"File attached.":`${s.length} files attached.`,color:"green"})}catch(u){f({title:"Could not attach file",message:k(u),color:"red",autoClose:!1})}finally{_(!1),i.current&&(i.current.value="")}}}async function m(c){let s=xe(c);if(window.confirm(`Remove ${s} from this task?`)){r(c.id);try{await ke(t.id,c.id)}catch(u){f({title:"Could not remove attachment",message:k(u),color:"red",autoClose:!1})}finally{r("")}}}return e("section",{className:"TaskPage__attachments",children:[e("div",{className:"TaskPage__attachments__top",children:[e("div",{className:"TaskPage__attachments__label",children:"Attachments"}),e(T,{compact:!0,size:"xs",variant:"subtle",type:"button",loading:o,leftIcon:e(F,{size:14,strokeWidth:"1.8"}),onClick:()=>i.current?.click(),children:"Attach files"}),e("input",{ref:i,className:"TaskPage__attachments__input",type:"file",multiple:!0,onChange:c=>{n(c.currentTarget.files||[])}})]}),l.length>0?e("div",{className:"TaskPage__attachments__list",children:l.map(c=>e("div",{className:"TaskPage__attachments__item",children:[e("div",{className:"TaskPage__attachments__itemIcon",children:e(F,{size:16,strokeWidth:"1.8"})}),e("div",{className:"TaskPage__attachments__itemContent",children:[e("a",{href:c.src,target:"_blank",rel:"noreferrer",className:"TaskPage__attachments__itemTitle",children:xe(c)}),e("div",{className:"TaskPage__attachments__itemMeta",children:Re(c)})]}),e("div",{className:"TaskPage__attachments__itemActions",children:[e(P,{label:"Open file",children:e(h,{component:"a",href:c.src,target:"_blank",rel:"noreferrer",size:"sm",children:e(Z,{size:16,strokeWidth:"1.8"})})}),e(P,{label:"Remove attachment",children:e(h,{size:"sm",disabled:g===c.id,onClick:()=>m(c),children:e(M,{size:16,strokeWidth:"1.8"})})})]})]},c.id))}):e("div",{className:"TaskPage__attachments__empty",children:"No files attached."})]})}function Ee(a){let{task:t}=a,[i,o]=d(t.assignee||""),[_,g]=d(j(t.targetLaunchDate)),[r,l]=d("");y(()=>{o(t.assignee||""),g(j(t.targetLaunchDate))},[t.assignee,t.targetLaunchDate]);async function n(s,u){l(s);try{await u()}catch(p){f({title:"Could not update task",message:k(p),color:"red",autoClose:!1})}finally{l("")}}function m(){let s=i.trim();(t.assignee||"")!==s&&n("assignee",()=>ce(t.id,s||null))}function c(s){g(s),j(t.targetLaunchDate)!==s&&n("targetLaunchDate",()=>ge(t.id,Ke(s)))}return e(I,{className:"TaskPage__metadata",children:[e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Status"}),e(L,{size:"xs",data:we,value:C(t.status),onChange:s=>{s&&s!==C(t.status)&&n("status",()=>de(t.id,s))}})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Assignee"}),e("div",{className:"TaskPage__metadata__assignee",children:e(S,{size:"xs",type:"email",placeholder:"teammate@example.com",value:i,disabled:r==="assignee",onChange:s=>o(s.currentTarget.value),onBlur:()=>m(),onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}})})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Priority"}),e(L,{size:"xs",data:Ce,value:t.priority||"normal",onChange:s=>{s&&s!==(t.priority||"normal")&&n("priority",()=>_e(t.id,s))}})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Target launch date"}),e("div",{className:"TaskPage__metadata__date",children:e("input",{type:"date",value:_,disabled:r==="targetLaunchDate",onInput:s=>c(s.currentTarget.value)})})]})]})}function De(a){let{task:t,comments:i,events:o}=a,_=D(()=>{let r=new Map;return i.filter(l=>l.parentId).forEach(l=>{let n=l.parentId||"";r.set(n,[...r.get(n)||[],l])}),r.forEach(l=>l.sort((n,m)=>E(n.createdAt)-E(m.createdAt))),r},[i]),g=D(()=>{let r=i.filter(n=>!n.parentId);return[{id:"opened",kind:"opened",createdAt:t.createdAt},...o.map(n=>({id:n.id,kind:"event",event:n,createdAt:n.createdAt})),...r.map(n=>({id:n.id,kind:"comment",comment:n,createdAt:n.createdAt}))].sort((n,m)=>E(n.createdAt)-E(m.createdAt))},[t,i,o]);return e("div",{className:"TaskPage__timeline",children:g.map(r=>r.kind==="opened"?e(Se,{task:t},r.id):r.kind==="event"?e(Le,{event:r.event},r.id):e(ve,{comment:r.comment,replies:_.get(r.comment.id)||[],threadParentId:r.comment.id},r.id))})}function Se(a){let{task:t}=a;return e("div",{className:"TaskPage__timelineItem TaskPage__timelineItem--event",children:[e("div",{className:"TaskPage__timelineItem__marker",children:e(b,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e("b",{children:z(t.createdBy||"unknown")})," opened this task"," ",N(t.createdAt),"."]})]})}function Le(a){let{event:t}=a;return e("div",{className:"TaskPage__timelineItem TaskPage__timelineItem--event",children:[e("div",{className:"TaskPage__timelineItem__marker",children:t.field==="title"?e(w,{size:15,strokeWidth:"2"}):t.field==="assignee"?e(ee,{size:15,strokeWidth:"2"}):t.field==="priority"?e(J,{size:15,strokeWidth:"2"}):t.field==="targetLaunchDate"?e(X,{size:15,strokeWidth:"2"}):e(b,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e("b",{children:z(t.createdBy||"unknown")})," changed"," ",qe(t.field)," from"," ",e("span",{className:"TaskPage__timelineValue",children:Pe(t.field,t.oldValue)})," ","to"," ",e("span",{className:"TaskPage__timelineValue",children:Pe(t.field,t.newValue)})," ",N(t.createdAt),"."]})]})}function ve(a){let{comment:t}=a,i=window.firebase.user.email||"",[o,_]=d(!1),[g,r]=d(!1),[l,n]=d(t.body||q(t.content)),[m,c]=d(!1),s=t.createdBy===i&&!t.isDeleted,u=a.threadParentId||t.parentId||t.id;y(()=>{n(t.body||q(t.content))},[t.body,t.content]);async function p(){if(l){c(!0);try{await Te(t.taskId,t.id,l),r(!1)}catch(v){f({title:"Could not edit comment",message:k(v),color:"red",autoClose:!1})}finally{c(!1)}}}async function be(){if(window.confirm("Delete this comment?"))try{await he(t.taskId,t.id)}catch(v){f({title:"Could not delete comment",message:k(v),color:"red",autoClose:!1})}}return e("div",{className:x("TaskPage__timelineItem","TaskPage__timelineItem--comment",a.isReply&&"TaskPage__timelineItem--reply"),children:[e("div",{className:"TaskPage__timelineItem__marker",children:a.isReply?e(B,{size:15,strokeWidth:"2"}):e(Q,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e(I,{className:"TaskPage__comment",children:[e("div",{className:"TaskPage__comment__header",children:[e("div",{children:[e("b",{children:z(t.createdBy||"unknown")})," ",e("span",{children:N(t.createdAt)}),t.updatedAt&&!t.isDeleted&&e("span",{children:[" edited ",N(t.updatedAt)]})]}),e("div",{className:"TaskPage__comment__actions",children:[!t.isDeleted&&e(P,{label:"Reply",children:e(h,{size:"sm",onClick:()=>_(!o),children:e(B,{size:16,strokeWidth:"1.8"})})}),s&&e(P,{label:"Edit",children:e(h,{size:"sm",onClick:()=>r(!0),children:e(w,{size:16,strokeWidth:"1.8"})})}),s&&e(P,{label:"Delete",children:e(h,{size:"sm",onClick:be,children:e(M,{size:16,strokeWidth:"1.8"})})})]})]}),g?e("div",{className:"TaskPage__comment__edit",children:[e(H,{value:l,placeholder:"Edit this comment...",onChange:n}),e("div",{className:"TaskPage__comment__editActions",children:[e(T,{compact:!0,size:"xs",variant:"default",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{r(!1),n(t.body||q(t.content))},children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",loading:m,disabled:!l,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),onClick:p,children:"Save"})]})]}):e("div",{className:x("TaskPage__comment__body",t.isDeleted&&"TaskPage__comment__body--deleted"),children:t.isDeleted?"Comment deleted.":t.body?e(Be,{className:"TaskPage__comment__richText",data:t.body}):e(ae,{className:"TaskPage__comment__markdown",code:t.content})})]}),o&&e(ye,{taskId:t.taskId,parentId:u,autoFocus:!0,onSubmitted:()=>_(!1),onCancel:()=>_(!1)}),a.replies&&a.replies.length>0&&e("div",{className:"TaskPage__replies",children:a.replies.map(v=>e(ve,{comment:v,isReply:!0,threadParentId:t.id},v.id))})]})]})}function ye(a){let[t,i]=d(null),[o,_]=d(0),[g,r]=d(!1),l=!!a.parentId;async function n(m){if(m.preventDefault(),!!t){r(!0);try{await fe(a.taskId,t,a.parentId),i(null),_(c=>c+1),a.onSubmitted?.()}catch(c){f({title:l?"Could not add reply":"Could not add comment",message:k(c),color:"red",autoClose:!1})}finally{r(!1)}}}return e(I,{className:x("TaskPage__composer",l&&"TaskPage__composer--reply"),children:e("form",{onSubmit:n,children:[e(H,{autoFocus:a.autoFocus,placeholder:l?"Write a reply...":"Leave a comment...",value:t,onChange:i},o),e("div",{className:"TaskPage__composer__actions",children:[a.onCancel&&e(T,{compact:!0,size:"xs",variant:"default",type:"button",onClick:a.onCancel,children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",type:"submit",loading:g,disabled:!t,children:l?"Reply":"Comment"})]})]})})}function Be(a){return e("div",{className:a.className,children:(a.data.blocks||[]).map((t,i)=>e(Fe,{block:t},i))})}function Fe(a){let{block:t}=a;switch(t.type){case"paragraph":return e($,{tag:"p",html:t.data?.text});case"heading":return e($,{tag:"h4",html:t.data?.text});case"quote":return e($,{tag:"blockquote",html:t.data?.text});case"orderedList":return e("ol",{children:(t.data?.items||[]).map((i,o)=>e(K,{item:i},o))});case"unorderedList":return e("ul",{children:(t.data?.items||[]).map((i,o)=>e(K,{item:i},o))});case"image":{let i=t.data?.file;return i?.url?e("img",{src:i.url,width:Number(i.width)||void 0,height:Number(i.height)||void 0,alt:i.alt||""}):null}default:return null}}function $(a){if(!a.html)return null;let t=a.tag;return e(t,{dangerouslySetInnerHTML:{__html:R(a.html)}})}function K(a){return e("li",{children:[a.item.content&&e("span",{dangerouslySetInnerHTML:{__html:R(a.item.content)}}),a.item.items&&a.item.items.length>0&&e("ul",{children:a.item.items.map((t,i)=>e(K,{item:t},i))})]})}function q(a){return a.trim()?{blocks:a.split(/\n{2,}/).map(t=>({type:"paragraph",data:{text:Me(t).replace(/\n/g,"<br>")}})),time:Date.now(),version:"plain-text"}:null}function Me(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function E(a){return a?.toMillis?.()||0}function xe(a){let t=a.src.split("?")[0].split("/").filter(Boolean).at(-1)||"",i=a.filename||t||"Attachment";try{return decodeURIComponent(i)}catch{return i}}function Re(a){let t=[We(a.size),a.contentType||"",a.attachedBy?`attached by ${z(a.attachedBy)}`:"",a.attachedAt?N(a.attachedAt):""].filter(Boolean);return t.length>0?t.join(" - "):"Attached file"}function We(a){if(typeof a!="number")return"";if(a<1024)return`${a} B`;let t=["KB","MB","GB"],i=a/1024,o=0;for(;i>=1024&&o<t.length-1;)i=i/1024,o+=1;return`${i.toFixed(i>=10?0:1)} ${t[o]}`}function z(a){return a.split("@")[0]||a}function He(a){return a?.toMillis?new Date(a.toMillis()).toLocaleDateString("en",{month:"short",day:"numeric",year:"numeric"}):"No date"}function N(a){return a?.toMillis?new Date(a.toMillis()).toLocaleString("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"just now"}function $e(a){return C(a).replace(/[-_]/g," ")}function qe(a){return a.replace(/([A-Z])/g," $1").toLowerCase()}function Pe(a,t){return t?t instanceof Y?He(t):a==="assignee"?z(t):a==="title"?t:t.replace(/[-_]/g," "):"none"}function je(a){return C(a).replace(/[^a-z0-9]+/gi,"-").toLowerCase()}function j(a){if(!a?.toMillis)return"";let t=new Date(a.toMillis()),i=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),_=String(t.getDate()).padStart(2,"0");return`${i}-${o}-${_}`}function Ke(a){if(!a)return null;let[t,i,o]=a.split("-").map(Number);return!t||!i||!o?null:new Date(t,i-1,o)}export{yt as TaskPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g}from"./chunk-SQRKKWRG.js";import"./chunk-DUJYIOLE.js";import"./chunk-KFAZBEPV.js";import"./chunk-KYDOSLTO.js";import{a as e}from"./chunk-VMT7JFAM.js";import"./chunk-X2WHBGTP.js";import"./chunk-PJA7YP4A.js";import"./chunk-62UWGWON.js";import"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a as s,b as i}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as a}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function k(){return s("Tasks"),a(i,{children:a("div",{className:"TasksPage",children:[a("div",{className:"TasksPage__header",children:a(e,{size:"h1",children:"Tasks"})}),a(g,{variant:"page"})]})})}export{k as TasksPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as q}from"./chunk-P3NETZZP.js";import{a as M}from"./chunk-VMT7JFAM.js";import"./chunk-YDO2EDVY.js";import{u as O}from"./chunk-AFWBSIPL.js";import{f as D}from"./chunk-XOQ3KDSR.js";import{a as A}from"./chunk-HLMBCVRX.js";import"./chunk-ORXEMIQC.js";import{a as B,b as N}from"./chunk-FBJURT7Z.js";import"./chunk-5MV6XVGA.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ea as F,Ha as t,a as p,da as y,ea as T,oa as C,w as H,zb as $}from"./chunk-NZHF733K.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";H();var f=class{constructor(){this.data={}}setMeta(r){Object.entries(r).forEach(([e,s])=>{e.startsWith("@@")||(e=`@@${e}`),this.data[e]=s})}add(r,e,s){this.data[r]=e,s&&(this.data[`@${r}`]=s)}get(r){let e=this.data[r];return e?{source:e,meta:this.data[`@${r}`]}:null}list(){let r=[];return Object.entries(this.data).forEach(([e])=>{if(e.startsWith("@"))return;let s=this.data[e],c=this.data[`@${e}`];r.push({key:e,source:s,meta:c})}),r}toJson(){return{...this.data}}toString(){return JSON.stringify(this.toJson(),null,2)}};function h(){return B("ARB Translations"),t(N,{children:t("div",{className:"TranslationsArbPage",children:[t("div",{className:"TranslationsArbPage__header",children:[t(y,{className:"TranslationsArbPage__header__breadcrumbs",children:[t("a",{href:"/cms/translations",children:"Translations"}),t("div",{children:"ARB"})]}),t(M,{size:"h1",children:"ARB Translations"}),t(A,{as:"p",children:"Enter doc ids below (separated by newlines) to include in an ARB file."})]}),t(h.RequestForm,{})]})})}h.RequestForm=()=>{let[o,r]=p(""),[e,s]=p(!1),[c,l]=p(""),[m,I]=p(null);async function v(a){let u=await O(a),d=new f,g=window.__ROOT_CTX.rootConfig,b=[g.domain];g.base&&g.base!=="/"&&b.push(g.base);let n=b.join("");d.setMeta({locale:"en",context:n,last_modified:new Date().toISOString()}),console.log(u);for(let w in u){let W=await q(w);for(let[P,_]of W.entries()){let R=await D(P),i=d.get(R)?.meta;if(i){let x=i.context.split(", ");x.push(w),x.sort(),i.context=x.join(", "),!i.description&&_.description&&(i.description=_.description)}else i={context:w},_.notes&&(i.description=_.notes);d.add(R,P,i)}}return d}async function L(){try{let a=j(o),u=await v(a);I(u)}catch(a){console.error(a),l(`failed to preview arb: ${a}`)}}async function E(){try{s(!0),console.log("download arb");let a=j(o),d=(await v(a)).toString(),b=await new Response(d).blob(),n=document.createElement("a");n.href=window.URL.createObjectURL(b),n.download=k(a),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(n.href),s(!1)}catch(a){console.error(a),l(`failed to download arb: ${a}`)}}return t("form",{className:"TranslationsArbPage__RequestForm",onSubmit:a=>{a.preventDefault(),E()},children:[t("div",{className:"TranslationsArbPage__RequestForm__textareaWrapper",children:t(C,{required:!0,size:"xs",radius:0,autosize:!0,minRows:8,maxRows:20,value:o,placeholder:"Pages/index",onChange:a=>{r(a.currentTarget.value||"")}})}),t("div",{className:"TranslationsArbPage__RequestForm__submit",children:[t(T,{variant:"default",color:"dark",size:"xs",onClick:L,children:"Preview"}),t(T,{color:"blue",size:"xs",loading:e,type:"submit",leftIcon:t($,{size:16,strokeWidth:1.75}),children:"Download ARB"})]}),c&&t(A,{as:"p",className:"TranslationsArbPage__RequestForm__error",children:c}),m&&t(h.Preview,{arb:m})]})};h.Preview=o=>{let r=o.arb.list().filter(e=>!!e.meta);return console.log(r),t(F,{verticalSpacing:"xs",highlightOnHover:!0,fontSize:"xs",children:[t("thead",{children:t("tr",{children:[t("th",{children:"source"}),t("th",{children:"context"})]})}),t("tbody",{children:r.map(e=>t("tr",{class:"TranslationsArbPage__Preview__Table__row",children:[t("td",{children:e.source}),t("td",{children:[e.meta?.context,e.meta?.description&&t(S,{children:["/ ",e.meta.description]})]})]},e.source))})]})};function j(o){return o.split(`
|
|
2
|
+
`).map(r=>r.trim()).filter(r=>U(r))}function U(o){return!!o&&o.includes("/")&&o.split("/").length===2}function k(o){let r=new Date,e=m=>m.toString().padStart(2,"0"),s=`${r.getFullYear()}${e(r.getMonth()+1)}${e(r.getDate())}t${e(r.getHours())}${e(r.getMinutes())}`,c=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId,l=[z(c)];return o.length===1&&l.push(z(o[0])),l.push(s),`${l.join("_")}.arb`}function z(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}export{h as TranslationsArbPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h}from"./chunk-VMT7JFAM.js";import{c as F,d as y,g as N}from"./chunk-XOQ3KDSR.js";import{a as x}from"./chunk-I6ICVKEC.js";import"./chunk-ORXEMIQC.js";import{a as z,b as C}from"./chunk-FBJURT7Z.js";import"./chunk-EGEB6N4J.js";import"./chunk-AL3TN2KI.js";import{Ha as a,V as P,a as r,c,da as f,ea as T,j as B,oa as _,ta as b,va as v}from"./chunk-NZHF733K.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function w(i){z("Edit Translation");let t=i.hash,[p,l]=r(!1),[d,g]=r(!1),[n,o]=r({source:""});async function s(){l(!0);let e=await F(t);if(l(!1),!e?.source){g(!0);return}o(e)}async function u(e){console.log(e),await y(t,e),o(m=>({...m,...e})),x({title:"Saved translations",message:`Updated translations for ${t}.`,autoClose:5e3})}return c(()=>{s()},[i.hash]),a(C,{children:a("div",{className:"TranslationsEditPage",children:[a("div",{className:"TranslationsEditPage__header",children:[a(f,{className:"TranslationsEditPage__header__breadcrumbs",children:[a("a",{href:"/cms/translations",children:"Translations"}),a("div",{children:i.hash})]}),a(h,{size:"h1",children:"Edit Translations"})]}),p?a(P,{color:"gray",size:"xl"}):d?a("div",{className:"TranslationsEditPage__notFound",children:"Not Found"}):a(w.Form,{hash:i.hash,translations:n,onChange:u})]})})}w.Form=i=>{let t=i.translations,l=(window.__ROOT_CTX.rootConfig.i18n.locales||[]).filter(s=>s!=="en"),[d,g]=r(t.tags||[]),[n,o]=r(null);return c(()=>{g(t.tags||[])},[t.tags]),a("div",{className:"TranslationsEditPage__FormContainer",children:[a("form",{className:"TranslationsEditPage__Form",onSubmit:async s=>{s.preventDefault();let u=s.currentTarget,e=["en",...l],m={};e.forEach(E=>{let S=u.elements[E].value;m[E]=N(S)}),o("translations");try{await i.onChange(m)}finally{o(null)}},children:[a(v,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"hash",label:"hash",value:i.hash,disabled:!0}),a(_,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"source",label:"source",value:t.source,autosize:!0,disabled:!0}),a(_,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"en",label:"en",value:t.en,autosize:!0,disabled:!!n}),l.map(s=>a(_,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:s,label:s,value:t[s]||"",autosize:!0,disabled:!!n},s)),a(T,{className:"TranslationsEditPage__Form__input__submit",color:"blue",size:"xs",type:"submit",disabled:!!n,loading:n==="translations",children:n==="translations"?"Saving...":"Save"})]}),a("div",{className:"TranslationsEditPage__TagsForm",children:[a(h,{size:"h3",className:"TranslationsEditPage__TagsForm__heading",children:"Tags"}),a(b,{data:d,value:d,onChange:g,placeholder:"Add tags",searchable:!0,creatable:!0,disabled:!!n,getCreateLabel:s=>`+ Add tag ${s}`}),a(T,{className:"TranslationsEditPage__TagsForm__submit",color:"blue",size:"xs",disabled:!!n,loading:n==="tags",onClick:async()=>{o("tags");try{await i.onChange({...t,tags:d})}finally{o(null)}},children:n==="tags"?"Saving...":"Save tags"})]})]})};export{w as TranslationsEditPage};
|