@lunora/studio 1.0.0-alpha.46 → 1.0.0-alpha.48
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/index.d.ts +5 -3
- package/dist/index.js +12 -12
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +4 -4
- package/dist/packem_chunks/ExportImportPanel.js +4 -4
- package/dist/packem_chunks/FileBrowser.js +43 -20
- package/dist/packem_chunks/FunctionRunner.js +8 -25
- package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +5 -5
- package/dist/packem_chunks/LogsPanel.js +4 -4
- package/dist/packem_chunks/MailPanel.js +3 -3
- package/dist/packem_chunks/MetricsPanel.js +4 -4
- package/dist/packem_chunks/MigrationsPanel.js +5 -5
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +3 -3
- package/dist/packem_chunks/SecurityAdvisorPanel.js +2 -2
- package/dist/packem_chunks/SettingsPanel.js +2 -2
- package/dist/packem_chunks/SqlEditorPanel.js +7 -6
- package/dist/packem_chunks/TableEditor.js +6 -29
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +2 -2
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +3 -2
- package/dist/packem_chunks/fanout-panel.js +3 -3
- package/dist/packem_chunks/flags-panel.js +2 -2
- package/dist/packem_chunks/kv-browser.js +2 -2
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +3 -3
- package/dist/packem_chunks/payments-panel.js +3 -3
- package/dist/packem_chunks/permissions-panel.js +4 -4
- package/dist/packem_chunks/queues-panel.js +3 -3
- package/dist/packem_chunks/rls-panel.js +2 -2
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/storage-rules-panel.js +2 -2
- package/dist/packem_chunks/subscriptions-panel.js +3 -3
- package/dist/packem_chunks/users-panel.js +3 -3
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +2 -2
- package/dist/packem_shared/{ApiDocsPanel-CBma-lnp.js → ApiDocsPanel-B2Rc7nOF.js} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-CQM3pPN7.js → ApiReferencePanel-Dd8pcswz.js} +1 -1
- package/dist/packem_shared/{CommandPalette-X2tkbyHk.js → CommandPalette-BXV4eKf5.js} +1 -1
- package/dist/packem_shared/{DataBrowser-D2ywrdId.js → DataBrowser-Cc197zke.js} +8 -8
- package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
- package/dist/packem_shared/{GlobalDataBrowser-BkTPLzAY.js → GlobalDataBrowser-CxJxRRf2.js} +3 -3
- package/dist/packem_shared/{HomePanel-D1Q9LZgK.js → HomePanel-CjDlJzzs.js} +3 -3
- package/dist/packem_shared/{OpenRpcReferencePanel-Dno-hfDb.js → OpenRpcReferencePanel-CWaf0ZtX.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Ctw4jYtU.js → ScheduledJobs-dHMgnJbx.js} +2 -2
- package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
- package/dist/packem_shared/{Studio-lJhzDAze.js → Studio-sfBFghzO.js} +4 -4
- package/dist/packem_shared/{StudioApp-DiMkupvZ.js → StudioApp-Ism1gXfJ.js} +5 -11
- package/dist/packem_shared/{advisor-view-BX8OhG0w.js → advisor-view-Cx21PS_T.js} +1 -1
- package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
- package/dist/packem_shared/{data-grid-CdXztApG.js → data-grid-C9I16KWr.js} +1 -1
- package/dist/packem_shared/{error-alert-CXjqyGw9.js → error-alert-vIPQoN3Y.js} +1 -1
- package/dist/packem_shared/{grid-features-BF-KBDFz.js → grid-features-B_fZH4iQ.js} +3 -2
- package/dist/packem_shared/{home-panel-TFcRf9Ui.js → home-panel-BohxdqDb.js} +2 -2
- package/dist/packem_shared/{internal-CYcbqMjX.js → internal-zwBoOv24.js} +14 -1
- package/dist/packem_shared/{reference-view-DUiJcILV.js → reference-view-DUULLuOi.js} +3 -17
- package/dist/packem_shared/{browser-storage-BTrX4y3B.js → result-chart-DZradBAS.js} +2 -98
- package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
- package/dist/packem_shared/{studio-Dh9UlaF_.js → studio-CFC_pv0f.js} +3 -3
- package/dist/packem_shared/{table-list-sidebar-UVIXQJdU.js → table-list-sidebar-huX4VmgI.js} +19 -9
- package/dist/packem_shared/{use-admin-query-CfHYWx5n.js → use-admin-query-BGJ010yZ.js} +1 -1
- package/dist/packem_shared/{use-async-submit-DJQiPc-_.js → use-async-submit-DGCtuDyz.js} +2 -2
- package/dist/standalone/{chunk-J75M4LTW.js → chunk-22C6COGE.js} +4 -4
- package/dist/standalone/{chunk-7XTR7BWT.js → chunk-2CQ2YNER.js} +1 -1
- package/dist/standalone/chunk-2MLA6WFH.js +1 -0
- package/dist/standalone/{chunk-2BBENYBY.js → chunk-37HPVOYP.js} +1 -1
- package/dist/standalone/{chunk-B4TTGYIX.js → chunk-3HS3ZXFB.js} +1 -1
- package/dist/standalone/{chunk-T4XWXBKR.js → chunk-3OZDR3RM.js} +1 -1
- package/dist/standalone/chunk-4KSX53SI.js +4 -0
- package/dist/standalone/chunk-4PC7IXNY.js +1 -0
- package/dist/standalone/{chunk-7KR346F4.js → chunk-5UKRVDFD.js} +1 -1
- package/dist/standalone/{chunk-4WGGEF73.js → chunk-ADP5UEHQ.js} +1 -1
- package/dist/standalone/{chunk-WKWKAU22.js → chunk-AITOCPML.js} +1 -1
- package/dist/standalone/{chunk-ZSNXQT4N.js → chunk-AYANIT5P.js} +1 -1
- package/dist/standalone/chunk-BIBCC7EE.js +6 -0
- package/dist/standalone/{chunk-XFPHUG7M.js → chunk-CGGZAYGG.js} +1 -1
- package/dist/standalone/chunk-CJTT4TBP.js +1 -0
- package/dist/standalone/{chunk-73BV73BI.js → chunk-CLMGPTAI.js} +1 -1
- package/dist/standalone/{chunk-MP5MTWY5.js → chunk-CTPCJNOP.js} +1 -1
- package/dist/standalone/chunk-DDE62TRL.js +1 -0
- package/dist/standalone/{chunk-ATG3655M.js → chunk-DH4K2OLM.js} +1 -1
- package/dist/standalone/{chunk-KMNEQEHM.js → chunk-EEWKIQUE.js} +1 -1
- package/dist/standalone/{chunk-3JO76DWI.js → chunk-EYSL7KEQ.js} +1 -1
- package/dist/standalone/{chunk-I4RSHYDW.js → chunk-F4HDP4XW.js} +1 -1
- package/dist/standalone/chunk-F5I22A4W.js +1 -0
- package/dist/standalone/chunk-FKVCHCYV.js +4 -0
- package/dist/standalone/{chunk-6HW2RKAX.js → chunk-FNQQ3B5G.js} +1 -1
- package/dist/standalone/{chunk-PXR5E7AX.js → chunk-GSCV2N3F.js} +5 -5
- package/dist/standalone/{chunk-ICIQ2GWQ.js → chunk-H27CRIP3.js} +1 -1
- package/dist/standalone/{chunk-YSF43KIJ.js → chunk-HROXYAZT.js} +1 -1
- package/dist/standalone/{chunk-EOSXQTSQ.js → chunk-HVRDZZHL.js} +1 -1
- package/dist/standalone/{chunk-245TEXSO.js → chunk-IRSIK3HT.js} +2 -2
- package/dist/standalone/{chunk-2GMEK2W3.js → chunk-ITQKVEP7.js} +9 -9
- package/dist/standalone/{chunk-34B5ECBI.js → chunk-IZN4TYMN.js} +1 -1
- package/dist/standalone/{chunk-7JOVXGO4.js → chunk-JM7XBQVK.js} +1 -1
- package/dist/standalone/{chunk-S6JKSFSO.js → chunk-JPILGFXT.js} +1 -1
- package/dist/standalone/{chunk-QQH2YTBW.js → chunk-JQ4WOPMF.js} +1 -1
- package/dist/standalone/chunk-K2CB2CHL.js +1 -0
- package/dist/standalone/{chunk-3IJLM4GF.js → chunk-KCMKEMUL.js} +1 -1
- package/dist/standalone/{chunk-WKUGR7ER.js → chunk-KKD46QVN.js} +1 -1
- package/dist/standalone/chunk-L7WR3C4Z.js +1 -0
- package/dist/standalone/chunk-LRYLU6EY.js +1 -0
- package/dist/standalone/{chunk-I34RPZ7P.js → chunk-MDTNVR3G.js} +1 -1
- package/dist/standalone/chunk-PL2KY6IG.js +1 -0
- package/dist/standalone/{chunk-KFNNMXUZ.js → chunk-S3Q6R7BA.js} +1 -1
- package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
- package/dist/standalone/chunk-SEQ43UW2.js +1 -0
- package/dist/standalone/{chunk-5KUKYIU6.js → chunk-SHK6RAFG.js} +1 -1
- package/dist/standalone/chunk-TXTJPS5F.js +1 -0
- package/dist/standalone/chunk-V4ECZI2R.js +1 -0
- package/dist/standalone/{chunk-6CRKDJNL.js → chunk-WD2LBHJZ.js} +1 -1
- package/dist/standalone/{chunk-PBXQ5QS4.js → chunk-WMWDJLRO.js} +4 -4
- package/dist/standalone/{chunk-ZTOATVB7.js → chunk-WOXVMXSQ.js} +1 -1
- package/dist/standalone/{chunk-JEVKZIHN.js → chunk-WUFVFVHJ.js} +1 -1
- package/dist/standalone/{chunk-ERUIC6WI.js → chunk-X4QFAAZ5.js} +1 -1
- package/dist/standalone/{chunk-P7AMKXU2.js → chunk-XVR74IFC.js} +1 -1
- package/dist/standalone/chunk-Y2GJJVS5.js +1 -0
- package/dist/standalone/chunk-YFA7NUCL.js +1 -0
- package/dist/standalone/chunk-YSPZSTDI.js +1 -0
- package/dist/standalone/studio.js +43 -43
- package/package.json +6 -6
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/standalone/chunk-3SKIYIBN.js +0 -1
- package/dist/standalone/chunk-AFCBRDRQ.js +0 -1
- package/dist/standalone/chunk-AX7GYUQC.js +0 -1
- package/dist/standalone/chunk-BGHGKAOM.js +0 -1
- package/dist/standalone/chunk-BL45HXOJ.js +0 -1
- package/dist/standalone/chunk-ERXJPMCU.js +0 -1
- package/dist/standalone/chunk-GNMTLLGB.js +0 -1
- package/dist/standalone/chunk-M5OMEMQ3.js +0 -1
- package/dist/standalone/chunk-O4YNKFCZ.js +0 -1
- package/dist/standalone/chunk-OLUEBOHS.js +0 -1
- package/dist/standalone/chunk-OOETIPAO.js +0 -1
- package/dist/standalone/chunk-OQPT2BEZ.js +0 -6
- package/dist/standalone/chunk-PKIPNNRD.js +0 -4
- package/dist/standalone/chunk-QB3QUTSJ.js +0 -1
- package/dist/standalone/chunk-TBMYIZIO.js +0 -1
- package/dist/standalone/chunk-TU5ZNEZ4.js +0 -1
- package/dist/standalone/chunk-WATFBATD.js +0 -1
- package/dist/standalone/chunk-WSMZLZWM.js +0 -4
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{a,c as te,e as de,f as
|
|
1
|
+
import{a,c as te,e as de,f as Pe}from"./chunk-RRCPZMC2.js";var pe=te((he,W)=>{(function(e,r){typeof define=="function"&&define.amd?define([],r):typeof W=="object"&&W.exports?W.exports=r():e.moo=r()})(he,function(){"use strict";var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,t=typeof new RegExp().sticky=="boolean";function s(n){return n&&r.call(n)==="[object RegExp]"}a(s,"isRegExp");function i(n){return n&&typeof n=="object"&&!s(n)&&!Array.isArray(n)}a(i,"isObject");function l(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,function(o){return o==="-"?"\\x2d":"\\"+o})}a(l,"reEscape");function c(n){var o=new RegExp("|"+n);return o.exec("").length-1}a(c,"reGroups");function h(n){return"("+n+")"}a(h,"reCapture");function v(n){if(!n.length)return"(?!)";var o=n.map(function(u){return"(?:"+u+")"}).join("|");return"(?:"+o+")"}a(v,"reUnion");function S(n){if(typeof n=="string")return"(?:"+l(n)+")";if(s(n)){if(n.ignoreCase)throw new Error("RegExp /i flag not allowed");if(n.global)throw new Error("RegExp /g flag is implied");if(n.sticky)throw new Error("RegExp /y flag is implied");if(n.multiline)throw new Error("RegExp /m flag is implied");return n.source}else throw new Error("Not a pattern: "+n)}a(S,"regexpOrLiteral");function b(n,o){return n.length>o?n:Array(o-n.length+1).join(" ")+n}a(b,"pad");function M(n,o){for(var u=n.length,f=0;;){var g=n.lastIndexOf(`
|
|
2
2
|
`,u-1);if(g===-1||(f++,u=g,f===o)||u===0)break}var d=f<o?0:u+1;return n.substring(d).split(`
|
|
3
|
-
`)}a(M,"lastNLines");function K(n){for(var o=Object.getOwnPropertyNames(n),u=[],f=0;f<o.length;f++){var g=o[f],d=n[g],m=[].concat(d);if(g==="include"){for(var w=0;w<m.length;w++)u.push({include:m[w]});continue}var y=[];m.forEach(function(p){i(p)?(y.length&&u.push($(g,y)),u.push($(g,p)),y=[]):y.push(p)}),y.length&&u.push($(g,y))}return u}a(K,"objectToRules");function O(n){for(var o=[],u=0;u<n.length;u++){var f=n[u];if(f.include){for(var g=[].concat(f.include),d=0;d<g.length;d++)o.push({include:g[d]});continue}if(!f.type)throw new Error("Rule has no type: "+JSON.stringify(f));o.push($(f.type,f))}return o}a(O,"arrayToRules");function $(n,o){if(i(o)||(o={match:o}),o.include)throw new Error("Matching rules cannot also include states");var u={defaultType:n,lineBreaks:!!o.error||!!o.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var f in o)e.call(o,f)&&(u[f]=o[f]);if(typeof u.type=="string"&&n!==u.type)throw new Error("Type transform cannot be a string (type '"+u.type+"' for token '"+n+"')");var g=u.match;return u.match=Array.isArray(g)?g:g?[g]:[],u.match.sort(function(d,m){return s(d)&&s(m)?0:s(m)?-1:s(d)?1:m.length-d.length}),u}a($,"ruleOptions");function C(n){return Array.isArray(n)?O(n):K(n)}a(C,"toRules");var N=$("error",{lineBreaks:!0,shouldThrow:!0});function F(n,o){for(var u=null,f=Object.create(null),g=!0,d=null,m=[],w=[],y=0;y<n.length;y++)n[y].fallback&&(g=!1);for(var y=0;y<n.length;y++){var p=n[y];if(p.include)throw new Error("Inheritance is not allowed in stateless lexers");if(p.error||p.fallback){if(u)throw!p.fallback==!u.fallback?new Error("Multiple "+(p.fallback?"fallback":"error")+" rules not allowed (for token '"+p.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+p.defaultType+"')");u=p}var _=p.match.slice();if(g)for(;_.length&&typeof _[0]=="string"&&_[0].length===1;){var D=_.shift();f[D.charCodeAt(0)]=p}if(p.pop||p.push||p.next){if(!o)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+p.defaultType+"')");if(p.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+p.defaultType+"')")}if(_.length!==0){g=!1,m.push(p);for(var
|
|
3
|
+
`)}a(M,"lastNLines");function K(n){for(var o=Object.getOwnPropertyNames(n),u=[],f=0;f<o.length;f++){var g=o[f],d=n[g],m=[].concat(d);if(g==="include"){for(var w=0;w<m.length;w++)u.push({include:m[w]});continue}var y=[];m.forEach(function(p){i(p)?(y.length&&u.push($(g,y)),u.push($(g,p)),y=[]):y.push(p)}),y.length&&u.push($(g,y))}return u}a(K,"objectToRules");function O(n){for(var o=[],u=0;u<n.length;u++){var f=n[u];if(f.include){for(var g=[].concat(f.include),d=0;d<g.length;d++)o.push({include:g[d]});continue}if(!f.type)throw new Error("Rule has no type: "+JSON.stringify(f));o.push($(f.type,f))}return o}a(O,"arrayToRules");function $(n,o){if(i(o)||(o={match:o}),o.include)throw new Error("Matching rules cannot also include states");var u={defaultType:n,lineBreaks:!!o.error||!!o.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var f in o)e.call(o,f)&&(u[f]=o[f]);if(typeof u.type=="string"&&n!==u.type)throw new Error("Type transform cannot be a string (type '"+u.type+"' for token '"+n+"')");var g=u.match;return u.match=Array.isArray(g)?g:g?[g]:[],u.match.sort(function(d,m){return s(d)&&s(m)?0:s(m)?-1:s(d)?1:m.length-d.length}),u}a($,"ruleOptions");function C(n){return Array.isArray(n)?O(n):K(n)}a(C,"toRules");var N=$("error",{lineBreaks:!0,shouldThrow:!0});function F(n,o){for(var u=null,f=Object.create(null),g=!0,d=null,m=[],w=[],y=0;y<n.length;y++)n[y].fallback&&(g=!1);for(var y=0;y<n.length;y++){var p=n[y];if(p.include)throw new Error("Inheritance is not allowed in stateless lexers");if(p.error||p.fallback){if(u)throw!p.fallback==!u.fallback?new Error("Multiple "+(p.fallback?"fallback":"error")+" rules not allowed (for token '"+p.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+p.defaultType+"')");u=p}var _=p.match.slice();if(g)for(;_.length&&typeof _[0]=="string"&&_[0].length===1;){var D=_.shift();f[D.charCodeAt(0)]=p}if(p.pop||p.push||p.next){if(!o)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+p.defaultType+"')");if(p.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+p.defaultType+"')")}if(_.length!==0){g=!1,m.push(p);for(var q=0;q<_.length;q++){var P=_[q];if(s(P)){if(d===null)d=P.unicode;else if(d!==P.unicode&&p.fallback===!1)throw new Error("If one rule is /u then all must be")}}var I=v(_.map(S)),T=new RegExp(I);if(T.test(""))throw new Error("RegExp matches empty string: "+T);var U=c(I);if(U>0)throw new Error("RegExp has capture groups: "+T+`
|
|
4
4
|
Use (?: \u2026 ) instead`);if(!p.lineBreaks&&T.test(`
|
|
5
|
-
`))throw new Error("Rule should declare lineBreaks: "+T);w.push(h(I))}}var R=u&&u.fallback,L=t&&!R?"ym":"gm",H=t||R?"":"|";d===!0&&(L+="u");var
|
|
6
|
-
`)f=1;else for(;g.exec(o);)f++,d=g.lastIndex}var m={type:typeof n.type=="function"&&n.type(o)||n.defaultType,value:typeof n.value=="function"?n.value(o):o,text:o,toString:De,offset:u,lineBreaks:f,line:this.line,col:this.col},w=o.length;if(this.index+=w,this.line+=f,f!==0?this.col=w-d+1:this.col+=w,n.shouldThrow){var y=new Error(this.formatError(m,"invalid syntax"));throw y}return n.pop?this.popState():n.push?this.pushState(n.push):n.next&&this.setState(n.next),m},typeof Symbol<"u"&&Symbol.iterator){var ee=a(function(n){this.lexer=n},"LexerIterator");ee.prototype.next=function(){var n=this.lexer.next();return{value:n,done:!n}},ee.prototype[Symbol.iterator]=function(){return this},
|
|
7
|
-
`)===-1?0:1,line:this.line,col:this.col};var f=2,g=Math.max(n.line-f,1),d=n.line+f,m=String(d).length,w=M(this.buffer,this.line-n.line+f+1).slice(0,5),y=[];y.push(o+" at line "+n.line+" col "+n.col+":"),y.push("");for(var p=0;p<w.length;p++){var _=w[p],D=g+p;y.push(
|
|
8
|
-
`)},b.prototype.clone=function(){return new b(this.states,this.state)},b.prototype.has=function(n){return!0},{compile:X,states:$e,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:Be}})});var ge=te(A=>{"use strict";var Ne=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:!0});A.lexer=A.states=void 0;var Fe=Ne(pe());A.states={body:{doubleapos:{match:"''",value:a(()=>"'","value")},quoted:{lineBreaks:!0,match:/'[{}#](?:[^']|'')*'(?!')/u,value:a(e=>e.slice(1,-1).replace(/''/g,"'"),"value")},argument:{lineBreaks:!0,match:/\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,push:"arg",value:a(e=>e.substring(1).trim(),"value")},octothorpe:"#",end:{match:"}",pop:1},content:{lineBreaks:!0,match:/[^][^{}#']*/u}},arg:{select:{lineBreaks:!0,match:/,\s*(?:plural|select|selectordinal)\s*,\s*/u,next:"select",value:a(e=>e.split(",")[1].trim(),"value")},"func-args":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,next:"body",value:a(e=>e.split(",")[1].trim(),"value")},"func-simple":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,value:a(e=>e.substring(1).trim(),"value")},end:{match:"}",pop:1}},select:{offset:{lineBreaks:!0,match:/\s*offset\s*:\s*\d+\s*/u,value:a(e=>e.split(":")[1].trim(),"value")},case:{lineBreaks:!0,match:/\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,push:"body",value:a(e=>e.substring(0,e.indexOf("{")).trim(),"value")},end:{match:/\s*\}/u,pop:1}}};A.lexer=Fe.default.states(A.states)});var ve=te(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.ParseError=void 0;z.parse=Ue;var ye=ge(),j=a(e=>({offset:e.offset,line:e.line,col:e.col,text:e.text,lineBreaks:e.lineBreaks}),"getContext"),re=a(e=>e==="plural"||e==="select"||e==="selectordinal","isSelectType");function Ie(e,r){let t="",s="";for(let l of r){let c=l.ctx.text;switch(s+=c,l.type){case"content":t+=l.value;break;case"argument":case"function":case"octothorpe":t+=c;break;default:throw new x(e,`Unsupported part in strict mode function arg style: ${c}`)}}return[{type:"content",value:t.trim(),ctx:Object.assign({},r[0].ctx,{text:s})}]}a(Ie,"strictArgStyleParam");var Re=["number","date","time","spellout","ordinal","duration"],me=["zero","one","two","few","many","other"],x=class extends Error{static{a(this,"ParseError")}constructor(r,t){super(ye.lexer.formatError(r,t))}};z.ParseError=x;var ne=class{static{a(this,"Parser")}constructor(r,t){var s,i,l,c;this.lexer=ye.lexer.reset(r),this.cardinalKeys=(s=t?.cardinal)!==null&&s!==void 0?s:me,this.ordinalKeys=(i=t?.ordinal)!==null&&i!==void 0?i:me,this.strict=(l=t?.strict)!==null&&l!==void 0?l:!1,this.strictPluralKeys=(c=t?.strictPluralKeys)!==null&&c!==void 0?c:!0}parse(){return this.parseBody(!1,!0)}checkSelectKey(r,t,s){if(s[0]==="="){if(t==="select")throw new x(r,`The case ${s} is not valid with select`)}else if(t!=="select"){let i=t==="plural"?this.cardinalKeys:this.ordinalKeys;if(this.strictPluralKeys&&i.length>0&&!i.includes(s)){let l=`The ${t} case ${s} is not valid in this locale`;throw new x(r,l)}}}parseSelect({value:r},t,s,i){let l={type:i,arg:r,cases:[],ctx:s};i==="plural"||i==="selectordinal"?t=!0:this.strict&&(t=!1);for(let c of this.lexer)switch(c.type){case"offset":if(i==="select")throw new x(c,"Unexpected plural offset for select");if(l.cases.length>0)throw new x(c,"Plural offset must be set before cases");l.pluralOffset=Number(c.value),s.text+=c.text,s.lineBreaks+=c.lineBreaks;break;case"case":{this.checkSelectKey(c,i,c.value),l.cases.push({key:c.value,tokens:this.parseBody(t),ctx:j(c)});break}case"end":return l;default:throw new x(c,`Unexpected lexer token: ${c.type}`)}throw new x(null,"Unexpected message end")}parseArgToken(r,t){let s=j(r),i=this.lexer.next();if(!i)throw new x(null,"Unexpected message end");if(s.text+=i.text,s.lineBreaks+=i.lineBreaks,this.strict&&(i.type==="func-simple"||i.type==="func-args")&&!Re.includes(i.value)){let l=`Invalid strict mode function arg type: ${i.value}`;throw new x(r,l)}switch(i.type){case"end":return{type:"argument",arg:r.value,ctx:s};case"func-simple":{let l=this.lexer.next();if(!l)throw new x(null,"Unexpected message end");if(l.type!=="end")throw new x(l,`Unexpected lexer token: ${l.type}`);if(s.text+=l.text,re(i.value.toLowerCase()))throw new x(i,`Invalid type identifier: ${i.value}`);return{type:"function",arg:r.value,key:i.value,ctx:s}}case"func-args":{if(re(i.value.toLowerCase())){let c=`Invalid type identifier: ${i.value}`;throw new x(i,c)}let l=this.parseBody(this.strict?!1:t);return this.strict&&l.length>0&&(l=Ie(r,l)),{type:"function",arg:r.value,key:i.value,param:l,ctx:s}}case"select":if(re(i.value))return this.parseSelect(r,t,s,i.value);throw new x(i,`Unexpected select type ${i.value}`);default:throw new x(i,`Unexpected lexer token: ${i.type}`)}}parseBody(r,t){let s=[],i=null;for(let l of this.lexer)if(l.type==="argument")i&&(i=null),s.push(this.parseArgToken(l,r));else if(l.type==="octothorpe"&&r)i&&(i=null),s.push({type:"octothorpe",ctx:j(l)});else{if(l.type==="end"&&!t)return s;{let c=l.value;if(!r&&l.type==="quoted"&&c[0]==="#"){if(c.includes("{")){let h=`Unsupported escape pattern: ${c}`;throw new x(l,h)}c=l.text}i?(i.value+=c,i.ctx.text+=l.text,i.ctx.lineBreaks+=l.lineBreaks):(i={type:"content",value:c,ctx:j(l)},s.push(i))}}if(t)return s;throw new x(null,"Unexpected message end")}};function Ue(e,r={}){return new ne(e,r).parse()}a(Ue,"parse")});var _e=de(ve(),1);var E=class extends Error{static{a(this,"DateFormatError")}constructor(r,t,s){super(r),this.token=t,this.type=s||"error"}},we=a(e=>e<4?"short":e===4?"long":"narrow","alpha"),G=a(e=>e%2===0?"2-digit":"numeric","numeric");function Le(e,r){switch(e.char){case"y":return{year:G(e.width)};case"r":return{calendar:"gregory",year:"numeric"};default:return r(`${e.desc} is not supported; falling back to year:numeric`,E.WARNING),{year:"numeric"}}}a(Le,"yearOptions");function ze(e,r){switch(e.width){case 1:return"numeric";case 2:return"2-digit";case 3:return"short";case 4:return"long";case 5:return"narrow";default:r(`${e.desc} is not supported with width ${e.width}`);return}}a(ze,"monthStyle");function Ge(e,r){let{char:t,desc:s,width:i}=e;if(t==="d")return G(i);r(`${s} is not supported`)}a(Ge,"dayStyle");function Ke(e,r){let{char:t,desc:s,width:i}=e;if((t==="c"||t==="e")&&i<3){let l=`Numeric value is not supported for ${s}; falling back to weekday:short`;r(l,E.WARNING)}return we(i)}a(Ke,"weekdayStyle");function He(e){let r=G(e.width),t;switch(e.char){case"h":t="h12";break;case"H":t="h23";break;case"k":t="h24";break;case"K":t="h11";break}return t?{hour:r,hourCycle:t}:{hour:r}}a(He,"hourOptions");function We(e,r){let{char:t,desc:s,width:i}=e;switch(t){case"v":case"z":return i===4?"long":"short";case"V":if(i===4)return"long";r(`${s} is not supported with width ${i}`);return;case"X":r(`${s} is not supported`);return}return"short"}a(We,"timeZoneNameStyle");function je(e,r){switch(e.field){case"era":return{era:we(e.width)};case"year":return Le(e,r);case"month":return{month:ze(e,r)};case"day":return{day:Ge(e,r)};case"weekday":return{weekday:Ke(e,r)};case"period":return;case"hour":return He(e);case"min":return{minute:G(e.width)};case"sec":return{second:G(e.width)};case"tz":return{timeZoneName:We(e,r)};case"quarter":case"week":case"sec-frac":case"ms":r(`${e.desc} is not supported`)}}a(je,"compileOptions");function se(e,r,t=s=>{throw s}){let s={timeZone:r},i=[];for(let l of e){let{error:c,field:h,str:v}=l;if(c){let k=new E(c.message,l);k.stack=c.stack,t(k)}if(v){let k=`Ignoring string part: ${v}`;t(new E(k,l,E.WARNING))}h&&(i.indexOf(h)===-1?i.push(h):t(new E(`Duplicate ${h} token`,l)));let S=je(l,(k,M)=>t(new E(k,l,M)));S&&Object.assign(s,S)}return s}a(se,"getDateFormatOptions");var Ze={G:{field:"era",desc:"Era"},y:{field:"year",desc:"Year"},Y:{field:"year",desc:'Year of "Week of Year"'},u:{field:"year",desc:"Extended year"},U:{field:"year",desc:"Cyclic year name"},r:{field:"year",desc:"Related Gregorian year"},Q:{field:"quarter",desc:"Quarter"},q:{field:"quarter",desc:"Stand-alone quarter"},M:{field:"month",desc:"Month in year"},L:{field:"month",desc:"Stand-alone month in year"},w:{field:"week",desc:"Week of year"},W:{field:"week",desc:"Week of month"},d:{field:"day",desc:"Day in month"},D:{field:"day",desc:"Day of year"},F:{field:"day",desc:"Day of week in month"},g:{field:"day",desc:"Modified julian day"},E:{field:"weekday",desc:"Day of week"},e:{field:"weekday",desc:"Local day of week"},c:{field:"weekday",desc:"Stand-alone local day of week"},a:{field:"period",desc:"AM/PM marker"},b:{field:"period",desc:"AM/PM/noon/midnight marker"},B:{field:"period",desc:"Flexible day period"},h:{field:"hour",desc:"Hour in AM/PM (1~12)"},H:{field:"hour",desc:"Hour in day (0~23)"},k:{field:"hour",desc:"Hour in day (1~24)"},K:{field:"hour",desc:"Hour in AM/PM (0~11)"},j:{field:"hour",desc:"Hour in preferred cycle"},J:{field:"hour",desc:"Hour in preferred cycle without marker"},C:{field:"hour",desc:"Hour in preferred cycle with flexible marker"},m:{field:"min",desc:"Minute in hour"},s:{field:"sec",desc:"Second in minute"},S:{field:"sec-frac",desc:"Fractional second"},A:{field:"ms",desc:"Milliseconds in day"},z:{field:"tz",desc:"Time Zone: specific non-location"},Z:{field:"tz",desc:"Time Zone"},O:{field:"tz",desc:"Time Zone: localized"},v:{field:"tz",desc:"Time Zone: generic non-location"},V:{field:"tz",desc:"Time Zone: ID"},X:{field:"tz",desc:"Time Zone: ISO8601 with Z"},x:{field:"tz",desc:"Time Zone: ISO8601"}},xe=a(e=>e>="A"&&e<="Z"||e>="a"&&e<="z","isLetter");function Je(e,r){let t=e[r],s=1;for(;e[++r]===t;)++s;let i=Ze[t];if(!i){let l=`The letter ${t} is not a valid field identifier`;return{char:t,error:new Error(l),width:s}}return{char:t,field:i.field,desc:i.desc,width:s}}a(Je,"readFieldToken");function Ye(e,r){let t=e[++r],s=2;if(t==="'")return{char:"'",str:t,width:s};for(;;){let i=e[++r];if(++s,i===void 0){let l=`Unterminated quoted literal in pattern: ${t||e}`;return{char:"'",error:new Error(l),str:t,width:s}}else if(i==="'"){if(e[++r]!=="'")return{char:"'",str:t,width:s};++s}t+=i}}a(Ye,"readQuotedToken");function Qe(e,r){let t=e[r];if(!t)return null;if(xe(t))return Je(e,r);if(t==="'")return Ye(e,r);let s=t,i=1;for(;;){let l=e[++r];if(!l||xe(l)||l==="'")return{char:t,str:s,width:i};s+=l,i+=1}}a(Qe,"readToken");function Z(e){let r=[],t=0;for(;;){let s=Qe(e,t);if(!s)return r;r.push(s),t+=s.width}}a(Z,"parseDateTokens");function be(e,r){return e.filter(t=>t.type!=="content").length?e.map(t=>{if(t.type==="content")return r(t.value);if(t.type==="octothorpe")return"#";if(t.type==="argument")return[t.arg];if(t.type==="function"){let l=t?.param?.[0];if(t.key==="date"&&l){let c=Ve(l.value.trim(),h=>{throw new Error(`Unable to compile date expression: ${h.message}`)});return[t.arg,t.key,c]}return l?[t.arg,t.key,l.value.trim()]:[t.arg,t.key]}let s=t.pluralOffset,i={};return t.cases.forEach(({key:l,tokens:c})=>{let h=l[0]==="="?l.slice(1):l;i[h]=be(c,r)}),[t.arg,t.type,{offset:s,...i}]}):e.map(t=>r(t.value))}a(be,"processTokens");function Ve(e,r){if(/^::/.test(e)){let t=Z(e.substring(2));return se(t,void 0,r)}return e}a(Ve,"compileDateExpression");function Xe(e,r=t=>t){return be((0,_e.parse)(e),r)}a(Xe,"compileMessageOrThrow");function J(e,r=t=>t){try{return Xe(e,r)}catch(t){return console.error(`${t.message}
|
|
5
|
+
`))throw new Error("Rule should declare lineBreaks: "+T);w.push(h(I))}}var R=u&&u.fallback,L=t&&!R?"ym":"gm",H=t||R?"":"|";d===!0&&(L+="u");var qe=new RegExp(v(w)+H,L);return{regexp:qe,groups:m,fast:f,error:u||N}}a(F,"compileRules");function X(n){var o=F(C(n));return new k({start:o},"start")}a(X,"compile");function fe(n,o,u){var f=n&&(n.push||n.next);if(f&&!u[f])throw new Error("Missing state '"+f+"' (in token '"+n.defaultType+"' of state '"+o+"')");if(n&&n.pop&&+n.pop!=1)throw new Error("pop must be 1 (in token '"+n.defaultType+"' of state '"+o+"')")}a(fe,"checkStateGroup");function $e(n,o){var u=n.$all?C(n.$all):[];delete n.$all;var f=Object.getOwnPropertyNames(n);o||(o=f[0]);for(var g=Object.create(null),d=0;d<f.length;d++){var m=f[d];g[m]=C(n[m]).concat(u)}for(var d=0;d<f.length;d++)for(var m=f[d],w=g[m],y=Object.create(null),p=0;p<w.length;p++){var _=w[p];if(_.include){var D=[p,1];if(_.include!==m&&!y[_.include]){y[_.include]=!0;var q=g[_.include];if(!q)throw new Error("Cannot include nonexistent state '"+_.include+"' (in state '"+m+"')");for(var P=0;P<q.length;P++){var I=q[P];w.indexOf(I)===-1&&D.push(I)}}w.splice.apply(w,D),p--}}for(var T=Object.create(null),d=0;d<f.length;d++){var m=f[d];T[m]=F(g[m],!0)}for(var d=0;d<f.length;d++){for(var U=f[d],R=T[U],L=R.groups,p=0;p<L.length;p++)fe(L[p],U,T);for(var H=Object.getOwnPropertyNames(R.fast),p=0;p<H.length;p++)fe(R.fast[H[p]],U,T)}return new k(T,o)}a($e,"compileStates");function Be(n){for(var o=typeof Map<"u",u=o?new Map:Object.create(null),f=Object.getOwnPropertyNames(n),g=0;g<f.length;g++){var d=f[g],m=n[d],w=Array.isArray(m)?m:[m];w.forEach(function(y){if(typeof y!="string")throw new Error("keyword must be string (in keyword '"+d+"')");o?u.set(y,d):u[y]=d})}return function(y){return o?u.get(y):u[y]}}a(Be,"keywordTransform");var k=a(function(n,o){this.startState=o,this.states=n,this.buffer="",this.stack=[],this.reset()},"Lexer");k.prototype.reset=function(n,o){return this.buffer=n||"",this.index=0,this.line=o?o.line:1,this.col=o?o.col:1,this.queuedToken=o?o.queuedToken:null,this.queuedText=o?o.queuedText:"",this.queuedThrow=o?o.queuedThrow:null,this.setState(o?o.state:this.startState),this.stack=o&&o.stack?o.stack.slice():[],this},k.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedText:this.queuedText,queuedThrow:this.queuedThrow}},k.prototype.setState=function(n){if(!(!n||this.state===n)){this.state=n;var o=this.states[n];this.groups=o.groups,this.error=o.error,this.re=o.regexp,this.fast=o.fast}},k.prototype.popState=function(){this.setState(this.stack.pop())},k.prototype.pushState=function(n){this.stack.push(this.state),this.setState(n)};var Ce=t?function(n,o){return n.exec(o)}:function(n,o){var u=n.exec(o);return u[0].length===0?null:u};k.prototype._getGroup=function(n){for(var o=this.groups.length,u=0;u<o;u++)if(n[u+1]!==void 0)return this.groups[u];throw new Error("Cannot find token type for matched text")};function De(){return this.value}if(a(De,"tokenToString"),k.prototype.next=function(){var n=this.index;if(this.queuedGroup){var o=this._token(this.queuedGroup,this.queuedText,n);return this.queuedGroup=null,this.queuedText="",o}var u=this.buffer;if(n!==u.length){var m=this.fast[u.charCodeAt(n)];if(m)return this._token(m,u.charAt(n),n);var f=this.re;f.lastIndex=n;var g=Ce(f,u),d=this.error;if(g==null)return this._token(d,u.slice(n,u.length),n);var m=this._getGroup(g),w=g[0];return d.fallback&&g.index!==n?(this.queuedGroup=m,this.queuedText=w,this._token(d,u.slice(n,g.index),n)):this._token(m,w,n)}},k.prototype._token=function(n,o,u){var f=0;if(n.lineBreaks){var g=/\n/g,d=1;if(o===`
|
|
6
|
+
`)f=1;else for(;g.exec(o);)f++,d=g.lastIndex}var m={type:typeof n.type=="function"&&n.type(o)||n.defaultType,value:typeof n.value=="function"?n.value(o):o,text:o,toString:De,offset:u,lineBreaks:f,line:this.line,col:this.col},w=o.length;if(this.index+=w,this.line+=f,f!==0?this.col=w-d+1:this.col+=w,n.shouldThrow){var y=new Error(this.formatError(m,"invalid syntax"));throw y}return n.pop?this.popState():n.push?this.pushState(n.push):n.next&&this.setState(n.next),m},typeof Symbol<"u"&&Symbol.iterator){var ee=a(function(n){this.lexer=n},"LexerIterator");ee.prototype.next=function(){var n=this.lexer.next();return{value:n,done:!n}},ee.prototype[Symbol.iterator]=function(){return this},k.prototype[Symbol.iterator]=function(){return new ee(this)}}return k.prototype.formatError=function(n,o){if(n==null)var u=this.buffer.slice(this.index),n={text:u,offset:this.index,lineBreaks:u.indexOf(`
|
|
7
|
+
`)===-1?0:1,line:this.line,col:this.col};var f=2,g=Math.max(n.line-f,1),d=n.line+f,m=String(d).length,w=M(this.buffer,this.line-n.line+f+1).slice(0,5),y=[];y.push(o+" at line "+n.line+" col "+n.col+":"),y.push("");for(var p=0;p<w.length;p++){var _=w[p],D=g+p;y.push(b(String(D),m)+" "+_),D===n.line&&y.push(b("",m+n.col+1)+"^")}return y.join(`
|
|
8
|
+
`)},k.prototype.clone=function(){return new k(this.states,this.state)},k.prototype.has=function(n){return!0},{compile:X,states:$e,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:Be}})});var ge=te(A=>{"use strict";var Ne=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:!0});A.lexer=A.states=void 0;var Fe=Ne(pe());A.states={body:{doubleapos:{match:"''",value:a(()=>"'","value")},quoted:{lineBreaks:!0,match:/'[{}#](?:[^']|'')*'(?!')/u,value:a(e=>e.slice(1,-1).replace(/''/g,"'"),"value")},argument:{lineBreaks:!0,match:/\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,push:"arg",value:a(e=>e.substring(1).trim(),"value")},octothorpe:"#",end:{match:"}",pop:1},content:{lineBreaks:!0,match:/[^][^{}#']*/u}},arg:{select:{lineBreaks:!0,match:/,\s*(?:plural|select|selectordinal)\s*,\s*/u,next:"select",value:a(e=>e.split(",")[1].trim(),"value")},"func-args":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,next:"body",value:a(e=>e.split(",")[1].trim(),"value")},"func-simple":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,value:a(e=>e.substring(1).trim(),"value")},end:{match:"}",pop:1}},select:{offset:{lineBreaks:!0,match:/\s*offset\s*:\s*\d+\s*/u,value:a(e=>e.split(":")[1].trim(),"value")},case:{lineBreaks:!0,match:/\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,push:"body",value:a(e=>e.substring(0,e.indexOf("{")).trim(),"value")},end:{match:/\s*\}/u,pop:1}}};A.lexer=Fe.default.states(A.states)});var ve=te(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.ParseError=void 0;z.parse=Ue;var ye=ge(),j=a(e=>({offset:e.offset,line:e.line,col:e.col,text:e.text,lineBreaks:e.lineBreaks}),"getContext"),re=a(e=>e==="plural"||e==="select"||e==="selectordinal","isSelectType");function Ie(e,r){let t="",s="";for(let l of r){let c=l.ctx.text;switch(s+=c,l.type){case"content":t+=l.value;break;case"argument":case"function":case"octothorpe":t+=c;break;default:throw new x(e,`Unsupported part in strict mode function arg style: ${c}`)}}return[{type:"content",value:t.trim(),ctx:Object.assign({},r[0].ctx,{text:s})}]}a(Ie,"strictArgStyleParam");var Re=["number","date","time","spellout","ordinal","duration"],me=["zero","one","two","few","many","other"],x=class extends Error{static{a(this,"ParseError")}constructor(r,t){super(ye.lexer.formatError(r,t))}};z.ParseError=x;var ne=class{static{a(this,"Parser")}constructor(r,t){var s,i,l,c;this.lexer=ye.lexer.reset(r),this.cardinalKeys=(s=t?.cardinal)!==null&&s!==void 0?s:me,this.ordinalKeys=(i=t?.ordinal)!==null&&i!==void 0?i:me,this.strict=(l=t?.strict)!==null&&l!==void 0?l:!1,this.strictPluralKeys=(c=t?.strictPluralKeys)!==null&&c!==void 0?c:!0}parse(){return this.parseBody(!1,!0)}checkSelectKey(r,t,s){if(s[0]==="="){if(t==="select")throw new x(r,`The case ${s} is not valid with select`)}else if(t!=="select"){let i=t==="plural"?this.cardinalKeys:this.ordinalKeys;if(this.strictPluralKeys&&i.length>0&&!i.includes(s)){let l=`The ${t} case ${s} is not valid in this locale`;throw new x(r,l)}}}parseSelect({value:r},t,s,i){let l={type:i,arg:r,cases:[],ctx:s};i==="plural"||i==="selectordinal"?t=!0:this.strict&&(t=!1);for(let c of this.lexer)switch(c.type){case"offset":if(i==="select")throw new x(c,"Unexpected plural offset for select");if(l.cases.length>0)throw new x(c,"Plural offset must be set before cases");l.pluralOffset=Number(c.value),s.text+=c.text,s.lineBreaks+=c.lineBreaks;break;case"case":{this.checkSelectKey(c,i,c.value),l.cases.push({key:c.value,tokens:this.parseBody(t),ctx:j(c)});break}case"end":return l;default:throw new x(c,`Unexpected lexer token: ${c.type}`)}throw new x(null,"Unexpected message end")}parseArgToken(r,t){let s=j(r),i=this.lexer.next();if(!i)throw new x(null,"Unexpected message end");if(s.text+=i.text,s.lineBreaks+=i.lineBreaks,this.strict&&(i.type==="func-simple"||i.type==="func-args")&&!Re.includes(i.value)){let l=`Invalid strict mode function arg type: ${i.value}`;throw new x(r,l)}switch(i.type){case"end":return{type:"argument",arg:r.value,ctx:s};case"func-simple":{let l=this.lexer.next();if(!l)throw new x(null,"Unexpected message end");if(l.type!=="end")throw new x(l,`Unexpected lexer token: ${l.type}`);if(s.text+=l.text,re(i.value.toLowerCase()))throw new x(i,`Invalid type identifier: ${i.value}`);return{type:"function",arg:r.value,key:i.value,ctx:s}}case"func-args":{if(re(i.value.toLowerCase())){let c=`Invalid type identifier: ${i.value}`;throw new x(i,c)}let l=this.parseBody(this.strict?!1:t);return this.strict&&l.length>0&&(l=Ie(r,l)),{type:"function",arg:r.value,key:i.value,param:l,ctx:s}}case"select":if(re(i.value))return this.parseSelect(r,t,s,i.value);throw new x(i,`Unexpected select type ${i.value}`);default:throw new x(i,`Unexpected lexer token: ${i.type}`)}}parseBody(r,t){let s=[],i=null;for(let l of this.lexer)if(l.type==="argument")i&&(i=null),s.push(this.parseArgToken(l,r));else if(l.type==="octothorpe"&&r)i&&(i=null),s.push({type:"octothorpe",ctx:j(l)});else{if(l.type==="end"&&!t)return s;{let c=l.value;if(!r&&l.type==="quoted"&&c[0]==="#"){if(c.includes("{")){let h=`Unsupported escape pattern: ${c}`;throw new x(l,h)}c=l.text}i?(i.value+=c,i.ctx.text+=l.text,i.ctx.lineBreaks+=l.lineBreaks):(i={type:"content",value:c,ctx:j(l)},s.push(i))}}if(t)return s;throw new x(null,"Unexpected message end")}};function Ue(e,r={}){return new ne(e,r).parse()}a(Ue,"parse")});var _e=de(ve(),1);var E=class extends Error{static{a(this,"DateFormatError")}constructor(r,t,s){super(r),this.token=t,this.type=s||"error"}},we=a(e=>e<4?"short":e===4?"long":"narrow","alpha"),G=a(e=>e%2===0?"2-digit":"numeric","numeric");function Le(e,r){switch(e.char){case"y":return{year:G(e.width)};case"r":return{calendar:"gregory",year:"numeric"};default:return r(`${e.desc} is not supported; falling back to year:numeric`,E.WARNING),{year:"numeric"}}}a(Le,"yearOptions");function ze(e,r){switch(e.width){case 1:return"numeric";case 2:return"2-digit";case 3:return"short";case 4:return"long";case 5:return"narrow";default:r(`${e.desc} is not supported with width ${e.width}`);return}}a(ze,"monthStyle");function Ge(e,r){let{char:t,desc:s,width:i}=e;if(t==="d")return G(i);r(`${s} is not supported`)}a(Ge,"dayStyle");function Ke(e,r){let{char:t,desc:s,width:i}=e;if((t==="c"||t==="e")&&i<3){let l=`Numeric value is not supported for ${s}; falling back to weekday:short`;r(l,E.WARNING)}return we(i)}a(Ke,"weekdayStyle");function He(e){let r=G(e.width),t;switch(e.char){case"h":t="h12";break;case"H":t="h23";break;case"k":t="h24";break;case"K":t="h11";break}return t?{hour:r,hourCycle:t}:{hour:r}}a(He,"hourOptions");function We(e,r){let{char:t,desc:s,width:i}=e;switch(t){case"v":case"z":return i===4?"long":"short";case"V":if(i===4)return"long";r(`${s} is not supported with width ${i}`);return;case"X":r(`${s} is not supported`);return}return"short"}a(We,"timeZoneNameStyle");function je(e,r){switch(e.field){case"era":return{era:we(e.width)};case"year":return Le(e,r);case"month":return{month:ze(e,r)};case"day":return{day:Ge(e,r)};case"weekday":return{weekday:Ke(e,r)};case"period":return;case"hour":return He(e);case"min":return{minute:G(e.width)};case"sec":return{second:G(e.width)};case"tz":return{timeZoneName:We(e,r)};case"quarter":case"week":case"sec-frac":case"ms":r(`${e.desc} is not supported`)}}a(je,"compileOptions");function se(e,r,t=s=>{throw s}){let s={timeZone:r},i=[];for(let l of e){let{error:c,field:h,str:v}=l;if(c){let b=new E(c.message,l);b.stack=c.stack,t(b)}if(v){let b=`Ignoring string part: ${v}`;t(new E(b,l,E.WARNING))}h&&(i.indexOf(h)===-1?i.push(h):t(new E(`Duplicate ${h} token`,l)));let S=je(l,(b,M)=>t(new E(b,l,M)));S&&Object.assign(s,S)}return s}a(se,"getDateFormatOptions");var Ze={G:{field:"era",desc:"Era"},y:{field:"year",desc:"Year"},Y:{field:"year",desc:'Year of "Week of Year"'},u:{field:"year",desc:"Extended year"},U:{field:"year",desc:"Cyclic year name"},r:{field:"year",desc:"Related Gregorian year"},Q:{field:"quarter",desc:"Quarter"},q:{field:"quarter",desc:"Stand-alone quarter"},M:{field:"month",desc:"Month in year"},L:{field:"month",desc:"Stand-alone month in year"},w:{field:"week",desc:"Week of year"},W:{field:"week",desc:"Week of month"},d:{field:"day",desc:"Day in month"},D:{field:"day",desc:"Day of year"},F:{field:"day",desc:"Day of week in month"},g:{field:"day",desc:"Modified julian day"},E:{field:"weekday",desc:"Day of week"},e:{field:"weekday",desc:"Local day of week"},c:{field:"weekday",desc:"Stand-alone local day of week"},a:{field:"period",desc:"AM/PM marker"},b:{field:"period",desc:"AM/PM/noon/midnight marker"},B:{field:"period",desc:"Flexible day period"},h:{field:"hour",desc:"Hour in AM/PM (1~12)"},H:{field:"hour",desc:"Hour in day (0~23)"},k:{field:"hour",desc:"Hour in day (1~24)"},K:{field:"hour",desc:"Hour in AM/PM (0~11)"},j:{field:"hour",desc:"Hour in preferred cycle"},J:{field:"hour",desc:"Hour in preferred cycle without marker"},C:{field:"hour",desc:"Hour in preferred cycle with flexible marker"},m:{field:"min",desc:"Minute in hour"},s:{field:"sec",desc:"Second in minute"},S:{field:"sec-frac",desc:"Fractional second"},A:{field:"ms",desc:"Milliseconds in day"},z:{field:"tz",desc:"Time Zone: specific non-location"},Z:{field:"tz",desc:"Time Zone"},O:{field:"tz",desc:"Time Zone: localized"},v:{field:"tz",desc:"Time Zone: generic non-location"},V:{field:"tz",desc:"Time Zone: ID"},X:{field:"tz",desc:"Time Zone: ISO8601 with Z"},x:{field:"tz",desc:"Time Zone: ISO8601"}},xe=a(e=>e>="A"&&e<="Z"||e>="a"&&e<="z","isLetter");function Je(e,r){let t=e[r],s=1;for(;e[++r]===t;)++s;let i=Ze[t];if(!i){let l=`The letter ${t} is not a valid field identifier`;return{char:t,error:new Error(l),width:s}}return{char:t,field:i.field,desc:i.desc,width:s}}a(Je,"readFieldToken");function Ye(e,r){let t=e[++r],s=2;if(t==="'")return{char:"'",str:t,width:s};for(;;){let i=e[++r];if(++s,i===void 0){let l=`Unterminated quoted literal in pattern: ${t||e}`;return{char:"'",error:new Error(l),str:t,width:s}}else if(i==="'"){if(e[++r]!=="'")return{char:"'",str:t,width:s};++s}t+=i}}a(Ye,"readQuotedToken");function Qe(e,r){let t=e[r];if(!t)return null;if(xe(t))return Je(e,r);if(t==="'")return Ye(e,r);let s=t,i=1;for(;;){let l=e[++r];if(!l||xe(l)||l==="'")return{char:t,str:s,width:i};s+=l,i+=1}}a(Qe,"readToken");function Z(e){let r=[],t=0;for(;;){let s=Qe(e,t);if(!s)return r;r.push(s),t+=s.width}}a(Z,"parseDateTokens");function ke(e,r){return e.filter(t=>t.type!=="content").length?e.map(t=>{if(t.type==="content")return r(t.value);if(t.type==="octothorpe")return"#";if(t.type==="argument")return[t.arg];if(t.type==="function"){let l=t?.param?.[0];if(t.key==="date"&&l){let c=Ve(l.value.trim(),h=>{throw new Error(`Unable to compile date expression: ${h.message}`)});return[t.arg,t.key,c]}return l?[t.arg,t.key,l.value.trim()]:[t.arg,t.key]}let s=t.pluralOffset,i={};return t.cases.forEach(({key:l,tokens:c})=>{let h=l[0]==="="?l.slice(1):l;i[h]=ke(c,r)}),[t.arg,t.type,{offset:s,...i}]}):e.map(t=>r(t.value))}a(ke,"processTokens");function Ve(e,r){if(/^::/.test(e)){let t=Z(e.substring(2));return se(t,void 0,r)}return e}a(Ve,"compileDateExpression");function Xe(e,r=t=>t){return ke((0,_e.parse)(e),r)}a(Xe,"compileMessageOrThrow");function J(e,r=t=>t){try{return Xe(e,r)}catch(t){return console.error(`${t.message}
|
|
9
9
|
|
|
10
|
-
Message: ${e}`),[e]}}a(J,"compileMessage");var B=a(e=>typeof e=="string","isString"),et=a(e=>typeof e=="function","isFunction"),
|
|
10
|
+
Message: ${e}`),[e]}}a(J,"compileMessage");var B=a(e=>typeof e=="string","isString"),et=a(e=>typeof e=="function","isFunction"),be=new Map,Te="en";function le(e){return[...Array.isArray(e)?e:[e],Te]}a(le,"normalizeLocales");function ce(e,r,t){let s=le(e);t||(t="default");let i;if(typeof t=="string")switch(i={day:"numeric",month:"short",year:"numeric"},t){case"full":i.weekday="long";case"long":i.month="long";break;case"short":i.month="numeric";break}else i=t;return Y(()=>Q("date",s,t),()=>new Intl.DateTimeFormat(s,i)).format(B(r)?new Date(r):r)}a(ce,"date");function tt(e,r,t){let s;if(t||(t="default"),typeof t=="string")switch(s={second:"numeric",minute:"numeric",hour:"numeric"},t){case"full":case"long":s.timeZoneName="short";break;case"short":delete s.second}else s=t;return ce(e,r,s)}a(tt,"time");function ie(e,r,t){let s=le(e);return Y(()=>Q("number",s,t),()=>new Intl.NumberFormat(s,t)).format(r)}a(ie,"number");function Se(e,r,t,{offset:s=0,...i}){let l=le(e),c=r?Y(()=>Q("plural-ordinal",l),()=>new Intl.PluralRules(l,{type:"ordinal"})):Y(()=>Q("plural-cardinal",l),()=>new Intl.PluralRules(l,{type:"cardinal"}));return i[t]??i[c.select(t-s)]??i.other}a(Se,"plural");function Y(e,r){let t=e(),s=be.get(t);return s||(s=r(),be.set(t,s)),s}a(Y,"getMemoized");function Q(e,r,t){let s=r.join("-");return`${e}-${s}-${JSON.stringify(t)}`}a(Q,"cacheKey");var Ee=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Oe=a(e=>e.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(r,t,s)=>{if(t){let i=parseInt(t,16);return String.fromCharCode(i)}else{let i=parseInt(s,16);return String.fromCharCode(i)}}),"decodeEscapeSequences"),Ae="%__lingui_octothorpe__%",rt=a((e,r,t={})=>{let s=r||e,i=a(c=>typeof c=="object"?c:t[c],"style"),l=a((c,h)=>{let v=Object.keys(t).length?i("number"):void 0,S=ie(s,c,v);return h.replace(new RegExp(Ae,"g"),S)},"replaceOctothorpe");return{plural:a((c,h)=>{let{offset:v=0}=h,S=Se(s,!1,c,h);return l(c-v,S)},"plural"),selectordinal:a((c,h)=>{let{offset:v=0}=h,S=Se(s,!0,c,h);return l(c-v,S)},"selectordinal"),select:nt,number:a((c,h)=>ie(s,c,i(h)||{style:h}),"number"),date:a((c,h)=>ce(s,c,i(h)||h),"date"),time:a((c,h)=>tt(s,c,i(h)||h),"time")}},"getDefaultFormats"),nt=a((e,r)=>r[e]??r.other,"selectFormatter");function st(e,r,t){return(s={},i)=>{let l=rt(r,t,i),c=a((v,S=!1)=>Array.isArray(v)?v.reduce((b,M)=>{if(M==="#"&&S)return b+Ae;if(B(M))return b+M;let[K,O,$]=M,C={};O==="plural"||O==="selectordinal"||O==="select"?Object.entries($).forEach(([F,X])=>{C[F]=c(X,O==="plural"||O==="selectordinal")}):C=$;let N;if(O){let F=l[O];N=F(s[K],C)}else N=s[K];return N==null?b:b+N},""):v,"formatMessage"),h=c(e);return B(h)&&Ee.test(h)?Oe(h):B(h)?h:h?String(h):""}}a(st,"interpolate");var ae=class{static{a(this,"EventEmitter")}_events={};on(r,t){return this._events[r]??=new Set,this._events[r].add(t),()=>this.removeListener(r,t)}removeListener(r,t){let s=this._events[r];s?.delete(t),s?.size===0&&delete this._events[r]}emit(r,...t){let s=this._events[r];if(s)for(let i of[...s])i.apply(this,t)}},oe=class extends ae{static{a(this,"I18n")}_locale="";_locales;_messages={};_missing;_messageCompiler;constructor(r){super(),this.setMessagesCompiler(J),r.missing!=null&&(this._missing=r.missing),r.messages!=null&&this.load(r.messages),(typeof r.locale=="string"||r.locales)&&this.activate(r.locale??Te,r.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}setMessagesCompiler(r){return this._messageCompiler=r,this}_load(r,t){let s=this._messages[r];s?Object.assign(s,t):this._messages[r]=t}load(r,t){typeof r=="string"&&typeof t=="object"?this._load(r,t):Object.entries(r).forEach(([s,i])=>this._load(s,i)),this.emit("change")}loadAndActivate({locale:r,locales:t,messages:s}){this._locale=r,this._locales=t||void 0,this._messages[this._locale]=s,this.emit("change")}activate(r,t){this._messages[r]||console.warn(`Messages for locale "${r}" not loaded.`),this._locale=r,this._locales=t,this.emit("change")}_(r,t,s){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let i=s?.message;r||(r=""),B(r)||(t=r.values||t,i=r.message,r=r.id);let l=this.messages[r],c=l===void 0,h=this._missing;if(h&&c)return et(h)?h(this._locale,r):h;c&&this.emit("missing",{id:r,locale:this._locale});let v=l||i||r;return B(v)&&(this._messageCompiler?v=this._messageCompiler(v):console.warn(`Uncompiled message detected! Message:
|
|
11
11
|
|
|
12
12
|
> ${v}
|
|
13
13
|
|
|
@@ -15,5 +15,5 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
15
15
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
16
16
|
|
|
17
17
|
Please compile your catalog first.
|
|
18
|
-
`)),B(v)&&Ee.test(v)?Oe(v):B(v)?v:st(v,this._locale,this._locales)(t,s?.formats)}t=this._.bind(this);date(r,t){return ce(this._locales||this._locale,r,t)}number(r,t){return ie(this._locales||this._locale,r,t)}};function ue(e={}){return new oe(e)}a(ue,"setupI18n");var
|
|
19
|
-
`):void 0},"errorHint"),
|
|
18
|
+
`)),B(v)&&Ee.test(v)?Oe(v):B(v)?v:st(v,this._locale,this._locales)(t,s?.formats)}t=this._.bind(this);date(r,t){return ce(this._locales||this._locale,r,t)}number(r,t){return ie(this._locales||this._locale,r,t)}};function ue(e={}){return new oe(e)}a(ue,"setupI18n");var Pt=ue();var V=de(Pe(),1);var it={},Me="en",at={en:it},ot=a((e=Me,r=at)=>{let t=ue();t.setMessagesCompiler(J);for(let[s,i]of Object.entries(r))t.load(s,i);return t.activate(r[e]===void 0?Me:e),t},"createStudioI18n"),lt=ot(),ct=(0,V.createContext)(lt),Ut=a(()=>{let e=(0,V.use)(ct);return(r,t)=>e._(r,t)},"useT");var Gt=a((e,r,t,s,i)=>{switch(r){case"action":return e.action(t,s,i);case"mutation":return e.mutation(t,s,i);default:return e.query(t,s,i)}},"dispatchByKind"),Kt=a(e=>({__lunoraRef:e}),"adminRef"),Ht=a(e=>{let r=e.trim();return r===""?{}:{shardKey:r}},"callOptions"),Wt=a(e=>e instanceof Error?e.message:String(e),"errorMessage"),jt=a(e=>{if(e===null||typeof e!="object"||!("hint"in e))return;let{hint:r}=e;return typeof r=="string"?r:Array.isArray(r)?r.filter(t=>typeof t=="string").join(`
|
|
19
|
+
`):void 0},"errorHint"),Zt=a(e=>{if(e===null||typeof e!="object"||!("docsUrl"in e))return;let r=e.docsUrl;if(typeof r=="string")try{let{protocol:t}=new URL(r);return t==="http:"||t==="https:"?r:void 0}catch{return}},"errorDocumentationUrl"),Jt=a(e=>{if(e==null)return"";switch(typeof e){case"bigint":case"boolean":case"number":return e.toString();case"string":return e;case"symbol":return e.toString();default:return JSON.stringify(e)}},"formatCell"),ut=a((e,r)=>{e.catch(t=>{})},"fireAndForget"),Yt=a(e=>{if(e!==void 0&&e!=="")return e;let r=globalThis.location;return r?.origin!==void 0&&r.origin!==""?r.origin:"http://localhost:5173"},"resolveOrigin"),Qt=a(e=>{let r="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return r===void 0?!1:(ut(r.writeText(e)),!0)},"copyToClipboard"),Vt=a(e=>{if(e==null)return"\u2014";if(e<1024)return`${e.toString()} B`;let r=["KB","MB","GB","TB"],t=e/1024,s=0;for(;t>=1024&&s<r.length-1;)t/=1024,s+=1;return`${t.toFixed(1)} ${r[s]??"TB"}`},"formatBytes"),Xt=a((e,r="")=>{if(e==null||e==="")return r;let t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()},"formatTimestamp");export{ot as a,lt as b,ct as c,Ut as d,Gt as e,Kt as f,Ht as g,Wt as h,jt as i,Zt as j,Jt as k,ut as l,Yt as m,Qt as n,Vt as o,Xt as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as u}from"./chunk-
|
|
1
|
+
import{a as d,b as u}from"./chunk-X4QFAAZ5.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import"./chunk-HV7G6DFP.js";import"./chunk-3OA7PECS.js";import"./chunk-22C6COGE.js";import{a as c,e as m,g as p,h as v}from"./chunk-RRCPZMC2.js";var h=m(p(),1);var o=m(v(),1);var y={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},g=c(n=>{let e=(0,h.c)(6),{data:i}=n,a,r;if(e[0]!==i){r=Symbol.for("react.early_return_sentinel");e:{let f=i.slice(-16);if(f.length<3){r=null;break e}a=f.map(_)}e[0]=i,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;let s=a,t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.jsxDEV)(u,{dataKey:"value"},void 0,!1),e[3]=t):t=e[3];let l;return e[4]!==s?(l=(0,o.jsxDEV)("div",{"aria-hidden":"true",className:"h-8 w-28",children:(0,o.jsxDEV)(d,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:y,data:s,children:t},void 0,!1)},void 0,!1),e[4]=s,e[5]=l):l=e[5],l},"Sparkline");function _(n,e){return{index:e,value:n}}c(_,"_temp");export{g as Sparkline};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as N,
|
|
1
|
+
import{d as N,k as x}from"./chunk-ITQKVEP7.js";import{a as m,e as w,g as y,h as C}from"./chunk-RRCPZMC2.js";var v=w(y(),1);var o=w(C(),1);var T=m(b=>{let e=(0,v.c)(8),{value:l}=b;if(l==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,o.jsxDEV)("span",{className:"text-muted-foreground/50 italic",children:"NULL"},void 0,!1),e[0]=a):a=e[0],a}let t;e[1]!==l?(t=x(l),e[1]=l,e[2]=t):t=e[2];let r;e[3]!==l?(r=x(l),e[3]=l,e[4]=r):r=e[4];let s;return e[5]!==t||e[6]!==r?(s=(0,o.jsxDEV)("span",{title:t,children:r},void 0,!1),e[5]=t,e[6]=r,e[7]=s):s=e[7],s},"CellValue"),G=m(b=>{let e=(0,v.c)(22),{columns:l,rows:t}=b,r=N(),s;e[0]!==r?(s=r("Field"),e[0]=r,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,o.jsxDEV)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:s},void 0,!1),e[2]=s,e[3]=a):a=e[3];let i;if(e[4]!==t||e[5]!==r){let d;e[7]!==r?(d=m((u,h)=>(0,o.jsxDEV)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:r("Row {n}",{n:h+1})},h,!1),"t42"),e[7]=r,e[8]=d):d=e[8],i=t.map(d),e[4]=t,e[5]=r,e[6]=i}else i=e[6];let n;e[9]!==a||e[10]!==i?(n=(0,o.jsxDEV)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,o.jsxDEV)("tr",{children:[a,i]},void 0,!0)},void 0,!1),e[9]=a,e[10]=i,e[11]=n):n=e[11];let f;if(e[12]!==l||e[13]!==t){let d;e[15]!==t?(d=m(u=>(0,o.jsxDEV)("tr",{className:"hover:bg-muted/40",children:[(0,o.jsxDEV)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:u},void 0,!1),t.map((h,g)=>(0,o.jsxDEV)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,o.jsxDEV)(T,{value:h[u]},void 0,!1)},g,!1))]},u,!0),"t62"),e[15]=t,e[16]=d):d=e[16],f=l.map(d),e[12]=l,e[13]=t,e[14]=f}else f=e[14];let c;e[17]!==f?(c=(0,o.jsxDEV)("tbody",{children:f},void 0,!1),e[17]=f,e[18]=c):c=e[18];let p;return e[19]!==n||e[20]!==c?(p=(0,o.jsxDEV)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,o.jsxDEV)("table",{className:"border-collapse text-xs",children:[n,c]},void 0,!0)},void 0,!1),e[19]=n,e[20]=c,e[21]=p):p=e[21],p},"TransposedTable"),L=m(({children:b,layout:e="card",testId:l})=>(0,o.jsxDEV)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:b},void 0,!1),"GridContainer");export{T as a,G as b,L as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,b as S}from"./chunk-
|
|
1
|
+
import{a as g,b as S}from"./chunk-X4QFAAZ5.js";import{a as i,e as m,g as v,h as C,j as d}from"./chunk-RRCPZMC2.js";var w=i(e=>{let t=0,n=0,o=0,r=0,s=0,l=0,c=0;for(let{metrics:a}of e){if(a===null){s+=1;continue}r+=1,t+=a.requests,n+=a.errors,o+=a.databaseSize??0,a.cache!==null&&(l+=a.cache.hits,c+=a.cache.hits+a.cache.misses)}return{failed:s,hitRate:c===0?null:l/c,reachable:r,totalDatabaseSize:o,totalErrors:n,totalRequests:t}},"aggregateMetrics"),E=i((e,t)=>{let n=new Set,o=[];for(let r of["",e.trim(),...t])n.has(r)||(n.add(r),o.push(r));return o},"shardsToAggregate"),x=i((e,t)=>{if(e.length===0)return 0;if(e.sort((o,r)=>o-r),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let n=Math.ceil(t/100*e.length)-1;return e[n]??0},"percentile"),N=i(e=>{let n=e.functions;if(!n||n.length===0)return{p90:0,p95:0};let o=1e3,r=[];for(let s of n){if(s.calls<=0)continue;let l=s.totalDurationMs/s.calls,c=Math.min(s.calls,o);for(let a=0;a<c;a+=1)r.push(l)}return r.length===0?{p90:0,p95:0}:{p90:x([...r],90),p95:x([...r],95)}},"computeLatencyPercentiles");var _=i(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"enrichQueryStats");var b=m(v(),1);var p=m(C(),1);var D={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},P=i(e=>{let t=(0,b.c)(12),{ariaLabel:n,className:o,series:r,testId:s}=e;if(r.length<2)return null;let l;t[0]!==r?(l=r.slice(-40).map(M),t[0]=r,t[1]=l):l=t[1];let c=l,a;t[2]!==o?(a=d("h-6 w-[120px]",o),t[2]=o,t[3]=a):a=t[3];let u;t[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,p.jsxDEV)(S,{dataKey:"value"},void 0,!1),t[4]=u):u=t[4];let f;t[5]!==c?(f=(0,p.jsxDEV)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:D,data:c,children:u},void 0,!1),t[5]=c,t[6]=f):f=t[6];let h;return t[7]!==n||t[8]!==a||t[9]!==f||t[10]!==s?(h=(0,p.jsxDEV)("div",{"aria-label":n,className:a,"data-testid":s,role:"img",children:f},void 0,!1),t[7]=n,t[8]=a,t[9]=f,t[10]=s,t[11]=h):h=t[11],h},"Sparkline");function M(e,t){return{index:t,value:e}}i(M,"_temp");export{w as a,E as b,N as c,_ as d,P as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A}from"./chunk-
|
|
1
|
+
import{a as A}from"./chunk-HVRDZZHL.js";import{a as y,e as I}from"./chunk-SEU5V7I6.js";import{b as m}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as k}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as u,e as w,g as S,h as P}from"./chunk-RRCPZMC2.js";var N=w(S(),1);var a=w(P(),1);var z=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],b=u(e=>{if(e===void 0)return"\u2014";let l=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,o]of l)if(e>=t&&e%t===0)return`${String(e/t)}${o}`;return`${String(e)}s`},"formatDuration"),h=u(e=>{let l=(0,N.c)(8),{children:t,heading:o,testId:r}=e,i;l[0]!==o?(i=(0,a.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1)},void 0,!1),l[0]=o,l[1]=i):i=l[1];let s;l[2]!==t?(s=(0,a.jsxDEV)(I,{className:"p-3",children:t},void 0,!1),l[2]=t,l[3]=s):s=l[3];let c;return l[4]!==i||l[5]!==s||l[6]!==r?(c=(0,a.jsxDEV)(y,{className:"gap-0 py-0","data-testid":r,children:[i,s]},void 0,!0),l[4]=i,l[5]=s,l[6]=r,l[7]=c):c=l[7],c},"ConfigCard"),d=u(e=>{let l=(0,N.c)(7),{label:t,value:o}=e,r;l[0]!==t?(r=(0,a.jsxDEV)("span",{className:"text-sm",children:t},void 0,!1),l[0]=t,l[1]=r):r=l[1];let i;l[2]!==o?(i=(0,a.jsxDEV)("span",{className:"text-sm text-muted-foreground tabular-nums",children:o},void 0,!1),l[2]=o,l[3]=i):i=l[3];let s;return l[4]!==r||l[5]!==i?(s=(0,a.jsxDEV)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,i]},void 0,!0),l[4]=r,l[5]=i,l[6]=s):s=l[6],s},"KeyValue"),O=u(()=>{let e=(0,N.c)(20),l=k(),t=C(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],e[0]=o):o=e[0];let r;e[1]!==l?(r=u(()=>l.getAuthConfig(),"t1"),e[1]=l,e[2]=r):r=e[2];let{data:i,error:s}=A(o,r),c;e[3]!==t?(c=u(n=>(0,a.jsxDEV)(m,{variant:n?"success":"outline",children:t(n?"Enabled":"Disabled")},void 0,!1),"t2"),e[3]=t,e[4]=c):c=e[4];let f=c,g;e[5]!==s?(g=s!==null&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s},void 0,!1),e[5]=s,e[6]=g):g=e[6];let p;e[7]!==i||e[8]!==s||e[9]!==t?(p=s===null&&i===void 0&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")},void 0,!1),e[7]=i,e[8]=s,e[9]=t,e[10]=p):p=e[10];let v;e[11]!==i||e[12]!==s||e[13]!==f||e[14]!==t?(v=s===null&&i!==void 0&&(0,a.jsxDEV)(a.Fragment,{children:[(0,a.jsxDEV)(h,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsxDEV)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:z.map(n=>{let $=i.capabilities[n.key];return(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${n.key}`,children:[(0,a.jsxDEV)("span",{className:"text-sm",children:t(n.label)},void 0,!1),f($)]},n.key,!0)})},void 0,!1)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Plugins"),testId:"auth-config-plugins",children:i.plugins.length===0?(0,a.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")},void 0,!1):(0,a.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:i.plugins.map(L)},void 0,!1)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Email & password"),value:f(i.emailAndPassword)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Social providers"),value:i.socialProviders.length===0?t("None"):(0,a.jsxDEV)("span",{className:"flex flex-wrap justify-end gap-1",children:i.socialProviders.map(j)},void 0,!1)},void 0,!1)]},void 0,!0)},void 0,!1),i.organization.enabled&&(0,a.jsxDEV)(h,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Teams"),value:f(i.organization.teams)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Custom roles"),value:f(i.organization.roles)},void 0,!1)]},void 0,!0)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Expires in"),value:b(i.session.expiresIn)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Refresh after"),value:b(i.session.updateAge)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Fresh window"),value:b(i.session.freshAge)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Cookie cache"),value:f(i.session.cookieCache===!0)},void 0,!1)]},void 0,!0)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Status"),value:f(i.rateLimit.enabled)},void 0,!1),i.rateLimit.enabled&&(0,a.jsxDEV)(a.Fragment,{children:[(0,a.jsxDEV)(d,{label:t("Max requests"),value:i.rateLimit.max??"\u2014"},void 0,!1),(0,a.jsxDEV)(d,{label:t("Window"),value:b(i.rateLimit.window)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),i.userFields.length>0&&(0,a.jsxDEV)(h,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsxDEV)("ul",{className:"flex flex-col gap-2",children:i.userFields.map(n=>(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${n.name}`,children:[(0,a.jsxDEV)("span",{className:"flex flex-col",children:[(0,a.jsxDEV)("span",{className:"font-mono text-xs",children:n.name},void 0,!1),n.plugin!==void 0&&(0,a.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:n.plugin},void 0,!1)]},void 0,!0),(0,a.jsxDEV)("span",{className:"flex items-center gap-1",children:[(0,a.jsxDEV)(m,{variant:"outline",children:n.type},void 0,!1),n.required&&(0,a.jsxDEV)(m,{variant:"secondary",children:t("required")},void 0,!1),n.unique&&(0,a.jsxDEV)(m,{variant:"secondary",children:t("unique")},void 0,!1)]},void 0,!0)]},n.name,!0))},void 0,!1)},void 0,!1),(0,a.jsxDEV)(y,{className:"gap-0 py-0",children:(0,a.jsxDEV)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")},void 0,!1)},void 0,!1)]},void 0,!0),e[11]=i,e[12]=s,e[13]=f,e[14]=t,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==p||e[18]!==v?(x=(0,a.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,p,v]},void 0,!0),e[16]=g,e[17]=p,e[18]=v,e[19]=x):x=e[19],x},"AuthConfigPanel");function L(e){return(0,a.jsxDEV)(m,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e,!1)}u(L,"_temp");function j(e){return(0,a.jsxDEV)(m,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e,!1)}u(j,"_temp2");export{O as AuthConfigPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as le}from"./chunk-AITOCPML.js";import{a as te}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{a as ae,b as se,c as oe,d as Q,e as $,f as z}from"./chunk-GTM65MVX.js";import{a as re}from"./chunk-VLXV72QE.js";import{a as C}from"./chunk-JSEXCW5Q.js";import{a as ee}from"./chunk-DH4K2OLM.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as E}from"./chunk-3CJW6NWG.js";import{c as k}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as L}from"./chunk-BOXSWNXZ.js";import{a as J}from"./chunk-TAD43CG5.js";import{b as U}from"./chunk-HVRDZZHL.js";import{a as j,b as K,c as V,d as Y,e as q}from"./chunk-SEU5V7I6.js";import{b as I}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as W}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as O,f as G,g as X,h as Z,l as D}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as n,e as B,f as ve,g as he,h as xe}from"./chunk-RRCPZMC2.js";var c=B(ve(),1);var ne=B(he(),1);var e=B(xe(),1);var ie=["read","insert","update","delete"],ye=n((a,t)=>({delete:a("Delete"),insert:a("Insert"),read:a("Read"),update:a("Update")})[t],"operationLabel"),ge=n(a=>{let t=new Set;for(let l of a?.advisories??[])if(l.name==="rls_uncovered_table"){let{table:r}=l.metadata;typeof r=="string"&&r!==""&&t.add(r)}return t},"uncoveredTables"),be=n((a,t,l)=>{let r=new Map,s=n(o=>{let d=r.get(o);if(d!==void 0)return d;let i={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:o,uncovered:l.has(o)};return r.set(o,i),i},"ensure");for(let o of a)s(o.table).cells[o.on]={procedure:o.procedure};for(let o of t){let d=s(o.table);d.maskedColumns.includes(o.column)||d.maskedColumns.push(o.column)}for(let o of l)s(o);return[...r.values()].toSorted((o,d)=>o.table.localeCompare(d.table))},"buildRows"),Ne=n(a=>{let t=(0,ne.c)(17),l;t[0]!==a?(l=a===void 0?{}:a,t[0]=a,t[1]=l):l=t[1];let{onProbe:r}=l,s=O(),o,d;t[2]===Symbol.for("react.memo_cache_sentinel")?(o={},d={live:!0},t[2]=o,t[3]=d):(o=t[2],d=t[3]);let i=U(L.rlsPolicies,o,d),x;t[4]===Symbol.for("react.memo_cache_sentinel")?(x={},t[4]=x):x=t[4];let p=U(L.maskPolicies,x),v;t[5]===Symbol.for("react.memo_cache_sentinel")?(v={},t[5]=v):v=t[5];let b=U(L.getAdvisories,v),N;if(t[6]!==b.data||t[7]!==p.data||t[8]!==r||t[9]!==i||t[10]!==s){let g=null;i.data!==void 0&&(g=Array.isArray(i.data.policies)?i.data.policies:[]);let _=Array.isArray(p.data?.columns)?p.data.columns:[],F=b.data??null,{error:h,errorSource:m,liveError:P}=i,A=g===null?[]:be(g,_,ge(F)),T;t[12]!==P?(T=(0,e.jsxDEV)("div",{className:"flex items-center justify-end",children:(0,e.jsxDEV)(le,{message:P,prefix:"pm"},void 0,!1)},void 0,!1),t[12]=P,t[13]=T):T=t[13];let y;t[14]!==h||t[15]!==m?(y=h!==null&&(0,e.jsxDEV)(te,{error:m,testId:"pm-error"},void 0,!1),t[14]=h,t[15]=m,t[16]=y):y=t[16],N=(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[T,y,g!==null&&A.length===0?(0,e.jsxDEV)(J,{description:s("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:s("No policy")},void 0,!1):(0,e.jsxDEV)(ae,{"data-testid":"pm-table",children:[(0,e.jsxDEV)(se,{children:(0,e.jsxDEV)(Q,{children:[(0,e.jsxDEV)($,{children:s("Table")},void 0,!1),ie.map(u=>(0,e.jsxDEV)($,{children:ye(s,u)},u,!1)),(0,e.jsxDEV)($,{children:s("Masked columns")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(oe,{children:A.map(u=>(0,e.jsxDEV)(Q,{"data-testid":`pm-row-${u.table}`,children:[(0,e.jsxDEV)(z,{className:"font-mono text-xs",children:(0,e.jsxDEV)("span",{className:"flex items-center gap-1.5",children:[u.table,u.uncovered&&(0,e.jsxDEV)(I,{"data-testid":`pm-uncovered-${u.table}`,title:s("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:s("Uncovered \u2014 reachable without a policy")},void 0,!1)]},void 0,!0)},void 0,!1),ie.map(w=>{let R=u.cells[w];return(0,e.jsxDEV)(z,{"data-testid":`pm-cell-${u.table}-${w}`,children:R.procedure===void 0?(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:s("No policy")},void 0,!1):(0,e.jsxDEV)("span",{className:"flex flex-col gap-1",children:[(0,e.jsxDEV)(I,{variant:"secondary",children:s("Covered by {procedure}",{procedure:R.procedure})},void 0,!1),r!==void 0&&(0,e.jsxDEV)(k,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${u.table}-${w}`,onClick:n(()=>{r(u.table,w,R.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Probe this")},void 0,!1)]},void 0,!0)},w,!1)}),(0,e.jsxDEV)(z,{children:u.maskedColumns.length===0?(0,e.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,e.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:u.maskedColumns.map(ke)},void 0,!1)},void 0,!1)]},u.table,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),t[6]=b.data,t[7]=p.data,t[8]=r,t[9]=i,t[10]=s,t[11]=N}else N=t[11];return N},"PermissionsMatrix");function ke(a){return(0,e.jsxDEV)(I,{variant:"outline",children:a},a,!1)}n(ke,"_temp");var Ce=G(L.runAs),we=n(()=>{let a=W();return async({args:t,functionPath:l,shardKey:r="",userId:s})=>{let o=Ce;try{return{kind:"allowed",value:await a.query(o,{args:t,functionPath:l,userId:s},X(r))}}catch(d){return{kind:"denied",message:d instanceof Error?d.message:String(d)}}}},"useRunAsProbe"),Se=n(a=>a===void 0?"undefined":JSON.stringify(a,null,2),"formatValue"),Pe=n(({functions:a,prefill:t,runAsIdentity:l=!1}={})=>{let r=W(),s=O(),o=we(),[d,i]=(0,c.useState)(null),[x,p]=(0,c.useState)(null),v=a??d??[],[b,N]=(0,c.useState)(""),[g,_]=(0,c.useState)("{}"),[F,h]=(0,c.useState)(""),[m,P]=(0,c.useState)(""),[A,T]=(0,c.useState)(!1),[y,u]=(0,c.useState)(null),[w,R]=(0,c.useState)(null),H=(0,c.useRef)(-1);(0,c.useEffect)(()=>{if(a!==void 0)return;let f=!1;return r.listFunctions().then(S=>(f||i(S),S)).catch(S=>{f||p(Z(S))}),()=>{f=!0}},[r,a]),(0,c.useEffect)(()=>{if(t===void 0||H.current===t.nonce)return;H.current=t.nonce;let f=t.functionPath;queueMicrotask(()=>{N(f),u(null)})},[t]);let M=b===""?v[0]?.path??"":b,ce=n(async()=>{if(M==="")return;let f;try{f=g.trim()===""?{}:JSON.parse(g)}catch(S){R(s("Invalid JSON args: {message}",{message:S.message})),u(null);return}R(null),T(!0);try{let S=await o({args:f,functionPath:M,shardKey:F.trim(),userId:m.trim()});u(S)}finally{T(!1)}},"run"),fe=n(()=>{D(ce())},"runOnce"),ue=n(f=>{N(f.target.value)},"onSelectChange"),me=n(f=>{_(f.target.value)},"onArgsChange"),pe=n(f=>{P(f.target.value)},"onUserIdChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[x!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:x},void 0,!1),!l&&(0,e.jsxDEV)(J,{description:s("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:s("Set `runAsIdentity` to forge an identity and probe access.")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)(C,{htmlFor:"pp-function",children:s("Function")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":s("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:ue,value:M,children:v.map(f=>(0,e.jsxDEV)("option",{value:f.path,children:[f.path," (",f.kind,")"]},f.path,!0))},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)(C,{htmlFor:"pp-args",children:s("Arguments")},void 0,!1),(0,e.jsxDEV)(re,{"aria-label":s("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:me,value:g},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(ee,{onChange:h,testId:"pp-shard",value:F},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)(C,{htmlFor:"pp-user",children:s("Run as (userId)")},void 0,!1),(0,e.jsxDEV)(E,{"aria-label":s("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:pe,placeholder:s("Leave empty to run as admin"),value:m},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)(k,{"data-testid":"pp-run",disabled:!l||A||M==="",onClick:fe,type:"button",children:s(A?"Probing\u2026":"Run probe")},void 0,!1),m.trim()!==""&&(0,e.jsxDEV)(I,{"data-testid":"pp-as-badge",variant:"secondary",children:s("as {userId}",{userId:m.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),w!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:w},void 0,!1),y!==null&&y.kind==="allowed"&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,e.jsxDEV)(I,{variant:"secondary",children:s("Allowed")},void 0,!1),(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:Se(y.value)},void 0,!1)]},void 0,!0),y!==null&&y.kind==="denied"&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,e.jsxDEV)(I,{variant:"destructive",children:s("Denied")},void 0,!1),(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:y.message},void 0,!1)]},void 0,!0)]},void 0,!0)},"PermissionsPlayground"),Ae="/__lunora/policy-scaffold",Te={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},Ie=n(async a=>{let t=await fetch(Ae,{body:JSON.stringify(a),headers:{"Content-Type":"application/json"},method:"POST"}),l=await t.json();if(l.needsManualEdit===!0)return{kind:"needs-manual-edit",message:l.message??"This change must be made by hand."};if(t.ok)return{diagnostics:l.diagnostics??[],kind:"ok",label:l.fileName??l.exportName??""};let r=l.error;return{kind:"error",message:r===void 0?`policy scaffold failed (${String(t.status)})`:Te[r]??r}},"applyPolicyScaffold"),de={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Ee=n(()=>{let a=O(),[t,l]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1),[o,d]=(0,c.useState)(null),[i,x]=(0,c.useState)(de),p=n(h=>{let m=h.target.name,{value:P}=h.target;x(A=>({...A,[m]:P}))},"onFieldChange"),v=n(()=>{l(null),x(de)},"reset"),b=n(async h=>{s(!0),d(null);try{let m=await Ie(h);d(m),m.kind==="ok"&&v()}catch(m){d({kind:"error",message:m instanceof Error?m.message:String(m)})}finally{s(!1)}},"submit"),N=n(()=>{D(b({kind:"scaffoldPolicy",name:i.policyName.trim(),table:i.tableName.trim()}))},"onSubmitScaffold"),g=n(()=>{D(b({exportName:i.exportName.trim(),filePath:i.filePath.trim(),kind:"wireRls",policies:i.policies.trim()}))},"onSubmitWire"),_=n(()=>{d(null),l("scaffold")},"openScaffold"),F=n(()=>{d(null),l("wire")},"openWire");return(0,e.jsxDEV)(j,{"data-testid":"policy-scaffolder",size:"sm",children:[(0,e.jsxDEV)(K,{children:[(0,e.jsxDEV)(V,{children:a("Scaffold access rules")},void 0,!1),(0,e.jsxDEV)(Y,{children:a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(q,{children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsxDEV)(k,{"data-testid":"policy-scaffolder-new",onClick:_,size:"xs",type:"button",variant:t==="scaffold"?"default":"outline",children:a("New policy file")},void 0,!1),(0,e.jsxDEV)(k,{"data-testid":"policy-scaffolder-wire",onClick:F,size:"xs",type:"button",variant:t==="wire"?"default":"outline",children:a("Wire into a procedure")},void 0,!1)]},void 0,!0),t==="scaffold"&&(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,e.jsxDEV)(C,{htmlFor:"policy-scaffolder-name",children:a("Policy name")},void 0,!1),(0,e.jsxDEV)(E,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:p,value:i.policyName},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,e.jsxDEV)(C,{htmlFor:"policy-scaffolder-table",children:a("Table name")},void 0,!1),(0,e.jsxDEV)(E,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:p,value:i.tableName},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(k,{"data-testid":"policy-scaffolder-create",disabled:r||i.policyName.trim()===""||i.tableName.trim()==="",onClick:N,size:"xs",type:"button",children:a(r?"Creating\u2026":"Create policy file")},void 0,!1),(0,e.jsxDEV)(k,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")},void 0,!1)]},void 0,!0),t==="wire"&&(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,e.jsxDEV)(C,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")},void 0,!1),(0,e.jsxDEV)(E,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:p,value:i.filePath},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,e.jsxDEV)(C,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")},void 0,!1),(0,e.jsxDEV)(E,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:p,value:i.exportName},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,e.jsxDEV)(C,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")},void 0,!1),(0,e.jsxDEV)(E,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:p,value:i.policies},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(k,{"data-testid":"policy-scaffolder-apply",disabled:r||i.filePath.trim()===""||i.exportName.trim()===""||i.policies.trim()==="",onClick:g,size:"xs",type:"button",children:a(r?"Wiring\u2026":"Wire RLS")},void 0,!1),(0,e.jsxDEV)(k,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")},void 0,!1)]},void 0,!0),o?.kind==="error"&&(0,e.jsxDEV)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:o.message},void 0,!1),o?.kind==="needs-manual-edit"&&(0,e.jsxDEV)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")},void 0,!1),o?.kind==="ok"&&(0,e.jsxDEV)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,e.jsxDEV)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:o.label})},void 0,!1),o.diagnostics.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:o.diagnostics.map(h=>(0,e.jsxDEV)("li",{className:"font-mono text-[11px] text-destructive",children:h},h,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"PolicyScaffolder"),He=n(({functions:a,runAsIdentity:t=!1,schemaEditable:l=!1}={})=>{let r=O(),[s,o]=(0,c.useState)(void 0),d=n((i,x,p)=>{p!==""&&o(v=>({functionPath:p,nonce:(v?.nonce??0)+1}))},"onProbe");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,e.jsxDEV)("section",{className:"flex flex-col gap-3",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Permissions")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(Ne,{onProbe:d},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("section",{className:"flex flex-col gap-3",children:(0,e.jsxDEV)(j,{className:"gap-0 py-0",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Probe")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(q,{className:"px-4 py-4",children:[(0,e.jsxDEV)("p",{className:"mb-3 text-sm text-muted-foreground",children:r("Pick a function and an identity, then run it to see the access outcome.")},void 0,!1),(0,e.jsxDEV)(Pe,{functions:a,prefill:s,runAsIdentity:t},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),l&&(0,e.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,e.jsxDEV)(Ee,{},void 0,!1)},void 0,!1)]},void 0,!0)},"PermissionsPanel");export{He as PermissionsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-HVRDZZHL.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as f}from"./chunk-
|
|
1
|
+
import{b as f}from"./chunk-MDTNVR3G.js";import"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import"./chunk-GTM65MVX.js";import{a as R}from"./chunk-BOXSWNXZ.js";import{b as p}from"./chunk-HVRDZZHL.js";import"./chunk-SEU5V7I6.js";import"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as h}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as i,e as m,g as S,h as A}from"./chunk-RRCPZMC2.js";var g=m(S(),1);var k=m(A(),1);var _=i((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[s.kind],"findingTitle"),E=i(e=>Array.isArray(e.findings)?e.findings:[],"toFindings"),w=i(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"findingEntity"),T=i((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[s.kind],"findingDetail"),v=i(()=>{let e=(0,g.c)(8),s=h(),r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let{data:a,error:d,errorSource:c}=p(R.getSecurityAudit,r),o;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:E(a);o=u===null?null:u.map(t=>({description:T(s,t),entity:w(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=o}else o=e[3];let l=o,n;return e[4]!==d||e[5]!==c||e[6]!==l?(n=(0,k.jsxDEV)(f,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"},void 0,!1),e[4]=d,e[5]=c,e[6]=l,e[7]=n):n=e[7],n},"SecurityAdvisorPanel");export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as H}from"./chunk-VLXV72QE.js";import{a as v}from"./chunk-JSEXCW5Q.js";import{a as q}from"./chunk-DH4K2OLM.js";import{b as V}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as B}from"./chunk-3CJW6NWG.js";import{c as p}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as z}from"./chunk-BOXSWNXZ.js";import{b as S}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as L}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as j,e as K,f as U,h as J,l as M,p as P}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a,e as D,f as ne,h as ie}from"./chunk-RRCPZMC2.js";var n=D(ne(),1);var e=D(ie(),1);var de=a(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"argumentType"),le=a(r=>r===void 0||r.length===0?"()":`(${r.map(i=>`${i.name}${i.optional?"?":""}: ${de(i)}`).join(", ")})`,"formatSignature"),ce=a(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"placeholderValue"),ue=a(r=>{let i={};for(let s of r??[])s.optional||(i[s.name]=ce(s.kind));return JSON.stringify(i,void 0,2)},"argumentsTemplate"),fe=U(z.runAs),me=10,he=a(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"formatResult"),Ae=a(({functions:r,runAsIdentity:i=!1}={})=>{let s=j(),u=L(),[X,Y]=(0,n.useState)(null),[w,G]=(0,n.useState)(null),g=r??X??[],[R,I]=(0,n.useState)(""),[f,x]=(0,n.useState)("{}"),[c,k]=(0,n.useState)(""),[m,Q]=(0,n.useState)(""),[b,h]=(0,n.useState)("idle"),[W,N]=(0,n.useState)(void 0),[A,y]=(0,n.useState)(null),[C,Z]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Y(d),d)).catch(d=>{t||G(J(d))}),()=>{t=!0}},[u,r]);let T=R===""?g[0]?.path??"":R,o=g.find(t=>t.path===T),_=a(async()=>{if(!o)return;let t;try{t=f.trim()===""?{}:JSON.parse(f)}catch(l){h("error"),N(void 0),y(s("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:o.path},F=c.trim()===""?{}:{shardKey:c.trim()},$=i?m.trim():"",E=a(l=>{Z(O=>[{argsText:f,at:Date.now(),id:(O[0]?.id??0)+1,kind:o.kind,path:o.path,shardKey:c,status:l},...O].slice(0,me))},"record");h("running"),y(null);try{let l=$===""?await K(u,o.kind,d,t,F):await u.query(fe,{args:t,functionPath:o.path,userId:$},F);V(c),N(l),h("success"),E("success")}catch(l){N(void 0),y(l.message),h("error"),E("error")}},"run"),ee=a(t=>{I(t.path),x(t.argsText),k(t.shardKey)},"loadRun"),te=a(t=>{I(t.target.value)},"onSelectChange"),re=a(t=>{x(t.target.value)},"onArgsChange"),se=a(t=>{Q(t.target.value)},"onRunAsChange"),ae=a(()=>{M(_())},"runOnce"),oe=a(()=>{x(ue(o?.args))},"prefillArgs");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[w!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:w},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)(v,{htmlFor:"function-select",children:s("Function")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":s("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:T,children:g.map(t=>(0,e.jsxDEV)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path,!0))},void 0,!1),o!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsxDEV)("span",{className:"mr-1.5 font-medium",children:s("Signature")},void 0,!1),(0,e.jsxDEV)("code",{className:"font-mono","data-testid":"function-signature",children:le(o.args)},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)(v,{htmlFor:"args-input",children:s("Arguments")},void 0,!1),(0,e.jsxDEV)(p,{"data-testid":"prefill-button",disabled:o===void 0,onClick:oe,size:"xs",type:"button",variant:"ghost",children:s("Prefill")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(H,{"aria-label":s("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:f},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(q,{onChange:k,testId:"shard-input",value:c},void 0,!1),i&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsxDEV)(v,{htmlFor:"run-as-input",children:s("Run as identity (userId)")},void 0,!1),(0,e.jsxDEV)(B,{"aria-label":s("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:se,placeholder:s("Leave empty to run as admin"),value:m},void 0,!1),(0,e.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:s("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(p,{"data-testid":"run-button",disabled:b==="running"||o===void 0,onClick:ae,type:"button",children:s("Run")},void 0,!1),o!==void 0&&(0,e.jsxDEV)(S,{variant:"outline",children:o.kind},void 0,!1),i&&m.trim()!==""&&(0,e.jsxDEV)(S,{"data-testid":"run-as-badge",variant:"secondary",children:s("as {userId}",{userId:m.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),b==="error"&&A!==null&&(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:A},void 0,!1),b==="success"&&(0,e.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:he(W)},void 0,!1),C.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:C.map((t,d)=>(0,e.jsxDEV)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsxDEV)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"},void 0,!1)," ",(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]},void 0,!0)," ",(0,e.jsxDEV)("time",{className:"text-xs text-muted-foreground",children:P(t.at)},void 0,!1)," ",(0,e.jsxDEV)(p,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:a(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Load")},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},"FunctionRunner");export{Ae as FunctionRunner};
|