palbase 0.35.0 → 0.36.1
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/README.md +10 -4
- package/dist/ai/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +3 -3
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{S4BXGBZ5.js → 4XFRN45H.js} +2 -2
- package/dist/chunks/{KBY7IBXO.js → 5A5YCRPV.js} +2 -2
- package/dist/chunks/{33B3S5RY.js → 5XN7I6JA.js} +1 -1
- package/dist/chunks/{C2AFHALD.js → H4U6H3OQ.js} +1 -1
- package/dist/chunks/{BGFOKJRG.js → HBXDBDED.js} +2 -2
- package/dist/chunks/{ACXA3P2N.js → ICTHOHDI.js} +2 -2
- package/dist/chunks/ID4L4YNL.js +2 -0
- package/dist/chunks/{FRUUIOFR.js → IYSOKCF4.js} +2 -2
- package/dist/chunks/{OXEDY6JB.js → KAUIR66Z.js} +2 -2
- package/dist/chunks/{NOTDQXFX.js → KN2GS5WM.js} +2 -2
- package/dist/chunks/{PGH2237Q.js → LFNWB4YQ.js} +1 -1
- package/dist/chunks/{CFJZ3DPG.js → LZM7DZDZ.js} +2 -2
- package/dist/chunks/{5AY6UR4J.js → M7SGK2KE.js} +2 -2
- package/dist/chunks/{TGIVD25Y.js → PORYVJPX.js} +2 -2
- package/dist/chunks/{AAS47Y5B.js → QAH6YJUC.js} +1 -1
- package/dist/chunks/{LO57KBUW.js → QMNURUZN.js} +2 -2
- package/dist/chunks/{2OXYYE3V.js → QY5HQFM5.js} +2 -2
- package/dist/chunks/{ASBRNYVS.js → RR6G2GXT.js} +1 -1
- package/dist/chunks/{ZBKJUKQA.js → S76G5MS2.js} +1 -1
- package/dist/chunks/{CODVONHV.js → VAC32QIB.js} +2 -2
- package/dist/chunks/XNR3LADA.js +22 -0
- package/dist/chunks/{HMWR5O3Y.js → YULBKQL2.js} +2 -2
- package/dist/chunks/{FKGX3BOZ.js → ZBANMLOU.js} +1 -1
- package/dist/cli.js +4 -4
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +1 -1
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -6
- package/types/ai/src/ai.d.ts +2 -2
- package/types/web/src/calls.d.ts +142 -9
- package/types/web/src/index.d.ts +1 -1
- package/dist/chunks/2YZ33WMV.js +0 -22
- package/dist/chunks/6L2MMJA6.js +0 -2
- package/dist/web/calls-ui.js +0 -46
- package/types/web/src/calls-ui/index.d.ts +0 -71
package/dist/chunks/6L2MMJA6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! palbase 0.35.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
-
import{a as u,b as d}from"./2OXYYE3V.js";var p={too_many_chats:()=>"this user is in as many chats as they may be (100): delete or leave one before starting another",too_many_endpoints:()=>"the project holds as many tool endpoints as it may (32): delete one (ai.endpoints.delete) before putting another",too_many_messages:t=>`this user has sent as many messages this minute as the project allows${t.retryAfter!==void 0?`: write again in ${t.retryAfter} s`:""}`,history_full:()=>"the project keeps as much chat history as it may: delete chats to write again",not_your_turn:()=>"this turn is another member's: only the member who started it (or the project's server) answers its tools and decides its approvals",not_a_member:()=>"the member the server acts as (as) is not in this chat: put them in it first (chats.members.put), or act as the server",goal_lapsed:()=>"the goal was set as a member who no longer stands where they stood then (out of the chat, or the chat no longer theirs alone): it is not resumed \u2014 clear it, or set another for the chat as it is now",goal_achieved:()=>"the goal is achieved: set a new one (chats.goal.set) to work on",turn_running:()=>"the chat's agent is at work on a turn: fork it once the turn has ended, or stop it first (chats.stop)",fork_too_large:()=>"what came before that message is more than a fork begins with (512 KiB): fork it before an earlier message",too_many_voices:t=>`this user has started as many voices this hour as the project allows (5)${t.retryAfter!==void 0?`: start again in ${t.retryAfter} s`:""}`,voice_active:()=>"another member's voice is live in this chat \u2014 one voice talks in a chat at a time: wait for it to end",not_your_voice:()=>"this voice is another member's: only its member \u2014 or the server as itself \u2014 reads, tells and closes it",voice_closed:()=>"the voice has ended: start a new one (chats.voice.start)",no_workspace:()=>"this chat works in no workspace, and files go into one: start the chat with a workspace, or send pictures as images",attachment_not_found:()=>"a picture or a file given is not one its writer may attach: a file of the project's storage \u2014 for a member, their own or a public bucket's",attachment_too_large:()=>"an attachment is past its bound: 5 MiB a picture, 15 MiB a file",attachment_changed:()=>"a file changed while it was being attached: send the message again",unsupported_image:()=>"a picture is not png, jpeg, webp or gif by its bytes: send it as a file",image_not_found:()=>"a picture given is not a file of the project's storage: upload it first (storage.from(bucket).upload(path, file)) and give that bucket and path",storage_unavailable:t=>`the project's storage did not answer when the model was to read a picture${t.retryAfter!==void 0?`: try again in ${t.retryAfter} s`:"; try again shortly"}`,draft_changed:()=>"the agent's draft was saved again since its revision was read: read it again (ai.agents.get) and make the change on that one",agent_defined_in_code:()=>"this agent is the backend's code's (its build's contract names it): it is changed in the code, and has no draft, versions or delete",nothing_to_publish:()=>"the agent's draft is the version published already: save a change to it first (ai.agents.saveDraft)",agent_not_published:()=>"the agent has no version published yet: publish its draft (ai.agents.publish) before a chat or an answer names it",ai_budget_reached:()=>"the project's monthly AI budget is spent: Palbase's models serve it again when the month turns (UTC) or an owner or admin raises the budget (Studio \u203A AI \u203A Settings, or palbase ai:settings:set --monthly-budget) \u2014 or connect the project's own key for the model's provider (ai.connectProvider), which its provider bills",ai_payment_required:()=>"the month's free AI dollar is spent and the project's account has no balance to pay for Palbase's models: top it up (Studio \u203A Billing) \u2014 or connect the project's own key for the model's provider (ai.connectProvider), which its provider bills",billing_unavailable:t=>`Palbase's billing did not say whether its models serve the project${t.retryAfter!==void 0?`: try again in ${t.retryAfter} s`:"; try again shortly"}`},g=new WeakSet;function c(t){if(!(t instanceof d)||g.has(t))return t;let r=p[t.code];if(!r)return t;let s=new d({op:t.op,status:t.status,code:t.code,message:`${r(t)} (${t.op}: ${t.status} ${t.code})`,requestId:t.requestId,retryAfter:t.retryAfter,body:t.body,cause:t});return g.add(s),s}function m(t){return t.catch(r=>{throw c(r)})}function _(t){if(typeof t!="object"||t===null)return;let r=t,s=r.data;if(typeof r.type!="string"||typeof s!="object"||s===null||Array.isArray(s))return;let e=u(s),i=typeof r.id=="number"&&Number.isSafeInteger(r.id)?r.id:0;switch(r.type){case"message":return typeof e.client_id=="string"?{type:"message",seq:i,message:e}:void 0;case"turn":{if(typeof e.response_id!="string"||typeof e.status!="string")return;let n={...e,type:"turn",seq:i};return n.waiting??=null,n.error??=null,n}case"text":{let n=e.offset;return typeof e.response_id!="string"||typeof n!="number"||!Number.isInteger(n)||n<0?void 0:{type:"text",response_id:e.response_id,offset:n,text:typeof e.text=="string"?e.text:""}}case"reset":{let n=e.offset;return typeof e.response_id!="string"||typeof n!="number"||!Number.isInteger(n)||n<0?void 0:{type:"reset",response_id:e.response_id,offset:n}}case"tool":{if(typeof e.call_id!="string"||typeof e.response_id!="string")return;let n=e.omitted_bytes;return{...e,type:"tool",seq:i,omittedBytes:typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:0,outputTruncated:e.output_truncated===!0}}case"agent":return typeof e.parent_response_id=="string"?{...e,type:"agent",seq:i}:void 0;case"thinking":{if(typeof e.response_id!="string")return;let n=typeof e.run_id=="string"?e.run_id:"";return e.unavailable===!0?{type:"thinking",seq:i,response_id:e.response_id,run_id:n,text:"",unavailable:!0,model:typeof e.model=="string"?e.model:"",reason:typeof e.reason=="string"?e.reason:""}:typeof e.text!="string"?void 0:{type:"thinking",seq:i,response_id:e.response_id,run_id:n,...typeof e.step_id=="string"&&e.step_id!==""?{step_id:e.step_id}:{},text:e.text}}case"goal":{if(typeof e.goal_id!="string"||typeof e.kind!="string")return;let{seq:n,...o}=e;return{...o,type:"goal",seq:i,...typeof n=="number"?{turn:n}:{}}}case"history":{if(!Array.isArray(e.items)||typeof e.part!="number"||!Number.isInteger(e.part)||e.part<0)return;let n=e.items.filter(a=>typeof a=="object"&&a!==null&&(a.role==="user"||a.role==="assistant")&&typeof a.text=="string"),o=e.forked_from;return{type:"history",forked_from:o&&typeof o.chat_id=="string"?o:null,part:e.part,parts:typeof e.parts=="number"?e.parts:e.part+1,items:n}}case"voice":return typeof e.voice_id!="string"||e.voice_id===""||typeof e.status!="string"?void 0:{...e,type:"voice",seq:i,user_id:typeof e.user_id=="string"?e.user_id:null};case"transcript":return typeof e.id!="string"||e.id===""||typeof e.text!="string"?void 0:{type:"transcript",seq:i,id:e.id,voice_id:typeof e.voice_id=="string"?e.voice_id:"",role:typeof e.role=="string"?e.role:"",user_id:typeof e.user_id=="string"?e.user_id:null,author_name:typeof e.author_name=="string"?e.author_name:"",text:e.text,final:e.final!==!1,created_at:typeof e.created_at=="string"?e.created_at:""};default:return}}function b(t){let r=0;for(let s=0;s<t.length;s++){let e=t.charCodeAt(s);e<128?r+=1:e<2048?r+=2:e>=55296&&e<=56319&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(r+=4,s++):r+=3}return r}function l(t,r){if(r<=0)return 0;let s=0;for(let e=0;e<t.length;e++){let i=t.charCodeAt(e),n=3,o=1;if(i<128?n=1:i<2048?n=2:i>=55296&&i<=56319&&e+1<t.length&&(t.charCodeAt(e+1)&64512)===56320&&(n=4,o=2),s+=n,s>=r)return e+o;e+=o-1}return t.length}function v(t,r){return t.slice(l(t,r))}export{m as a,_ as b,b as c,l as d,v as e};
|
package/dist/web/calls-ui.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*! palbase 0.35.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
-
import"../chunks/ZBKJUKQA.js";var pe=Object.freeze({incomingVoice:"Incoming voice call",incomingVideo:"Incoming video call",accept:"Accept",acceptVoiceOnly:"Accept with voice only",decline:"Decline",calling:"Calling\u2026",connecting:"Connecting\u2026",reconnecting:"Reconnecting\u2026",declined:"Call declined",missed:"No answer",busy:"Busy",hungUp:"Call ended",canceled:"Call canceled",failed:"Call failed",answeredElsewhere:"Answered on another device",left:"You left the call",ended:"Call ended"}),ue=Object.freeze({incoming:"Incoming call",call:"Call",mute:"Mute",unmute:"Unmute",cameraOn:"Turn camera on",cameraOff:"Turn camera off",switchCamera:"Switch camera",hangUp:"Hang up",self:"Your camera"}),be=new Map([["declined","declined"],["missed","missed"],["busy","busy"],["hung_up","hungUp"],["canceled","canceled"],["failed","failed"],["answered_elsewhere","answeredElsewhere"],["left","left"]]),fe=["accent","background","foreground","danger","radius","font"],ge=2e3,R="data-palbase-calls-ui-style",V=new WeakMap,z=new WeakMap,me=0;function Ie(a,n={}){let i=n.container?.ownerDocument??globalThis.document;if(!i)throw new Error("mountCallUI needs a page");let c={...pe,...n.texts},d={...ue,...n.labels},r=(e,t,...o)=>{let l=i.createElement(e);return t&&(l.className=t),l.append(...o),l};Ce(i);let h=r("div",["pb-call-root",n.container?"pb-call-contained":"",n.className??""].filter(Boolean).join(" "));h.setAttribute("data-palbase-calls-ui","");for(let e of fe){let t=n.theme?.[e];t!==void 0&&t!==""&&h.style.setProperty(`--pb-call-${e}`,typeof t=="number"?`${t}px`:t)}(n.container??i.body).append(h);let u=[],p=null,m=null,M=null,H=!1,ne=a.onIncoming(e=>{u.some(t=>t.s===e)||(u.push({s:e,off:e.subscribe(P)}),P())}),le=a.onCall(B);a.current&&B(a.current);function P(){let e=null;for(let t=u.length-1;t>=0;t--){let o=u[t],l=o.s.state.phase;l!=="incoming"&&l!=="invited"?(o.off(),u.splice(t,1)):!e&&l==="incoming"&&(o.wanted??=ae(o.s))&&(e=o.s)}p&&p.s!==e&&(p.layer.remove(),p=null),e&&!p&&(p=oe(e)),p?.fill(),p&&!m&&n.ringtone!==!1&&(m=we()),!p&&m&&(m.stop(),m=null)}function ae(e){try{return n.incoming?.(e.state.call,e)!==!1}catch{return!0}}function oe(e){let t=`pb-call-${++me}`,o=r("div","pb-call-avatar"),l=r("div","pb-call-title"),g=r("div","pb-call-sub");l.id=`${t}-name`,g.id=`${t}-sub`;let b=q("pb-call-decline",c.decline,"hangUp",()=>S(()=>e.decline())),k=q("pb-call-accept",c.accept,"phone",()=>S(()=>e.accept())),y=E("pb-call-link",c.acceptVoiceOnly,()=>S(()=>e.accept({video:!1})));y.textContent=c.acceptVoiceOnly;let T=r("div","pb-call-panel pb-call-sheet",r("div","pb-call-who",o,l,g),r("div","pb-call-foot",r("div","pb-call-actions",b,k),y));Q(T,d.incoming),T.setAttribute("aria-describedby",`${l.id} ${g.id}`);let A=r("div","pb-call-layer pb-call-ringing",T);h.append(A);function S(v){let C=[b,k,y];for(let w of C)w.disabled=!0;U(v,e).finally(()=>C.forEach(w=>w.disabled=!1))}function I(){let v=e.state.call,C=v.participants.find(j=>j.user_id===v.caller_id),w=C?.name||v.caller_id;l.textContent=w,g.textContent=v.video?c.incomingVideo:c.incomingVoice,y.hidden=!v.video,N(k.firstElementChild,v.video?"video":"phone"),K(o,w,C?.image_url??null)}return{s:e,layer:A,fill:I}}function B(e){M?.s!==e&&(M?.close(),M=ie(e))}function ie(e){let t=r("div","pb-call-status");t.setAttribute("role","status");let o=r("div","pb-call-timer"),l=D("pb-call-self");l.setAttribute("aria-label",d.self);let g=r("div","pb-call-stage",l),b=E("pb-call-ctl","",()=>{U(()=>e.setMicrophone(!e.state.microphone),e)}),k=E("pb-call-ctl","",()=>{U(()=>e.setCamera(!e.state.camera),e)}),y=E("pb-call-ctl",d.switchCamera,()=>{U(()=>e.switchCamera(),e)}),T=E("pb-call-ctl pb-call-hangup",d.hangUp,()=>{U(()=>e.leave(),e)});N(y,"flip"),N(T,"hangUp");let A=r("div","pb-call-panel pb-call-view",r("div","pb-call-top",t,o),g,r("div","pb-call-controls",b,k,y,T));Q(A,d.call);let S=r("div","pb-call-layer",A);h.prepend(S);let I=new Map,v=null,C,w,j=null,W={s:e,close:G},se=e.subscribe(X);return X(),W;function X(){let s=e.state,L=s.phase==="ended"||s.phase==="elsewhere";g.classList.toggle("pb-call-voice",!(s.call.video||s.camera||s.remote.some(f=>f.video)));let de=s.remote.length>0?s.remote:re(s),F=new Set;for(let f of de){F.add(f.userId);let x=I.get(f.userId);x||(x=ce(),I.set(f.userId,x),g.insertBefore(x.el,l));let J=f.name||f.userId;x.name.textContent=J,K(x.avatar,J,f.imageUrl),x.video.srcObject!==f.stream&&(x.video.srcObject=f.stream),x.el.classList.toggle("pb-call-novideo",!f.video)}for(let[f,x]of I)F.has(f)||(x.video.srcObject=null,x.el.remove(),I.delete(f));let O=s.camera&&!L?s.local:null,$=O?.getVideoTracks?.()[0]??null;($??O)!==j&&(j=$??O,l.srcObject=O),l.hidden=!O,l.classList.toggle("pb-call-rear",$?.getSettings?.().facingMode==="environment"),s.phase==="connected"&&v===null&&(v=Date.now(),C=setInterval(_,1e3)),t.textContent=L?c[be.get(s.endReason??"")??"ended"]:s.phase==="calling"?c.calling:s.phase==="connecting"?c.connecting:s.phase==="reconnecting"?c.reconnecting:"",L||_(),b.classList.toggle("pb-call-off",!s.microphone),Y(b,s.microphone?d.mute:d.unmute,s.microphone?"mic":"micOff"),k.classList.toggle("pb-call-off",!s.camera),Y(k,s.camera?d.cameraOff:d.cameraOn,s.camera?"video":"videoOff"),y.hidden=!s.camera;for(let f of[b,k,y,T])f.disabled=L;L&&w===void 0&&(_(),clearInterval(C),w=setTimeout(G,ge))}function _(){o.textContent=v===null?"":xe(Date.now()-v)}function G(){se(),clearInterval(C),clearTimeout(w);for(let s of I.values())s.video.srcObject=null;l.srcObject=null,S.remove(),M===W&&(M=null)}}function re(e){let t=e.call,o=t.participants.find(l=>l.device_id===a.deviceId)?.user_id??(e.outgoing?t.caller_id:null);return t.participants.filter(l=>l.user_id!==o&&(t.kind==="direct"||l.state==="ringing"||l.state==="joined")).map(l=>({userId:l.user_id,name:l.name,imageUrl:l.image_url,stream:null,video:!1}))}function ce(){let e=D(""),t=r("div","pb-call-avatar"),o=r("div","pb-call-name");return{el:r("div","pb-call-tile",e,t,o),video:e,avatar:t,name:o}}function D(e){let t=r("video",e);return t.autoplay=!0,t.playsInline=!0,t.muted=!0,t.defaultMuted=!0,t}function E(e,t,o){let l=r("button",e);return l.type="button",t&&l.setAttribute("aria-label",t),l.addEventListener("click",o),l}function q(e,t,o,l){let g=r("span","pb-call-ico");N(g,o);let b=E(`pb-call-btn ${e}`,t,l);return b.append(g,r("span","pb-call-caption",i.createTextNode(t))),b}function Y(e,t,o){e.setAttribute("aria-label",t),e.title=t,N(e,o)}function K(e,t,o){let l=`${o??""}
|
|
3
|
-
${t}`;if(z.get(e)===l)return;z.set(e,l),e.textContent=ve(t);let g=he(o,i);if(!g)return;let b=i.createElement("img");b.alt="",b.addEventListener("error",()=>b.remove()),b.src=g,e.append(b)}function U(e,t){return new Promise(o=>o(e())).catch(o=>{H||n.onError?.(o,t)})}return{unmount(){if(!H){H=!0,ne(),le();for(let e of u.splice(0))e.off();p=null,m?.stop(),m=null,M?.close(),h.remove(),ke(i)}}}}function Q(a,n){a.setAttribute("role","dialog"),a.setAttribute("aria-modal","false"),a.setAttribute("aria-label",n)}function ve(a){let n=a.trim().split(/\s+/).filter(Boolean);return(n.length>1?[n[0],n[n.length-1]]:n).map(c=>[...c][0]??"").join("").toUpperCase()||"?"}function he(a,n){if(!a)return null;try{let i=new URL(a,n.baseURI);return i.protocol==="https:"||i.protocol==="http:"||i.protocol==="blob:"||/^data:image\//i.test(i.href)?i.href:null}catch{return null}}function xe(a){let n=Math.max(0,Math.floor(a/1e3)),i=d=>String(d).padStart(2,"0"),c=Math.floor(n/60)%60;return n>=3600?`${Math.floor(n/3600)}:${i(c)}:${i(n%60)}`:`${c}:${i(n%60)}`}function we(){let a=globalThis,n=a.AudioContext??a.webkitAudioContext;if(!n)return null;try{let i=new n,c=i.createGain();c.gain.value=0,c.connect(i.destination);let d=i.createOscillator();d.type="sine",d.connect(c),d.start();let r=()=>{let u=i.currentTime+.05;for(let[p,m]of[[880,0],[660,.42]])d.frequency.setValueAtTime(p,u+m),c.gain.setValueAtTime(0,u+m),c.gain.linearRampToValueAtTime(.05,u+m+.03),c.gain.setValueAtTime(.05,u+m+.32),c.gain.linearRampToValueAtTime(0,u+m+.38)};r();let h=setInterval(r,2500);return Promise.resolve().then(()=>i.resume()).catch(()=>{}),{stop(){clearInterval(h);try{d.stop()}catch{}Promise.resolve().then(()=>i.close()).catch(()=>{})}}}catch{return null}}var Z="M6.6 3.5h2.8l1.6 4.2-2.1 1.3a11 11 0 0 0 6.1 6.1l1.3-2.1 4.2 1.6v2.8a2 2 0 0 1-2.2 2A16.5 16.5 0 0 1 4.6 5.7a2 2 0 0 1 2-2.2z",ee=["M12 3a3 3 0 0 1 3 3v5a3 3 0 0 1-6 0V6a3 3 0 0 1 3-3z","M5 11a7 7 0 0 0 14 0","M12 18v3"],te=["M4 7h9a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2z","M15 11l6-3v8l-6-3"],ye={phone:[Z],hangUp:[Z],mic:ee,micOff:[...ee,"M4 4l16 16"],video:te,videoOff:[...te,"M3 3l18 18"],flip:["M4 12a8 8 0 0 1 13.7-5.6L20 9","M20 4v5h-5","M20 12a8 8 0 0 1-13.7 5.6L4 15","M4 20v-5h5"]};function N(a,n){if(z.get(a)===n)return;z.set(a,n);let i="http://www.w3.org/2000/svg",c=a.ownerDocument,d=c.createElementNS(i,"svg"),r={viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"};for(let[u,p]of Object.entries(r))d.setAttribute(u,p);let h=c.createElementNS(i,"g");n==="hangUp"&&h.setAttribute("transform","rotate(135 12 12)");for(let u of ye[n]){let p=c.createElementNS(i,"path");p.setAttribute("d",u),h.append(p)}d.append(h),a.replaceChildren(d)}function Ce(a){if(V.set(a,(V.get(a)??0)+1),a.querySelector(`style[${R}]`))return;let n=a.createElement("style");n.setAttribute(R,""),n.textContent=Te,(a.head??a.documentElement).append(n)}function ke(a){let n=(V.get(a)??1)-1;if(n>0)return void V.set(a,n);V.delete(a),a.querySelector(`style[${R}]`)?.remove()}var Te=`
|
|
4
|
-
.pb-call-root{--pb-call-accent:#16a34a;--pb-call-background:#fff;--pb-call-foreground:#111827;--pb-call-danger:#dc2626;--pb-call-radius:20px;--pb-call-font:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;position:fixed;inset:0;z-index:2147482000;pointer-events:none;font-family:var(--pb-call-font);color:var(--pb-call-foreground);-webkit-font-smoothing:antialiased}
|
|
5
|
-
@media (prefers-color-scheme:dark){.pb-call-root{--pb-call-background:#17181c;--pb-call-foreground:#f3f4f6}}
|
|
6
|
-
.pb-call-root.pb-call-contained{position:absolute}
|
|
7
|
-
.pb-call-root [hidden]{display:none!important}
|
|
8
|
-
.pb-call-layer{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:16px;background:rgba(0,0,0,.45);pointer-events:auto}
|
|
9
|
-
.pb-call-ringing{z-index:1}
|
|
10
|
-
.pb-call-panel{position:relative;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:24px;width:min(380px,100%);max-height:100%;padding:32px 24px 24px;border-radius:var(--pb-call-radius);background:var(--pb-call-background);color:var(--pb-call-foreground);box-shadow:0 24px 64px rgba(0,0,0,.35);overflow:hidden}
|
|
11
|
-
.pb-call-view{width:min(960px,100%);height:min(680px,100%);padding:16px;gap:12px}
|
|
12
|
-
.pb-call-who,.pb-call-foot{display:flex;flex-direction:column;align-items:center;gap:6px;max-width:100%;text-align:center}
|
|
13
|
-
.pb-call-foot{gap:16px}
|
|
14
|
-
.pb-call-who .pb-call-avatar{margin-bottom:12px}
|
|
15
|
-
.pb-call-title{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:22px;font-weight:600}
|
|
16
|
-
.pb-call-sub,.pb-call-status,.pb-call-timer{font-size:15px;opacity:.75}
|
|
17
|
-
.pb-call-actions{display:flex;gap:56px}
|
|
18
|
-
.pb-call-root button{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
19
|
-
.pb-call-root button:disabled{opacity:.5;cursor:default}
|
|
20
|
-
.pb-call-root button:focus-visible{outline:3px solid var(--pb-call-accent);outline-offset:3px}
|
|
21
|
-
.pb-call-btn{display:flex;flex-direction:column;align-items:center;gap:8px;padding:0;border:0;background:none;font-size:14px}
|
|
22
|
-
.pb-call-ico{display:grid;place-items:center;width:64px;height:64px;border-radius:50%;color:#fff;background:var(--pb-call-accent)}
|
|
23
|
-
.pb-call-decline .pb-call-ico{background:var(--pb-call-danger)}
|
|
24
|
-
.pb-call-link{padding:6px 10px;border:0;background:none;font-size:14px;text-decoration:underline;text-underline-offset:3px;opacity:.85}
|
|
25
|
-
.pb-call-top{display:flex;gap:10px;align-items:baseline;min-height:20px;font-variant-numeric:tabular-nums}
|
|
26
|
-
.pb-call-stage{position:relative;flex:1;align-self:stretch;min-height:0;display:grid;gap:8px;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));grid-auto-rows:minmax(0,1fr)}
|
|
27
|
-
.pb-call-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;min-height:0;overflow:hidden;border-radius:calc(var(--pb-call-radius) * .6);background:color-mix(in srgb,var(--pb-call-foreground) 10%,var(--pb-call-background))}
|
|
28
|
-
.pb-call-tile video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:#000}
|
|
29
|
-
.pb-call-novideo video,.pb-call-tile:not(.pb-call-novideo) .pb-call-avatar{display:none}
|
|
30
|
-
.pb-call-name{position:absolute;left:10px;bottom:10px;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 10px;border-radius:999px;font-size:13px;color:#fff;background:rgba(0,0,0,.5)}
|
|
31
|
-
.pb-call-voice .pb-call-tile{background:none}
|
|
32
|
-
.pb-call-voice .pb-call-name{position:static;padding:0;font-size:22px;font-weight:600;color:inherit;background:none}
|
|
33
|
-
.pb-call-avatar{position:relative;display:grid;place-items:center;flex:none;width:96px;height:96px;overflow:hidden;border-radius:50%;font-size:36px;font-weight:600;color:var(--pb-call-foreground);background:color-mix(in srgb,var(--pb-call-accent) 22%,var(--pb-call-background))}
|
|
34
|
-
.pb-call-voice .pb-call-avatar{width:140px;height:140px;font-size:52px}
|
|
35
|
-
.pb-call-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
|
|
36
|
-
.pb-call-sheet .pb-call-avatar{animation:pb-call-pulse 1.8s ease-out infinite}
|
|
37
|
-
@keyframes pb-call-pulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--pb-call-accent) 45%,transparent)}100%{box-shadow:0 0 0 22px transparent}}
|
|
38
|
-
.pb-call-self{position:absolute;right:12px;bottom:12px;z-index:1;width:min(28%,180px);aspect-ratio:3/4;object-fit:cover;border-radius:12px;background:#000;box-shadow:0 8px 24px rgba(0,0,0,.35);transform:scaleX(-1)}
|
|
39
|
-
.pb-call-self.pb-call-rear{transform:none}
|
|
40
|
-
.pb-call-controls{display:flex;gap:14px;justify-content:center}
|
|
41
|
-
.pb-call-ctl{display:grid;place-items:center;width:54px;height:54px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--pb-call-foreground) 12%,transparent)}
|
|
42
|
-
.pb-call-ctl.pb-call-off{color:var(--pb-call-background);background:var(--pb-call-foreground)}
|
|
43
|
-
.pb-call-ctl.pb-call-hangup{color:#fff;background:var(--pb-call-danger)}
|
|
44
|
-
@media (max-width:600px){.pb-call-layer{padding:0}.pb-call-panel{width:100%;height:100%;border-radius:0;box-shadow:none;padding:max(16px,env(safe-area-inset-top,0px)) 16px max(16px,env(safe-area-inset-bottom,0px))}.pb-call-sheet{justify-content:space-between;padding-top:18vh;padding-bottom:max(48px,env(safe-area-inset-bottom,0px))}}
|
|
45
|
-
@media (prefers-reduced-motion:reduce){.pb-call-root *{animation:none!important}}
|
|
46
|
-
`;export{ue as CALL_UI_LABELS,pe as CALL_UI_TEXTS,Ie as mountCallUI};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { Call, CallSession, Calls } from '../calls.js';
|
|
2
|
-
/** Every word the screens show. */
|
|
3
|
-
export interface CallUITexts {
|
|
4
|
-
incomingVoice: string;
|
|
5
|
-
incomingVideo: string;
|
|
6
|
-
accept: string;
|
|
7
|
-
acceptVoiceOnly: string;
|
|
8
|
-
decline: string;
|
|
9
|
-
calling: string;
|
|
10
|
-
connecting: string;
|
|
11
|
-
reconnecting: string;
|
|
12
|
-
/** How the call ended for this device, by its endReason; `ended` for any other. */
|
|
13
|
-
declined: string;
|
|
14
|
-
missed: string;
|
|
15
|
-
busy: string;
|
|
16
|
-
hungUp: string;
|
|
17
|
-
canceled: string;
|
|
18
|
-
failed: string;
|
|
19
|
-
answeredElsewhere: string;
|
|
20
|
-
left: string;
|
|
21
|
-
ended: string;
|
|
22
|
-
}
|
|
23
|
-
/** What a screen reader says of what shows no words of its own. */
|
|
24
|
-
export interface CallUILabels {
|
|
25
|
-
/** The ringing sheet. */
|
|
26
|
-
incoming: string;
|
|
27
|
-
/** The call's view. */
|
|
28
|
-
call: string;
|
|
29
|
-
mute: string;
|
|
30
|
-
unmute: string;
|
|
31
|
-
cameraOn: string;
|
|
32
|
-
cameraOff: string;
|
|
33
|
-
switchCamera: string;
|
|
34
|
-
hangUp: string;
|
|
35
|
-
/** This device's camera. */
|
|
36
|
-
self: string;
|
|
37
|
-
}
|
|
38
|
-
/** The screens' colors, corners and font: CSS values, set as --pb-call-<name> on the root element. */
|
|
39
|
-
export interface CallUITheme {
|
|
40
|
-
accent?: string;
|
|
41
|
-
background?: string;
|
|
42
|
-
foreground?: string;
|
|
43
|
-
danger?: string;
|
|
44
|
-
/** A length; a number is pixels. */
|
|
45
|
-
radius?: string | number;
|
|
46
|
-
font?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface CallUIOptions {
|
|
49
|
-
/** The element the screens are drawn in (positioned): over the whole page (the body) unless given. */
|
|
50
|
-
container?: HTMLElement;
|
|
51
|
-
texts?: Partial<CallUITexts>;
|
|
52
|
-
labels?: Partial<CallUILabels>;
|
|
53
|
-
/** The light and dark colors the system asks for, unless given. */
|
|
54
|
-
theme?: CallUITheme;
|
|
55
|
-
/** Added to the root element's classes. */
|
|
56
|
-
className?: string;
|
|
57
|
-
/** A soft ring while a sheet shows (true by default); silent where the page may not play sound yet. */
|
|
58
|
-
ringtone?: boolean;
|
|
59
|
-
/** Asked once for each call that rings: false leaves it to the app's own screen. */
|
|
60
|
-
incoming?(call: Call, session: CallSession): boolean;
|
|
61
|
-
/** An answer, a microphone or a camera that failed (the person refused the camera, the network). */
|
|
62
|
-
onError?(error: unknown, session: CallSession): void;
|
|
63
|
-
}
|
|
64
|
-
export interface CallUI {
|
|
65
|
-
/** Takes the screens away and stops listening; a call goes on. */
|
|
66
|
-
unmount(): void;
|
|
67
|
-
}
|
|
68
|
-
export declare const CALL_UI_TEXTS: Readonly<CallUITexts>;
|
|
69
|
-
export declare const CALL_UI_LABELS: Readonly<CallUILabels>;
|
|
70
|
-
/** Shows pb.calls' ringing calls and the call this page is in, until unmount. */
|
|
71
|
-
export declare function mountCallUI(calls: Calls, options?: CallUIOptions): CallUI;
|