@av-pi-studio/web-client 0.0.114 → 0.0.116
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/web/assets/{BinaryFallbackViewer-Bkpz8WV_.js → BinaryFallbackViewer-CgqvcH7r.js} +1 -1
- package/dist/web/assets/ChatPanel-DrY_su6H.js +11 -0
- package/dist/web/assets/ChatPanel-eXvPOkx2.css +1 -0
- package/dist/web/assets/{CodeView-BGmM4Xdz.js → CodeView-CLqXf_zq.js} +1 -1
- package/dist/web/assets/{FilePanel-_4YNsvO0.js → FilePanel-D70tIhDP.js} +1 -1
- package/dist/web/assets/{HtmlViewer-DFstCiC5.js → HtmlViewer-DSjhzjwY.js} +1 -1
- package/dist/web/assets/{ImageViewer-BQxrdTlE.js → ImageViewer-5Up9iJJ7.js} +1 -1
- package/dist/web/assets/{MarkdownFileViewer-BGovxRT6.js → MarkdownFileViewer-BtXDNRcG.js} +1 -1
- package/dist/web/assets/{ModelProvidersPanel-DfQW9oP8.js → ModelProvidersPanel-CEj669D0.js} +1 -1
- package/dist/web/assets/{MoleculeViewerPanel-u97-c07_.js → MoleculeViewerPanel-BiSKuUKH.js} +1 -1
- package/dist/web/assets/{PdfViewer-BXC1UMNj.js → PdfViewer-FoRGVMMP.js} +1 -1
- package/dist/web/assets/{SettingsDialog-CINzuD1W.js → SettingsDialog-BduWeTtA.js} +5 -5
- package/dist/web/assets/{SkillsPanel-Mfgze4oy.js → SkillsPanel-DFN65SoZ.js} +1 -1
- package/dist/web/assets/{TerminalPanel-CyyoVOMa.js → TerminalPanel-DN6tM7eR.js} +1 -1
- package/dist/web/assets/{TextViewer-C6Lp03uL.js → TextViewer-Cu-49yJ_.js} +1 -1
- package/dist/web/assets/{VideoViewer-hV_glBDT.js → VideoViewer-CD56-Rpo.js} +1 -1
- package/dist/web/assets/{ViewersPanel-ZyLSqRdr.js → ViewersPanel-CAoHz8Or.js} +1 -1
- package/dist/web/assets/{href-resolution-DWAlGpSI.js → href-resolution-CSqTI9Vm.js} +1 -1
- package/dist/web/assets/index-CchwjcLZ.js +19 -0
- package/dist/web/assets/{markdown-ZgA079Q9.js → markdown-2gm-29tf.js} +1 -1
- package/dist/web/assets/{use-file-download-Bc8Kby2g.js → use-file-download-8zPww5m-.js} +1 -1
- package/dist/web/assets/{use-file-watch-hu9dEdvA.js → use-file-watch-CYQrRagj.js} +1 -1
- package/dist/web/assets/{use-provider-auth-list-BDqjbQx-.js → use-provider-auth-list-CPbr4xbh.js} +1 -1
- package/dist/web/assets/{vendor-icons-Dq3K7TC5.js → vendor-icons-Bh5CT32q.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
- package/dist/web/assets/ChatPanel-DtQ_LR4Y.css +0 -1
- package/dist/web/assets/ChatPanel-kbXAj_zX.js +0 -9
- package/dist/web/assets/index-DjUHduQf.js +0 -19
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{b as me,r as v,j as l}from"./vendor-react-DQUAl2K8.js";import{af as we,N as ye}from"./vendor-DaF96HbP.js";import{u as oe,r as _t,D as ie,B as G,S as It,q as Ce,s as Ee,ac as Be,ad as Ne,ae as Se,I as Ie,E as Lt}from"./index-DjUHduQf.js";import{a as Re}from"./vendor-query-i7fr__Xm.js";import{u as O}from"./provider-auth-store-9hsJ07X1.js";import{s as se,f as be,t as Ae}from"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function _e(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Le(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Te(t,n){const i=t.statusLines.filter(r=>r.kind!=="progress");return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...i,{kind:"progress",message:n}]}}function Me(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function Pe(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function ve(t,n){return{...t,phase:"prompt",prompt:n}}function je(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function De(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function xe(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Le(t,n.message,n.links);case"progress":return Te(t,n.message);case"auth_url":return Me(t,n.url,n.instructions);case"device_code":return Pe(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return ve(t,n);case"prompt_cancelled":return je(t,n.promptId);case"done":return De(t,n.ok,n.error)}}var V={},nt,Tt;function ke(){return Tt||(Tt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},Mt;function F(){if(Mt)return U;Mt=1;let t;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},U.getSymbolTotalCodewords=function(r){return n[r]},U.getBCHDigit=function(i){let r=0;for(;i!==0;)r++,i>>>=1;return r},U.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},U.isKanjiModeEnabled=function(){return typeof t<"u"},U.toSJIS=function(r){return t(r)},U}var ot={},Pt;function Rt(){return Pt||(Pt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,e){if(t.isValid(r))return r;try{return n(r)}catch{return e}}})(ot)),ot}var it,vt;function Ue(){if(vt)return it;vt=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(n){const i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let r=0;r<i;r++)this.putBit((n>>>i-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},it=t,it}var st,jt;function qe(){if(jt)return st;jt=1;function t(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return t.prototype.set=function(n,i,r,e){const o=n*this.size+i;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(n,i){return this.data[n*this.size+i]},t.prototype.xor=function(n,i,r){this.data[n*this.size+i]^=r},t.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},st=t,st}var at={},Dt;function Fe(){return Dt||(Dt=1,(function(t){const n=F().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const e=Math.floor(r/7)+2,o=n(r),s=o===145?26:Math.ceil((o-13)/(2*e-2))*2,a=[o-7];for(let u=1;u<e-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const e=[],o=t.getRowColCoords(r),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||e.push([o[a],o[u]]);return e}})(at)),at}var ut={},xt;function ze(){if(xt)return ut;xt=1;const t=F().getSymbolSize,n=7;return ut.getPositions=function(r){const e=t(r);return[[0,0],[e-n,0],[0,e-n]]},ut}var ct={},kt;function Ke(){return kt||(kt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const o=e.size;let s=0,a=0,u=0,c=null,m=null;for(let E=0;E<o;E++){a=u=0,c=m=null;for(let S=0;S<o;S++){let h=e.get(E,S);h===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=h,a=1),h=e.get(S,E),h===m?u++:(u>=5&&(s+=n.N1+(u-5)),m=h,u=1)}a>=5&&(s+=n.N1+(a-5)),u>=5&&(s+=n.N1+(u-5))}return s},t.getPenaltyN2=function(e){const o=e.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=e.get(a,u)+e.get(a,u+1)+e.get(a+1,u)+e.get(a+1,u+1);(c===4||c===0)&&s++}return s*n.N2},t.getPenaltyN3=function(e){const o=e.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let m=0;m<o;m++)a=a<<1&2047|e.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(m,c),m>=10&&(u===1488||u===93)&&s++}return s*n.N3},t.getPenaltyN4=function(e){let o=0;const s=e.data.length;for(let u=0;u<s;u++)o+=e.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*n.N4};function i(r,e,o){switch(r){case t.Patterns.PATTERN000:return(e+o)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(e+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return e*o%2+e*o%3===0;case t.Patterns.PATTERN110:return(e*o%2+e*o%3)%2===0;case t.Patterns.PATTERN111:return(e*o%3+(e+o)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(e,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,i(e,u,a))},t.getBestMask=function(e,o){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),t.applyMask(c,e);const m=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),m<u&&(u=m,a=c)}return a}})(ct)),ct}var W={},Ut;function ae(){if(Ut)return W;Ut=1;const t=Rt(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return W.getBlocksCount=function(e,o){switch(o){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},W.getTotalCodewordsCount=function(e,o){switch(o){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}},W}var lt={},Q={},qt;function Ve(){if(qt)return Q;qt=1;const t=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,r&256&&(r^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),Q.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},Q.exp=function(r){return t[r]},Q.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},Q}var Ft;function Oe(){return Ft||(Ft=1,(function(t){const n=Ve();t.mul=function(r,e){const o=new Uint8Array(r.length+e.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<e.length;a++)o[s+a]^=n.mul(r[s],e[a]);return o},t.mod=function(r,e){let o=new Uint8Array(r);for(;o.length-e.length>=0;){const s=o[0];for(let u=0;u<e.length;u++)o[u]^=n.mul(e[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}})(lt)),lt}var dt,zt;function He(){if(zt)return dt;zt=1;const t=Oe();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(r.length+this.degree);e.set(r);const o=t.mod(e,this.genPoly),s=this.degree-o.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(o,s),a}return o},dt=n,dt}var ft={},ht={},gt={},Kt;function ue(){return Kt||(Kt=1,gt.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),gt}var D={},Vt;function ce(){if(Vt)return D;Vt=1;const t="[0-9]+",n="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
|
|
1
|
+
import{b as me,r as v,j as l}from"./vendor-react-DQUAl2K8.js";import{af as we,N as ye}from"./vendor-DaF96HbP.js";import{u as oe,r as _t,D as ie,B as G,S as It,q as Ce,s as Ee,M as Ne,N as Be,O as Se,I as Ie,E as Lt}from"./index-CchwjcLZ.js";import{a as Re}from"./vendor-query-i7fr__Xm.js";import{u as O}from"./provider-auth-store-9hsJ07X1.js";import{E as se,c as be,d as Ae}from"./vendor-icons-Bh5CT32q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function _e(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Le(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Te(t,n){const i=t.statusLines.filter(r=>r.kind!=="progress");return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...i,{kind:"progress",message:n}]}}function Me(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function Pe(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function ve(t,n){return{...t,phase:"prompt",prompt:n}}function je(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function De(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function xe(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Le(t,n.message,n.links);case"progress":return Te(t,n.message);case"auth_url":return Me(t,n.url,n.instructions);case"device_code":return Pe(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return ve(t,n);case"prompt_cancelled":return je(t,n.promptId);case"done":return De(t,n.ok,n.error)}}var V={},nt,Tt;function ke(){return Tt||(Tt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},Mt;function F(){if(Mt)return U;Mt=1;let t;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},U.getSymbolTotalCodewords=function(r){return n[r]},U.getBCHDigit=function(i){let r=0;for(;i!==0;)r++,i>>>=1;return r},U.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},U.isKanjiModeEnabled=function(){return typeof t<"u"},U.toSJIS=function(r){return t(r)},U}var ot={},Pt;function Rt(){return Pt||(Pt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,e){if(t.isValid(r))return r;try{return n(r)}catch{return e}}})(ot)),ot}var it,vt;function Ue(){if(vt)return it;vt=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(n){const i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let r=0;r<i;r++)this.putBit((n>>>i-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},it=t,it}var st,jt;function qe(){if(jt)return st;jt=1;function t(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return t.prototype.set=function(n,i,r,e){const o=n*this.size+i;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(n,i){return this.data[n*this.size+i]},t.prototype.xor=function(n,i,r){this.data[n*this.size+i]^=r},t.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},st=t,st}var at={},Dt;function Fe(){return Dt||(Dt=1,(function(t){const n=F().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const e=Math.floor(r/7)+2,o=n(r),s=o===145?26:Math.ceil((o-13)/(2*e-2))*2,a=[o-7];for(let u=1;u<e-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const e=[],o=t.getRowColCoords(r),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||e.push([o[a],o[u]]);return e}})(at)),at}var ut={},xt;function ze(){if(xt)return ut;xt=1;const t=F().getSymbolSize,n=7;return ut.getPositions=function(r){const e=t(r);return[[0,0],[e-n,0],[0,e-n]]},ut}var ct={},kt;function Ke(){return kt||(kt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const o=e.size;let s=0,a=0,u=0,c=null,m=null;for(let E=0;E<o;E++){a=u=0,c=m=null;for(let S=0;S<o;S++){let h=e.get(E,S);h===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=h,a=1),h=e.get(S,E),h===m?u++:(u>=5&&(s+=n.N1+(u-5)),m=h,u=1)}a>=5&&(s+=n.N1+(a-5)),u>=5&&(s+=n.N1+(u-5))}return s},t.getPenaltyN2=function(e){const o=e.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=e.get(a,u)+e.get(a,u+1)+e.get(a+1,u)+e.get(a+1,u+1);(c===4||c===0)&&s++}return s*n.N2},t.getPenaltyN3=function(e){const o=e.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let m=0;m<o;m++)a=a<<1&2047|e.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(m,c),m>=10&&(u===1488||u===93)&&s++}return s*n.N3},t.getPenaltyN4=function(e){let o=0;const s=e.data.length;for(let u=0;u<s;u++)o+=e.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*n.N4};function i(r,e,o){switch(r){case t.Patterns.PATTERN000:return(e+o)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(e+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return e*o%2+e*o%3===0;case t.Patterns.PATTERN110:return(e*o%2+e*o%3)%2===0;case t.Patterns.PATTERN111:return(e*o%3+(e+o)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(e,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,i(e,u,a))},t.getBestMask=function(e,o){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),t.applyMask(c,e);const m=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),m<u&&(u=m,a=c)}return a}})(ct)),ct}var W={},Ut;function ae(){if(Ut)return W;Ut=1;const t=Rt(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return W.getBlocksCount=function(e,o){switch(o){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},W.getTotalCodewordsCount=function(e,o){switch(o){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}},W}var lt={},Q={},qt;function Ve(){if(qt)return Q;qt=1;const t=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,r&256&&(r^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),Q.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},Q.exp=function(r){return t[r]},Q.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},Q}var Ft;function Oe(){return Ft||(Ft=1,(function(t){const n=Ve();t.mul=function(r,e){const o=new Uint8Array(r.length+e.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<e.length;a++)o[s+a]^=n.mul(r[s],e[a]);return o},t.mod=function(r,e){let o=new Uint8Array(r);for(;o.length-e.length>=0;){const s=o[0];for(let u=0;u<e.length;u++)o[u]^=n.mul(e[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}})(lt)),lt}var dt,zt;function He(){if(zt)return dt;zt=1;const t=Oe();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(r.length+this.degree);e.set(r);const o=t.mod(e,this.genPoly),s=this.degree-o.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(o,s),a}return o},dt=n,dt}var ft={},ht={},gt={},Kt;function ue(){return Kt||(Kt=1,gt.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),gt}var D={},Vt;function ce(){if(Vt)return D;Vt=1;const t="[0-9]+",n="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
|
|
2
2
|
]))+`;D.KANJI=new RegExp(i,"g"),D.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),D.BYTE=new RegExp(r,"g"),D.NUMERIC=new RegExp(t,"g"),D.ALPHANUMERIC=new RegExp(n,"g");const e=new RegExp("^"+i+"$"),o=new RegExp("^"+t+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return D.testKanji=function(u){return e.test(u)},D.testNumeric=function(u){return o.test(u)},D.testAlphanumeric=function(u){return s.test(u)},D}var Ot;function z(){return Ot||(Ot=1,(function(t){const n=ue(),i=ce();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!n.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},t.getBestModeForData=function(o){return i.testNumeric(o)?t.NUMERIC:i.testAlphanumeric(o)?t.ALPHANUMERIC:i.testKanji(o)?t.KANJI:t.BYTE},t.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},t.isValid=function(o){return o&&o.bit&&o.ccBits};function r(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}t.from=function(o,s){if(t.isValid(o))return o;try{return r(o)}catch{return s}}})(ht)),ht}var Ht;function Qe(){return Ht||(Ht=1,(function(t){const n=F(),i=ae(),r=Rt(),e=z(),o=ue(),s=7973,a=n.getBCHDigit(s);function u(S,h,_){for(let d=1;d<=40;d++)if(h<=t.getCapacity(d,_,S))return d}function c(S,h){return e.getCharCountIndicator(S,h)+4}function m(S,h){let _=0;return S.forEach(function(d){const P=c(d.mode,h);_+=P+d.getBitsLength()}),_}function E(S,h){for(let _=1;_<=40;_++)if(m(S,_)<=t.getCapacity(_,h,e.MIXED))return _}t.from=function(h,_){return o.isValid(h)?parseInt(h,10):_},t.getCapacity=function(h,_,d){if(!o.isValid(h))throw new Error("Invalid QR Code version");typeof d>"u"&&(d=e.BYTE);const P=n.getSymbolTotalCodewords(h),A=i.getTotalCodewordsCount(h,_),L=(P-A)*8;if(d===e.MIXED)return L;const b=L-c(d,h);switch(d){case e.NUMERIC:return Math.floor(b/10*3);case e.ALPHANUMERIC:return Math.floor(b/11*2);case e.KANJI:return Math.floor(b/13);case e.BYTE:default:return Math.floor(b/8)}},t.getBestVersionForData=function(h,_){let d;const P=r.from(_,r.M);if(Array.isArray(h)){if(h.length>1)return E(h,P);if(h.length===0)return 1;d=h[0]}else d=h;return u(d.mode,d.getLength(),P)},t.getEncodedBits=function(h){if(!o.isValid(h)||h<7)throw new Error("Invalid QR Code version");let _=h<<12;for(;n.getBCHDigit(_)-a>=0;)_^=s<<n.getBCHDigit(_)-a;return h<<12|_}})(ft)),ft}var pt={},Qt;function Je(){if(Qt)return pt;Qt=1;const t=F(),n=1335,i=21522,r=t.getBCHDigit(n);return pt.getEncodedBits=function(o,s){const a=o.bit<<3|s;let u=a<<10;for(;t.getBCHDigit(u)-r>=0;)u^=n<<t.getBCHDigit(u)-r;return(a<<10|u)^i},pt}var mt={},wt,Jt;function Ye(){if(Jt)return wt;Jt=1;const t=z();function n(i){this.mode=t.NUMERIC,this.data=i.toString()}return n.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let e,o,s;for(e=0;e+3<=this.data.length;e+=3)o=this.data.substr(e,3),s=parseInt(o,10),r.put(s,10);const a=this.data.length-e;a>0&&(o=this.data.substr(e),s=parseInt(o,10),r.put(s,a*3+1))},wt=n,wt}var yt,Yt;function $e(){if(Yt)return yt;Yt=1;const t=z(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(r){this.mode=t.ALPHANUMERIC,this.data=r}return i.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let o;for(o=0;o+2<=this.data.length;o+=2){let s=n.indexOf(this.data[o])*45;s+=n.indexOf(this.data[o+1]),e.put(s,11)}this.data.length%2&&e.put(n.indexOf(this.data[o]),6)},yt=i,yt}var Ct,$t;function Ge(){if($t)return Ct;$t=1;const t=z();function n(i){this.mode=t.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return n.getBitsLength=function(r){return r*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){for(let r=0,e=this.data.length;r<e;r++)i.put(this.data[r],8)},Ct=n,Ct}var Et,Gt;function We(){if(Gt)return Et;Gt=1;const t=z(),n=F();function i(r){this.mode=t.KANJI,this.data=r}return i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let o=n.toSJIS(this.data[e]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
|
-
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),r.put(o,13)}},Et=i,Et}var Wt;function Xe(){return Wt||(Wt=1,(function(t){const n=z(),i=Ye(),r=$e(),e=Ge(),o=We(),s=ce(),a=F(),u=we();function c(A){return unescape(encodeURIComponent(A)).length}function m(A,L,b){const R=[];let M;for(;(M=A.exec(b))!==null;)R.push({data:M[0],index:M.index,mode:L,length:M[0].length});return R}function E(A){const L=m(s.NUMERIC,n.NUMERIC,A),b=m(s.ALPHANUMERIC,n.ALPHANUMERIC,A);let R,M;return a.isKanjiModeEnabled()?(R=m(s.BYTE,n.BYTE,A),M=m(s.KANJI,n.KANJI,A)):(R=m(s.BYTE_KANJI,n.BYTE,A),M=[]),L.concat(b,R,M).sort(function(
|
|
4
|
-
Suggested mode is: `+n.toString(R));switch(b===n.KANJI&&!a.isKanjiModeEnabled()&&(b=n.BYTE),b){case n.NUMERIC:return new i(A);case n.ALPHANUMERIC:return new r(A);case n.KANJI:return new o(A);case n.BYTE:return new e(A)}}t.fromArray=function(L){return L.reduce(function(b,R){return typeof R=="string"?b.push(P(R,null)):R.data&&b.push(P(R.data,R.mode)),b},[])},t.fromString=function(L,b){const R=E(L,a.isKanjiModeEnabled()),M=_(R),p=d(M,b),
|
|
3
|
+
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),r.put(o,13)}},Et=i,Et}var Wt;function Xe(){return Wt||(Wt=1,(function(t){const n=z(),i=Ye(),r=$e(),e=Ge(),o=We(),s=ce(),a=F(),u=we();function c(A){return unescape(encodeURIComponent(A)).length}function m(A,L,b){const R=[];let M;for(;(M=A.exec(b))!==null;)R.push({data:M[0],index:M.index,mode:L,length:M[0].length});return R}function E(A){const L=m(s.NUMERIC,n.NUMERIC,A),b=m(s.ALPHANUMERIC,n.ALPHANUMERIC,A);let R,M;return a.isKanjiModeEnabled()?(R=m(s.BYTE,n.BYTE,A),M=m(s.KANJI,n.KANJI,A)):(R=m(s.BYTE_KANJI,n.BYTE,A),M=[]),L.concat(b,R,M).sort(function(N,w){return N.index-w.index}).map(function(N){return{data:N.data,mode:N.mode,length:N.length}})}function S(A,L){switch(L){case n.NUMERIC:return i.getBitsLength(A);case n.ALPHANUMERIC:return r.getBitsLength(A);case n.KANJI:return o.getBitsLength(A);case n.BYTE:return e.getBitsLength(A)}}function h(A){return A.reduce(function(L,b){const R=L.length-1>=0?L[L.length-1]:null;return R&&R.mode===b.mode?(L[L.length-1].data+=b.data,L):(L.push(b),L)},[])}function _(A){const L=[];for(let b=0;b<A.length;b++){const R=A[b];switch(R.mode){case n.NUMERIC:L.push([R,{data:R.data,mode:n.ALPHANUMERIC,length:R.length},{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.ALPHANUMERIC:L.push([R,{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.KANJI:L.push([R,{data:R.data,mode:n.BYTE,length:c(R.data)}]);break;case n.BYTE:L.push([{data:R.data,mode:n.BYTE,length:c(R.data)}])}}return L}function d(A,L){const b={},R={start:{}};let M=["start"];for(let p=0;p<A.length;p++){const N=A[p],w=[];for(let g=0;g<N.length;g++){const I=N[g],y=""+p+g;w.push(y),b[y]={node:I,lastCount:0},R[y]={};for(let B=0;B<M.length;B++){const C=M[B];b[C]&&b[C].node.mode===I.mode?(R[C][y]=S(b[C].lastCount+I.length,I.mode)-S(b[C].lastCount,I.mode),b[C].lastCount+=I.length):(b[C]&&(b[C].lastCount=I.length),R[C][y]=S(I.length,I.mode)+4+n.getCharCountIndicator(I.mode,L))}}M=w}for(let p=0;p<M.length;p++)R[M[p]].end=0;return{map:R,table:b}}function P(A,L){let b;const R=n.getBestModeForData(A);if(b=n.from(L,R),b!==n.BYTE&&b.bit<R.bit)throw new Error('"'+A+'" cannot be encoded with mode '+n.toString(b)+`.
|
|
4
|
+
Suggested mode is: `+n.toString(R));switch(b===n.KANJI&&!a.isKanjiModeEnabled()&&(b=n.BYTE),b){case n.NUMERIC:return new i(A);case n.ALPHANUMERIC:return new r(A);case n.KANJI:return new o(A);case n.BYTE:return new e(A)}}t.fromArray=function(L){return L.reduce(function(b,R){return typeof R=="string"?b.push(P(R,null)):R.data&&b.push(P(R.data,R.mode)),b},[])},t.fromString=function(L,b){const R=E(L,a.isKanjiModeEnabled()),M=_(R),p=d(M,b),N=u.find_path(p.map,"start","end"),w=[];for(let g=1;g<N.length-1;g++)w.push(p.table[N[g]].node);return t.fromArray(h(w))},t.rawSplit=function(L){return t.fromArray(E(L,a.isKanjiModeEnabled()))}})(mt)),mt}var Xt;function Ze(){if(Xt)return rt;Xt=1;const t=F(),n=Rt(),i=Ue(),r=qe(),e=Fe(),o=ze(),s=Ke(),a=ae(),u=He(),c=Qe(),m=Je(),E=z(),S=Xe();function h(p,N){const w=p.size,g=o.getPositions(N);for(let I=0;I<g.length;I++){const y=g[I][0],B=g[I][1];for(let C=-1;C<=7;C++)if(!(y+C<=-1||w<=y+C))for(let f=-1;f<=7;f++)B+f<=-1||w<=B+f||(C>=0&&C<=6&&(f===0||f===6)||f>=0&&f<=6&&(C===0||C===6)||C>=2&&C<=4&&f>=2&&f<=4?p.set(y+C,B+f,!0,!0):p.set(y+C,B+f,!1,!0))}}function _(p){const N=p.size;for(let w=8;w<N-8;w++){const g=w%2===0;p.set(w,6,g,!0),p.set(6,w,g,!0)}}function d(p,N){const w=e.getPositions(N);for(let g=0;g<w.length;g++){const I=w[g][0],y=w[g][1];for(let B=-2;B<=2;B++)for(let C=-2;C<=2;C++)B===-2||B===2||C===-2||C===2||B===0&&C===0?p.set(I+B,y+C,!0,!0):p.set(I+B,y+C,!1,!0)}}function P(p,N){const w=p.size,g=c.getEncodedBits(N);let I,y,B;for(let C=0;C<18;C++)I=Math.floor(C/3),y=C%3+w-8-3,B=(g>>C&1)===1,p.set(I,y,B,!0),p.set(y,I,B,!0)}function A(p,N,w){const g=p.size,I=m.getEncodedBits(N,w);let y,B;for(y=0;y<15;y++)B=(I>>y&1)===1,y<6?p.set(y,8,B,!0):y<8?p.set(y+1,8,B,!0):p.set(g-15+y,8,B,!0),y<8?p.set(8,g-y-1,B,!0):y<9?p.set(8,15-y-1+1,B,!0):p.set(8,15-y-1,B,!0);p.set(g-8,8,1,!0)}function L(p,N){const w=p.size;let g=-1,I=w-1,y=7,B=0;for(let C=w-1;C>0;C-=2)for(C===6&&C--;;){for(let f=0;f<2;f++)if(!p.isReserved(I,C-f)){let j=!1;B<N.length&&(j=(N[B]>>>y&1)===1),p.set(I,C-f,j),y--,y===-1&&(B++,y=7)}if(I+=g,I<0||w<=I){I-=g,g=-g;break}}}function b(p,N,w){const g=new i;w.forEach(function(f){g.put(f.mode.bit,4),g.put(f.getLength(),E.getCharCountIndicator(f.mode,p)),f.write(g)});const I=t.getSymbolTotalCodewords(p),y=a.getTotalCodewordsCount(p,N),B=(I-y)*8;for(g.getLengthInBits()+4<=B&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const C=(B-g.getLengthInBits())/8;for(let f=0;f<C;f++)g.put(f%2?17:236,8);return R(g,p,N)}function R(p,N,w){const g=t.getSymbolTotalCodewords(N),I=a.getTotalCodewordsCount(N,w),y=g-I,B=a.getBlocksCount(N,w),C=g%B,f=B-C,j=Math.floor(g/B),q=Math.floor(y/B),Y=q+1,H=j-q,ge=new u(H);let X=0;const $=new Array(B),bt=new Array(B);let Z=0;const pe=new Uint8Array(p.buffer);for(let K=0;K<B;K++){const et=K<f?q:Y;$[K]=pe.slice(X,X+et),bt[K]=ge.encode($[K]),X+=et,Z=Math.max(Z,et)}const tt=new Uint8Array(g);let At=0,x,k;for(x=0;x<Z;x++)for(k=0;k<B;k++)x<$[k].length&&(tt[At++]=$[k][x]);for(x=0;x<H;x++)for(k=0;k<B;k++)tt[At++]=bt[k][x];return tt}function M(p,N,w,g){let I;if(Array.isArray(p))I=S.fromArray(p);else if(typeof p=="string"){let j=N;if(!j){const q=S.rawSplit(p);j=c.getBestVersionForData(q,w)}I=S.fromString(p,j||40)}else throw new Error("Invalid data");const y=c.getBestVersionForData(I,w);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(!N)N=y;else if(N<y)throw new Error(`
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
6
|
Minimum version required to store current data is: `+y+`.
|
|
7
|
-
`);const
|
|
8
|
-
`;return typeof a=="function"&&a(null,P),P},St}var ne;function nn(){if(ne)return V;ne=1;const t=ke(),n=Ze(),i=tn(),r=en();function e(o,s,a,u,c){const m=[].slice.call(arguments,1),E=m.length,S=typeof m[E-1]=="function";if(!S&&!t())throw new Error("Callback required as last argument");if(S){if(E<2)throw new Error("Too few arguments provided");E===2?(c=a,a=s,s=u=void 0):E===3&&(s.getContext&&typeof c>"u"?(c=u,u=void 0):(c=u,u=a,a=s,s=void 0))}else{if(E<1)throw new Error("Too few arguments provided");return E===1?(a=s,s=u=void 0):E===2&&!s.getContext&&(u=a,a=s,s=void 0),new Promise(function(h,_){try{const d=n.create(a,u);h(o(d,s,u))}catch(d){_(d)}})}try{const h=n.create(a,u);c(null,o(h,s,u))}catch(h){c(h)}}return V.create=n.create,V.toCanvas=e.bind(null,i.render),V.toDataURL=e.bind(null,i.renderToDataURL),V.toString=e.bind(null,function(o,s,a){return r.render(o,a)}),V}var rn=nn();const on=me(rn),sn="_qr_lnaw6_1",an="_placeholder_lnaw6_2",re={qr:sn,placeholder:an},un=320;function de({value:t,label:n}){const[i,r]=v.useState(null),[e,o]=v.useState(!1);return v.useEffect(()=>{let s=!0;return r(null),o(!1),on.toDataURL(t,{width:un,margin:1,errorCorrectionLevel:"M"}).then(a=>{s&&r(a)}).catch(()=>{s&&o(!0)}),()=>{s=!1}},[t]),e?null:i?l.jsx("img",{className:re.qr,src:i,alt:n}):l.jsx("div",{className:re.placeholder,"aria-hidden":"true"})}const cn="_body_1yyw5_1",ln="_status_1yyw5_11",dn="_statusLine_1yyw5_17",fn="_statusLineProgress_1yyw5_18",hn="_statusText_1yyw5_28",gn="_prompt_1yyw5_40",pn="_promptMessage_1yyw5_46",mn="_options_1yyw5_51",wn="_option_1yyw5_51",yn="_optionLabel_1yyw5_76",Cn="_optionDescription_1yyw5_81",En="_success_1yyw5_86",Bn="_error_1yyw5_91",Nn="_oauth_1yyw5_98",Sn="_oauthInstructions_1yyw5_107",In="_oauthMain_1yyw5_115",Rn="_oauthActions_1yyw5_123",bn="_openButton_1yyw5_135",An="_urlRow_1yyw5_156",_n="_oauthUrl_1yyw5_164",Ln="_oauthQr_1yyw5_175",Tn="_oauthQrCaption_1yyw5_184",Mn="_deviceCode_1yyw5_191",Pn="_countdown_1yyw5_198",T={body:cn,status:ln,statusLine:dn,statusLineProgress:fn,statusText:hn,prompt:gn,promptMessage:pn,options:mn,option:wn,optionLabel:yn,optionDescription:Cn,success:En,error:Bn,oauth:Nn,oauthInstructions:Sn,oauthMain:In,oauthActions:Rn,openButton:bn,urlRow:An,oauthUrl:_n,oauthQr:Ln,oauthQrCaption:Tn,deviceCode:Mn,countdown:Pn},vn=1200,fe="provider-auth-prompt-form";function jn(){const t=O(a=>a.pendingLogin),n=O(a=>a.cancelLogin),i=O(a=>a.clearLogin),r=O(a=>a.retryLogin),e=oe(a=>a.client),o=Re(),s=v.useCallback(()=>{o.invalidateQueries({queryKey:_t.providerAuthList()}),o.invalidateQueries({queryKey:_t.providerModelsAll()})},[o]);return!t||!e?null:l.jsx(Dn,{provider:t.provider,providerName:t.providerName,authType:t.authType,controller:t.controller,client:e,onCancel:n,onClear:i,onRetry:r,onSuccess:s},`${t.provider}:${t.authType}:${t.attempt}`)}function Dn({provider:t,providerName:n,authType:i,controller:r,client:e,onCancel:o,onClear:s,onRetry:a,onSuccess:u}){var I,y,N,C;const[c,m]=v.useReducer(xe,_e(t,i)),E=v.useRef(null),S=v.useRef(!1),h=v.useRef(!1),[_,d]=v.useState(""),[P,A]=v.useState(null);v.useEffect(()=>(h.current=!0,S.current||(S.current=!0,e.loginProvider(t,i,{prompt:f=>new Promise((j,q)=>{var Y;E.current={promptId:f.promptId,resolve:j,reject:q},m({kind:"prompt",...f}),(Y=f.signal)==null||Y.addEventListener("abort",()=>{var H;((H=E.current)==null?void 0:H.promptId)===f.promptId&&(E.current=null),d(""),m({kind:"prompt_cancelled",promptId:f.promptId})},{once:!0})}),onEvent:f=>m(f)},{signal:r.signal}).then(f=>{h.current&&m({kind:"done",ok:f.ok,error:f.error})}).catch(f=>{h.current&&m({kind:"done",ok:!1,error:f instanceof Error?f.message:String(f)})})),()=>{var f;h.current=!1,(f=E.current)==null||f.reject(new Error("login dialog closed")),E.current=null}),[]),v.useEffect(()=>{var j;if(c.phase!=="done"||!((j=c.result)!=null&&j.ok))return;u();const f=setTimeout(s,vn);return()=>clearTimeout(f)},[c.phase,(I=c.result)==null?void 0:I.ok,u,s]);function L(f){const j=E.current;j&&(E.current=null,A(j.promptId),d(""),j.resolve(f))}function b(f){f.preventDefault(),L(_)}function R(f){f||(c.phase==="done"?s():o())}const M=c.phase==="done",p=M&&((y=c.result)==null?void 0:y.ok)===!0,B=M&&((N=c.result)==null?void 0:N.ok)===!1,w=c.phase==="prompt"&&c.prompt&&c.prompt.promptId!==P?c.prompt:void 0,g=w&&w.promptKind!=="select"?w:void 0;return l.jsx(ie,{open:!0,onOpenChange:R,title:`Log in to ${n}`,width:480,footer:M?l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:s,children:"Close"}),B&&l.jsx(G,{onClick:a,children:"Try again"})]}):l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:o,children:"Cancel"}),g&&l.jsx(G,{type:"submit",form:fe,children:"Submit"})]}),children:l.jsxs("div",{className:T.body,children:[l.jsx(xn,{state:c}),!M&&c.authUrl&&l.jsx(qn,{authUrl:c.authUrl,showInstructions:!g}),!M&&c.deviceCode&&l.jsx(zn,{deviceCode:c.deviceCode,stopped:M}),w&&l.jsx(kn,{prompt:w,inputValue:_,onInputChange:d,onTextSubmit:b,onSelect:L}),p&&l.jsx("p",{className:T.success,children:"Signed in. Closing…"}),B&&l.jsx("p",{className:T.error,children:((C=c.result)==null?void 0:C.error)??"Login failed."})]})})}function xn({state:t}){return t.statusLines.length===0&&t.phase!=="starting"?null:l.jsxs("div",{className:T.status,children:[t.phase==="starting"&&l.jsxs("div",{className:T.statusLine,children:[l.jsx(It,{size:"sm"})," Starting…"]}),t.statusLines.map((n,i)=>{var r;return l.jsxs("div",{className:n.kind==="progress"?T.statusLineProgress:T.statusLine,children:[n.kind==="progress"&&l.jsx(It,{size:"sm"}),l.jsxs("span",{className:T.statusText,children:[l.jsx("span",{children:n.message}),(r=n.links)==null?void 0:r.map(e=>l.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:e.label??e.url},e.url))]})]},i)})]})}function kn({prompt:t,inputValue:n,onInputChange:i,onTextSubmit:r,onSelect:e}){var o;return t.promptKind==="select"?l.jsxs("div",{className:T.prompt,children:[l.jsx("p",{className:T.promptMessage,children:t.message}),l.jsx("div",{className:T.options,children:(o=t.options)==null?void 0:o.map(s=>l.jsxs("button",{type:"button",className:T.option,onClick:()=>e(s.id),children:[l.jsx("span",{className:T.optionLabel,children:s.label}),s.description&&l.jsx("span",{className:T.optionDescription,children:s.description})]},s.id))})]}):l.jsxs("form",{id:fe,className:T.prompt,onSubmit:r,children:[l.jsx("label",{className:T.promptMessage,htmlFor:"login-prompt-input",children:t.message}),l.jsx(Ce,{id:"login-prompt-input",autoFocus:!0,type:t.promptKind==="secret"?"password":"text",autoComplete:t.promptKind==="secret"?"off":void 0,"data-1p-ignore":t.promptKind==="secret"?"true":void 0,"data-lpignore":t.promptKind==="secret"?"true":void 0,"data-bwignore":t.promptKind==="secret"?"true":void 0,placeholder:t.placeholder,value:n,onChange:s=>i(s.target.value)})]})}const Un=1800;function he({value:t,label:n}){const[i,r]=v.useState(!1);return v.useEffect(()=>{if(!i)return;const e=setTimeout(()=>r(!1),Un);return()=>clearTimeout(e)},[i]),l.jsx(Ee,{size:"sm","aria-label":i?"Copied":n,title:i?"Copied":n,onClick:()=>{Be(t).then(()=>r(!0),()=>r(!1))},children:i?l.jsx(be,{size:14}):l.jsx(Ae,{size:14})})}function qn({authUrl:t,showInstructions:n}){return l.jsxs("div",{className:T.oauth,children:[n&&t.instructions&&l.jsx("p",{className:T.oauthInstructions,children:t.instructions}),l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsxs("a",{className:T.openButton,href:t.url,target:"_blank",rel:"noreferrer",children:[l.jsx(se,{size:14}),"Open login page"]}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.oauthUrl,children:t.url}),l.jsx(he,{value:t.url,label:"Copy link"})]})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(de,{value:t.url,label:"QR code for the provider's login page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})]})}function Fn(t){const n=Math.max(0,t),i=Math.floor(n/60),r=n%60;return`${i}:${String(r).padStart(2,"0")}`}function zn({deviceCode:t,stopped:n}){const[i,r]=v.useState(t.expiresInSeconds);return v.useEffect(()=>{if(n||t.expiresInSeconds===void 0)return;r(t.expiresInSeconds);const e=setInterval(()=>{r(o=>o===void 0?void 0:Math.max(0,o-1))},1e3);return()=>clearInterval(e)},[t.expiresInSeconds,n]),l.jsx("div",{className:T.oauth,children:l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsx("span",{className:T.oauthInstructions,children:"Enter this code at the verification page"}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.deviceCode,children:t.userCode}),l.jsx(he,{value:t.userCode,label:"Copy code"})]}),l.jsxs("a",{className:T.openButton,href:t.verificationUri,target:"_blank",rel:"noreferrer",children:[l.jsx(se,{size:14}),"Open verification page"]}),i!==void 0&&l.jsx("span",{className:T.countdown,children:i>0?`Expires in ${Fn(i)}`:"Code expired"})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(de,{value:t.verificationUri,label:"QR code for the verification page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})})}const Kn="_shell_13hat_7",Vn="_sidebar_13hat_14",On="_category_13hat_24",Hn="_categoryActive_13hat_44",Qn="_content_13hat_2",J={shell:Kn,sidebar:Vn,category:On,categoryActive:Hn,content:Qn};function er({open:t,onOpenChange:n}){var _;const i=oe(d=>d.serverInfo),r=O(d=>d.pendingLogin),e=O(d=>d.cancelLogin),o=Ne(i==null?void 0:i.features),s=Se.filter(d=>d.available(o)),[a,u]=v.useState((_=s[0])==null?void 0:_.id);v.useEffect(()=>{var d;s.some(P=>P.id===a)||u((d=s[0])==null?void 0:d.id)},[s.map(d=>d.id).join(",")]);const c=s.find(d=>d.id===a)??s[0],m=c==null?void 0:c.component;function E(d){!d&&r&&e(),n(d)}function S(d){if(r){d.preventDefault();return}const P=d.detail.originalEvent.target;P instanceof Node&&!P.isConnected&&d.preventDefault()}function h(d){r&&d.preventDefault()}return l.jsxs(l.Fragment,{children:[l.jsx(ie,{open:t,onOpenChange:E,title:"Settings",width:900,onInteractOutside:S,onEscapeKeyDown:h,children:l.jsxs("div",{className:J.shell,children:[l.jsx("nav",{className:J.sidebar,children:s.map(d=>l.jsxs("button",{type:"button",className:ye(J.category,d.id===(c==null?void 0:c.id)&&J.categoryActive),onClick:()=>u(d.id),children:[l.jsx(Ie,{icon:d.icon,size:"sm"}),d.label]},d.id))}),l.jsx("div",{className:J.content,children:m?l.jsx(v.Suspense,{fallback:l.jsxs(Lt,{children:[l.jsx(It,{size:"sm"})," Loading…"]}),children:l.jsx(m,{})}):l.jsx(Lt,{children:"No settings categories available."})})]})}),l.jsx(jn,{})]})}export{er as SettingsDialog};
|
|
7
|
+
`);const B=b(N,w,I),C=t.getSymbolSize(N),f=new r(C);return h(f,N),_(f),d(f,N),A(f,w,0),N>=7&&P(f,N),L(f,B),isNaN(g)&&(g=s.getBestMask(f,A.bind(null,f,w))),s.applyMask(g,f),A(f,w,g),{modules:f,version:N,errorCorrectionLevel:w,maskPattern:g,segments:I}}return rt.create=function(N,w){if(typeof N>"u"||N==="")throw new Error("No input text");let g=n.M,I,y;return typeof w<"u"&&(g=n.from(w.errorCorrectionLevel,n.M),I=c.from(w.version),y=s.from(w.maskPattern),w.toSJISFunc&&t.setToSJISFunction(w.toSJISFunc)),M(N,I,g,y)},rt}var Nt={},Bt={},Zt;function le(){return Zt||(Zt=1,(function(t){function n(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let r=i.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+i);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(o){return[o,o]}))),r.length===6&&r.push("F","F");const e=parseInt(r.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const e=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,o=r.width&&r.width>=21?r.width:void 0,s=r.scale||4;return{width:o,scale:o?4:s,margin:e,color:{dark:n(r.color.dark||"#000000ff"),light:n(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,e){return e.width&&e.width>=r+e.margin*2?e.width/(r+e.margin*2):e.scale},t.getImageWidth=function(r,e){const o=t.getScale(r,e);return Math.floor((r+e.margin*2)*o)},t.qrToImageData=function(r,e,o){const s=e.modules.size,a=e.modules.data,u=t.getScale(s,o),c=Math.floor((s+o.margin*2)*u),m=o.margin*u,E=[o.color.light,o.color.dark];for(let S=0;S<c;S++)for(let h=0;h<c;h++){let _=(S*c+h)*4,d=o.color.light;if(S>=m&&h>=m&&S<c-m&&h<c-m){const P=Math.floor((S-m)/u),A=Math.floor((h-m)/u);d=E[a[P*s+A]?1:0]}r[_++]=d.r,r[_++]=d.g,r[_++]=d.b,r[_]=d.a}}})(Bt)),Bt}var te;function tn(){return te||(te=1,(function(t){const n=le();function i(e,o,s){e.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=s,o.width=s,o.style.height=s+"px",o.style.width=s+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(o,s,a){let u=a,c=s;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(c=r()),u=n.getOptions(u);const m=n.getImageWidth(o.modules.size,u),E=c.getContext("2d"),S=E.createImageData(m,m);return n.qrToImageData(S.data,o,u),i(E,c,m),E.putImageData(S,0,0),c},t.renderToDataURL=function(o,s,a){let u=a;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const c=t.render(o,s,u),m=u.type||"image/png",E=u.rendererOpts||{};return c.toDataURL(m,E.quality)}})(Nt)),Nt}var St={},ee;function en(){if(ee)return St;ee=1;const t=le();function n(e,o){const s=e.a/255,a=o+'="'+e.hex+'"';return s<1?a+" "+o+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function i(e,o,s){let a=e+o;return typeof s<"u"&&(a+=" "+s),a}function r(e,o,s){let a="",u=0,c=!1,m=0;for(let E=0;E<e.length;E++){const S=Math.floor(E%o),h=Math.floor(E/o);!S&&!c&&(c=!0),e[E]?(m++,E>0&&S>0&&e[E-1]||(a+=c?i("M",S+s,.5+h+s):i("m",u,0),u=0,c=!1),S+1<o&&e[E+1]||(a+=i("h",m),m=0)):u++}return a}return St.render=function(o,s,a){const u=t.getOptions(s),c=o.modules.size,m=o.modules.data,E=c+u.margin*2,S=u.color.light.a?"<path "+n(u.color.light,"fill")+' d="M0 0h'+E+"v"+E+'H0z"/>':"",h="<path "+n(u.color.dark,"stroke")+' d="'+r(m,c,u.margin)+'"/>',_='viewBox="0 0 '+E+" "+E+'"',P='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+_+' shape-rendering="crispEdges">'+S+h+`</svg>
|
|
8
|
+
`;return typeof a=="function"&&a(null,P),P},St}var ne;function nn(){if(ne)return V;ne=1;const t=ke(),n=Ze(),i=tn(),r=en();function e(o,s,a,u,c){const m=[].slice.call(arguments,1),E=m.length,S=typeof m[E-1]=="function";if(!S&&!t())throw new Error("Callback required as last argument");if(S){if(E<2)throw new Error("Too few arguments provided");E===2?(c=a,a=s,s=u=void 0):E===3&&(s.getContext&&typeof c>"u"?(c=u,u=void 0):(c=u,u=a,a=s,s=void 0))}else{if(E<1)throw new Error("Too few arguments provided");return E===1?(a=s,s=u=void 0):E===2&&!s.getContext&&(u=a,a=s,s=void 0),new Promise(function(h,_){try{const d=n.create(a,u);h(o(d,s,u))}catch(d){_(d)}})}try{const h=n.create(a,u);c(null,o(h,s,u))}catch(h){c(h)}}return V.create=n.create,V.toCanvas=e.bind(null,i.render),V.toDataURL=e.bind(null,i.renderToDataURL),V.toString=e.bind(null,function(o,s,a){return r.render(o,a)}),V}var rn=nn();const on=me(rn),sn="_qr_lnaw6_1",an="_placeholder_lnaw6_2",re={qr:sn,placeholder:an},un=320;function de({value:t,label:n}){const[i,r]=v.useState(null),[e,o]=v.useState(!1);return v.useEffect(()=>{let s=!0;return r(null),o(!1),on.toDataURL(t,{width:un,margin:1,errorCorrectionLevel:"M"}).then(a=>{s&&r(a)}).catch(()=>{s&&o(!0)}),()=>{s=!1}},[t]),e?null:i?l.jsx("img",{className:re.qr,src:i,alt:n}):l.jsx("div",{className:re.placeholder,"aria-hidden":"true"})}const cn="_body_1yyw5_1",ln="_status_1yyw5_11",dn="_statusLine_1yyw5_17",fn="_statusLineProgress_1yyw5_18",hn="_statusText_1yyw5_28",gn="_prompt_1yyw5_40",pn="_promptMessage_1yyw5_46",mn="_options_1yyw5_51",wn="_option_1yyw5_51",yn="_optionLabel_1yyw5_76",Cn="_optionDescription_1yyw5_81",En="_success_1yyw5_86",Nn="_error_1yyw5_91",Bn="_oauth_1yyw5_98",Sn="_oauthInstructions_1yyw5_107",In="_oauthMain_1yyw5_115",Rn="_oauthActions_1yyw5_123",bn="_openButton_1yyw5_135",An="_urlRow_1yyw5_156",_n="_oauthUrl_1yyw5_164",Ln="_oauthQr_1yyw5_175",Tn="_oauthQrCaption_1yyw5_184",Mn="_deviceCode_1yyw5_191",Pn="_countdown_1yyw5_198",T={body:cn,status:ln,statusLine:dn,statusLineProgress:fn,statusText:hn,prompt:gn,promptMessage:pn,options:mn,option:wn,optionLabel:yn,optionDescription:Cn,success:En,error:Nn,oauth:Bn,oauthInstructions:Sn,oauthMain:In,oauthActions:Rn,openButton:bn,urlRow:An,oauthUrl:_n,oauthQr:Ln,oauthQrCaption:Tn,deviceCode:Mn,countdown:Pn},vn=1200,fe="provider-auth-prompt-form";function jn(){const t=O(a=>a.pendingLogin),n=O(a=>a.cancelLogin),i=O(a=>a.clearLogin),r=O(a=>a.retryLogin),e=oe(a=>a.client),o=Re(),s=v.useCallback(()=>{o.invalidateQueries({queryKey:_t.providerAuthList()}),o.invalidateQueries({queryKey:_t.providerModelsAll()})},[o]);return!t||!e?null:l.jsx(Dn,{provider:t.provider,providerName:t.providerName,authType:t.authType,controller:t.controller,client:e,onCancel:n,onClear:i,onRetry:r,onSuccess:s},`${t.provider}:${t.authType}:${t.attempt}`)}function Dn({provider:t,providerName:n,authType:i,controller:r,client:e,onCancel:o,onClear:s,onRetry:a,onSuccess:u}){var I,y,B,C;const[c,m]=v.useReducer(xe,_e(t,i)),E=v.useRef(null),S=v.useRef(!1),h=v.useRef(!1),[_,d]=v.useState(""),[P,A]=v.useState(null);v.useEffect(()=>(h.current=!0,S.current||(S.current=!0,e.loginProvider(t,i,{prompt:f=>new Promise((j,q)=>{var Y;E.current={promptId:f.promptId,resolve:j,reject:q},m({kind:"prompt",...f}),(Y=f.signal)==null||Y.addEventListener("abort",()=>{var H;((H=E.current)==null?void 0:H.promptId)===f.promptId&&(E.current=null),d(""),m({kind:"prompt_cancelled",promptId:f.promptId})},{once:!0})}),onEvent:f=>m(f)},{signal:r.signal}).then(f=>{h.current&&m({kind:"done",ok:f.ok,error:f.error})}).catch(f=>{h.current&&m({kind:"done",ok:!1,error:f instanceof Error?f.message:String(f)})})),()=>{var f;h.current=!1,(f=E.current)==null||f.reject(new Error("login dialog closed")),E.current=null}),[]),v.useEffect(()=>{var j;if(c.phase!=="done"||!((j=c.result)!=null&&j.ok))return;u();const f=setTimeout(s,vn);return()=>clearTimeout(f)},[c.phase,(I=c.result)==null?void 0:I.ok,u,s]);function L(f){const j=E.current;j&&(E.current=null,A(j.promptId),d(""),j.resolve(f))}function b(f){f.preventDefault(),L(_)}function R(f){f||(c.phase==="done"?s():o())}const M=c.phase==="done",p=M&&((y=c.result)==null?void 0:y.ok)===!0,N=M&&((B=c.result)==null?void 0:B.ok)===!1,w=c.phase==="prompt"&&c.prompt&&c.prompt.promptId!==P?c.prompt:void 0,g=w&&w.promptKind!=="select"?w:void 0;return l.jsx(ie,{open:!0,onOpenChange:R,title:`Log in to ${n}`,width:480,footer:M?l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:s,children:"Close"}),N&&l.jsx(G,{onClick:a,children:"Try again"})]}):l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:o,children:"Cancel"}),g&&l.jsx(G,{type:"submit",form:fe,children:"Submit"})]}),children:l.jsxs("div",{className:T.body,children:[l.jsx(xn,{state:c}),!M&&c.authUrl&&l.jsx(qn,{authUrl:c.authUrl,showInstructions:!g}),!M&&c.deviceCode&&l.jsx(zn,{deviceCode:c.deviceCode,stopped:M}),w&&l.jsx(kn,{prompt:w,inputValue:_,onInputChange:d,onTextSubmit:b,onSelect:L}),p&&l.jsx("p",{className:T.success,children:"Signed in. Closing…"}),N&&l.jsx("p",{className:T.error,children:((C=c.result)==null?void 0:C.error)??"Login failed."})]})})}function xn({state:t}){return t.statusLines.length===0&&t.phase!=="starting"?null:l.jsxs("div",{className:T.status,children:[t.phase==="starting"&&l.jsxs("div",{className:T.statusLine,children:[l.jsx(It,{size:"sm"})," Starting…"]}),t.statusLines.map((n,i)=>{var r;return l.jsxs("div",{className:n.kind==="progress"?T.statusLineProgress:T.statusLine,children:[n.kind==="progress"&&l.jsx(It,{size:"sm"}),l.jsxs("span",{className:T.statusText,children:[l.jsx("span",{children:n.message}),(r=n.links)==null?void 0:r.map(e=>l.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:e.label??e.url},e.url))]})]},i)})]})}function kn({prompt:t,inputValue:n,onInputChange:i,onTextSubmit:r,onSelect:e}){var o;return t.promptKind==="select"?l.jsxs("div",{className:T.prompt,children:[l.jsx("p",{className:T.promptMessage,children:t.message}),l.jsx("div",{className:T.options,children:(o=t.options)==null?void 0:o.map(s=>l.jsxs("button",{type:"button",className:T.option,onClick:()=>e(s.id),children:[l.jsx("span",{className:T.optionLabel,children:s.label}),s.description&&l.jsx("span",{className:T.optionDescription,children:s.description})]},s.id))})]}):l.jsxs("form",{id:fe,className:T.prompt,onSubmit:r,children:[l.jsx("label",{className:T.promptMessage,htmlFor:"login-prompt-input",children:t.message}),l.jsx(Ce,{id:"login-prompt-input",autoFocus:!0,type:t.promptKind==="secret"?"password":"text",autoComplete:t.promptKind==="secret"?"off":void 0,"data-1p-ignore":t.promptKind==="secret"?"true":void 0,"data-lpignore":t.promptKind==="secret"?"true":void 0,"data-bwignore":t.promptKind==="secret"?"true":void 0,placeholder:t.placeholder,value:n,onChange:s=>i(s.target.value)})]})}const Un=1800;function he({value:t,label:n}){const[i,r]=v.useState(!1);return v.useEffect(()=>{if(!i)return;const e=setTimeout(()=>r(!1),Un);return()=>clearTimeout(e)},[i]),l.jsx(Ee,{size:"sm","aria-label":i?"Copied":n,title:i?"Copied":n,onClick:()=>{Ne(t).then(()=>r(!0),()=>r(!1))},children:i?l.jsx(be,{size:14}):l.jsx(Ae,{size:14})})}function qn({authUrl:t,showInstructions:n}){return l.jsxs("div",{className:T.oauth,children:[n&&t.instructions&&l.jsx("p",{className:T.oauthInstructions,children:t.instructions}),l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsxs("a",{className:T.openButton,href:t.url,target:"_blank",rel:"noreferrer",children:[l.jsx(se,{size:14}),"Open login page"]}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.oauthUrl,children:t.url}),l.jsx(he,{value:t.url,label:"Copy link"})]})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(de,{value:t.url,label:"QR code for the provider's login page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})]})}function Fn(t){const n=Math.max(0,t),i=Math.floor(n/60),r=n%60;return`${i}:${String(r).padStart(2,"0")}`}function zn({deviceCode:t,stopped:n}){const[i,r]=v.useState(t.expiresInSeconds);return v.useEffect(()=>{if(n||t.expiresInSeconds===void 0)return;r(t.expiresInSeconds);const e=setInterval(()=>{r(o=>o===void 0?void 0:Math.max(0,o-1))},1e3);return()=>clearInterval(e)},[t.expiresInSeconds,n]),l.jsx("div",{className:T.oauth,children:l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsx("span",{className:T.oauthInstructions,children:"Enter this code at the verification page"}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.deviceCode,children:t.userCode}),l.jsx(he,{value:t.userCode,label:"Copy code"})]}),l.jsxs("a",{className:T.openButton,href:t.verificationUri,target:"_blank",rel:"noreferrer",children:[l.jsx(se,{size:14}),"Open verification page"]}),i!==void 0&&l.jsx("span",{className:T.countdown,children:i>0?`Expires in ${Fn(i)}`:"Code expired"})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(de,{value:t.verificationUri,label:"QR code for the verification page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})})}const Kn="_shell_13hat_7",Vn="_sidebar_13hat_14",On="_category_13hat_24",Hn="_categoryActive_13hat_44",Qn="_content_13hat_2",J={shell:Kn,sidebar:Vn,category:On,categoryActive:Hn,content:Qn};function er({open:t,onOpenChange:n}){var _;const i=oe(d=>d.serverInfo),r=O(d=>d.pendingLogin),e=O(d=>d.cancelLogin),o=Be(i==null?void 0:i.features),s=Se.filter(d=>d.available(o)),[a,u]=v.useState((_=s[0])==null?void 0:_.id);v.useEffect(()=>{var d;s.some(P=>P.id===a)||u((d=s[0])==null?void 0:d.id)},[s.map(d=>d.id).join(",")]);const c=s.find(d=>d.id===a)??s[0],m=c==null?void 0:c.component;function E(d){!d&&r&&e(),n(d)}function S(d){if(r){d.preventDefault();return}const P=d.detail.originalEvent.target;P instanceof Node&&!P.isConnected&&d.preventDefault()}function h(d){r&&d.preventDefault()}return l.jsxs(l.Fragment,{children:[l.jsx(ie,{open:t,onOpenChange:E,title:"Settings",width:900,onInteractOutside:S,onEscapeKeyDown:h,children:l.jsxs("div",{className:J.shell,children:[l.jsx("nav",{className:J.sidebar,children:s.map(d=>l.jsxs("button",{type:"button",className:ye(J.category,d.id===(c==null?void 0:c.id)&&J.categoryActive),onClick:()=>u(d.id),children:[l.jsx(Ie,{icon:d.icon,size:"sm"}),d.label]},d.id))}),l.jsx("div",{className:J.content,children:m?l.jsx(v.Suspense,{fallback:l.jsxs(Lt,{children:[l.jsx(It,{size:"sm"})," Loading…"]}),children:l.jsx(m,{})}):l.jsx(Lt,{children:"No settings categories available."})})]})}),l.jsx(jn,{})]})}export{er as SettingsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as t}from"./vendor-react-DQUAl2K8.js";import{u as T,r as j,q as Z,I as D,D as Y,C as Q,B as A,S as M,E as $,s as ee}from"./index-DjUHduQf.js";import{S as z}from"./StatusBadge-BMKAPA9O.js";import{S as te}from"./Switch-1I6AMAC7.js";import"./vendor-DaF96HbP.js";import{a as B,u as se}from"./vendor-query-i7fr__Xm.js";import{T as G,C as ne,b as re}from"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const ae=/^npm:\S+$/,le=/^git:\S+$/,oe=/^ssh:\/\/\S+$/,ie=/^git@[^\s:/]+:\S+$/,ce=/^https?:\/\/(?:[^\s/]*\.)?(?:github|gitlab)\.com\/\S+$/i,ue=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\S+\.git$/,de=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,H="[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?",pe=new RegExp(`^${H}/${H}(?:@${H})?$`);function ge(e){const s=e.trim();return s.length===0?null:ae.test(s)?{kind:"pi_npm",normalized:s}:le.test(s)?{kind:"pi_git",normalized:s}:s==="~"||s.startsWith("~/")||s.startsWith("/")?{kind:"local_path",normalized:s}:ie.test(s)||oe.test(s)||ce.test(s)||ue.test(s)?{kind:"skills_repo",normalized:s}:de.test(s)?null:pe.test(s)?{kind:"skills_repo",normalized:s}:null}const U={agent_dir:"Pi skills",agents_dir:"Agent Skills",settings_path:"Skill paths"},q=new Set(["agent_dir","agents_dir"]);function _e(e,s){return q.has(e.origin)&&s.some(r=>r!==e&&r.name===e.name&&q.has(r.origin))?`Pi applies this setting to every '${e.name}' skill folder.`:null}function he(e,s,a){var o;const r=!!e.shadowedBy,l=[];if(r){const u=e.shadowedBy?a.get(e.shadowedBy):void 0;l.push({label:`shadowed by ${(u==null?void 0:u.originLabel)??e.shadowedBy}`,variant:"warning"})}return e.symlinkTarget&&l.push({label:`→ ${e.symlinkTarget}`,variant:"muted"}),e.disableModelInvocation&&l.push({label:"manual only",variant:"muted"}),(o=e.provenance)!=null&&o.source&&l.push({label:e.provenance.source,variant:"muted"}),{skill:e,muted:r,toggleDisabled:r,badges:l,warnings:e.warnings??[],sharedPatternTooltip:_e(e,s)}}function me(e){const s=[{label:e.kind,variant:"muted"}];return e.curated&&s.push({label:"curated",variant:"success"}),e.pinned&&s.push({label:"pinned",variant:"muted"}),s}function fe(e,s){const a=new Map(e.map(c=>[c.path,c])),r=c=>he(c,e,a),l=[],o=e.filter(c=>c.origin==="agent_dir").map(r);o.length>0&&l.push({id:"agent_dir",label:U.agent_dir,rows:o});const u=e.filter(c=>c.origin==="agents_dir").map(r);u.length>0&&l.push({id:"agents_dir",label:U.agents_dir,rows:u});const g=e.filter(c=>c.origin==="package"),d=new Set;for(const c of s){d.add(c.source);const v=g.filter(w=>w.packageSource===c.source).map(r);v.length>0&&l.push({id:`package:${c.source}`,label:c.source,rows:v,packageInfo:c})}const n=Array.from(new Set(g.filter(c=>c.packageSource&&!d.has(c.packageSource)).map(c=>c.packageSource)));for(const c of n){const v=g.filter(w=>w.packageSource===c).map(r);v.length>0&&l.push({id:`package:${c}`,label:c,rows:v})}const i=e.filter(c=>c.origin==="settings_path").map(r);i.length>0&&l.push({id:"settings_path",label:U.settings_path,rows:i});const f=new Set(["agent_dir","agents_dir","package","settings_path"]),k=Array.from(new Set(e.filter(c=>!f.has(c.origin)).map(c=>c.origin)));for(const c of k){const v=e.filter(w=>w.origin===c).map(r);v.length>0&&l.push({id:c,label:c,rows:v})}return l}function ke(e,s){const a=s.trim().toLowerCase();return a?e.map(r=>({...r,rows:r.rows.filter(l=>l.skill.name.toLowerCase().includes(a)||(l.skill.description??"").toLowerCase().includes(a))})).filter(r=>r.rows.length>0):e}function Se(e,s){if(e.origin!=="package"||!e.packageSource)return!1;const a=s.find(r=>r.source===e.packageSource);return!!(a!=null&&a.curated)}function we(e){return e.symlinkTarget?`Removes the link only; ${e.symlinkTarget} is kept.`:e.origin==="agents_dir"&&e.provenance?`Removes '${e.name}' for every agent on this machine.`:e.origin==="settings_path"?`Removes the Pi settings entry that provides ${e.path} (other skills from the same folder stop loading too); files are kept.`:`Deletes ${e.path}.`}function ve(e){const s=e.skillCount;return`Remove ${e.source}? This removes ${s} skill${s===1?"":"s"}.`}const Re="Updates every Agent Skills skill and every unpinned Pi package; may take several minutes",xe={"agent-skills":"Agent Skills","pi-packages":"Pi packages"};function be(e){return xe[e]??e}const je={settings_unreadable:"Can't read settings.json — skills can't be loaded or changed until this is fixed.",invalid_source:"That source isn't recognized.",not_found:"That skill could not be found.",not_removable:"That skill can't be removed from here.",spawn_failed:"Could not run the skills command.",timeout:"Timed out."};function X(e){return{...e,ok:!0,error:void 0,message:void 0}}function J(e){return e.results.length>0}function L(e,s){return e?s||(je[e]??e):null}const Ee={pi_npm:"npm package",pi_git:"git package",skills_repo:"Agent Skills repo",local_path:"Folder on daemon host"};function ye(e){return e?Ee[e.kind]:"Unrecognized"}function K(e){return e==="pi_npm"||e==="pi_git"}function Ne(e){return e!==null}const Ae="Installs the package's skills only; its extensions stay disabled. Pi packages run with full system access — review the source before installing.";function Ce(e){return e.installResult?"results":e.installPending?"running":e.previewPending?"previewing":e.previewResult?"pick":"source"}function ze(e){return e.map(s=>({skill:s,checked:s.valid,replace:!1}))}function W(e){return e.filter(s=>s.skill.valid&&s.checked&&(!s.skill.exists||s.replace)).map(s=>s.skill.name)}function Te(e){return e.some(s=>s.skill.valid&&s.checked&&s.skill.exists&&s.replace)}function Le(e,s,a){return{...e,skills:e.skills.map(r=>r.path===s?{...r,enabled:a}:r)}}function Pe(){const e=T(a=>a.client),s=B();return h.useEffect(()=>{if(e)return e.onSkillsChanged(()=>{s.invalidateQueries({queryKey:j.skillsList()})})},[e,s]),se({queryKey:j.skillsList(),queryFn:()=>{if(!e)throw new Error("not connected");return e.listSkills()},enabled:!!e})}function De(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){r(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d,n){if(!e)return;const i=d.path;u(i),o(k=>({...k,[i]:!0}));const f=s.getQueryData(j.skillsList());f&&s.setQueryData(j.skillsList(),Le(f,i,n));try{const k=await e.setSkillEnabled(i,n);if(!k.ok){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:L(k.error,k.message)??"Failed to update skill."}));return}s.setQueryData(j.skillsList(),k)}catch(k){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:k instanceof Error?k.message:"Failed to update skill."}))}finally{o(k=>{const c={...k};return delete c[i],c})}}return{rowErrors:a,pending:l,toggle:g,clearRowError:u}}function Be(e){return e.path??`package:${e.packageSource}`}function Ie(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){o(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d){if(!e)return;const n=Be(d);u(n),r(i=>({...i,[n]:!0}));try{const i=await e.removeSkill(d);if(!i.ok){o(f=>({...f,[n]:L(i.error,i.message)??"Failed to remove."}));return}s.setQueryData(j.skillsList(),i)}catch(i){o(f=>({...f,[n]:i instanceof Error?i.message:"Failed to remove."}))}finally{r(i=>{const f={...i};return delete f[n],f})}}return{pending:a,errors:l,clearError:u,removeSkill:d=>g({path:d.path}),removePackage:d=>g({packageSource:d.source})}}function $e(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(){if(e){r(!0),g(null);try{const n=await e.updateAllSkills();if(!n.ok&&!J(n)){g(L(n.error,n.message)??"Failed to update skills.");return}o(n),s.setQueryData(j.skillsList(),X(n))}catch(n){g(n instanceof Error?n.message:"Failed to update skills.")}finally{r(!1)}}}return{pending:a,result:l,error:u,updateAll:d,clearResult:()=>o(null)}}function Me(){const e=T(d=>d.client),[s,a]=h.useState(!1),[r,l]=h.useState(null),[o,u]=h.useState(null);async function g(d){if(e){a(!0),u(null);try{const n=await e.previewSkillSource(d);if(!n.ok){u(L(n.error,n.message)??"Failed to preview.");return}l(n)}catch(n){u(n instanceof Error?n.message:"Failed to preview.")}finally{a(!1)}}}return{pending:s,result:r,error:o,preview:g,reset:()=>{l(null),u(null)}}}function Fe(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(n){if(e){r(!0),g(null);try{const i=await e.installSkills(n);if(!i.ok&&!J(i)){g(L(i.error,i.message)??"Failed to install.");return}o(i),s.setQueryData(j.skillsList(),X(i))}catch(i){g(i instanceof Error?i.message:"Failed to install.")}finally{r(!1)}}}return{pending:a,result:l,error:u,install:d,reset:()=>{o(null),g(null)}}}const Oe="_sourceStep_1n0el_6",He="_sourceLabel_1n0el_13",Ue="_notice_1n0el_18",Ge="_error_1n0el_30",Qe="_statusStep_1n0el_35",qe="_pickStep_1n0el_45",Ke="_pickRows_1n0el_52",We="_pickRow_1n0el_52",Ze="_pickRowMain_1n0el_73",Xe="_pickRowTop_1n0el_80",Je="_pickRowName_1n0el_87",Ve="_pickRowDescription_1n0el_95",Ye="_backButton_1n0el_103",et="_results_1n0el_107",tt="_resultRow_1n0el_116",st="_resultHeader_1n0el_125",nt="_resultTarget_1n0el_132",rt="_resultError_1n0el_140",at="_resultToggle_1n0el_148",lt="_resultStderr_1n0el_159",m={sourceStep:Oe,sourceLabel:He,notice:Ue,error:Ge,statusStep:Qe,pickStep:qe,pickRows:Ke,pickRow:We,pickRowMain:Ze,pickRowTop:Xe,pickRowName:Je,pickRowDescription:Ve,backButton:Ye,results:et,resultRow:tt,resultHeader:st,resultTarget:nt,resultError:rt,resultToggle:at,resultStderr:lt};function ot({open:e,onOpenChange:s}){var I;const a=Me(),r=Fe(),[l,o]=h.useState(""),[u,g]=h.useState([]),d=h.useRef(!1),n=ge(l),i=Ce({previewPending:a.pending,previewResult:a.result,installPending:r.pending,installResult:r.result});h.useEffect(()=>{e&&!d.current&&!r.pending&&!r.result&&(o(""),g([]),a.reset()),d.current=e},[e]),h.useEffect(()=>{a.result&&g(ze(a.result.skills))},[a.result]);async function f(){if(n){if(K(n.kind)){await r.install({source:n.normalized});return}await a.preview(n.normalized)}}function k(R,N){g(P=>P.map((_,b)=>b===R?{..._,...N}:_))}async function c(){var N;const R=W(u);R.length!==0&&await r.install({source:((N=a.result)==null?void 0:N.source)??(n==null?void 0:n.normalized)??l,skills:R,replace:Te(u)})}function v(){a.reset(),g([])}function w(){r.reset(),s(!1)}const F=((I=a.result)==null?void 0:I.source)??(n==null?void 0:n.normalized)??l,O=W(u).length;let y,E;return i==="source"?(y=t.jsxs("div",{className:m.sourceStep,children:[t.jsx(Z,{autoFocus:!0,placeholder:"npm:<name>, git:<url>, owner/repo, or a daemon-host path",value:l,onChange:R=>o(R.target.value),"aria-label":"Install source"}),t.jsx("div",{className:m.sourceLabel,children:ye(n)}),n&&K(n.kind)&&t.jsxs("div",{className:m.notice,children:[t.jsx(D,{icon:G,size:"xs"}),t.jsx("span",{children:Ae})]}),a.error&&t.jsx("div",{className:m.error,children:a.error})]}),E=t.jsx(A,{size:"sm",disabled:!Ne(n),loading:r.pending,onClick:()=>void f(),children:"Next"})):i==="previewing"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Looking up the source…"]}),E=null):i==="pick"?(y=t.jsxs("div",{className:m.pickStep,children:[u.length===0?t.jsx("div",{className:m.statusStep,children:"No installable skills found."}):t.jsx("div",{className:m.pickRows,children:u.map((R,N)=>t.jsx(it,{row:R,onChange:P=>k(N,P)},R.skill.relPath))}),r.error&&t.jsx("div",{className:m.error,children:r.error})]}),E=t.jsxs(t.Fragment,{children:[t.jsx(A,{size:"sm",variant:"ghost",className:m.backButton,onClick:v,children:"‹ Back"}),t.jsxs(A,{size:"sm",disabled:O===0,loading:r.pending,onClick:()=>void c(),children:["Install from ",F]})]})):i==="running"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Installing… this may take several minutes"]}),E=null):(y=r.result?t.jsx(ct,{result:r.result}):null,E=t.jsx(A,{size:"sm",onClick:w,children:"Done"})),t.jsx(Y,{open:e,onOpenChange:R=>{if(!R&&i==="results"){w();return}s(R)},title:"Install skill…",width:480,footer:E,children:y})}function it({row:e,onChange:s}){const{skill:a,checked:r,replace:l}=e,o=!a.valid;return t.jsxs("div",{className:m.pickRow,"data-disabled":o||void 0,children:[t.jsx(Q,{checked:r&&a.valid,disabled:o,onChange:u=>s({checked:u.target.checked}),"aria-label":a.name}),t.jsxs("div",{className:m.pickRowMain,children:[t.jsxs("div",{className:m.pickRowTop,children:[t.jsx("span",{className:m.pickRowName,children:a.name}),!a.valid&&t.jsx(z,{label:"Invalid",variant:"error"}),a.exists&&t.jsx(z,{label:"Already installed",variant:"warning"}),a.warnings&&a.warnings.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":a.warnings.join("; ")})]}),a.description&&t.jsx("span",{className:m.pickRowDescription,children:a.description}),a.exists&&a.valid&&t.jsx(Q,{label:"Already installed — replace",checked:l,onChange:u=>s({replace:u.target.checked})})]})]})}function ct({result:e}){const[s,a]=h.useState(()=>new Set);function r(l){a(o=>{const u=new Set(o);return u.has(l)?u.delete(l):u.add(l),u})}return t.jsx("div",{className:m.results,children:e.results.map((l,o)=>{const u=s.has(o);return t.jsxs("div",{className:m.resultRow,children:[t.jsxs("div",{className:m.resultHeader,children:[t.jsx(z,{label:l.ok?"Installed":"Failed",variant:l.ok?"success":"error"}),t.jsx("span",{className:m.resultTarget,children:l.target}),l.error&&t.jsx("span",{className:m.resultError,children:l.error}),l.stderr&&t.jsx("button",{type:"button",className:m.resultToggle,onClick:()=>r(o),children:u?"Hide details":"Show details"})]}),u&&l.stderr&&t.jsx("pre",{className:m.resultStderr,children:l.stderr})]},`${l.target}-${o}`)})})}const ut="_panel_1tczp_1",dt="_toolbar_1tczp_7",pt="_search_1tczp_14",gt="_groups_1tczp_19",_t="_group_1tczp_19",ht="_groupHeader_1tczp_30",mt="_chevronExpanded_1tczp_47",ft="_groupLabel_1tczp_51",kt="_groupBadges_1tczp_62",St="_groupCount_1tczp_68",wt="_rows_1tczp_74",vt="_row_1tczp_74",Rt="_rowMain_1tczp_91",xt="_rowTop_1tczp_98",bt="_name_1tczp_105",jt="_nameMuted_1tczp_113 _name_1tczp_105",Et="_badge_1tczp_118",yt="_description_1tczp_122",Nt="_descriptionMuted_1tczp_130 _description_1tczp_122",At="_rowError_1tczp_135",Ct="_footnote_1tczp_147",zt="_errorState_1tczp_153",Tt="_removePackageBtn_1tczp_157",Lt="_rowActions_1tczp_161",Pt="_updateAllResults_1tczp_168",Dt="_updateAllResultRow_1tczp_178",Bt="_updateAllResultHeader_1tczp_184",It="_updateAllResultLabel_1tczp_191",$t="_updateAllResultError_1tczp_196",Mt="_updateAllResultToggle_1tczp_204",Ft="_updateAllResultStderr_1tczp_215",p={panel:ut,toolbar:dt,search:pt,groups:gt,group:_t,groupHeader:ht,chevronExpanded:mt,groupLabel:ft,groupBadges:kt,groupCount:St,rows:wt,row:vt,rowMain:Rt,rowTop:xt,name:bt,nameMuted:jt,badge:Et,description:yt,descriptionMuted:Nt,rowError:At,footnote:Ct,errorState:zt,removePackageBtn:Tt,rowActions:Lt,updateAllResults:Pt,updateAllResultRow:Dt,updateAllResultHeader:Bt,updateAllResultLabel:It,updateAllResultError:$t,updateAllResultToggle:Mt,updateAllResultStderr:Ft};function Vt(){const{data:e,isLoading:s,isError:a,error:r}=Pe(),{rowErrors:l,pending:o,toggle:u,clearRowError:g}=De(),d=Ie(),n=$e(),[i,f]=h.useState(""),[k,c]=h.useState(()=>new Set),[v,w]=h.useState(!1),[F,O]=h.useState(()=>new Set);function y(_){c(b=>{const x=new Set(b);return x.has(_)?x.delete(_):x.add(_),x})}if(s)return t.jsxs($,{children:[t.jsx(M,{size:"sm"})," Loading skills…"]});if(a)return t.jsx($,{className:p.errorState,children:r instanceof Error?r.message:"Failed to load skills."});if(!e)return null;if(!e.ok)return t.jsx($,{className:p.errorState,children:L(e.error,e.message)??"Could not load skills."});const E=ke(fe(e.skills,e.packages),i);function I(_,b){if(b&&_.packageSource&&Se(_,e.packages)&&!F.has(_.packageSource)){if(!window.confirm("Pi-Studio will stop managing this package's updates."))return;O(x=>new Set(x).add(_.packageSource))}u(_,b)}function R(_){window.confirm(we(_))&&d.removeSkill(_)}function N(_){window.confirm(ve(_))&&d.removePackage(_)}function P(){window.confirm(Re)&&n.updateAll()}return t.jsxs("div",{className:p.panel,children:[t.jsxs("div",{className:p.toolbar,children:[t.jsx(Z,{className:p.search,placeholder:"Search skills…",value:i,onChange:_=>f(_.target.value),"aria-label":"Search skills"}),t.jsx(A,{size:"sm",variant:"outline",loading:n.pending,onClick:P,children:"Update all"}),t.jsx(A,{size:"sm",onClick:()=>w(!0),children:"Install skill…"})]}),n.error&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>n.updateAll().catch(()=>{}),children:n.error}),n.result&&t.jsx(Ot,{result:n.result,onDismiss:n.clearResult}),E.length===0?t.jsx($,{children:i?"No skills match your search.":"No skills found."}):t.jsx("div",{className:p.groups,children:E.map(_=>{const b=k.has(_.id),x=_.packageInfo,C=x?`package:${x.source}`:void 0;return t.jsxs("div",{className:p.group,children:[t.jsxs("button",{type:"button",className:p.groupHeader,onClick:()=>y(_.id),"aria-expanded":!b,children:[t.jsx(D,{icon:ne,size:"xs",className:b?void 0:p.chevronExpanded}),t.jsx("span",{className:p.groupLabel,children:_.label}),x&&t.jsx("span",{className:p.groupBadges,children:me(x).map(S=>t.jsx(z,{label:S.label,variant:S.variant},S.label))}),t.jsx("span",{className:p.groupCount,children:_.rows.length}),x&&t.jsx(A,{size:"xs",variant:"ghost",className:p.removePackageBtn,loading:C?!!d.pending[C]:!1,onClick:S=>{S.stopPropagation(),N(x)},children:"Remove package"})]}),C&&d.errors[C]&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>d.clearError(C),children:d.errors[C]}),!b&&t.jsx("div",{className:p.rows,children:_.rows.map(S=>t.jsx(Ht,{row:S,error:l[S.skill.path],pending:!!o[S.skill.path],removeError:d.errors[S.skill.path],removePending:!!d.pending[S.skill.path],onToggle:V=>I(S.skill,V),onDismissError:()=>g(S.skill.path),onRemove:()=>R(S.skill),onDismissRemoveError:()=>d.clearError(S.skill.path)},S.skill.path))})]},_.id)})}),t.jsx("p",{className:p.footnote,children:"Changes apply to newly started agent sessions."}),t.jsx(ot,{open:v,onOpenChange:w})]})}function Ot({result:e,onDismiss:s}){const[a,r]=h.useState(()=>new Set);function l(o){r(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})}return t.jsxs("div",{className:p.updateAllResults,children:[e.results.map(o=>{const u=a.has(o.target);return t.jsxs("div",{className:p.updateAllResultRow,children:[t.jsxs("div",{className:p.updateAllResultHeader,children:[t.jsx(z,{label:o.ok?"Succeeded":"Failed",variant:o.ok?"success":"error"}),t.jsx("span",{className:p.updateAllResultLabel,children:be(o.target)}),o.error&&t.jsx("span",{className:p.updateAllResultError,children:o.error}),o.stderr&&t.jsx("button",{type:"button",className:p.updateAllResultToggle,onClick:()=>l(o.target),children:u?"Hide details":"Show details"})]}),u&&o.stderr&&t.jsx("pre",{className:p.updateAllResultStderr,children:o.stderr})]},o.target)}),t.jsx("button",{type:"button",className:p.rowError,onClick:s,children:"Dismiss"})]})}function Ht({row:e,error:s,pending:a,removeError:r,removePending:l,onToggle:o,onDismissError:u,onRemove:g,onDismissRemoveError:d}){const{skill:n,muted:i,toggleDisabled:f,badges:k,warnings:c,sharedPatternTooltip:v}=e;return t.jsxs("div",{className:p.row,title:v??void 0,children:[t.jsxs("div",{className:p.rowMain,children:[t.jsxs("div",{className:p.rowTop,children:[t.jsx("span",{className:i?p.nameMuted:p.name,children:n.name}),c.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":c.join("; ")}),k.map(w=>t.jsx(z,{label:w.label,variant:w.variant,className:p.badge},w.label))]}),n.description&&t.jsx("span",{className:i?p.descriptionMuted:p.description,children:n.description}),s&&t.jsx("button",{type:"button",className:p.rowError,onClick:u,children:s}),r&&t.jsx("button",{type:"button",className:p.rowError,onClick:d,children:r})]}),t.jsxs("div",{className:p.rowActions,children:[t.jsx(te,{checked:n.enabled,disabled:f||a,onCheckedChange:o,"aria-label":n.name}),n.removable&&t.jsx(ee,{"aria-label":`Remove ${n.name}`,disabled:l,onClick:g,children:l?t.jsx(M,{size:"xs"}):t.jsx(D,{icon:re,size:"xs"})})]})]})}export{Vt as SkillsPanel};
|
|
1
|
+
import{r as h,j as t}from"./vendor-react-DQUAl2K8.js";import{u as T,r as j,q as Z,I as D,D as Y,C as Q,B as A,S as M,E as $,s as ee}from"./index-CchwjcLZ.js";import{S as z}from"./StatusBadge-BMKAPA9O.js";import{S as te}from"./Switch-1I6AMAC7.js";import"./vendor-DaF96HbP.js";import{a as B,u as se}from"./vendor-query-i7fr__Xm.js";import{T as G,C as ne,b as re}from"./vendor-icons-Bh5CT32q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const ae=/^npm:\S+$/,le=/^git:\S+$/,oe=/^ssh:\/\/\S+$/,ie=/^git@[^\s:/]+:\S+$/,ce=/^https?:\/\/(?:[^\s/]*\.)?(?:github|gitlab)\.com\/\S+$/i,ue=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\S+\.git$/,de=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,H="[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?",pe=new RegExp(`^${H}/${H}(?:@${H})?$`);function ge(e){const s=e.trim();return s.length===0?null:ae.test(s)?{kind:"pi_npm",normalized:s}:le.test(s)?{kind:"pi_git",normalized:s}:s==="~"||s.startsWith("~/")||s.startsWith("/")?{kind:"local_path",normalized:s}:ie.test(s)||oe.test(s)||ce.test(s)||ue.test(s)?{kind:"skills_repo",normalized:s}:de.test(s)?null:pe.test(s)?{kind:"skills_repo",normalized:s}:null}const U={agent_dir:"Pi skills",agents_dir:"Agent Skills",settings_path:"Skill paths"},q=new Set(["agent_dir","agents_dir"]);function _e(e,s){return q.has(e.origin)&&s.some(r=>r!==e&&r.name===e.name&&q.has(r.origin))?`Pi applies this setting to every '${e.name}' skill folder.`:null}function he(e,s,a){var o;const r=!!e.shadowedBy,l=[];if(r){const u=e.shadowedBy?a.get(e.shadowedBy):void 0;l.push({label:`shadowed by ${(u==null?void 0:u.originLabel)??e.shadowedBy}`,variant:"warning"})}return e.symlinkTarget&&l.push({label:`→ ${e.symlinkTarget}`,variant:"muted"}),e.disableModelInvocation&&l.push({label:"manual only",variant:"muted"}),(o=e.provenance)!=null&&o.source&&l.push({label:e.provenance.source,variant:"muted"}),{skill:e,muted:r,toggleDisabled:r,badges:l,warnings:e.warnings??[],sharedPatternTooltip:_e(e,s)}}function me(e){const s=[{label:e.kind,variant:"muted"}];return e.curated&&s.push({label:"curated",variant:"success"}),e.pinned&&s.push({label:"pinned",variant:"muted"}),s}function fe(e,s){const a=new Map(e.map(c=>[c.path,c])),r=c=>he(c,e,a),l=[],o=e.filter(c=>c.origin==="agent_dir").map(r);o.length>0&&l.push({id:"agent_dir",label:U.agent_dir,rows:o});const u=e.filter(c=>c.origin==="agents_dir").map(r);u.length>0&&l.push({id:"agents_dir",label:U.agents_dir,rows:u});const g=e.filter(c=>c.origin==="package"),d=new Set;for(const c of s){d.add(c.source);const v=g.filter(w=>w.packageSource===c.source).map(r);v.length>0&&l.push({id:`package:${c.source}`,label:c.source,rows:v,packageInfo:c})}const n=Array.from(new Set(g.filter(c=>c.packageSource&&!d.has(c.packageSource)).map(c=>c.packageSource)));for(const c of n){const v=g.filter(w=>w.packageSource===c).map(r);v.length>0&&l.push({id:`package:${c}`,label:c,rows:v})}const i=e.filter(c=>c.origin==="settings_path").map(r);i.length>0&&l.push({id:"settings_path",label:U.settings_path,rows:i});const f=new Set(["agent_dir","agents_dir","package","settings_path"]),k=Array.from(new Set(e.filter(c=>!f.has(c.origin)).map(c=>c.origin)));for(const c of k){const v=e.filter(w=>w.origin===c).map(r);v.length>0&&l.push({id:c,label:c,rows:v})}return l}function ke(e,s){const a=s.trim().toLowerCase();return a?e.map(r=>({...r,rows:r.rows.filter(l=>l.skill.name.toLowerCase().includes(a)||(l.skill.description??"").toLowerCase().includes(a))})).filter(r=>r.rows.length>0):e}function Se(e,s){if(e.origin!=="package"||!e.packageSource)return!1;const a=s.find(r=>r.source===e.packageSource);return!!(a!=null&&a.curated)}function we(e){return e.symlinkTarget?`Removes the link only; ${e.symlinkTarget} is kept.`:e.origin==="agents_dir"&&e.provenance?`Removes '${e.name}' for every agent on this machine.`:e.origin==="settings_path"?`Removes the Pi settings entry that provides ${e.path} (other skills from the same folder stop loading too); files are kept.`:`Deletes ${e.path}.`}function ve(e){const s=e.skillCount;return`Remove ${e.source}? This removes ${s} skill${s===1?"":"s"}.`}const Re="Updates every Agent Skills skill and every unpinned Pi package; may take several minutes",xe={"agent-skills":"Agent Skills","pi-packages":"Pi packages"};function be(e){return xe[e]??e}const je={settings_unreadable:"Can't read settings.json — skills can't be loaded or changed until this is fixed.",invalid_source:"That source isn't recognized.",not_found:"That skill could not be found.",not_removable:"That skill can't be removed from here.",spawn_failed:"Could not run the skills command.",timeout:"Timed out."};function X(e){return{...e,ok:!0,error:void 0,message:void 0}}function J(e){return e.results.length>0}function L(e,s){return e?s||(je[e]??e):null}const Ee={pi_npm:"npm package",pi_git:"git package",skills_repo:"Agent Skills repo",local_path:"Folder on daemon host"};function ye(e){return e?Ee[e.kind]:"Unrecognized"}function K(e){return e==="pi_npm"||e==="pi_git"}function Ne(e){return e!==null}const Ae="Installs the package's skills only; its extensions stay disabled. Pi packages run with full system access — review the source before installing.";function Ce(e){return e.installResult?"results":e.installPending?"running":e.previewPending?"previewing":e.previewResult?"pick":"source"}function ze(e){return e.map(s=>({skill:s,checked:s.valid,replace:!1}))}function W(e){return e.filter(s=>s.skill.valid&&s.checked&&(!s.skill.exists||s.replace)).map(s=>s.skill.name)}function Te(e){return e.some(s=>s.skill.valid&&s.checked&&s.skill.exists&&s.replace)}function Le(e,s,a){return{...e,skills:e.skills.map(r=>r.path===s?{...r,enabled:a}:r)}}function Pe(){const e=T(a=>a.client),s=B();return h.useEffect(()=>{if(e)return e.onSkillsChanged(()=>{s.invalidateQueries({queryKey:j.skillsList()})})},[e,s]),se({queryKey:j.skillsList(),queryFn:()=>{if(!e)throw new Error("not connected");return e.listSkills()},enabled:!!e})}function De(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){r(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d,n){if(!e)return;const i=d.path;u(i),o(k=>({...k,[i]:!0}));const f=s.getQueryData(j.skillsList());f&&s.setQueryData(j.skillsList(),Le(f,i,n));try{const k=await e.setSkillEnabled(i,n);if(!k.ok){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:L(k.error,k.message)??"Failed to update skill."}));return}s.setQueryData(j.skillsList(),k)}catch(k){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:k instanceof Error?k.message:"Failed to update skill."}))}finally{o(k=>{const c={...k};return delete c[i],c})}}return{rowErrors:a,pending:l,toggle:g,clearRowError:u}}function Be(e){return e.path??`package:${e.packageSource}`}function Ie(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){o(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d){if(!e)return;const n=Be(d);u(n),r(i=>({...i,[n]:!0}));try{const i=await e.removeSkill(d);if(!i.ok){o(f=>({...f,[n]:L(i.error,i.message)??"Failed to remove."}));return}s.setQueryData(j.skillsList(),i)}catch(i){o(f=>({...f,[n]:i instanceof Error?i.message:"Failed to remove."}))}finally{r(i=>{const f={...i};return delete f[n],f})}}return{pending:a,errors:l,clearError:u,removeSkill:d=>g({path:d.path}),removePackage:d=>g({packageSource:d.source})}}function $e(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(){if(e){r(!0),g(null);try{const n=await e.updateAllSkills();if(!n.ok&&!J(n)){g(L(n.error,n.message)??"Failed to update skills.");return}o(n),s.setQueryData(j.skillsList(),X(n))}catch(n){g(n instanceof Error?n.message:"Failed to update skills.")}finally{r(!1)}}}return{pending:a,result:l,error:u,updateAll:d,clearResult:()=>o(null)}}function Me(){const e=T(d=>d.client),[s,a]=h.useState(!1),[r,l]=h.useState(null),[o,u]=h.useState(null);async function g(d){if(e){a(!0),u(null);try{const n=await e.previewSkillSource(d);if(!n.ok){u(L(n.error,n.message)??"Failed to preview.");return}l(n)}catch(n){u(n instanceof Error?n.message:"Failed to preview.")}finally{a(!1)}}}return{pending:s,result:r,error:o,preview:g,reset:()=>{l(null),u(null)}}}function Fe(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(n){if(e){r(!0),g(null);try{const i=await e.installSkills(n);if(!i.ok&&!J(i)){g(L(i.error,i.message)??"Failed to install.");return}o(i),s.setQueryData(j.skillsList(),X(i))}catch(i){g(i instanceof Error?i.message:"Failed to install.")}finally{r(!1)}}}return{pending:a,result:l,error:u,install:d,reset:()=>{o(null),g(null)}}}const Oe="_sourceStep_1n0el_6",He="_sourceLabel_1n0el_13",Ue="_notice_1n0el_18",Ge="_error_1n0el_30",Qe="_statusStep_1n0el_35",qe="_pickStep_1n0el_45",Ke="_pickRows_1n0el_52",We="_pickRow_1n0el_52",Ze="_pickRowMain_1n0el_73",Xe="_pickRowTop_1n0el_80",Je="_pickRowName_1n0el_87",Ve="_pickRowDescription_1n0el_95",Ye="_backButton_1n0el_103",et="_results_1n0el_107",tt="_resultRow_1n0el_116",st="_resultHeader_1n0el_125",nt="_resultTarget_1n0el_132",rt="_resultError_1n0el_140",at="_resultToggle_1n0el_148",lt="_resultStderr_1n0el_159",m={sourceStep:Oe,sourceLabel:He,notice:Ue,error:Ge,statusStep:Qe,pickStep:qe,pickRows:Ke,pickRow:We,pickRowMain:Ze,pickRowTop:Xe,pickRowName:Je,pickRowDescription:Ve,backButton:Ye,results:et,resultRow:tt,resultHeader:st,resultTarget:nt,resultError:rt,resultToggle:at,resultStderr:lt};function ot({open:e,onOpenChange:s}){var I;const a=Me(),r=Fe(),[l,o]=h.useState(""),[u,g]=h.useState([]),d=h.useRef(!1),n=ge(l),i=Ce({previewPending:a.pending,previewResult:a.result,installPending:r.pending,installResult:r.result});h.useEffect(()=>{e&&!d.current&&!r.pending&&!r.result&&(o(""),g([]),a.reset()),d.current=e},[e]),h.useEffect(()=>{a.result&&g(ze(a.result.skills))},[a.result]);async function f(){if(n){if(K(n.kind)){await r.install({source:n.normalized});return}await a.preview(n.normalized)}}function k(R,N){g(P=>P.map((_,b)=>b===R?{..._,...N}:_))}async function c(){var N;const R=W(u);R.length!==0&&await r.install({source:((N=a.result)==null?void 0:N.source)??(n==null?void 0:n.normalized)??l,skills:R,replace:Te(u)})}function v(){a.reset(),g([])}function w(){r.reset(),s(!1)}const F=((I=a.result)==null?void 0:I.source)??(n==null?void 0:n.normalized)??l,O=W(u).length;let y,E;return i==="source"?(y=t.jsxs("div",{className:m.sourceStep,children:[t.jsx(Z,{autoFocus:!0,placeholder:"npm:<name>, git:<url>, owner/repo, or a daemon-host path",value:l,onChange:R=>o(R.target.value),"aria-label":"Install source"}),t.jsx("div",{className:m.sourceLabel,children:ye(n)}),n&&K(n.kind)&&t.jsxs("div",{className:m.notice,children:[t.jsx(D,{icon:G,size:"xs"}),t.jsx("span",{children:Ae})]}),a.error&&t.jsx("div",{className:m.error,children:a.error})]}),E=t.jsx(A,{size:"sm",disabled:!Ne(n),loading:r.pending,onClick:()=>void f(),children:"Next"})):i==="previewing"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Looking up the source…"]}),E=null):i==="pick"?(y=t.jsxs("div",{className:m.pickStep,children:[u.length===0?t.jsx("div",{className:m.statusStep,children:"No installable skills found."}):t.jsx("div",{className:m.pickRows,children:u.map((R,N)=>t.jsx(it,{row:R,onChange:P=>k(N,P)},R.skill.relPath))}),r.error&&t.jsx("div",{className:m.error,children:r.error})]}),E=t.jsxs(t.Fragment,{children:[t.jsx(A,{size:"sm",variant:"ghost",className:m.backButton,onClick:v,children:"‹ Back"}),t.jsxs(A,{size:"sm",disabled:O===0,loading:r.pending,onClick:()=>void c(),children:["Install from ",F]})]})):i==="running"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Installing… this may take several minutes"]}),E=null):(y=r.result?t.jsx(ct,{result:r.result}):null,E=t.jsx(A,{size:"sm",onClick:w,children:"Done"})),t.jsx(Y,{open:e,onOpenChange:R=>{if(!R&&i==="results"){w();return}s(R)},title:"Install skill…",width:480,footer:E,children:y})}function it({row:e,onChange:s}){const{skill:a,checked:r,replace:l}=e,o=!a.valid;return t.jsxs("div",{className:m.pickRow,"data-disabled":o||void 0,children:[t.jsx(Q,{checked:r&&a.valid,disabled:o,onChange:u=>s({checked:u.target.checked}),"aria-label":a.name}),t.jsxs("div",{className:m.pickRowMain,children:[t.jsxs("div",{className:m.pickRowTop,children:[t.jsx("span",{className:m.pickRowName,children:a.name}),!a.valid&&t.jsx(z,{label:"Invalid",variant:"error"}),a.exists&&t.jsx(z,{label:"Already installed",variant:"warning"}),a.warnings&&a.warnings.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":a.warnings.join("; ")})]}),a.description&&t.jsx("span",{className:m.pickRowDescription,children:a.description}),a.exists&&a.valid&&t.jsx(Q,{label:"Already installed — replace",checked:l,onChange:u=>s({replace:u.target.checked})})]})]})}function ct({result:e}){const[s,a]=h.useState(()=>new Set);function r(l){a(o=>{const u=new Set(o);return u.has(l)?u.delete(l):u.add(l),u})}return t.jsx("div",{className:m.results,children:e.results.map((l,o)=>{const u=s.has(o);return t.jsxs("div",{className:m.resultRow,children:[t.jsxs("div",{className:m.resultHeader,children:[t.jsx(z,{label:l.ok?"Installed":"Failed",variant:l.ok?"success":"error"}),t.jsx("span",{className:m.resultTarget,children:l.target}),l.error&&t.jsx("span",{className:m.resultError,children:l.error}),l.stderr&&t.jsx("button",{type:"button",className:m.resultToggle,onClick:()=>r(o),children:u?"Hide details":"Show details"})]}),u&&l.stderr&&t.jsx("pre",{className:m.resultStderr,children:l.stderr})]},`${l.target}-${o}`)})})}const ut="_panel_1tczp_1",dt="_toolbar_1tczp_7",pt="_search_1tczp_14",gt="_groups_1tczp_19",_t="_group_1tczp_19",ht="_groupHeader_1tczp_30",mt="_chevronExpanded_1tczp_47",ft="_groupLabel_1tczp_51",kt="_groupBadges_1tczp_62",St="_groupCount_1tczp_68",wt="_rows_1tczp_74",vt="_row_1tczp_74",Rt="_rowMain_1tczp_91",xt="_rowTop_1tczp_98",bt="_name_1tczp_105",jt="_nameMuted_1tczp_113 _name_1tczp_105",Et="_badge_1tczp_118",yt="_description_1tczp_122",Nt="_descriptionMuted_1tczp_130 _description_1tczp_122",At="_rowError_1tczp_135",Ct="_footnote_1tczp_147",zt="_errorState_1tczp_153",Tt="_removePackageBtn_1tczp_157",Lt="_rowActions_1tczp_161",Pt="_updateAllResults_1tczp_168",Dt="_updateAllResultRow_1tczp_178",Bt="_updateAllResultHeader_1tczp_184",It="_updateAllResultLabel_1tczp_191",$t="_updateAllResultError_1tczp_196",Mt="_updateAllResultToggle_1tczp_204",Ft="_updateAllResultStderr_1tczp_215",p={panel:ut,toolbar:dt,search:pt,groups:gt,group:_t,groupHeader:ht,chevronExpanded:mt,groupLabel:ft,groupBadges:kt,groupCount:St,rows:wt,row:vt,rowMain:Rt,rowTop:xt,name:bt,nameMuted:jt,badge:Et,description:yt,descriptionMuted:Nt,rowError:At,footnote:Ct,errorState:zt,removePackageBtn:Tt,rowActions:Lt,updateAllResults:Pt,updateAllResultRow:Dt,updateAllResultHeader:Bt,updateAllResultLabel:It,updateAllResultError:$t,updateAllResultToggle:Mt,updateAllResultStderr:Ft};function Vt(){const{data:e,isLoading:s,isError:a,error:r}=Pe(),{rowErrors:l,pending:o,toggle:u,clearRowError:g}=De(),d=Ie(),n=$e(),[i,f]=h.useState(""),[k,c]=h.useState(()=>new Set),[v,w]=h.useState(!1),[F,O]=h.useState(()=>new Set);function y(_){c(b=>{const x=new Set(b);return x.has(_)?x.delete(_):x.add(_),x})}if(s)return t.jsxs($,{children:[t.jsx(M,{size:"sm"})," Loading skills…"]});if(a)return t.jsx($,{className:p.errorState,children:r instanceof Error?r.message:"Failed to load skills."});if(!e)return null;if(!e.ok)return t.jsx($,{className:p.errorState,children:L(e.error,e.message)??"Could not load skills."});const E=ke(fe(e.skills,e.packages),i);function I(_,b){if(b&&_.packageSource&&Se(_,e.packages)&&!F.has(_.packageSource)){if(!window.confirm("Pi-Studio will stop managing this package's updates."))return;O(x=>new Set(x).add(_.packageSource))}u(_,b)}function R(_){window.confirm(we(_))&&d.removeSkill(_)}function N(_){window.confirm(ve(_))&&d.removePackage(_)}function P(){window.confirm(Re)&&n.updateAll()}return t.jsxs("div",{className:p.panel,children:[t.jsxs("div",{className:p.toolbar,children:[t.jsx(Z,{className:p.search,placeholder:"Search skills…",value:i,onChange:_=>f(_.target.value),"aria-label":"Search skills"}),t.jsx(A,{size:"sm",variant:"outline",loading:n.pending,onClick:P,children:"Update all"}),t.jsx(A,{size:"sm",onClick:()=>w(!0),children:"Install skill…"})]}),n.error&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>n.updateAll().catch(()=>{}),children:n.error}),n.result&&t.jsx(Ot,{result:n.result,onDismiss:n.clearResult}),E.length===0?t.jsx($,{children:i?"No skills match your search.":"No skills found."}):t.jsx("div",{className:p.groups,children:E.map(_=>{const b=k.has(_.id),x=_.packageInfo,C=x?`package:${x.source}`:void 0;return t.jsxs("div",{className:p.group,children:[t.jsxs("button",{type:"button",className:p.groupHeader,onClick:()=>y(_.id),"aria-expanded":!b,children:[t.jsx(D,{icon:ne,size:"xs",className:b?void 0:p.chevronExpanded}),t.jsx("span",{className:p.groupLabel,children:_.label}),x&&t.jsx("span",{className:p.groupBadges,children:me(x).map(S=>t.jsx(z,{label:S.label,variant:S.variant},S.label))}),t.jsx("span",{className:p.groupCount,children:_.rows.length}),x&&t.jsx(A,{size:"xs",variant:"ghost",className:p.removePackageBtn,loading:C?!!d.pending[C]:!1,onClick:S=>{S.stopPropagation(),N(x)},children:"Remove package"})]}),C&&d.errors[C]&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>d.clearError(C),children:d.errors[C]}),!b&&t.jsx("div",{className:p.rows,children:_.rows.map(S=>t.jsx(Ht,{row:S,error:l[S.skill.path],pending:!!o[S.skill.path],removeError:d.errors[S.skill.path],removePending:!!d.pending[S.skill.path],onToggle:V=>I(S.skill,V),onDismissError:()=>g(S.skill.path),onRemove:()=>R(S.skill),onDismissRemoveError:()=>d.clearError(S.skill.path)},S.skill.path))})]},_.id)})}),t.jsx("p",{className:p.footnote,children:"Changes apply to newly started agent sessions."}),t.jsx(ot,{open:v,onOpenChange:w})]})}function Ot({result:e,onDismiss:s}){const[a,r]=h.useState(()=>new Set);function l(o){r(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})}return t.jsxs("div",{className:p.updateAllResults,children:[e.results.map(o=>{const u=a.has(o.target);return t.jsxs("div",{className:p.updateAllResultRow,children:[t.jsxs("div",{className:p.updateAllResultHeader,children:[t.jsx(z,{label:o.ok?"Succeeded":"Failed",variant:o.ok?"success":"error"}),t.jsx("span",{className:p.updateAllResultLabel,children:be(o.target)}),o.error&&t.jsx("span",{className:p.updateAllResultError,children:o.error}),o.stderr&&t.jsx("button",{type:"button",className:p.updateAllResultToggle,onClick:()=>l(o.target),children:u?"Hide details":"Show details"})]}),u&&o.stderr&&t.jsx("pre",{className:p.updateAllResultStderr,children:o.stderr})]},o.target)}),t.jsx("button",{type:"button",className:p.rowError,onClick:s,children:"Dismiss"})]})}function Ht({row:e,error:s,pending:a,removeError:r,removePending:l,onToggle:o,onDismissError:u,onRemove:g,onDismissRemoveError:d}){const{skill:n,muted:i,toggleDisabled:f,badges:k,warnings:c,sharedPatternTooltip:v}=e;return t.jsxs("div",{className:p.row,title:v??void 0,children:[t.jsxs("div",{className:p.rowMain,children:[t.jsxs("div",{className:p.rowTop,children:[t.jsx("span",{className:i?p.nameMuted:p.name,children:n.name}),c.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":c.join("; ")}),k.map(w=>t.jsx(z,{label:w.label,variant:w.variant,className:p.badge},w.label))]}),n.description&&t.jsx("span",{className:i?p.descriptionMuted:p.description,children:n.description}),s&&t.jsx("button",{type:"button",className:p.rowError,onClick:u,children:s}),r&&t.jsx("button",{type:"button",className:p.rowError,onClick:d,children:r})]}),t.jsxs("div",{className:p.rowActions,children:[t.jsx(te,{checked:n.enabled,disabled:f||a,onCheckedChange:o,"aria-label":n.name}),n.removable&&t.jsx(ee,{"aria-label":`Remove ${n.name}`,disabled:l,onClick:g,children:l?t.jsx(M,{size:"xs"}):t.jsx(D,{icon:re,size:"xs"})})]})]})}export{Vt as SkillsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ce=Object.defineProperty;var ie=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>ie(n,typeof e!="symbol"?e+"":e,t);import{r as s,j as b}from"./vendor-react-DQUAl2K8.js";import{x as ue,a as le}from"./vendor-terminal-BhzX2_ts.js";import{f as X,g as ae,T as J,u as fe,h as de,j as me,k as pe,l as Q,S as he,m as Re,o as we}from"./index-
|
|
1
|
+
var ce=Object.defineProperty;var ie=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>ie(n,typeof e!="symbol"?e+"":e,t);import{r as s,j as b}from"./vendor-react-DQUAl2K8.js";import{x as ue,a as le}from"./vendor-terminal-BhzX2_ts.js";import{f as X,g as ae,T as J,u as fe,h as de,j as me,k as pe,l as Q,S as he,m as Re,o as we}from"./index-CchwjcLZ.js";import"./vendor-DaF96HbP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-Bh5CT32q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";class Se{constructor(e){U(this,"subscribers",new Map);U(this,"detach",null);this.daemon=e}start(){this.detach||(this.detach=this.daemon.onTerminalFrame(e=>this.dispatch(e)))}stop(){var e;(e=this.detach)==null||e.call(this),this.detach=null}subscribeSlot(e,t){return this.subscribers.set(e,t),()=>{this.subscribers.get(e)===t&&this.subscribers.delete(e)}}hasSlot(e){return this.subscribers.has(e)}sendInput(e,t){this.daemon.sendBinary(X({opcode:"Input",slot:e,data:t}))}sendResize(e,t,d){this.daemon.sendBinary(X({opcode:"Resize",slot:e,rows:t,cols:d}))}dispatch(e){var d,R,p;const t=this.subscribers.get(e.slot);if(t)switch(e.opcode){case"Output":(d=t.onOutput)==null||d.call(t,e.data);return;case"Snapshot":(R=t.onSnapshot)==null||R.call(t,e.data);return;case"Restore":(p=t.onRestore)==null||p.call(t,e.data);return;default:return}}}const ye=3e3,Z=`${ae.sm}px ${J}`,ee="M";function te(){if(typeof document>"u"||!document.fonts)return!0;try{return document.fonts.check(Z,ee)}catch{return!0}}const Te=(async()=>{if(typeof document>"u"||!document.fonts||te())return;let n;try{await Promise.race([document.fonts.load(Z,ee),new Promise(e=>{n=window.setTimeout(e,ye)})])}catch{}finally{window.clearTimeout(n)}})(),_e=2,ve=1;function y(n){if(n==null)return!1;const{cols:e,rows:t}=n;return typeof e=="number"&&Number.isInteger(e)&&e>=_e&&typeof t=="number"&&Number.isInteger(t)&&t>=ve}function ge(n,e){return n===null||e===null?n===e:n.cols===e.cols&&n.rows===e.rows}function xe(n,e){return y(n)?!ge(n,e):!1}function be(n,e){if(e===null)return;const t=n.find(R=>R.slot===e);if(!t)return;const d={cols:t.cols,rows:t.rows};return y(d)?d:void 0}const Fe="_wrap_1fx2h_1",Ee="_terminal_1fx2h_12",Ae="_statusOverlay_1fx2h_19",ze="_exitedBanner_1fx2h_30",z={wrap:Fe,terminal:Ee,statusOverlay:Ae,exitedBanner:ze},Oe=64*1024,$=new TextEncoder,K=new WeakMap;function Ne(n){let e=K.get(n);return e||(e=new Se(n),e.start(),K.set(n,e)),e}function Y(n){const e=Q.getState(),t=e.tabs.find(d=>d.id===n);return!t||t.workspaceCwd!==e.activeWorkspaceCwd?!1:Re(we.getState().layouts[t.workspaceCwd],n)}function Le({tab:n}){const e=n.data,t=fe(r=>r.client),d=de(n.id),{settings:R,resolvedTheme:p}=me(),B=R.monoFont&&R.monoFont.trim()!==""?p.fontFamily.mono:J,W=s.useRef(null),w=s.useRef(null),T=s.useRef(null),_=s.useRef(e.slot),O=s.useRef(null),N=s.useRef([]),I=s.useRef(0),F=s.useRef(null),ne=s.useRef(null),E=s.useRef(null),v=s.useRef(null),A=s.useRef(null),k=s.useRef(!1),H=s.useRef(null),V=s.useRef(t);V.current=t;const D=s.useRef(e.exited??!1);D.current=e.exited??!1;const[g,re]=s.useState(e.slot),[j,M]=s.useState({isAttaching:!0,error:null}),[q,se]=s.useState(te);s.useEffect(()=>{if(q)return;let r=!1;return Te.then(()=>{r||se(!0)}),()=>{r=!0}},[q]);const C=()=>{var o,c;const r=(o=T.current)==null?void 0:o.proposeDimensions();(c=E.current)==null||c.call(E,y(r)?r:null)},oe=()=>{var r;A.current=null,k.current=!0,(r=T.current)==null||r.fit(),C(),requestAnimationFrame(()=>{k.current=!1})},P=()=>{v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{v.current=null,A.current===null&&(A.current=requestAnimationFrame(oe))},60)};s.useEffect(()=>{const r=W.current;if(!r||!q)return;const o=new ue.Terminal({cursorBlink:!0,fontFamily:B,fontSize:p.fontSize.code,scrollback:5e3,theme:p.colors.terminal,allowProposedApi:!0}),c=new le.FitAddon;o.loadAddon(c),o.open(r);const f=u=>{if(!Y(n.id))return;const l=_.current,S=O.current;l===null||!S||xe(u,F.current)&&(F.current=u,S.sendResize(l,u.rows,u.cols))},a=o.onData(u=>{if(D.current)return;const l=_.current,S=O.current;if(l===null||!S){const G=$.encode(u);I.current+G.length<=Oe&&(N.current.push(G),I.current+=G.length);return}S.sendInput(l,$.encode(u))}),m=o.onResize(({cols:u,rows:l})=>{f({cols:u,rows:l})}),h=()=>{c.fit(),C()};r.addEventListener("focusin",h),c.fit(),w.current=o,T.current=c,E.current=f;const i=new ResizeObserver(u=>{if(k.current)return;const l=u[0];l&&(l.contentRect.width===0||l.contentRect.height===0)||P()});return i.observe(r),()=>{i.disconnect(),v.current!==null&&window.clearTimeout(v.current),A.current!==null&&cancelAnimationFrame(A.current),r.removeEventListener("focusin",h),a.dispose(),m.dispose(),o.dispose(),w.current=null,T.current=null,E.current=null}},[q]),s.useEffect(()=>{const r=w.current;if(!r)return;r.options.theme=p.colors.terminal;const o=p.fontSize.code,c=B,f=H.current,a=f!==null&&(f.size!==o||f.family!==c);r.options.fontSize=o,r.options.fontFamily=c,H.current={size:o,family:c},a&&P()},[p,B]),s.useEffect(()=>{if(!e.exited)return;const r=w.current;r&&(r.options.cursorBlink=!1,r.blur())},[e.exited]),s.useEffect(()=>{if(t)return t.connection.onSessionMessage(r=>{const o=r;if(!pe(o))return;const c=be(o.terminals,_.current);c!==void 0&&(F.current=c)})},[t]);const x=s.useRef(!1),L=s.useRef(!1);return s.useEffect(()=>{var f;if(x.current=!0,!t||_.current!==null||L.current)return()=>{x.current=!1};L.current=!0;const r=e.cwd||"~",o=(f=T.current)==null?void 0:f.proposeDimensions(),c=y(o)?o:null;return t.connection.request("create_terminal_request",{workspaceId:"",cwd:r,...c?{cols:c.cols,rows:c.rows}:{}}).then(a=>{const m=a.terminal.slot;if(!x.current){t.connection.request("kill_terminal_request",{slot:m}).catch(()=>{});return}_.current=m,re(m),Q.getState().updateData(n.id,{slot:m});const h={cols:a.terminal.cols,rows:a.terminal.rows};F.current=y(h)?h:null}).catch(a=>{x.current&&M({isAttaching:!1,error:a instanceof Error?a.message:String(a)})}).finally(()=>{L.current=!1}),()=>{x.current=!1}},[t,n.id]),s.useEffect(()=>()=>{const r=_.current;r!==null&&setTimeout(()=>{var o;x.current||D.current||(o=V.current)==null||o.connection.request("kill_terminal_request",{slot:r}).catch(()=>{})},0)},[]),s.useEffect(()=>{var h;if(!t||g===null)return;M({isAttaching:!0,error:null});const r=Ne(t.connection);O.current=r;const o=i=>{var u,l;(u=w.current)==null||u.reset(),(l=w.current)==null||l.write(i)},c=r.subscribeSlot(g,{onOutput:i=>{var u;return(u=w.current)==null?void 0:u.write(i)},onSnapshot:o,onRestore:o});let f=!1;const a=(h=T.current)==null?void 0:h.proposeDimensions(),m=y(a)&&Y(n.id)?a:null;return t.connection.request("subscribe_terminal_request",{slot:g,restoreMode:"reflowable",...m?{cols:m.cols,rows:m.rows}:{}}).then(i=>{if(f)return;M({isAttaching:!1,error:null}),ne.current=(i==null?void 0:i.restoreMode)??"basic";const u=N.current;N.current=[],I.current=0;for(const S of u)r.sendInput(g,S);const l={cols:i==null?void 0:i.cols,rows:i==null?void 0:i.rows};F.current=y(l)?l:m,C()}).catch(i=>{f||(N.current=[],I.current=0,M({isAttaching:!1,error:i instanceof Error?i.message:String(i)}))}),()=>{f=!0,c(),O.current=null,t.connection.request("unsubscribe_terminal_request",{slot:g}).catch(()=>{})}},[t,g]),s.useEffect(()=>{d&&P()},[d]),b.jsxs("div",{className:z.wrap,children:[b.jsx("div",{ref:W,className:z.terminal}),j.error?b.jsxs("div",{className:z.statusOverlay,children:["Terminal error: ",j.error]}):j.isAttaching?b.jsxs("div",{className:z.statusOverlay,children:[b.jsx(he,{size:"sm"})," Starting terminal…"]}):null,e.exited?b.jsx("div",{className:z.exitedBanner,children:"Terminal exited"}):null]})}export{Le as TerminalPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-DQUAl2K8.js";import{E as r,S as t,B as a,P as c}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-react-DQUAl2K8.js";import{E as r,S as t,B as a,P as c}from"./index-CchwjcLZ.js";import{u as m,C as d}from"./CodeView-CLqXf_zq.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-Bh5CT32q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-8zPww5m-.js";const x="_note_1g5yz_1",j="_body_1g5yz_9",g="_tooLarge_1g5yz_13",i={note:x,body:j,tooLarge:g};function n(o){return`${(o/(1024*1024)).toFixed(1)} MB`}function b({path:o}){const s=m(o);switch(s.kind){case"loading":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Loading..."]});case"inline":return e.jsx(d,{path:o,content:s.content});case"streaming":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Streaming ",n(s.size)," file..."]});case"stream-error":return e.jsxs(r,{children:["Error: ",s.message]});case"streamed":return e.jsxs(c,{children:[e.jsxs("div",{className:i.note,children:[n(s.size)," file streamed"]}),e.jsx("div",{className:i.body,children:e.jsx(d,{path:o,content:s.content})})]});case"too-large":{const l=o.split("/").pop()||o;return e.jsx(r,{children:e.jsxs("div",{className:i.tooLarge,children:[e.jsxs("div",{children:[n(s.size)," — too large to display (display ceiling is"," ",n(s.maxDisplayBytes),")."]}),s.downloading?e.jsx(t,{size:"sm"}):s.downloadUrl?e.jsx("a",{href:s.downloadUrl,download:s.downloadName||l,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>s.requestDownload(),children:"Download"})]})})}case"error":return e.jsxs(r,{children:["Error: ",s.message]})}}export{b as TextViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-
|
|
1
|
+
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-CchwjcLZ.js";import{u as n}from"./use-file-download-8zPww5m-.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-Bh5CT32q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const a="_wrap_gy3e6_1",d="_video_gy3e6_10",s={wrap:a,video:d};function v({path:i,workspaceCwd:m}){const r=n(i);return r.isLoading?o.jsxs(e,{children:[o.jsx(t,{size:"sm"})," Loading video..."]}):r.isError?o.jsxs(e,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:s.wrap,children:o.jsx("video",{className:s.video,src:r.data.objectUrl,controls:!0})}):null}export{v as VideoViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-DQUAl2K8.js";import{S as d}from"./Switch-1I6AMAC7.js";import{b as a}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-react-DQUAl2K8.js";import{S as d}from"./Switch-1I6AMAC7.js";import{b as a}from"./index-CchwjcLZ.js";import"./vendor-DaF96HbP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-Bh5CT32q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const p="_list_x2x5z_1",m="_row_x2x5z_7",x="_rowMain_x2x5z_17",w="_name_x2x5z_24",_="_description_x2x5z_29",f="_note_x2x5z_34",n={list:p,row:m,rowMain:x,name:w,description:_,note:f},b=[{id:"molviewer",name:"Molecule Viewer",description:"Open molecular structure files (.cif, .pdb, .xyz, and similar) in the 3D viewer instead of as plain text."},{id:"pdfviewer",name:"PDF Viewer",description:"Render PDF files in place instead of offering only a download."}];function h({id:o,name:i,description:r}){const t=a(s=>s.capable),c=a(s=>s.isViewerEnabled(o)),l=a(s=>s.setEnabled);return e.jsxs("div",{className:n.row,children:[e.jsxs("div",{className:n.rowMain,children:[e.jsx("span",{className:n.name,children:i}),e.jsx("span",{className:n.description,children:r})]}),e.jsx(d,{checked:c,disabled:!t,onCheckedChange:s=>void l(o,s),"aria-label":i})]})}function M(){const o=a(i=>i.capable);return e.jsxs("div",{className:n.list,children:[b.map(i=>e.jsx(h,{...i},i.id)),!o&&e.jsx("p",{className:n.note,children:"Requires a newer daemon."})]})}export{M as ViewersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as l,a as o,c as i}from"./index-
|
|
1
|
+
import{n as l,a as o,c as i}from"./index-CchwjcLZ.js";const u=/^([a-zA-Z][a-zA-Z0-9+.-]*):/;function d(n){try{return decodeURIComponent(n)}catch{return n}}function p(n,a,r){const s=n.trim();if(!s)return null;const e=s.split(/[?#]/,1)[0];if(!e||u.exec(e))return null;let t;if(e.startsWith("/")?t=e:e==="~"||e.startsWith("~/")?t=r?l(e,r):null:t=o(e,a??""),!t)return null;const c=i(t);return d(c)}export{u as S,d as p,p as r};
|