@popmelt.com/core 0.39.0 → 0.40.0
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 +1 -29
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/skills/popmelt-core/SKILL.md +5 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/codex-plugin/skills/popmelt-core/SKILL.md +5 -1
- package/dist/{ExploreAttachment-OA2PUTNR.mjs → ExploreAttachment-DBMYVYWK.mjs} +1 -1
- package/dist/{PagePreviewLayer-HKADULHD.mjs → PagePreviewLayer-CVUA6CTQ.mjs} +1 -1
- package/dist/ParticipantRuntime-PCBEG3Q2.mjs +1 -0
- package/dist/PhoneHostGate-FZLK4R6M.mjs +1 -0
- package/dist/PopmeltTasteConnectedPane-62LUNNWZ.mjs +1 -0
- package/dist/{PreviewRuntime-3ANAJNFO.mjs → PreviewRuntime-7EQNIOF5.mjs} +1 -1
- package/dist/SamplePlacementOverlay-LR7GZVYP.mjs +1 -0
- package/dist/ShareProjectPane-U47UTAOP.mjs +1 -0
- package/dist/SuppliedContext-F7WKJ5XO.mjs +1 -0
- package/dist/ThreadErrorCard-KPP7YUFC.mjs +1 -0
- package/dist/ThreadPanel-GOYQEF3I.mjs +1 -0
- package/dist/adapter-react-three-fiber.d.mts +4 -37
- package/dist/adapter-react-three-fiber.mjs +1 -1
- package/dist/adapter-three.d.mts +14 -220
- package/dist/adapter-three.mjs +1 -45
- package/dist/bridge-entry.mjs +1 -1
- package/dist/browser-runtime-BBQQQLF7.mjs +1 -0
- package/dist/browser.d.mts +4 -4
- package/dist/browser.mjs +1 -1
- package/dist/canvas-text.d.mts +38 -0
- package/dist/canvas-text.mjs +1 -0
- package/dist/{checkFixture-I2ALOQTM.mjs → checkFixture-VDRYDCUX.mjs} +1 -1
- package/dist/{chunk-UFUH63SR.mjs → chunk-27WBFE5X.mjs} +1 -1
- package/dist/{chunk-VWFST2IX.mjs → chunk-3EYAVOPH.mjs} +1 -1
- package/dist/chunk-4EDMISUV.mjs +1 -0
- package/dist/chunk-52OTX7DP.mjs +1 -0
- package/dist/{chunk-4B6HUJCH.mjs → chunk-53QOGFAT.mjs} +1 -1
- package/dist/chunk-6GS4BQVU.mjs +30 -0
- package/dist/{chunk-MLNC5TMP.mjs → chunk-6U5JWZ4X.mjs} +1 -1
- package/dist/chunk-7DXJSJCI.mjs +1 -0
- package/dist/chunk-A4GARXVQ.mjs +1 -0
- package/dist/{chunk-MSWRCFPJ.mjs → chunk-AKUIREET.mjs} +1 -1
- package/dist/chunk-C4AMAM3W.mjs +1 -0
- package/dist/{chunk-FD6IIFJC.mjs → chunk-CR6TRUUV.mjs} +1 -1
- package/dist/{chunk-G6ITTTFD.mjs → chunk-DJFZGYX6.mjs} +1 -1
- package/dist/chunk-EHM2ZBQU.mjs +1 -0
- package/dist/{chunk-4LN72RDZ.mjs → chunk-FFBBRCPC.mjs} +1 -1
- package/dist/chunk-FR6VIGJ2.mjs +1 -0
- package/dist/{chunk-D3BHAI37.mjs → chunk-FSSHNWMO.mjs} +1 -1
- package/dist/{chunk-QDFQPABM.mjs → chunk-HC2SF7KE.mjs} +1 -1
- package/dist/chunk-HTQEMKFA.mjs +1 -0
- package/dist/{chunk-IWF42SDV.mjs → chunk-MHTX52KW.mjs} +1 -1
- package/dist/{chunk-RJWFSAKE.mjs → chunk-NFO2CREV.mjs} +1 -1
- package/dist/{chunk-CPFVBR6Q.mjs → chunk-OECEYJNK.mjs} +1 -1
- package/dist/{chunk-W5JUAOLA.mjs → chunk-P2LMCRUN.mjs} +1 -1
- package/dist/{chunk-OL7RDZ2R.mjs → chunk-PQITT2QK.mjs} +1 -1
- package/dist/chunk-PRPXMDZ7.mjs +1 -0
- package/dist/chunk-RCY5N5KQ.mjs +1 -0
- package/dist/{chunk-W62YY5IT.mjs → chunk-RDB75FUD.mjs} +1 -1
- package/dist/chunk-RIGP4DAV.mjs +1 -0
- package/dist/chunk-RXC7B7SX.mjs +1 -0
- package/dist/{chunk-V56MNQLF.mjs → chunk-T4WUQPBS.mjs} +1 -1
- package/dist/chunk-TTOCYOEH.mjs +1 -0
- package/dist/chunk-U5NROUVA.mjs +24 -0
- package/dist/{chunk-ML7YV4RV.mjs → chunk-UBPJIVWE.mjs} +1 -1
- package/dist/{chunk-SKM4ZXV5.mjs → chunk-UFU5IA3G.mjs} +1 -1
- package/dist/chunk-UPEEIAVJ.mjs +1 -0
- package/dist/chunk-V5FCWXMN.mjs +1 -0
- package/dist/chunk-VBH2YQLG.mjs +1 -0
- package/dist/chunk-VQ76TWRR.mjs +1 -0
- package/dist/chunk-WYQZ7DAK.mjs +1 -0
- package/dist/chunk-X6I6KQDG.mjs +1 -0
- package/dist/{chunk-P3IOAIYB.mjs → chunk-Y2BJZLYU.mjs} +1 -1
- package/dist/chunk-ZC2I35WD.mjs +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/codex-note-context-2CHDGTG3.mjs +1 -0
- package/dist/codex-project-TIMWOCE5.mjs +1 -0
- package/dist/{codex-store-mount-MNIL3VK6.mjs → codex-store-mount-MAQK6VEG.mjs} +1 -1
- package/dist/dev-server-ESGE6QNP.mjs +1 -0
- package/dist/{focus-inspection-LGIRFL2T.mjs → focus-inspection-BMDJJC5K.mjs} +1 -1
- package/dist/guest-admission.mjs +1 -1
- package/dist/guest-live-canvas.mjs +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/media.d.mts +3 -3
- package/dist/memory-legacy.d.mts +43 -1
- package/dist/memory-store.d.mts +5 -162
- package/dist/memory.d.mts +3 -531
- package/dist/{page-interaction-GC2UN47Y.mjs → page-interaction-YXHXEYOT.mjs} +1 -1
- package/dist/{page-planes-9GVbnVZa.d.mts → page-planes-Jz2yR_Wk.d.mts} +6 -1
- package/dist/{participantBootstrap-BTcD7XgB.d.mts → participantBootstrap-DDOxY-Cy.d.mts} +2 -2
- package/dist/{peer-client-XNTMFSOV.mjs → peer-client-LPDWWFT4.mjs} +1 -1
- package/dist/plugin-astro.d.mts +1 -1
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.d.mts +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.mjs +1 -1
- package/dist/shared-page-QN2XRXUE.mjs +1 -0
- package/dist/{subjects-D_yanOQ2.d.mts → subjects-cLtt9-iK.d.mts} +12 -0
- package/dist/{types-CggBG-H6.d.mts → types-XKO-uva0.d.mts} +1 -1
- package/dist/{index-D6bSXWNT.d.mts → validate-0kt2EgVe.d.mts} +7 -40
- package/dist/{video-adapter-CWpR4NSt.d.mts → video-adapter-xL95wukX.d.mts} +1 -1
- package/package.json +29 -35
- package/dist/ParticipantRuntime-IU2STHIT.mjs +0 -1
- package/dist/PhoneHostGate-CS3KFCP5.mjs +0 -1
- package/dist/PopmeltTasteConnectedPane-TRQCY5SM.mjs +0 -1
- package/dist/SamplePlacementOverlay-SNA4WB6Z.mjs +0 -1
- package/dist/ShareProjectPane-QLHMNZNU.mjs +0 -1
- package/dist/SuppliedContext-SFOM3R3K.mjs +0 -1
- package/dist/ThreadErrorCard-NJUVLWMU.mjs +0 -1
- package/dist/ThreadPanel-RVCNMX7B.mjs +0 -1
- package/dist/browser-runtime-BUC4RUD7.mjs +0 -1
- package/dist/chunk-25EXQOPI.mjs +0 -1
- package/dist/chunk-742KV4YS.mjs +0 -1
- package/dist/chunk-ADOCYY5I.mjs +0 -1
- package/dist/chunk-B3RA4XAR.mjs +0 -1
- package/dist/chunk-B4ZKGIGU.mjs +0 -1
- package/dist/chunk-CHK24QU5.mjs +0 -1
- package/dist/chunk-DKBVNKIG.mjs +0 -24
- package/dist/chunk-EOAWCUFT.mjs +0 -1
- package/dist/chunk-FPSR4NAR.mjs +0 -1
- package/dist/chunk-H4GG2RS4.mjs +0 -1
- package/dist/chunk-K2OUXYDM.mjs +0 -1
- package/dist/chunk-KY4YVZ3O.mjs +0 -1
- package/dist/chunk-LSKP5UC6.mjs +0 -1
- package/dist/chunk-RALP6ENI.mjs +0 -30
- package/dist/chunk-RRB5IHBT.mjs +0 -1
- package/dist/chunk-WNOLXY3Y.mjs +0 -1
- package/dist/codex-note-context-4ORRY4CH.mjs +0 -1
- package/dist/codex-project-LMAR3FMS.mjs +0 -1
- package/dist/dev-server-ZLT7TAUF.mjs +0 -1
- package/dist/shared-page-JN7T4DDQ.mjs +0 -1
- package/infra/phone-pairing/README.md +0 -25
- /package/dist/{chunk-CZJILD7T.mjs → chunk-ERPJ6LXX.mjs} +0 -0
package/dist/chunk-ADOCYY5I.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{a as e}from"./chunk-G2ZHJXHZ.mjs";import{a as t,c as n}from"./chunk-53SKVMWR.mjs";import{a as o,j as i,d as a,i as r,g as d,b as s,e as l}from"./chunk-EOAWCUFT.mjs";import{l as c}from"./chunk-RWZ7SVMO.mjs";import{h as p,i as u}from"./chunk-AOTDTBQO.mjs";import{X as f,c as h,b as m,o as g,h as y,i as v,j as S,k as I,e as x}from"./chunk-TVIKC33M.mjs";import{h as M,a as w,g as b}from"./chunk-VXRRHXUP.mjs";import{f as T}from"./chunk-AAMUU2QA.mjs";import{v as k,d as A}from"./chunk-LH7HKUCK.mjs";import{a as E}from"./chunk-HQVWOBYH.mjs";import{a as C}from"./chunk-OREALBUO.mjs";import{a as O}from"./chunk-B4DYUYX4.mjs";import{a as D}from"./chunk-ZVDKW7TO.mjs";import{c as P,a as N}from"./chunk-7D4BUDKG.mjs";import{N as _,ia as R,I as L,$,Ma as j,qa as z,xa as H,M as B}from"./chunk-OA63PYHZ.mjs";import{createContext as F,memo as W,useContext as K,useState as U,useEffect as Y,useRef as X,useLayoutEffect as V,useReducer as q,useSyncExternalStore as Q,useId as G}from"react";import{jsxs as J,Fragment as Z,jsx as ee}from"react/jsx-runtime";function te(e,t){return ne(e,t)?e:t}function ne(e,t){if(Object.is(e,t))return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t||Array.isArray(e)!==Array.isArray(t))return!1;let n=e,o=t,i=Object.keys(n);return i.length===Object.keys(o).length&&i.every(e=>Object.prototype.hasOwnProperty.call(o,e)&&ne(n[e],o[e]))}var oe=F(null),ie=()=>()=>{},ae=()=>null;function re(){return Math.random().toString(36).substring(2,9)}function de(e){return"text"===e.type&&"lasso"===e.region?.kind&&(e={...e,fontSize:12,linkedAnchor:e.linkedAnchor??"bottom-left"}),e.status?e:e.captured?{...e,status:"in_flight"}:{...e,status:"pending"}}function se(e){return{canvasSamples:e.canvasSamples,annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}}function le(e,t){return{...e,undoStack:[...e.undoStack,{...se(e),...t&&{textEditSessionId:t}}],redoStack:[]}}function ce(e,t,n=!0){let{selector:o,durableSelector:i,element:a,changes:r}=t,d=typeof window<"u"?T(window.location.pathname):"/",s=r.filter(e=>e.original!==e.modified);if(0===s.length)return e;let l=n?le(e):e,c=l.styleModifications.findIndex(e=>e.selector===o&&(!e.pathname||e.pathname===d));if(c>=0){let e=l.styleModifications[c],t=e.captured?[]:[...e.changes];for(let e of s){let n=t.findIndex(t=>t.property===e.property);n>=0?t=e.modified===t[n].original?t.filter((e,t)=>t!==n):t.map((t,o)=>o===n?{...t,modified:e.modified,token:e.token,sticker:e.sticker}:t):t.push(e)}return 0===t.length?{...l,styleModifications:l.styleModifications.filter((e,t)=>t!==c)}:{...l,styleModifications:l.styleModifications.map((e,n)=>n===c?{...e,changes:t,createdAt:e.createdAt??Date.now(),captured:!1,pathname:d}:e)}}return{...l,styleModifications:[...l.styleModifications,{selector:o,durableSelector:i,element:a,changes:s,createdAt:Date.now(),pathname:d}]}}function pe(e,t){let n=new Map,o=[];for(let i of e){let e=i.sampledTree&&i.referenceSelector?n.get(i.referenceSelector):void 0,a=e&&e.pathname===i.pathname?{...i,referenceSelector:e.referenceSelector,placement:e.placement}:i;i.sampledTree&&t.has(i.id)?(n.set(i.selector,a),n.set(`[data-popmelt-placement-item="${i.id}"]`,a)):o.push(a)}return o.length===e.length?e:o}function ue(e,t,n,o){return e.selector===t&&(!e.pathname||e.pathname===o)&&e.textNodePath.length===n.length&&e.textNodePath.every((e,t)=>e===n[t])}function fe(e,t,n=!0){let{selector:o,durableSelector:i,element:a,textNodePath:r,original:d,modified:s}=t,l=typeof window<"u"?T(window.location.pathname):"/",c=e.textModifications.findIndex(e=>ue(e,o,r,l)),p=t.paragraphs?JSON.stringify(t.paragraphs.before)===JSON.stringify(t.paragraphs.after):d===s;if(p&&c<0)return e;if(c>=0){let o=e.textModifications[c],r=o.captured&&n?le(e):e,u=o.captured?d:o.original;return(t.paragraphs?p:s===u)?{...r,textModifications:r.textModifications.filter((e,t)=>t!==c)}:{...r,textModifications:r.textModifications.map((e,n)=>n===c?{...e,durableSelector:i,element:a,...t.paragraphs&&{paragraphs:t.paragraphs},original:u,canvasLabel:t.canvasLabel,modified:s,createdAt:e.createdAt??Date.now(),captured:!1,pathname:l}:e)}}let u=n?le(e):e;return{...u,textModifications:[...u.textModifications,{selector:o,durableSelector:i,element:a,textNodePath:r,...t.paragraphs&&{paragraphs:t.paragraphs},...void 0!==t.canvasLabel&&{canvasLabel:t.canvasLabel},original:d,modified:s,createdAt:Date.now(),pathname:l}]}}function he(e,t,n=!0,o){return 0===t.length?e:t.reduce((e,t)=>fe(e,t,!1),n?le(e,o):e)}function me(e,t){switch(t.type){case"SET_ANNOTATING":return function(e,t){return{...e,isAnnotating:t}}(e,t.payload);case"SET_TOOL":return function(e,t){return{...e,activeTool:t}}(e,t.payload);case"SET_COLOR":return function(e,t){return{...e,activeColor:t}}(e,t.payload);case"SET_STROKE_WIDTH":return function(e,t){return{...e,strokeWidth:t}}(e,t.payload);case"ADD_TEXT":return function(e,t){let n={id:t.id??re(),type:"text",points:[t.point],text:t.text,fontSize:t.fontSize||12,color:e.activeColor,strokeWidth:e.strokeWidth,timestamp:Date.now(),status:"pending",pathname:typeof window<"u"?T(window.location.pathname):"/",groupId:t.groupId,linkedSelector:t.linkedSelector,target:t.target,linkedAnchor:t.linkedAnchor,elements:t.elements,...t.region?{region:t.region}:{},...t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?.length?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}};return{...t.groupId?e:le(e),annotations:[...e.annotations,n]}}(e,t.payload);case"UPDATE_TEXT":return function(e,t){return{...le(e),annotations:e.annotations.map(e=>e.id===t.id?{...e,text:t.text,...null!=t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}}:e)}}(e,t.payload);case"CLEAR_INTERACTION_EPISODE":return function(e,t){return{...le(e),annotations:e.annotations.map(e=>{if(e.id!==t.id)return e;let n=e.interactionEpisode?.frames?.length??0,{interactionEpisode:o,...i}=e;if(0===n)return i;let a=Math.max(0,(e.imageCount??0)-n);if(0===a){let{imageCount:e,...t}=i;return t}return{...i,imageCount:a}})}}(e,t.payload);case"DELETE_ANNOTATION":return function(e,t){let n=le(e),o=e.annotations.find(e=>e.id===t.id)?.groupId,i=new Set(e.annotations.filter(e=>e.id===t.id||o&&e.groupId===o).map(e=>e.id));return{...n,annotations:e.annotations.filter(e=>e.id!==t.id&&!(o&&e.groupId===o)),selectedAnnotationIds:e.selectedAnnotationIds.filter(e=>!i.has(e)),lastSelectedId:e.lastSelectedId&&i.has(e.lastSelectedId)?null:e.lastSelectedId}}(e,t.payload);case"MOVE_ANNOTATION":return function(e,t){let n=t.saveUndo?le(e):e,o=e.annotations.find(e=>e.id===t.id)?.groupId;return{...n,annotations:e.annotations.map(e=>{if(!(e.id===t.id||o&&e.groupId===o))return e;let n=t.delta.x,i=t.delta.y;return{...e,points:e.points.map(e=>({x:e.x+n,y:e.y+i}))}})}}(e,t.payload);case"RESIZE_ANNOTATION":return function(e,t){let n=t.saveUndo?le(e):e,o=e.annotations.find(e=>e.id===t.id);if(!o||"text"===o.type||o.points.length<2)return e;let i=0,a=0;if("rectangle"===o.type&&o.groupId){let e=t.points,n=Math.min(e[0].x,e[1].x),r=Math.max(e[0].y,e[1].y),d=o.points[0],s=o.points[o.points.length-1],l=Math.min(d.x,s.x),c=Math.max(d.y,s.y);i=n-l,a=r-c}return{...n,annotations:e.annotations.map(e=>e.id===t.id?{...e,points:t.points}:o.groupId&&e.groupId===o.groupId&&"text"===e.type?{...e,points:e.points.map(e=>({x:e.x+i,y:e.y+a}))}:e)}}(e,t.payload);case"PASTE_ANNOTATIONS":return function(e,t){return{...le(e),annotations:[...e.annotations,...t.annotations.map(de)]}}(e,t.payload);case"RESTORE_ANNOTATIONS":return function(e,t){let n=new Set,o=[];for(let e of t.annotations)n.has(e.id)||(n.add(e.id),o.push(de(e)));return{...e,annotations:o}}(e,t.payload);case"SYNC_ANNOTATIONS":return function(e,t){let n=new Map(e.annotations.map(e=>[e.id,e])),o=t.annotations.map(e=>{let t=de(e),o=n.get(t.id);return o&&t.linkedSelector&&o.linkedSelector===t.linkedSelector?{...t,points:o.points,linkedAnchor:o.linkedAnchor}:t});return{...e,annotations:o}}(e,t.payload);case"MERGE_ANNOTATIONS":return function(e,t){let n=new Set(e.annotations.map(e=>e.id)),o=t.annotations.filter(e=>!n.has(e.id)).map(de);return o.length>0?{...e,annotations:[...e.annotations,...o]}:e}(e,t.payload);case"UNDO":return function(e){if(0===e.undoStack.length)return e;let t=e.undoStack[e.undoStack.length-1];return{...e,annotations:t?.annotations||[],canvasSamples:t?.canvasSamples,styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,se(e)]}}(e);case"REDO":return function(e){if(0===e.redoStack.length)return e;let t=e.redoStack[e.redoStack.length-1];return{...e,annotations:t?.annotations||[],canvasSamples:t?.canvasSamples,styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,se(e)]}}(e);case"SELECT_ANNOTATION":return function(e,t){let{id:n,addToSelection:o}=t;if(null===n)return{...e,selectedAnnotationIds:[],lastSelectedId:null};if(o){if(e.selectedAnnotationIds.includes(n)){let t=e.selectedAnnotationIds.filter(e=>e!==n);return{...e,selectedAnnotationIds:t,lastSelectedId:t.length>0?t[t.length-1]:null}}return{...e,selectedAnnotationIds:[...e.selectedAnnotationIds,n],lastSelectedId:n}}return{...e,selectedAnnotationIds:[n],lastSelectedId:n}}(e,t.payload);case"UPDATE_ANNOTATION_COLOR":return function(e,t){let n=e.annotations.find(e=>e.id===t.id)?.groupId,o=new Set;for(let t of e.selectedAnnotationIds){let n=e.annotations.find(e=>e.id===t);n?.groupId&&o.add(n.groupId)}return{...e,annotations:e.annotations.map(i=>i.id===t.id||e.selectedAnnotationIds.includes(i.id)||i.groupId&&(i.groupId===n||o.has(i.groupId))?{...i,color:t.color}:i)}}(e,t.payload);case"MARK_CAPTURED":return function(e,t){let n=typeof window<"u"?T(window.location.pathname):"/",o=t?.annotationIds?new Set(t.annotationIds):void 0,i=t?.textModifications??e.textModifications.filter(e=>!e.pathname||e.pathname===n),a=e=>e.filter(e=>!i.some(t=>e.pathname===t.pathname&&ue(e,t.selector,t.textNodePath,t.pathname??"")&&e.createdAt===t.createdAt&&e.original===t.original&&e.modified===t.modified&&ne(e.paragraphs,t.paragraphs))),r=(e,t,n=!0)=>t?t.some(t=>ne(t,e)):n,d=t?.domModifications??e.domModifications.filter(e=>!e.pathname||e.pathname===n),s=e=>!e.captured&&d.some(t=>ne(t,e))?{...e,captured:!0}:e,l=e=>({...e,textModifications:a(e.textModifications),domModifications:(e.domModifications??[]).map(e=>e.sampledTree?s(e):e)});return{...e,undoStack:e.undoStack.map(l),redoStack:e.redoStack.map(l),annotations:e.annotations.map(e=>o&&!o.has(e.id)?e:{...e,captured:!0,status:"pending"!==e.status&&"sending"!==e.status&&e.status?e.status:"in_flight"}),styleModifications:e.styleModifications.map(e=>r(e,t?.styleModifications,!e.pathname||e.pathname===n)?{...e,captured:!0}:e),textModifications:a(e.textModifications),domModifications:e.domModifications.map(s),spacingTokenChanges:e.spacingTokenChanges.map(e=>r(e,t?.spacingTokenChanges)?{...e,captured:!0}:e),spacingTokenMods:e.spacingTokenMods.map(e=>r(e,t?.spacingTokenMods)?{...e,captured:!0}:e)}}(e,t.payload);case"CLEAR":return function(e){return{...e,canvasSamples:void 0,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]}}(e);case"DISCARD_DRAFT":return function(e){return e.canvasSamples?.length||e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured)?{...le(e),canvasSamples:void 0,annotations:e.annotations.filter(e=>"pending"!==(e.status??"pending")),styleModifications:e.styleModifications.filter(e=>e.captured),textModifications:e.textModifications.filter(e=>e.captured),domModifications:e.domModifications.filter(e=>e.captured),spacingTokenChanges:e.spacingTokenChanges.filter(e=>e.captured),spacingTokenMods:e.spacingTokenMods.filter(e=>e.captured),selectedAnnotationIds:[],lastSelectedId:null}:e}(e);case"MODIFY_STYLE":return function(e,t){let{selector:n,element:o,property:i,original:a,modified:r}=t,d=typeof window<"u"?T(window.location.pathname):"/",s=e.styleModifications.findIndex(e=>e.selector===n&&(!e.pathname||e.pathname===d));if(a===r&&s<0)return e;if(s>=0){let t=e.styleModifications[s];if(t.captured){let t=le(e),n=t.styleModifications.map((e,t)=>t===s?{...e,changes:[{property:i,original:a,modified:r}],createdAt:e.createdAt??Date.now(),captured:!1,pathname:d}:e);return{...t,styleModifications:n}}let n,o=t.changes.findIndex(e=>e.property===i),l=e;if(o>=0){let e=t.changes[o];n=r===e.original?t.changes.filter((e,t)=>t!==o):t.changes.map((e,t)=>t===o?{...e,modified:r}:e)}else{if(a===r)return e;l=le(e),n=[...t.changes,{property:i,original:a,modified:r}]}if(0===n.length)return{...l,styleModifications:l.styleModifications.filter((e,t)=>t!==s)};let c=l.styleModifications.map((e,t)=>t===s?{...e,changes:n,createdAt:e.createdAt??Date.now()}:e);return{...l,styleModifications:c}}{let t=le(e),s={selector:n,element:o,changes:[{property:i,original:a,modified:r}],createdAt:Date.now(),pathname:d};return{...t,styleModifications:[...t.styleModifications,s]}}}(e,t.payload);case"DISCARD_PLACED_SAMPLE":{let{selector:n,pathname:o}=t.payload,i=e.domModifications.find(e=>e.selector===n&&e.pathname===o&&e.sampledTree&&!e.captured),a=i?pe(e.domModifications,new Set([i.id])):e.domModifications,r=e.canvasSamples?.filter(e=>!(e.selector===n&&e.pathname===o&&e.subject?.inserted));return a.length===e.domModifications.length&&r?.length===e.canvasSamples?.length?e:{...le(e),domModifications:a,canvasSamples:r}}case"PULL_PEER_EDITS":{let{styles:n,texts:o,canvases:i=[],placedElement:a}=t.payload;if(!(n.length||o.length||i.length||a))return e;let r=le(e);a&&(r.domModifications=[...e.domModifications,a]),i.length&&(r.canvasSamples=[...(e.canvasSamples??[]).filter(e=>!e.subject||!i.some(t=>!t.subject&&t.pathname===e.pathname&&t.selector===e.subject?.canvasSelector)),...i]);for(let e of n)r=ce(r,e,!1);return he(r,o,!1)}case"MODIFY_STYLES_BATCH":return ce(e,t.payload);case"CLEAR_STYLE":return function(e,t){let{selector:n,property:o}=t,i=typeof window<"u"?T(window.location.pathname):"/",a=le(e),r=a.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i?e:{...e,changes:e.changes.filter(e=>e.property!==o)}).filter(e=>e.changes.length>0);return{...a,styleModifications:r}}(e,t.payload);case"CLEAR_STICKER":return function(e,t){let{selector:n,sticker:o}=t,i=typeof window<"u"?T(window.location.pathname):"/";if(!e.styleModifications.find(e=>e.selector===n&&(!e.pathname||e.pathname===i)&&!e.captured&&e.changes.some(e=>e.sticker?.family===o.family&&e.sticker.subproperty===o.subproperty)))return e;let a=le(e),r=a.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i||e.captured?e:{...e,changes:e.changes.filter(e=>e.sticker?.family!==o.family||e.sticker.subproperty!==o.subproperty)}).filter(e=>e.changes.length>0);return{...a,styleModifications:r}}(e,t.payload);case"CLEAR_ALL_STYLES":return function(e){return 0===e.styleModifications.length?e:{...le(e),styleModifications:[]}}(e);case"RECOVER_PLACEMENT_SLOT":{let{id:n,slot:o}=t.payload,i=e.domModifications.find(e=>e.id===n);return i?.captured&&i.sampledTree&&!i.sourceSlot?{...e,domModifications:e.domModifications.map(e=>e===i?{...e,sourceSlot:o}:e)}:e}case"SETTLE_IMPLEMENTED_PLACEMENTS":return function(e,t){let n=new Set(t),o=new Set;for(let t of[e,...e.undoStack,...e.redoStack])for(let e of t.domModifications??[])e.captured&&e.sampledTree&&n.has(e.id)&&o.add(e.id);if(!o.size)return e;let i=e=>({...e,domModifications:pe(e.domModifications??[],o)});return{...e,domModifications:pe(e.domModifications,o),undoStack:e.undoStack.map(i),redoStack:e.redoStack.map(i)}}(e,t.payload.ids);case"SETTLE_CAPTURED_STYLES":return function(e,t){let n=new Set(t.selectors);if(0===n.size)return e;let o=e.styleModifications.filter(e=>!(e.captured&&(n.has(e.selector)||e.durableSelector&&n.has(e.durableSelector))));return o.length===e.styleModifications.length?e:{...e,styleModifications:o}}(e,t.payload);case"RESTORE_STYLE_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,styleModifications:t.map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_TEXT_CONTENT":return fe(e,t.payload);case"MODIFY_TEXT_CONTENTS":return he(e,t.payload,t.saveUndo??!0,t.textEditSessionId);case"CANCEL_PARAGRAPH_EDIT":{let{id:n,selector:o,pathname:i,originalDrafts:a}=t.payload,r=e.undoStack.findIndex(e=>e.textEditSessionId===n);if(r<0)return e;let d=e=>[...e.filter(e=>e.selector!==o||e.pathname&&e.pathname!==i),...a],s=e.undoStack.slice(r).filter(e=>e.textEditSessionId!==n);return{...e,textModifications:d(e.textModifications),undoStack:[...e.undoStack.slice(0,r),...s.map(e=>({...e,textModifications:d(e.textModifications)}))]}}case"RESTORE_TEXT_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,textModifications:t.filter(e=>!e.captured).map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_DOM_STRUCTURE":return function(e,t){let n=le(e),o=n.domModifications.findIndex(e=>e.id===t.id);return o>=0?{...n,domModifications:n.domModifications.map((e,n)=>n===o?{...t,captured:!1}:e)}:{...n,domModifications:[...n.domModifications,t]}}(e,t.payload);case"RESTORE_DOM_MODIFICATIONS":return function(e,t){return{...e,domModifications:t}}(e,t.payload);case"UPDATE_LINKED_POSITIONS":return function(e,t){let{updates:n}=t,o=new Map(n.map(e=>[e.id,e]));return{...e,annotations:e.annotations.map(e=>{let t=o.get(e.id);return t?{...e,points:[t.point,...e.points.slice(1)],...t.linkedAnchor?{linkedAnchor:t.linkedAnchor}:{}}:e})}}(e,t.payload);case"CLEANUP_ORPHANED":return function(e,t){let{linkedSelectors:n,styleSelectors:o}=t,i=new Set(n),a=new Set(o),r=typeof window<"u"?T(window.location.pathname):"/",d=new Set,s=new Set;for(let t of e.annotations)t.linkedSelector&&i.has(t.linkedSelector)&&(d.add(t.id),t.groupId&&s.add(t.groupId));for(let t of e.annotations)t.groupId&&s.has(t.groupId)&&d.add(t.id);let l=e.annotations.filter(e=>!d.has(e.id)),c=e.styleModifications.filter(e=>!a.has(e.selector)||e.pathname&&e.pathname!==r),p=e.domModifications.filter(e=>!a.has(e.selector)||e.pathname&&e.pathname!==r);if(l.length===e.annotations.length&&c.length===e.styleModifications.length&&p.length===e.domModifications.length)return e;let u=e.selectedAnnotationIds.filter(e=>!d.has(e));return{...e,annotations:l,styleModifications:c,domModifications:p,selectedAnnotationIds:u,lastSelectedId:u.length>0?u[u.length-1]:null}}(e,t.payload);case"SET_ANNOTATION_STATUS":return function(e,t){let n=new Set(t.ids);return{...e,annotations:e.annotations.map(e=>!n.has(e.id)||t.from&&(e.status??"pending")!==t.from?e:{...e,status:t.status})}}(e,t.payload);case"MARK_ANNOTATIONS_REPLIED":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>{if(!(n.has(e.id)||e.groupId&&o.has(e.groupId)))return e;let i=!!t.jobId&&e.replyJobIds?.includes(t.jobId),a="waiting_input"===e.status;return{...e,status:a?"waiting_input":"resolved",replyCount:(e.replyCount??0)+(i?0:1),replyJobIds:t.jobId&&!i?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,threadId:e.threadId||t.threadId,question:a?e.question:void 0}})}}(e,t.payload);case"MARK_ANNOTATIONS_FAILED":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&o.has(e.groupId)?{...e,status:"failed",threadId:e.threadId||t.threadId,question:void 0}:e)}}(e,t.payload);case"SET_ANNOTATION_THREAD":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&o.has(e.groupId)?{...e,threadId:t.threadId,targetBindingId:t.targetBindingId}:e)}}(e,t.payload);case"SET_ANNOTATION_QUESTION":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&o.has(e.groupId)?{...e,status:"waiting_input",question:t.question,threadId:t.threadId}:e)}}(e,t.payload);case"APPLY_RESOLUTIONS":return function(e,t){let n=new Map(t.resolutions.map(e=>[e.annotationId,e])),o=new Map;for(let t of e.annotations){let e=n.get(t.id);e&&t.groupId&&o.set(t.groupId,e)}return{...e,annotations:e.annotations.map(e=>{let i=n.get(e.id)||(e.groupId?o.get(e.groupId):void 0);if(!i)return e;let a=!!t.jobId&&e.replyJobIds?.includes(t.jobId);return{...e,status:i.status,resolutionSummary:i.summary,scope:i.finalScope??i.inferredScope??null,replyCount:(e.replyCount??0)+(a?0:1),replyJobIds:t.jobId&&!a?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,question:void 0,threadId:e.threadId||t.threadId}})}}(e,t.payload);case"ADD_SPACING_TOKEN_CHANGE":return function(e,t){let n=e.spacingTokenChanges.findIndex(e=>e.tokenPath===t.tokenPath);return n>=0?{...e,spacingTokenChanges:e.spacingTokenChanges.map((e,o)=>o===n?t:e)}:{...e,spacingTokenChanges:[...e.spacingTokenChanges,t]}}(e,t.payload);case"RESTORE_SPACING_TOKEN_CHANGES":return function(e,t){return{...e,spacingTokenChanges:t}}(e,t.payload);case"MODIFY_SPACING_TOKEN":return function(e,t){let n,o=le(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath);if(i>=0){let o=e.spacingTokenMods[i],a={...t,originalValue:o.captured?o.currentValue:o.originalValue,originalPx:o.captured?o.currentPx:o.originalPx,captured:!1};n=e.spacingTokenMods.map((e,t)=>t===i?a:e)}else n=[...e.spacingTokenMods,{...t,captured:!1}];return{...o,spacingTokenMods:n}}(e,t.payload);case"DELETE_SPACING_TOKEN":return function(e,t){let n,o=le(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath),a=i>=0?e.spacingTokenMods[i]:null,r=i>=0?a.captured?a.currentValue:a.originalValue:t.originalValue,d=i>=0?a.captured?a.currentPx:a.originalPx:parseFloat(t.originalValue)||0,s={tokenPath:t.tokenPath,originalValue:r,currentValue:"__deleted__",targets:a?.targets??[],originalPx:d,currentPx:0,captured:!1};return n=i>=0?e.spacingTokenMods.map((e,t)=>t===i?s:e):[...e.spacingTokenMods,s],{...o,spacingTokenMods:n}}(e,t.payload);default:return t}}function ge(e,t){let n=K(oe),[o,i]=q(me,O),a=Q(n?.subscribe??ie,n?.getSnapshot??ae,n?.getSnapshot??ae)??o,r=n?.dispatch??i;Y(()=>{if(!a.isAnnotating)return;let n=n=>{t?.current||n.defaultPrevented||n.isComposing||n.altKey||n.composedPath().some(e=>e instanceof Element&&(e.matches('input, textarea, select, [role="textbox"]')||e instanceof HTMLElement&&e.isContentEditable||e.hasAttribute("contenteditable")&&"false"!==e.getAttribute("contenteditable")))||(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()===E.actions.undo.key&&(n.preventDefault(),n.shiftKey?r({type:"REDO"}):e?.current?.()||r({type:"UNDO"}))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[r,a.isAnnotating,e,t]);let d=n?.getUndoHead?n.getUndoHead():a.undoStack.at(-1);return[a,r,d]}function ye(){return{isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null}}function ve(e){if(!e||e===document.body||e===document.documentElement||c(e))return!1;let t=e.tagName.toLowerCase();return!["script","style","link","meta","head","html","body","input","textarea","select","option","button"].includes(t)&&!!e.parentElement}function Se(e){let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),`[data-pm="${t}"]`}function Ie(e){return e.parentElement?Array.from(e.parentElement.children).indexOf(e):-1}function xe(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function Me(e,t,n,o,i=M){let a=n.parentElement;if(!a)return null;let r=i(e,t);for(;r&&r!==document.body;)if(r===n||n.contains(r))r=r.parentElement;else{if(r.parentElement===a&&ve(r))break;r=r.parentElement}if(!r||r===document.body||r.parentElement!==a||r===o)return null;let d=r.getBoundingClientRect(),s=d.height>=d.width?t<d.top+d.height/2?"before":"after":e<d.left+d.width/2?"before":"after",l=Ie(r);return{parent:a,reference:r,placement:s,index:"before"===s?l:l+1}}function we(e,t,n){let o=Array.from(e.children).filter(e=>e!==t),i=Math.max(0,Math.min(n,o.length));e.insertBefore(t,o[i]??null)}function be({drag:e,clientX:t,clientY:n,pathname:o,createId:i,rootElement:a,elementAtPoint:r}){let d=e.element;if(!(d&&e.selector&&e.durableSelector&&e.elementInfo))return null;let s=Me(t,n,d,a,r);if(!s)return null;let l=e.originalParent===s.parent&&s.index>e.originalIndex?s.index-1:s.index;if("move"===e.mode&&e.originalParent===s.parent&&(l===e.originalIndex||l===e.originalIndex+1))return null;let c=w(s.parent),p=Se(s.parent),u=w(s.reference),f=Se(s.reference),h=e.selector,m=e.durableSelector,g=e.elementInfo;if("copy"===e.mode){let e=d.cloneNode(!0);if(!(e instanceof Element))return null;xe(e),we(s.parent,e,l),h=Se(e),m=w(e),g={...b(e),selector:h}}else we(s.parent,d,l);let y=e.originalParent;return{id:i(),operation:e.mode,selector:h,durableSelector:m,element:g,sourceSelector:"copy"===e.mode?e.selector:void 0,sourceDurableSelector:"copy"===e.mode?e.durableSelector:void 0,sourceElement:"copy"===e.mode?e.elementInfo:void 0,originalParentSelector:y?Se(y):void 0,originalParentDurableSelector:y?w(y):void 0,originalIndex:e.originalIndex,targetParentSelector:p,targetParentDurableSelector:c,targetIndex:l,referenceSelector:f,referenceDurableSelector:u,placement:s.placement,pathname:o}}function Te(e){return e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||!0===e.isContentEditable||"true"===e.getAttribute("contenteditable"))}function ke(e){return Te(e.composedPath?.()[0]??e.target)||Te(function(){if(typeof document>"u")return null;let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}())}function Ae(e,t,n){if(n)return[n];let o=new Set(t),i=new Map;for(let t of e)t.groupId&&t.threadId&&i.set(t.groupId,t.threadId);let a=new Set;for(let t of e){if(!o.has(t.id))continue;let e=t.threadId||(t.groupId?i.get(t.groupId):void 0);e&&a.add(e)}return[...a]}function Ee({state:e,stateRef:t,activeTextRef:n,selectedIdsRef:o,dispatch:i,clearSelection:a,selectAnnotation:r,handHoveredElement:d,onArchiveThread:s,openThreadId:l,currentPathname:c,hasOpenThread:p}){let u=X([]),f=X(0),h=X(null);Y(()=>{let m=m=>{if("Escape"===m.key){if(m.defaultPrevented||m.repeat||n.current||p||ke(m))return;if(o.current.length>0)return m.preventDefault(),void a();let e=t.current;if(e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured))return m.preventDefault(),void i({type:"DISCARD_DRAFT"})}if((m.metaKey||m.ctrlKey)&&"c"===m.key.toLowerCase()&&"hand"===e.activeTool&&d&&!n.current){if(ve(d)){m.preventDefault();let e=Se(d);h.current={source:d,sourceSelector:e,sourceDurableSelector:w(d),sourceElement:{...b(d),selector:e}}}return}if((m.metaKey||m.ctrlKey)&&"v"===m.key.toLowerCase()&&"hand"===e.activeTool&&h.current&&!n.current){let e=h.current,t=d&&ve(d)?d:e.source,n=t.parentElement;if(n){m.preventDefault();let o=w(n),a=Se(n),r=w(t),d=Se(t),s=Ie(t)+1,l=e.source.cloneNode(!0);if(l instanceof Element){xe(l),we(n,l,s);let t=Se(l),p=w(l),u={...b(l),selector:t};i({type:"MODIFY_DOM_STRUCTURE",payload:{id:re(),operation:"copy",selector:t,durableSelector:p,element:u,sourceSelector:e.sourceSelector,sourceDurableSelector:e.sourceDurableSelector,sourceElement:e.sourceElement,targetParentSelector:a,targetParentDurableSelector:o,targetIndex:s,referenceSelector:d,referenceDurableSelector:r,placement:"after",pathname:c}})}}return}if((m.metaKey||m.ctrlKey)&&"v"===m.key&&u.current.length>0&&!n.current){m.preventDefault(),f.current+=1;let e=20*f.current,t=u.current[0]?.groupId?Math.random().toString(36).substring(2,9):void 0,n=u.current.map(n=>({...n,id:Math.random().toString(36).substring(2,9),groupId:n.groupId?t:void 0,timestamp:Date.now(),points:n.points.map(t=>({x:t.x+e,y:t.y+e}))}));i({type:"PASTE_ANNOTATIONS",payload:{annotations:n}});let o=n.find(e=>"text"!==e.type)??n[0];return void(o&&r(o.id))}let g=o.current;if(!(n.current||ke(m)||"Delete"!==m.key&&"Backspace"!==m.key||m.metaKey||m.ctrlKey||m.altKey)){if(0===g.length&&!l)return;let e=Ae(t.current.annotations,g,l);if(!s||0===e.length)return;m.preventDefault();for(let t of e)s(t);a()}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,a,c,i,d,p,s,l,r,o,e.activeTool,t])}function Ce(e,t,n){let o=e.filter(e=>!(e.captured||e.selector!==t||e.pathname&&e.pathname!==n));return o.length?{type:"MODIFY_TEXT_CONTENTS",payload:o.map(e=>({...e,modified:e.original}))}:null}function Oe(e,t){return"text"===e.type&&(e.groupId?t.filter(t=>t.groupId===e.groupId):[e]).every(e=>"pending"===(e.status??"pending")&&!e.threadId)}var De=F(0),Pe=28;function Ne({threadId:t,color:n,size:o}){let i=K(e);if(!t||i?.preview?.threadId!==t)return null;let a=i.preview.enabled;return ee("button",{type:"button","data-devtools":"explore-preview-badge","aria-label":"Preview option on page","aria-pressed":a,title:a?"Turn off page preview":"Preview option on page",onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),i.setPreview(e=>e&&e.threadId===t?{...e,enabled:!e.enabled,revealOnPage:!1}:e)},style:{...g(o),appearance:"none",width:28,minWidth:28,padding:0,margin:0,border:0,display:"grid",placeItems:"center",cursor:"pointer",backgroundColor:n,color:"#fff",borderRadius:8,opacity:a?1:.5},children:ee(_,{size:12,strokeWidth:2.25})})}var _e=160;function Re(e,t,n){let o=e.points[0];if(typeof window>"u"||"text"!==e.type||!o)return!0;let i=e.region?.points,a=i?.length?s(i):{...o,width:0,height:0};return a.x+a.width>=t&&a.y+a.height>=n&&a.x<t+window.innerWidth&&a.y<n+window.innerHeight}function Le(e,t,n,o=.5){let i=Math.max(0,e-2*o),a=Math.max(0,t-2*o),r=function(e,t,n){let o=Math.max(0,n.topLeft),i=Math.max(0,n.topRight),a=Math.max(0,n.bottomRight),r=Math.max(0,n.bottomLeft),d=Math.min(1,e/Math.max(1,o+i),e/Math.max(1,r+a),t/Math.max(1,o+r),t/Math.max(1,i+a));return{topLeft:o*d,topRight:i*d,bottomRight:a*d,bottomLeft:r*d}}(e,t,n),d=Math.max(0,r.topLeft-o),s=Math.max(0,r.topRight-o),l=Math.max(0,r.bottomRight-o),c=Math.max(0,r.bottomLeft-o),p=o+i,u=o+a;return[`M ${o+d} ${o}`,"H "+(p-s),`A ${s} ${s} 0 0 1 ${p} ${o+s}`,"V "+(u-l),`A ${l} ${l} 0 0 1 ${p-l} ${u}`,`H ${o+c}`,`A ${c} ${c} 0 0 1 ${o} ${u-c}`,`V ${o+d}`,`A ${d} ${d} 0 0 1 ${o+d} ${o}`,"Z"].join(" ")}var $e=12,je=8;function ze(e){return e>0?16+7.2*String(e).length+16:0}function He({stepCount:e,onClear:o,layered:i=!1,submitted:a=!1,style:r}){let[d]=P(),s=N[d];return e<1?null:J("span",{"data-devtools":"interaction-episode-badge","data-popmelt-submitted":a?"true":void 0,"aria-label":`${e} recorded ${1===e?"action":"actions"}${a?", sent":""}`,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),o?.()},style:{height:22,display:"inline-flex",alignItems:"center",boxSizing:"border-box",backgroundColor:a?"#8c8c8c":s.surface,border:`1px solid ${a?"#8c8c8c":s.border}`,borderRadius:8,color:a?"#dddddd":s.primary,fontFamily:y,fontSize:12,fontWeight:600,padding:i?`0 8px 0 ${.7*n}px`:"0 8px 0 5.6px",gap:4,pointerEvents:o?"auto":"none",WebkitMaskImage:i?t:void 0,maskImage:i?t:void 0,...r},children:[J("svg",{"aria-hidden":!0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ee("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),ee("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]}),ee("span",{children:e})]})}function Be(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let o=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,a=n.avoidRight??o;return e+t>i&&e<a}(t,n,e)?e:{}}function Fe(e,t,n){return`translate(min(0px, calc(100vw - ${e} - 100%)), min(max(0px, calc(${void 0!==n.avoidTop?`${n.avoidTop}px`:"0px"} - ${t})), calc(${void 0!==n.avoidBottom?`${n.avoidBottom}px`:"100dvh"} - ${t} - 100%)))`}function We(e,t,n){if(void 0===n.avoidTop&&void 0===n.avoidBottom)return e;let o=typeof window<"u"?window.innerHeight:9999,i=n.avoidTop??0,a=n.avoidBottom??o,r=Math.max(i,a-t);return Math.max(i,Math.min(e,r))}function Ke({left:e,top:t,scrollX:n,scrollY:o,avoidTop:i,avoidBottom:a,style:r,children:d,...s}){return ee("div",{"data-devtools":"badge-hit-area",...s,style:{position:"fixed",left:0,top:0,padding:$e,...r,transform:`translate3d(${`calc(${e}px - var(--popmelt-scroll-x, ${n}px))`}, ${`calc(${t}px - var(--popmelt-scroll-y, ${o}px))`}, 0)`,willChange:"transform"},children:ee("div",{style:{transform:Fe(`calc(${e+$e}px - var(--popmelt-scroll-x, ${n}px))`,`calc(${t+$e}px - var(--popmelt-scroll-y, ${o}px))`,{avoidTop:i,avoidBottom:a})},children:d})})}function Ue({bundleCount:e,editingComment:o=!1,style:i,layered:a=!1,compact:r=!1,description:d,replacementText:s,actionLabel:l,actionIcon:c,shortcut:p,onHoverChange:u,onSend:f}){let[h,m]=U(!1),[v]=P(),S=X(null),I=X(!1),M=N[v],w=K(De),b=G(),T=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl",k=Math.max(1,e),A=r&&!h,E=e=>A?ee(H,{size:12,strokeWidth:2,"aria-hidden":!0}):J(Z,e?{children:[ee("span",{style:{color:"inherit",fontWeight:600},children:k>1?`Send all ${k}`:"Send"}),ee(H,{size:12,strokeWidth:2,"aria-hidden":!0})]}:{children:[J("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"inherit",fontWeight:600},children:[!o&&J(Z,{children:[ee("span",{children:T}),ee("span",{children:"+"})]}),ee(B,{size:12,strokeWidth:2,"aria-hidden":!0})]}),ee("span",{style:{color:M.secondary,fontWeight:600},children:"to"}),ee(H,{size:12,strokeWidth:2,"aria-hidden":!0}),k>1&&ee("span",{style:{color:"inherit",fontWeight:600},children:k})]}),O=e=>J(Z,l?{children:[p&&J("span",{className:"popmelt-action-shortcut","aria-hidden":!0,style:{alignItems:"center",gap:4,fontWeight:500},children:[ee("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:p}),ee("span",{style:{color:M.secondary},children:"to"})]}),c,ee("span",{style:{fontWeight:500},children:l})]}:{children:[ee("span",{className:"popmelt-send-hint-desktop",style:{alignItems:"center",gap:4},children:E(e)}),J("span",{className:"popmelt-send-hint-mobile",style:{alignItems:"center",gap:4},children:[!A&&ee("span",{style:{color:"inherit",fontWeight:600},children:"Send"}),ee(H,{size:12,strokeWidth:2,"aria-hidden":!0})]})]}),_=s?ee("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:s}):null,R={...g(),lineHeight:12*x+"px",display:"flex",alignItems:"center",boxSizing:"border-box",backgroundColor:M.surface,border:`1px solid ${M.border}`,fontFamily:y,fontSize:12,color:l&&!f?M.secondary:M.primary,userSelect:"none",padding:a?`0 8px 0 ${n}px`:"0 8px",gap:4,whiteSpace:"nowrap",borderRadius:8,letterSpacing:"0.24px",WebkitMaskImage:a?t:void 0,maskImage:a?t:void 0},L=k>1?`Send all ${k} pending annotations`:"Send pending annotation";return J("div",{"data-devtools":"send-hint-hit-area","data-popmelt-send-rejection":w?w%2?"odd":"even":void 0,onMouseEnter:()=>{D()||(m(!0),u?.(!0))},onMouseLeave:()=>{m(!1),u?.(!1)},style:{display:"grid",width:"max-content",...i},children:[ee("style",{children:`\n@keyframes popmelt-send-rejection-odd { ${C} }\n@keyframes popmelt-send-rejection-even { ${C} }\n[data-popmelt-send-rejection="odd"] { animation: popmelt-send-rejection-odd 220ms ease-out; }\n[data-popmelt-send-rejection="even"] { animation: popmelt-send-rejection-even 220ms ease-out; }\n@media (prefers-reduced-motion: reduce) {\n [data-popmelt-send-rejection] { animation: none; }\n}\n.popmelt-send-hint-desktop { display: inline-flex; }\n.popmelt-action-shortcut { display: inline-flex; }\n@media (hover: none) and (pointer: coarse) {\n .popmelt-action-shortcut { display: none; }\n}\n.popmelt-send-hint-mobile { display: none; }\n@media (max-width: 767px) {\n .popmelt-send-hint-desktop { display: none; }\n .popmelt-send-hint-mobile { display: inline-flex; }\n}\n `}),ee("div",{"aria-hidden":!0,style:{...R,gridArea:"1 / 1",visibility:"hidden"},children:O(!1)}),J("button",{type:"button","data-devtools":"annotation-badge","aria-label":l??L,"aria-describedby":d?b:void 0,disabled:!f,onPointerDown:e=>{I.current=!1,"touch"===e.pointerType&&e.isPrimary&&(S.current={id:e.pointerId,x:e.clientX,y:e.clientY}),e.preventDefault(),e.stopPropagation()},onPointerCancel:()=>{S.current=null},onPointerUp:e=>{let t=S.current;S.current=null,t?.id===e.pointerId&&(I.current=!0,e.preventDefault(),e.stopPropagation(),Math.hypot(e.clientX-t.x,e.clientY-t.y)<=10&&f?.())},onClick:e=>{e.preventDefault(),e.stopPropagation(),I.current&&0!==e.detail?I.current=!1:f?.()},style:{...R,gridArea:"1 / 1",justifySelf:"start",maxWidth:s?"min(320px, calc(100vw - 16px))":void 0,overflow:s?"hidden":void 0,appearance:"none",margin:0,opacity:1,cursor:f?"pointer":"default",touchAction:"manipulation"},children:[d&&ee("span",{id:b,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:d}),_??O(h)]})]})}function Ye({count:e,color:t,size:n=22,onHoverChange:o}){return J("div",{"data-devtools":"nested-annotation-count-badge",onMouseEnter:()=>o?.(!0),onMouseLeave:()=>o?.(!1),style:{height:n,display:"flex",alignItems:"center",backgroundColor:t,color:"#8c8c8c"===t?"#dddddd":"#ffffff",fontFamily:y,fontSize:12,fontWeight:600,lineHeight:1,padding:"0 8px",borderRadius:8,userSelect:"none",whiteSpace:"nowrap"},children:["+",e]})}function Xe({scrollX:e,scrollY:t,projected:n,children:i}){let a=K(o),r=X(null);return V(()=>{let e=r.current;if(!a||n||!e)return;let t=()=>{e.style.setProperty("--popmelt-scroll-x",`${window.scrollX}px`),e.style.setProperty("--popmelt-scroll-y",`${window.scrollY}px`)};return t(),window.addEventListener("scroll",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),e.style.removeProperty("--popmelt-scroll-x"),e.style.removeProperty("--popmelt-scroll-y")}},[n,a]),ee("div",{ref:r,part:n?void 0:l,"data-devtools":"annotation-badge-layer",style:{"--popmelt-painted-x":`var(--popmelt-scroll-x, ${e}px)`,"--popmelt-painted-y":`var(--popmelt-scroll-y, ${t}px)`,position:"fixed",inset:0,pointerEvents:"none",zIndex:9999},children:i})}function Ve({annotations:t,supersededAnnotations:n,inFlightIds:i,approvalThreads:a,orientationLabels:r,activeIds:d,queuePositions:s,scrollX:l,scrollY:c,annotationGroupMap:p,onViewThread:u,onSelectAnnotation:f,onDeleteDraftAnnotation:h,onClearInteractionEpisode:m,onHoverAnnotation:M,canvasRef:w,toolbarRef:b,activeBundleAnnotationIds:T,inactiveBundleOpacity:k=.5,animateBundleOpacity:A=!0,hoverRestoredAnnotationIds:E,nestedAnnotationCountById:C,nestedAnnotationIdsById:O,onHoverNestedAnnotations:D,onHoverSendBundle:P,onSend:N,sendHintAnchorId:_,pendingBundleCount:H=1,parentPinnedAnnotationIds:B,parentPinnedLocationLabels:F,parentPinnedTooltipAnnotationId:W,onActivateAnnotation:X,hiddenAnnotationIds:V,displayAnnotations:q,projected:Q=!1}){let G=K(e),te=K(o),[ne,oe]=U(0),ie=!!(i&&i.size>0&&(void 0===d||d.size>0));Y(()=>{if(!ie||!te)return;let e=setInterval(()=>{oe(e=>(e+1)%3)},250);return()=>{clearInterval(e)}},[ie,te]);let ae=[],re=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl";for(let e of t){if("text"!==e.type||!e.text||!e.points[0]||n.has(e)||V?.has(e.id))continue;let o=e.groupId?t.filter(t=>t.groupId===e.groupId):[e],s=e.status??"pending",u=o.map(e=>a?.get(e.id)).find(Boolean),f=!u&&H>0&&e.id===_,h=e.interactionEpisode?.steps.length??0,m=C?.get(e.id)??0,g=O?.get(e.id)??[],M=o.reduce((e,t)=>Math.max(e,t.replyCount??0),0),b="sending"===s||o.some(e=>"sending"===e.status),k="awaiting_review"===s,A=!b&&(!(!i||!i.has(e.id)&&!o.some(e=>i.has(e.id)))||"in_flight"===e.status||o.some(e=>"in_flight"===e.status)),D=o.some(e=>"resolved"===e.status&&(e.replyCount??0)>0||"needs_review"===e.status),P=o.some(e=>e.threadId),N=!!u||!T||o.some(e=>T.has(e.id)||E?.has(e.id));if(!(f||b||u||k||A||"resolved"===s||"failed"===s||"needs_review"===s||D||P||h>0)&&0===m)continue;let R=u??(e.threadId||o.find(e=>e.threadId)?.threadId),L="needs_review"===s||o.some(e=>"needs_review"===e.status),$="waiting_input"===s||o.some(e=>"waiting_input"===e.status),j="failed"===s||o.some(e=>"failed"===e.status),z=f||b||!!u||k||A||L||$||j||M>0||"resolved"===s&&P||h>0;if(!z&&0===m)continue;let F=e.points[0],W=e.fontSize||12,K=W*x,U=p.get(e.id),Y=((q?.find(t=>t.id===e.id)??e).text??e.text).replace(/\n/g," "),X=void 0!==U?U+". "+Y:Y,Q=w?.current?.getContext("2d")??document.createElement("canvas").getContext("2d");if(!Q)continue;Q.font=`${W}px ${y}`;let G=F.x-l,J=B?.has(e.id)?v:0,Z=Math.max(60,S(G)-J),ee=I(Q,X,Z),te=Q.measureText(ee).width,ne=!u&&A&&!!d&&!d.has(e.id)&&!o.some(e=>d.has(e.id));ae.push({id:e.id,threadId:R,visible:Re(e,l,c),x:F.x+te+J+8+2,y:F.y-4,size:K+8,color:f?"#000000":e.color,isSending:b,isAwaitingReview:k,needsApproval:!!u,isInFlight:A,orientationLabel:r?.get(e.id)??o.map(e=>r?.get(e.id)).find(Boolean),isQueued:ne,queuePosition:void 0,isNeedsReview:L,isQuestion:$,isFailed:j,replyCount:M>0?M:"resolved"===s&&P?1:0,isInActiveBundle:N,isSendHint:f,interactionEpisodeStepCount:h,interactionEpisodeSubmitted:"pending"!==s,nestedCount:m,nestedAnnotationIds:g,nestedColor:"pending"===s?e.color:"#8c8c8c",showActionBadge:z,canDeleteDraft:Oe(e,t)})}let de=ae.filter(e=>e.isQueued);if(de.length>0&&de.forEach((e,t)=>{e.queuePosition=s?.get(e.id)??`(${t+1}/${de.length})`}),0===ae.length)return null;let se=w?.current?.getContext("2d")??document.createElement("canvas").getContext("2d"),le=ae.map(e=>{se&&(se.font=`12px ${y}`);let t=e.nestedCount>0?(se?.measureText(`+${e.nestedCount}`).width??7.2*String(e.nestedCount).length+7.2)+16:0,n=ze(e.interactionEpisodeStepCount),o=e.threadId&&G?.preview?.threadId===e.threadId?30:0;if(!e.showActionBadge)return t+n+o;let i,a=W===e.id?F?.get(e.id):void 0;i=a||(e.isSendHint?re:e.needsApproval?"Approval needed":e.isSending?"Sending":e.isAwaitingReview?"Awaiting review":e.isInFlight?e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking":e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision");let r=e.isSendHint||a?0:12,d=7.2*i.length;se&&(d=se.measureText(i).width);let s=e.isSendHint&&se?se.measureText("to").width:e.isSendHint?14.4:0,l=e.isSendHint&&se?se.measureText("+").width:e.isSendHint?7.2:0,c=e.isSendHint&&H>1&&se?se.measureText(String(H)).width:e.isSendHint&&H>1?7.2:0;return n+t+(a?Math.min(d+16,320):e.isSendHint?d+l+s+c+16+12+12+4+4*(H>1?3:2):6+r+4+d+8)+2*(+(n>0)+ +(t>0)+1-1)+o}),ce=function(e){let t=e?.current?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+8,avoidLeft:t.left-8,avoidRight:t.right+8}:{avoidBottom:t.top-8,avoidLeft:t.left-8,avoidRight:t.right+8}}(b),pe=[];for(let e=0;e<ae.length;e++){let t=ae[e].y-c,n=ae[e].x-l,o=Be(ce,n,le[e]),i=We(t,ae[e].size,o),a=i+ae[e].size,r=n;for(let t=0;t<e;t++){if(!ae[t].visible||!ae[e].visible)continue;let n=ae[t].y-c,o=Be(ce,pe[t],le[t]),d=We(n,ae[t].size,o);if(!(i<d+ae[t].size&&a>d))continue;let s=pe[t]+le[t];r<s+2&&(r=s+2)}pe.push(r)}return J(Xe,{scrollX:l,scrollY:c,projected:Q,children:[ee("style",{dangerouslySetInnerHTML:{__html:'\n@media (prefers-reduced-motion: no-preference) {\n [data-devtools="annotation-badge-layer"] [data-devtools="badge-hit-area"] {\n transition: opacity 160ms ease-out;\n }\n}\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"]::selection,\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"] *::selection {\n background: #000000;\n color: #ffffff;\n}\n'}}),ae.map((e,t)=>{let n=!!e.threadId,o=F?.get(e.id),i=!!o&&W===e.id,a=n||!!o,r=!!e.threadId&&G?.preview?.threadId===e.threadId,d=e.showActionBadge&&e.isSendHint||r,s=a&&!d,p=()=>{X?X(e.id,e.threadId):(f?.(e.id),e.threadId&&u?.(e.threadId))},v=Be(ce,pe[t],le[t]);return ee(Ke,{inert:!e.visible||void 0,"aria-hidden":!e.visible||void 0,left:pe[t]+l-$e,top:e.y-$e,scrollX:l,scrollY:c,avoidTop:v.avoidTop,avoidBottom:v.avoidBottom,onMouseDown:e=>e.stopPropagation(),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.canDeleteDraft&&h&&h(e.id)},onClick:a?e=>{e.stopPropagation(),p()}:void 0,onMouseEnter:()=>{M?.(e.id)},onMouseLeave:()=>{M?.(null)},onFocus:()=>M?.(e.id),onBlur:()=>M?.(null),onKeyDown:s?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p())}:void 0,role:s?"button":void 0,tabIndex:s?0:void 0,"aria-label":s&&o?`${o}. Activate to reveal the annotation source${n?" and open its thread":""}`:void 0,style:{position:"absolute",opacity:e.visible?1:0,pointerEvents:e.visible?"auto":"none",cursor:a?"pointer":void 0,zIndex:9999,minWidth:e.isSendHint?le[t]:void 0},children:J("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:2},children:[ee(He,{stepCount:e.interactionEpisodeStepCount,submitted:e.interactionEpisodeSubmitted,onClear:e.canDeleteDraft&&m?()=>m(e.id):void 0}),e.nestedCount>0&&ee(Ye,{count:e.nestedCount,color:e.nestedColor,size:e.size,onHoverChange:t=>D?.(e.id,t?e.nestedAnnotationIds:null)}),ee(Ne,{threadId:e.threadId,color:e.color,size:e.size}),e.showActionBadge&&(e.isSendHint?ee(Ue,{bundleCount:H,description:o?`${o}. Activate the annotation label to reveal its source.`:void 0,replacementText:i?o:void 0,onHoverChange:P,onSend:N}):ee("div",{"data-devtools":"annotation-badge",style:{...g(e.size),display:"flex",alignItems:"center",backgroundColor:e.color,fontFamily:y,fontSize:12,color:"#ffffff",userSelect:"none",padding:"0 8px 0 6px",gap:4,whiteSpace:"nowrap",maxWidth:i?"min(320px, calc(100vw - 16px))":void 0,overflow:i?"hidden":void 0,borderRadius:8,opacity:e.isInActiveBundle?1:k,transition:A?"opacity 120ms ease-out":"none"},children:i?ee("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:o}):e.needsApproval?J(Z,{children:[ee(R,{size:12,"aria-hidden":"true"}),"Approval needed"]}):e.isAwaitingReview?J(Z,{children:[ee(L,{size:12,strokeWidth:2.25}),"Awaiting review"]}):e.isQueued?J("span",{style:{opacity:.6,color:"inherit",display:"inline-flex",alignItems:"center",gap:4},children:[ee(L,{size:12,strokeWidth:2.25}),"Queued",e.queuePosition?` ${e.queuePosition}`:""]}):e.isSending||e.isInFlight?J(Z,{children:[ee("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle",opacity:.6},children:J(Z,1===ne?{children:[ee("circle",{cx:"7",cy:"7",r:"2"}),ee("circle",{cx:"17",cy:"7",r:"2"}),ee("circle",{cx:"7",cy:"17",r:"2"}),ee("circle",{cx:"17",cy:"17",r:"2"})]}:{children:[ee("circle",{cx:"12",cy:"6",r:"2"}),ee("circle",{cx:"6",cy:"12",r:"2"}),ee("circle",{cx:"18",cy:"12",r:"2"}),ee("circle",{cx:"12",cy:"18",r:"2"})]})}),ee("span",{style:{opacity:.6,color:"inherit"},children:e.isSending?"Sending":e.orientationLabel??"Thinking"})]}):J(Z,{children:[e.isQuestion?ee($,{size:12,strokeWidth:2.25}):e.isFailed?ee(j,{size:12,strokeWidth:2.25}):e.replyCount>0?ee(z,{size:12,strokeWidth:2.25}):J("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ee("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),ee("path",{d:"M10 21h4"})]}),ee("span",{style:{color:"inherit"},children:e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision"})]})}))]})},e.id)})]})}function qe({d:e,color:t,animated:n}){let o=X(null);return V(()=>{let e=o.current;if(!e||"function"!=typeof e.getTotalLength)return;let t=function(e){if(Number.isFinite(e)&&!(e<=0))return Math.max(1,Math.round(e/h))*h}(e.getTotalLength());void 0===t?e.removeAttribute("pathLength"):e.setAttribute("pathLength",String(t))},[e]),ee("path",{ref:o,d:e,fill:"none",stroke:t,strokeWidth:1,strokeDasharray:n?m:void 0,"data-popmelt-marching-stroke":n||void 0,style:n?{animation:"popmelt-march 0.6s linear infinite"}:void 0})}function Qe(){return ee("style",{children:`\n @keyframes popmelt-march {\n from { stroke-dashoffset: 0; }\n to { stroke-dashoffset: -${h}; }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-marching-stroke="true"] { animation: none !important; }\n }\n `})}function Ge({annotations:e,activeIds:t,scrollX:n,scrollY:i,spotlightIds:a,emphasizedIds:r,hoverRestoredIds:d,inactiveOpacity:s=.5}){if(!K(o))return null;let l=e.filter(e=>e.region&&e.region.points.length>=3&&t?.has(e.id));return l.length?J(Z,{children:[ee(Qe,{}),ee("svg",{"data-devtools":"marching-lasso","aria-hidden":!0,style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9995,overflow:"visible"},children:ee("g",{transform:`translate(${-n} ${-i})`,children:l.map(e=>{let t=a?.size?a.has(e.id)?1:.2:!r||r.has(e.id)||d?.has(e.id)?1:s;return ee("g",{"data-popmelt-region-id":e.id,opacity:t,children:ee(qe,{d:`${e.region.points.map((e,t)=>`${t?"L":"M"}${e.x} ${e.y}`).join(" ")} Z`,color:e.color,animated:!0})},e.id)})})})]}):null}var Je=W(function({inFlightSelectorColors:e,animated:t=!0,subjectRegistry:n,selectorElementInfo:s}){let l=K(o),[c,h]=U([]);return Y(()=>{if(!l)return;if(0===e.size)return void h([]);let o=null,a=new Map,r=new Map,c=typeof ResizeObserver>"u"?void 0:new ResizeObserver(v),m=!0,g=!1,y=()=>{let n=new Set;m=!1,g=!1;let o=[];for(let[i,l]of e){let e=k(i,s?.get(i)),h=a.get(i);if(h?.element===e&&e?.closest("[data-popmelt-hover-painter]"))continue;if(h?.paint.abort(),a.delete(i),!e){g=!0,m=!0;continue}let y=e.hasAttribute("data-popmelt-subject-adapter");y&&(g=!0);let v=f(e,l,0,t?"marching":"solid");if(v){a.set(i,{element:e,paint:v});continue}let S=y?void 0:r.get(e);!S&&!y&&(S=d(e),S&&(r.set(e,S),c?.observe(e,{box:"border-box"}))),S?n.add(e):m=!0;let I=A(e);o.push({selector:i,anchor:S?.name,top:I.top,left:I.left,width:I.width,height:I.height,color:l,radius:u(e),radiusStyle:p(e)})}for(let[e,t]of r)n.has(e)||(c?.unobserve(e),t.release(),r.delete(e));h(e=>e.length||o.length?o:e)};function v(){null===o&&(o=requestAnimationFrame(()=>{o=null,y()}))}let S=()=>{m&&v()};y(),window.addEventListener("scroll",S,{capture:!0,passive:!0}),window.addEventListener("resize",v,!0);let I=new MutationObserver(t=>{a.size===e.size&&t.every(e=>"attributes"===e.type&&"style"===e.attributeName&&e.target instanceof Element&&e.target.closest("[data-popmelt-hover-painter]"))||v()});I.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]});let x=n?.subscribeFrame(()=>{g&&y()}),M=[...e.keys()].some(e=>e.startsWith("@frame("))?i(y):void 0;return()=>{window.removeEventListener("scroll",S,!0),c?.disconnect();for(let e of r.values())e.release();window.removeEventListener("resize",v,!0),I.disconnect();for(let e of a.values())e.paint.abort();x?.(),M?.(),o&&cancelAnimationFrame(o)}},[t,e,n,s,l]),l&&0!==c.length?J(Z,{children:[t&&ee(Qe,{}),c.map(e=>ee("div",{"data-devtools":"marching-ants",part:e.anchor?a:void 0,style:{position:"fixed",...r(e.anchor,e,e.left,e.top),width:e.width,height:e.height,pointerEvents:"none",zIndex:9995,overflow:"visible",borderTopLeftRadius:e.radiusStyle.topLeft,borderTopRightRadius:e.radiusStyle.topRight,borderBottomRightRadius:e.radiusStyle.bottomRight,borderBottomLeftRadius:e.radiusStyle.bottomLeft},children:ee("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible"},children:ee(qe,{d:Le(e.width,e.height,{topLeft:e.radius["top-left"],topRight:e.radius["top-right"],bottomRight:e.radius["bottom-right"],bottomLeft:e.radius["bottom-left"]}),color:e.color,animated:t})})},e.selector))]}):null},(e,t)=>{if(e.animated!==t.animated||e.subjectRegistry!==t.subjectRegistry||e.inFlightSelectorColors.size!==t.inFlightSelectorColors.size)return!1;let n=e.inFlightSelectorColors.entries();for(let[o,i]of t.inFlightSelectorColors){let a=n.next().value;if(a?.[0]!==o||a[1]!==i||e.selectorElementInfo?.get(o)!==t.selectorElementInfo?.get(o))return!1}return!0});export{Ke as A,Ue as B,Ye as C,Ve as D,Ge as E,Je as F,te as a,ne as b,oe as c,re as d,me as e,ge as f,ye as g,ve as h,Se as i,Ie as j,Me as k,be as l,ke as m,Ae as n,Ee as o,Pe as p,Ne as q,Ce as r,Oe as s,De as t,_e as u,Re as v,$e as w,je as x,ze as y,He as z};
|
package/dist/chunk-B3RA4XAR.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{f as e}from"./chunk-VXRRHXUP.mjs";import{e as t,f as n}from"./chunk-AAMUU2QA.mjs";import{u as a,d as i}from"./chunk-LH7HKUCK.mjs";import{createContext as r}from"react";function o(e,t){let n=a(e.filter(e=>!e.includes("data-pm=")),t);return"matched"===n.status?n.element:null}function l(e){if(!e||!/^\/(?!\/)/.test(e)||/[\\?#\s]/.test(e))return;let t=n(e);return t.startsWith("//")||t.startsWith("/__popmelt/")?void 0:new URL(t,"https://local.invalid").pathname===t?t:void 0}function s(e){let t,n=e.messages?.find(e=>"human"===e.role),a=n?.annotationSnapshot;try{if(a?.url){let e=new URL(a.url);/^https?:$/.test(e.protocol)&&(t=e)}}catch{}let i=a?.annotations?.[0],r=n?.requestItems?.find(e=>"changes"===e.kind),o=(e.targetBindings??[]).map(e=>e.anchor),s=o.find(e=>"dom"===e.type),m=[...e.elementIdentifiers??[],...r?[r.elementKey]:[]],c=l(t?.pathname),p=l(s?.pathname)??l(i?.pathname)??l(r?.pathname)??l(m.find(e=>e.startsWith("/")&&e.includes(":"))?.split(":")[0])??c,u=o.filter(e=>"opaque"===e.type||l(e.pathname)===p),f=!i||i.pathname&&l(i.pathname)!==p?void 0:i;f?.target&&u.push({type:"opaque",...f.target});let h=f?.elements?.[0];!f?.region&&(f?.linkedSelector||h)&&u.push({type:"dom",pathname:p??"/",structuralSelector:h?.selector,runtimeSelector:f?.linkedSelector,targetFingerprint:h?.targetFingerprint});for(let e of m){let t=e.indexOf(":"),n=e.startsWith("/")?t>0&&l(e.slice(0,t))===p?e.slice(t+1):"":c&&c===p?e:"";n&&u.push({type:"dom",pathname:p??"/",structuralSelector:n})}let d=f?.region;if(!(u.length||d?.points.length||f||r))return null;let g=c===p&&t?t.search+t.hash:"";return{pathname:p,href:p&&p+g,targets:u,region:d,element:h}}function m(e){return n(location.pathname)+location.search+location.hash===e}function c(e){try{let t=sessionStorage.getItem(e);if(!t)return;sessionStorage.removeItem(e);let n=JSON.parse(t);if(n.expires>Date.now()&&"string"==typeof n.id&&m(n.href))return n.id}catch{}}function p(n,a,r){let l,s=!1,p=new AbortController,u=()=>{s=!0,clearTimeout(l),p.abort()};for(let e of["wheel","pointerdown","touchstart","keydown"])window.addEventListener(e,u,{capture:!0,passive:!0,signal:p.signal});let{href:f}=a;return async function(){if(f&&!m(f)){try{sessionStorage.setItem(r.storageKey,JSON.stringify({id:n,href:f,expires:Date.now()+3e4}))}catch{}if(r.navigate)await r.navigate(f);else{let e=new URL(t(location.pathname).slice(0,-1)+f,location.origin),n=e.pathname!==location.pathname||e.search!==location.search;if(location.assign(e.href),n)return}}let p=performance.now()+4e3,h=!1,d=null,g=0,x=!1,y=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",w=async()=>{if(!s){if(!f||m(f)){!x&&f&&c(r.storageKey),x=!0;let t=d?.isConnected?d:function(e,t){for(let n of e)if("opaque"===n.type){let e=t.resolve(n);if(e)return e.subject.sourceElement??e.element}else{let e=o([n.structuralSelector,n.runtimeSelector,...n.legacySelectors??[]].filter(e=>!!e),n.targetFingerprint);if(e)return e}return null}(a.targets,r.registry);if(t){for(let e=t.parentElement;e;e=e.parentElement)e instanceof HTMLDetailsElement&&!e.open&&(e.open=!0);let e=i(t),n=e.bottom<=0||e.top>=innerHeight||e.right<=0||e.left>=innerWidth;e.height&&e.width&&(d!==t||n&&performance.now()-g>750)&&(t.scrollIntoView({behavior:d?"instant":y,block:"center",inline:"nearest"}),d=t,g=performance.now())}if(!d&&!h&&a.element?.revealRecipe&&(h=!0,await e(void 0,[a.element]),s))return;if(!t&&a.region?.points.length){let e=a.region.points.map(e=>e.x),t=a.region.points.map(e=>e.y);return window.scrollTo({left:(Math.min(...e)+Math.max(...e)-innerWidth)/2,top:(Math.min(...t)+Math.max(...t)-innerHeight)/2,behavior:y}),u()}if(!a.targets.length)return u()}else if(x)return u();performance.now()<p?l=setTimeout(()=>{w().catch(u)},d?250:160):u()}};await w()}().catch(u),u}function u(e,t){return"string"==typeof t.canvasLabel?t.canvasLabel:[e,t.modified].filter(Boolean).join(" ")}function f(e){return S(e,512)||"Empty text"}function h(e){if("changes"!==e.kind)return;if("string"==typeof e.replacementText)return e.replacementText;let t=[];for(let n of e.changes){if(!n.startsWith("Text: "))return;let e=n.slice(6).split(" → ");if(2!==e.length)return;t.push("empty"===e[1]?"":e[1])}return t.length?t.join(" "):void 0}function d(e){if(!e?.length)return;let t=[];for(let n of e){let e=h(n);if(void 0===e)return;t.push(e.replace(/\s+/g," ").trim()||"Empty text")}return t.join("; ")}function g(e=[]){let t={};if(e.some(e=>"annotation"===e.kind))return t;for(let n of e){if("changes"!==n.kind)continue;let e=h(n);void 0!==e&&(t[n.elementKey]=f(e))}return t}function x(e){let t=e?.requestItems?.flatMap(e=>"annotation"===e.kind&&e.text.trim()?[e.text.trim()]:[]);if(t?.length)return t.join("; ");let n=e?.requestItems?.flatMap(e=>"changes"===e.kind?[`${e.elementLabel} [${e.changes.join(", ")}]`]:[]);return n?.length?n.join("; "):e?.requestText?.trim()||void 0}function y(e,t){if(!e?.frames?.length)return[];let n=new Map;for(let t of e.steps){let e=t.visuals?.afterFrameId;e&&!n.has(e)&&n.set(e,t.action?.label?`After ${t.action.label}`:"Resulting state")}return e.frames.flatMap((e,a)=>{let i=t[e.imageIndex];return i?[{id:e.id,imageIndex:e.imageIndex,label:0===a?"Initial state":n.get(e.id)??"State",url:i}]:[]})}function w(e){let t=e.instruction?.trim();return t?e.attachments?.some(e=>e.name?.trim()===t)?null:t:null}function v(e,t){let n=e?.tagName?.toLowerCase(),a=e?.id?`#${e.id}`:"",i=e?.className?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"",r=n?`${n}${a}${i}`:t;return e?.reactComponent?`<${e.reactComponent}> ${r}`:r}function $(e){let t=e.elements?.[0]?.reactComponent||e.elements?.[0]?.tagName||e.linkedSelector,n=e.type&&"annotation"!==e.type?`${e.type} annotation`:"Annotation";return t?`${n} on ${t}`:n}function b(e){let t=e.annotations.map(e=>{let t=e.interactionEpisode?.steps.length??0;return{kind:"annotation",annotationId:e.id,pathname:e.pathname,text:w(e)??$(e),...t>0?{interactionEpisodeStepCount:t}:{}}}),n=new Map,a=e=>{let a=`${e.pathname??""}:${e.durableSelector??e.selector}`,i=n.get(a);if(i)return i.changes.push(e.text),void 0!==i.replacementText&&e.textEdit?i.replacementText=u(i.replacementText,e.textEdit):delete i.replacementText,void(void 0!==e.annotationNumber&&(void 0===i.annotationNumber||e.annotationNumber<i.annotationNumber)&&(i.annotationNumber=e.annotationNumber));let r={kind:"changes",elementKey:a,elementLabel:v(e.element,e.selector),...void 0!==e.annotationNumber?{annotationNumber:e.annotationNumber}:{},pathname:e.pathname,changes:[e.text],...e.textEdit?{replacementText:u(void 0,e.textEdit)}:{}};n.set(a,r),t.push(r)};for(let t of e.styleModifications??[])for(let e of t.changes)a({...t,text:`${e.property}: ${e.original||"unset"} → ${e.modified||"unset"}${e.token?` (${e.token})`:""}`});for(let t of e.textModifications??[])a({...t,textEdit:t,text:`Text: ${t.original||"empty"} → ${t.modified||"empty"}`});for(let t of e.domModifications??[])a({...t,text:"copy"===t.operation?"Copied element":"Moved element"});return e.spacingTokenChanges?.length&&t.push({kind:"changes",elementKey:"spacing-tokens",elementLabel:"Spacing tokens",changes:e.spacingTokenChanges.map(e=>`${e.tokenName}: ${e.originalPx}px → ${e.newPx}px`)}),t}function k(e){let t=e.annotations.flatMap(e=>{let t=w(e);return t?[{instruction:t,pathname:e.pathname}]:[]});if(0===t.length)return;if(new Set(t.map(e=>e.pathname).filter(Boolean)).size<=1)return t.map(e=>e.instruction).join("\n\n");let n=new Map;for(let e of t){let t=e.pathname||"(unknown)",a=n.get(t)??[];a.push(e.instruction),n.set(t,a)}return[...n.entries()].map(([e,t])=>`\`${e}\`\n${t.map(e=>`- ${e}`).join("\n")}`).join("\n")}function S(e,t=96){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(0,t-3))}...`:n}var M=r(null),N=r(void 0);export{o as a,s as b,c,p as d,u as e,f,d as g,g as h,x as i,y as j,b as k,k as l,S as m,M as n,N as o};
|
package/dist/chunk-B4ZKGIGU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{d as e}from"./chunk-5TCWBNV4.mjs";import{E as t,D as n,F as i,H as a,G as r}from"./chunk-742KV4YS.mjs";import{a as o}from"./chunk-H4GG2RS4.mjs";import{j as s,a as d,i as l}from"./chunk-FPSR4NAR.mjs";import{n as m,o as c}from"./chunk-EILBHZDX.mjs";import{a as p}from"./chunk-B4DYUYX4.mjs";import{a as u}from"./chunk-7D4BUDKG.mjs";import{w as h,I as y,Pa as f,Q as g,xa as b}from"./chunk-OA63PYHZ.mjs";import{c as v,a as w}from"./chunk-6RMM7JB6.mjs";import{useRef as k,useState as j,useLayoutEffect as x,useId as S,useEffect as C}from"react";import{jsxs as I,jsx as A,Fragment as T}from"react/jsx-runtime";function z(){let e=crypto.getRandomValues(new Uint8Array(32));return{id:crypto.randomUUID(),token:Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}}var R=360,N=120;function J({client:J,storage:E,storageKey:O,onAdmitted:q,theme:F="light",themePreference:W=F,onThemePreferenceChange:B,onJoin:H,guestInvite:L,showHostLinkHelp:P=!1}){let D=k(null),$=k(!1);if(!$.current){$.current=!0;try{O&&(D.current=JSON.parse(E.getItem(O)??"null"))}catch{}}let[U,K]=j(D.current?.name??""),M=k(!1),X=!!L;x(()=>{if(X&&O&&!M.current)try{let e=JSON.parse(E.getItem(O)??"null");"string"==typeof e?.name&&K(e.name)}catch{}},[X,E,O]);let Y=!(!H&&!L),[G,V]=j(Y?void 0:D.current?.receipt),[Z,Q]=j(null),[_,ee]=j(),te=L?.color??_,[ne,ie]=j(),ae=L?.shape??ne,re=k(null),[oe,se]=j(Y),[de,le]=j(!1),[me,ce]=j(0),[pe,ue]=j(),[he,ye]=j("idle"),[fe,ge]=j(),be=k(!1),[ve,we]=j(""),ke=k(null),je=k(null),xe=k(!1),Se=k(0),Ce=k(!1),Ie=S(),Ae=k(!1),Te=k(0),ze=k(q);ze.current=q;let Re=k(!1),Ne=k(null),Je=k(()=>{});Ne.current||(Ne.current=new Promise(e=>{Je.current=e}));let Ee=u[F],Oe=!X&&oe&&!te;C(()=>{let e,t,n=!1,i=()=>{n||(n=!0,Re.current=!0,Je.current())};"function"==typeof requestAnimationFrame&&(e=requestAnimationFrame(()=>{t=requestAnimationFrame(i)}));let a=window.setTimeout(i,64);return()=>{void 0!==e&&cancelAnimationFrame(e),void 0!==t&&cancelAnimationFrame(t),window.clearTimeout(a),i()}},[]),C(()=>v(document),[]),x(()=>{let e=!0,t=()=>{if(!e||!je.current)return;let t=getComputedStyle(je.current),n=document.createElement("span");Object.assign(n.style,{position:"fixed",visibility:"hidden",pointerEvents:"none",whiteSpace:"nowrap",fontFamily:t.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight}),document.body.append(n);let i=Number.parseFloat(t.paddingLeft)+Number.parseFloat(t.paddingRight);n.textContent="Ask for access";let a=i+12+3+n.getBoundingClientRect().width;n.textContent="Request pending";let r=i+12+3+n.getBoundingClientRect().width;n.textContent="Request declined";let o=i+12+3+n.getBoundingClientRect().width;n.remove(),a>15&&r>15&&o>15&&ge({ask:Math.ceil(a),pending:Math.ceil(r),declined:Math.ceil(o)})};return t(),document.fonts?.ready.then(t),()=>{e=!1}},[F,oe]),C(()=>{if(!me)return;let e=setTimeout(()=>ce(0),R);return()=>clearTimeout(e)},[me]),C(()=>{if(!pe)return;let e=setTimeout(()=>ue(void 0),R);return()=>clearTimeout(e)},[pe]),C(()=>{if("in"!==he)return;let e=setTimeout(()=>ye("idle"),180);return()=>clearTimeout(e)},[he]),C(()=>{if(O){D.current&&delete D.current.color;try{let e=JSON.parse(E.getItem(O)??"null");e&&"object"==typeof e&&"color"in e&&(delete e.color,E.setItem(O,JSON.stringify(e)))}catch{}}},[E,O]);let qe=!(!G||Z&&"pending"!==Z.status&&"granted"!==Z.status),Fe=(e,t)=>{D.current={...D.current,name:e,receipt:t},O&&E.setItem(O,JSON.stringify(D.current))};C(()=>{if("cancelled"===Z?.status){D.current={...D.current,name:U,receipt:void 0};try{E.setItem(O,JSON.stringify(D.current))}catch{}V(void 0),Q(null)}},[Z,U,E,O]);let We=()=>{if(re.current)return re.current;return re.current=(async()=>{if(!J)throw new Error("Local admission client unavailable");let e,t=JSON.parse(E.getItem(O)??"null"),n=t?.colorIdentity??t?.receipt??z();D.current={name:U,receipt:t?.receipt,colorIdentity:n},E.setItem(O,JSON.stringify(D.current));try{e=await J.reserveAdmissionColor(n)}catch(t){let i=t.status;if(400!==i&&401!==i)throw t;n=z(),D.current={...D.current,colorIdentity:n},E.setItem(O,JSON.stringify(D.current)),e=await J.reserveAdmissionColor(n)}return ee(e.color),ie(c(e)),n})().finally(()=>{re.current=null}),re.current},Be=k(We);Be.current=We,C(()=>{if(!J||!oe||te)return;let t,n=!1,i=0,a=async()=>{try{await Be.current()}catch{if(n)return;t=setTimeout(()=>{a()},e(++i))}};return a(),()=>{n=!0,clearTimeout(t)}},[J,oe,te,E,O]),C(()=>{if(!oe)return;let e=e=>{e.composedPath().includes(ke.current)||se(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[oe]),C(()=>{if(!J||!G)return;let t,n,i=!0,a=!1,r=!1,o=()=>{Te.current+=1,D.current={...D.current,name:U,receipt:void 0};try{E.setItem(O,JSON.stringify(D.current))}catch{}V(void 0),Q(null),se(!1),we("")},s=()=>{r=!0;let t=z(),a=0,o=async()=>{if(i)try{let e=await Be.current();D.current={...D.current,name:U,receipt:t,colorIdentity:e},E.setItem(O,JSON.stringify(D.current));let n=await J.requestAdmission(t,U,e);if(!i)return;Te.current+=1,V(t),Q(n),we("")}catch{if(!i)return;n=setTimeout(()=>{o()},e(++a))}};o()},d=async()=>{if(a||r||Ce.current||Ae.current)return;a=!0;let e=Te.current;try{let n=await J.admissionStatus(G);if(!i||e!==Te.current)return;if("declined"===n.status){if(Re.current||await Ne.current,!i||e!==Te.current)return;r=!0;let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,a=()=>{i&&(ye("rejected"),ce(e=>e+1),t=setTimeout(()=>{if(i){if(n)return o(),void ye("idle");ye("rejected-out"),t=setTimeout(()=>{i&&(o(),ye("in"))},N)}},R))};return void(n?a():(ye("pending-out"),t=setTimeout(a,N)))}if("expired"===n.status)return void s();if(Q(n),r="cancelled"===n.status,we(""),n.credential){Ce.current=!0;try{await(ze.current?.(n.credential)),r=!0}finally{Ce.current=!1}}}catch(t){if(!i||e!==Te.current)return;401===t.status&&s()}finally{a=!1}};d();let l=setInterval(d,1500);return()=>{i=!1,clearInterval(l),clearTimeout(t),clearTimeout(n)}},[J,G,U,E,O]);return I("div",{ref:ke,"data-devtools":"participant-admission","data-popmelt-font":"sans","data-popmelt-theme":F,style:{display:"contents"},onKeyDown:e=>{"Escape"===e.key&&(se(!1),e.stopPropagation())},children:[A("style",{children:`\n ${t}\n [data-popmelt-entry-dock$="-left"] [data-popmelt-admission-ask] {\n margin-right: 6px;\n }\n [data-popmelt-admission-ask] {\n transition: box-shadow 120ms ease, width 180ms ease;\n }\n [data-popmelt-admission-ask][data-popmelt-admission-rejection="odd"] {\n animation: popmelt-admission-rejection-odd 360ms ease-out;\n }\n [data-popmelt-admission-ask][data-popmelt-admission-rejection="even"] {\n animation: popmelt-admission-rejection-even 360ms ease-out;\n }\n [data-popmelt-admission-submit-rejection="odd"] {\n animation: popmelt-admission-rejection-odd 360ms ease-out;\n }\n [data-popmelt-admission-submit-rejection="even"] {\n animation: popmelt-admission-rejection-even 360ms ease-out;\n }\n @keyframes popmelt-admission-rejection-odd {\n 0%, 100% { transform: translateX(0); }\n 38% { transform: translateX(-3px); }\n }\n @keyframes popmelt-admission-rejection-even {\n 0%, 100% { transform: translateX(0); }\n 38% { transform: translateX(-3px); }\n }\n [data-popmelt-admission-sending-dot] {\n animation-duration: 1.2s;\n animation-iteration-count: infinite;\n animation-timing-function: step-end;\n }\n [data-popmelt-admission-sending-dot="1"] {\n animation-name: popmelt-admission-sending-dot-1;\n }\n [data-popmelt-admission-sending-dot="2"] {\n animation-name: popmelt-admission-sending-dot-2;\n }\n [data-popmelt-admission-sending-dot="3"] {\n animation-name: popmelt-admission-sending-dot-3;\n }\n @keyframes popmelt-admission-sending-dot-1 {\n 0%, 24.99% { opacity: 0; }\n 25%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-sending-dot-2 {\n 0%, 49.99% { opacity: 0; }\n 50%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-sending-dot-3 {\n 0%, 74.99% { opacity: 0; }\n 75%, 100% { opacity: 1; }\n }\n @keyframes popmelt-admission-send-icon-out {\n 0%, 30% {\n opacity: 1;\n transform: translate(0, -50%);\n }\n 100% {\n opacity: 0;\n transform: translate(10px, -50%);\n }\n }\n [data-devtools="participant-admission"][data-popmelt-theme="${F}"] [data-popmelt-admission-ask]:is([aria-expanded="false"], [data-popmelt-admission-pending]):is(:hover, :focus-visible) {\n box-shadow: inset 0 0 0 100px ${Ee.softHairline};\n }\n [data-popmelt-admission-pending-label],\n [data-popmelt-admission-cancel-label],\n [data-popmelt-admission-declined-label] {\n grid-area: 1 / 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 3px;\n }\n [data-popmelt-admission-cancel-label] { visibility: hidden; }\n [data-popmelt-admission-ask]:is(:hover, :focus-visible, [aria-busy="true"]) [data-popmelt-admission-pending-label] { visibility: hidden; }\n [data-popmelt-admission-ask]:is(:hover, :focus-visible, [aria-busy="true"]) [data-popmelt-admission-cancel-label] { visibility: visible; }\n [data-devtools="participant-admission"][data-popmelt-theme="${F}"] input::placeholder {\n color: ${Ee.secondary};\n opacity: 1;\n }\n [data-devtools="participant-admission"] button[type="submit"] {\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n }\n [data-devtools="participant-admission"] button[type="submit"] > * { pointer-events: none; }\n @media (pointer: coarse) {\n [data-devtools="participant-admission"] button[type="submit"] { min-width: 44px; min-height: 44px; touch-action: manipulation; }\n [data-popmelt-admission-name-field] { font-size: 16px; }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-admission-ask] { transition: none; animation: none; }\n [data-popmelt-admission-submit-rejection] { animation: none; }\n [data-popmelt-admission-sending-dot] { animation: none; opacity: 1; }\n [data-popmelt-admission-send-icon],\n [data-popmelt-admission-sending-label] { animation: none !important; }\n }\n `}),A(n,{theme:F,themePreference:W,onThemePreferenceChange:B,deemphasizeControls:oe,onCollapse:()=>se(!1),panel:oe||ve?I(T,{children:[oe&&!qe&&I("form",{"aria-label":Y?"Join session":"Ask for access","data-popmelt-font":"sans","aria-busy":de||void 0,style:{...r(F),flexWrap:"wrap",...X&&{maxWidth:"min(320px, calc(100vw - 24px))",boxSizing:"border-box",padding:12,gap:8,borderRadius:16}},onSubmit:e=>{e.preventDefault();let t=xe.current?"enter":"send";xe.current=!1,(async e=>{if(!U.trim()||Oe||de||qe||be.current)return;if(be.current=!0,le(!0),we(""),ue(void 0),L||H){try{if(Fe(U.trim()),L)return void await L.join(U.trim());H&&await H(U.trim(),await We())}catch(e){we(e instanceof Error?e.message:"Could not join. Please try again.")}return be.current=!1,void le(!1)}try{D.current=JSON.parse(E.getItem(O)??"null")}catch{}let t=!Z&&D.current?.receipt?D.current.receipt:z();try{let e=await We();Fe(U,t),D.current={...D.current,name:U,receipt:t};let n=await J.requestAdmission(t,U.trim(),e);V(t),K(n.name),Q(n),se(!1)}catch{D.current={...D.current,name:U,receipt:t},ue({target:e,pulse:++Se.current})}finally{be.current=!1,le(!1)}})(t)},children:[L?.projectName&&I("span",{style:{flexBasis:"100%",minWidth:0,overflowWrap:"anywhere"},children:["Join ",L.projectName]}),I("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[A(o,{"data-popmelt-entry-avatar":!0,shape:ae&&"circle"!==ae?ae:m(0),color:te??(Oe?Ee.muted:"transparent"),size:d.identitySize}),I("span",{"data-popmelt-admission-name-field":!0,style:{...X&&{fontSize:16},display:"inline-grid",flex:"0 1 auto",minWidth:0},children:[A("span",{"aria-hidden":"true","data-popmelt-admission-name-measure":!0,style:{gridArea:"1 / 1",visibility:"hidden",whiteSpace:"pre",overflow:"hidden",paddingRight:1},children:U||"what’s your name?"}),A("input",{autoFocus:!0,"aria-label":"Your name",placeholder:"what’s your name?",autoComplete:"nickname",enterKeyHint:Y?"go":"send",maxLength:48,value:U,disabled:de,onKeyDown:e=>{"Enter"===e.key&&(xe.current=!0)},onKeyUp:e=>{"Enter"===e.key&&(xe.current=!1)},onBlur:()=>{xe.current=!1},onChange:e=>{M.current=!0,K(e.target.value);try{Fe(e.target.value,D.current?.receipt)}catch{}},style:{gridArea:"1 / 1",minWidth:"100%",width:0,padding:0,border:0,borderRadius:0,background:"transparent",color:de?Ee.mutedStrong:Ee.primary,WebkitTextFillColor:de?Ee.mutedStrong:Ee.primary,caretColor:de?"transparent":Ee.primary,opacity:1,transition:"color 120ms ease",font:"inherit",fontFamily:w,outline:"none",boxShadow:"none",appearance:"none"}})]}),U.trim().length>0&&A("kbd",{"aria-hidden":"true","data-popmelt-admission-enter-hint":!0,"data-popmelt-admission-submit-rejection":"enter"===pe?.target?pe.pulse%2?"odd":"even":void 0,style:{...i(F),...l,flexShrink:0,color:Ee.primary,opacity:de?0:1,pointerEvents:de?"none":void 0,transition:"opacity 120ms ease"},children:"enter"})]}),I("button",{type:"submit",disabled:de||Oe||!U.trim(),"aria-label":de?"Sending…":Y?"Join session":"Send request",onPointerDown:e=>{"mouse"===e.pointerType&&0===e.button&&e.preventDefault()},"aria-keyshortcuts":"Enter","aria-busy":de||void 0,"data-popmelt-admission-submit-rejection":"send"===pe?.target?pe.pulse%2?"odd":"even":void 0,style:{...a(F),...X&&{minWidth:44,minHeight:44,borderRadius:10},position:"relative",boxSizing:"border-box",overflow:"hidden",fontSize:12,color:de||!U.trim()?Ee.muted:Ee.primary,transition:"color 120ms ease"},children:[A("span",{"aria-hidden":"true","data-popmelt-admission-submit-sizer":!0,style:{display:de?"none":"block",width:14,height:14}}),I("span",{"aria-hidden":"true","data-popmelt-admission-submit-content":!0,style:{position:de?"static":"absolute",inset:0,pointerEvents:"none"},children:[A(b,{size:14,"data-popmelt-admission-send-icon":!0,style:{position:"absolute",top:"50%",left:"50%",marginLeft:-7,opacity:de?0:1,transform:de?"translate(10px, -50%)":"translate(0, -50%)",animation:de?"popmelt-admission-send-icon-out 260ms ease both":void 0}}),I("span",{"data-popmelt-admission-sending-label":!0,style:{display:de?"inline-block":"none",opacity:de?1:0},children:["Sending",I("span",{"data-popmelt-admission-sending-dots":!0,"aria-hidden":"true",style:{display:"inline-block"},children:[A("span",{"data-popmelt-admission-sending-dot":"1",children:"."}),A("span",{"data-popmelt-admission-sending-dot":"2",children:"."}),A("span",{"data-popmelt-admission-sending-dot":"3",children:"."})]})]})]})]}),P&&!Y&&I("details",{style:{flexBasis:"100%",fontSize:12,color:Ee.secondary},children:[A("summary",{style:{cursor:"pointer"},children:"Using your own project?"}),I("p",{style:{margin:"6px 0 0",overflowWrap:"anywhere"},children:["Open the URL from your project’s"," ",A("code",{children:".popmelt/participant-host-link.json"})," in this browser to link it as a host."]})]}),ve&&A("span",{role:"alert",style:{flexBasis:"100%",fontSize:12},children:ve})]}),!oe&&ve&&A("div",{role:"status",style:{...r(F),fontSize:12},children:ve})]}):null,action:I(T,{children:[A("span",{"aria-hidden":"true","data-popmelt-admission-host":!0,style:{width:22,height:22,marginLeft:5,flexShrink:0,boxSizing:"border-box",border:`1px solid ${Ee.surface}`,borderRadius:"50%",background:p.activeColor,opacity:oe||qe?.2:1,transition:Re.current?"opacity 120ms ease":"none"}}),A("button",{ref:je,type:"button","data-popmelt-font":"sans","data-popmelt-admission-ask":!0,"data-popmelt-admission-pending":qe?"":void 0,"data-popmelt-admission-declined":"rejected"===he||"rejected-out"===he?"":void 0,"data-popmelt-admission-rejection":me?me%2?"odd":"even":void 0,"data-popmelt-admission-transition":"idle"===he?void 0:he,"data-popmelt-entry-control":!0,"aria-expanded":qe?void 0:oe,"aria-label":"rejected"===he||"rejected-out"===he?"Request declined":qe?"Cancel request":void 0,"aria-describedby":qe?Ie:void 0,"aria-busy":!(!qe||!de)||void 0,disabled:qe&&(de||"idle"!==he),onClick:()=>"idle"===he&&(qe?void(async()=>{if(J&&G&&!de&&!Ae.current){Ae.current=!0,Te.current+=1,le(!0),we("");try{let e=await J.cancelAdmission(G);Q(e),se(!1)}catch{ce(e=>e+1)}finally{Ae.current=!1,le(!1)}}})():(se(!oe),void(oe||we("")))),"aria-description":qe?void 0:Y?"Enter your name to join the session.":"Ask the host to join in Suggest mode.",style:{...s(F),width:fe?fe["rejected"===he||"rejected-out"===he?"declined":qe?"pending":"ask"]:void 0,paddingLeft:3,overflow:"hidden",transition:"box-shadow 120ms ease, width 180ms ease",background:qe&&Z?.color?`color-mix(in srgb, ${Z.color} 10%, ${Ee.control})`:Ee.control},children:I("span",{"data-popmelt-entry-content":!0,style:{display:qe?"inline-grid":"inline-flex",alignItems:"center",gap:"inherit",opacity:"pending-out"===he||"rejected-out"===he?0:1,transition:Re.current?"opacity 120ms ease":"none"},children:["rejected"===he||"rejected-out"===he?I("span",{id:Ie,"data-popmelt-admission-declined-label":!0,"aria-hidden":"true",children:[A(h,{size:12}),"Request declined"]}):qe?I(T,{children:[I("span",{id:Ie,"data-popmelt-admission-pending-label":!0,"aria-hidden":"true",children:[A(y,{size:12,style:{color:Z?.color}}),"Request pending"]}),I("span",{"data-popmelt-admission-cancel-label":!0,"aria-hidden":"true",children:[A(f,{size:12}),"Cancel request"]})]}):A(g,{size:12,"aria-hidden":"true","data-popmelt-admission-wave":!0}),!qe&&"Ask for access"]})})]})})]})}export{J as a};
|
package/dist/chunk-CHK24QU5.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{useRef as e,useId as t,useLayoutEffect as r}from"react";import{jsxs as n,Fragment as i,jsx as o}from"react/jsx-runtime";var a="M20.25 8.00293H20.249C21.5098 8.0286 22.7219 8.25094 23.8584 8.63672L23.8604 8.63574C23.8961 8.64787 23.9312 8.66145 23.9668 8.67383C24.0611 8.70686 24.1548 8.74106 24.248 8.77637C24.2915 8.79273 24.3357 8.80727 24.3789 8.82422L24.376 8.82617C27.6145 10.0955 30.1646 12.7301 31.3213 16.0234L31.3232 16.0225C31.3327 16.0493 31.3404 16.0766 31.3496 16.1035C31.7691 17.3256 32 18.6356 32 20C32 20.8726 31.9366 21.6706 31.7598 22.4902L31.7197 22.6328C31.6412 23.0066 31.5136 23.6108 31.3408 24.2217L31.3398 24.2246C31.2967 24.377 31.251 24.5299 31.2021 24.6797C30.9215 25.5403 30.5473 26.2998 30.0879 26.2998C29.7613 26.2996 29.5995 25.9674 29.4316 25.6221C29.2501 25.2487 29.0614 24.8605 28.6484 24.8604C27.8532 24.8604 27.2081 25.5046 27.208 26.2998V27.0771C27.2079 27.6079 26.9661 28.112 26.5205 28.4004C25.9146 28.7925 25.2357 28.6462 24.7959 28.2061L24.7949 28.208C24.7897 28.2028 24.7854 28.1967 24.7803 28.1914C24.7654 28.1761 24.7507 28.1606 24.7363 28.1445C24.7105 28.1156 24.6858 28.0857 24.6621 28.0547C24.6461 28.0339 24.6302 28.013 24.6152 27.9912C24.5931 27.9591 24.5726 27.9257 24.5527 27.8916C24.5392 27.8685 24.5261 27.8452 24.5137 27.8213C24.5093 27.8128 24.5043 27.8045 24.5 27.7959L24.501 27.7939C24.3932 27.5763 24.3282 27.3276 24.3281 27.0576V26.2998C24.328 25.5993 23.8278 25.0158 23.165 24.8867V24.8877C23.0752 24.8702 22.9826 24.8604 22.8877 24.8604C22.8446 24.8604 22.8019 24.8624 22.7598 24.8662C22.0247 24.9312 21.4483 25.5479 21.4482 26.2998C21.4482 26.9127 21.4608 27.5305 21.4736 28.1494L21.4951 29.3135C21.5 29.7013 21.5015 30.089 21.4971 30.4756C21.4874 31.3103 20.8426 32 20.0078 32C19.1732 31.9998 18.5292 31.3102 18.5195 30.4756C18.5159 30.1613 18.5176 29.8464 18.5205 29.5312V29.5322C18.5212 29.4593 18.5206 29.3864 18.5215 29.3135L18.5303 28.8154V28.8145C18.5343 28.5927 18.5384 28.371 18.543 28.1494C18.5558 27.5305 18.5684 28.1129 18.5684 27.5C18.5684 26.7047 17.9232 26.0596 17.1279 26.0596C16.907 26.0596 16.6978 26.1103 16.5107 26.1992C16.2161 26.3393 15.9767 26.5769 15.834 26.8701C15.8269 26.8846 15.8201 26.8993 15.8135 26.9141C15.7821 26.9845 15.7562 27.0579 15.7363 27.1338C15.7243 27.1798 15.7155 27.2267 15.708 27.2744C15.7012 27.3175 15.6953 27.361 15.6924 27.4053C15.6903 27.4366 15.6885 27.4681 15.6885 27.5V28.7383C15.6883 29.9234 14.4911 30.7248 13.4961 30.0811C13.0505 29.7926 12.8086 29.2886 12.8086 28.7578V26.2998C12.8086 25.9737 12.6984 25.674 12.5156 25.4326C12.4437 25.3381 12.3612 25.2521 12.2686 25.1777V25.1768C12.0219 24.9788 11.709 24.8604 11.3682 24.8604C10.9892 24.8604 10.8622 24.8872 10.7295 25.2295C10.5837 25.6055 10.4302 26 9.92773 26C9.33081 25.9996 8.95963 25.2403 8.71484 24.3799C8.5591 23.8325 8.45907 23.571 8.3623 23.0107C8.3501 22.9401 8.33284 22.8403 8.31738 22.7529C8.12812 21.9466 8.02043 21.1089 8.00293 20.249V20.25L8 20C8 19.8617 8.00317 19.724 8.00781 19.5869C8.00837 19.5703 8.00816 19.5537 8.00879 19.5371L8.00977 19.5352C8.0998 17.1716 8.87444 14.9844 10.1396 13.1631C10.1488 13.1499 10.1587 13.1372 10.168 13.124C12.255 10.1453 15.6582 8.15745 19.5352 8.00977L19.5371 8.00879C19.5537 8.00816 19.5703 8.00837 19.5869 8.00781C19.724 8.00317 19.8617 8 20 8L20.25 8.00293Z",l=Array.from({length:16},(e,t)=>{let r=16-t,n=19*r/16;return{dash:`0 ${100-n} ${n} 0`,opacity:1/(r+1)}}),s=Array.from({length:16},(e,t)=>{let r=2.75+5*t;return`M${r} 0L${r-40} 40`}).join(" ");function c({active:c,interactive:h=!1,hatched:d=!1,tracing:u,onSettlingChange:p,...m}){let C=e(null),g=e(null),f=e(null),y=t(),M=y+"-trace",v=y+"-perimeter",x=e(0),L=e(!1),b=e(null);return r(()=>{c&&(g.current?.setAttribute("fill",m.fill??"currentColor"),g.current?.setAttribute("stroke","none"))},[c,m.fill]),r(()=>{let e=C.current;if(!e)return;e.style.removeProperty("fill"),e.style.removeProperty("stroke");let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=0,n=null,i=0,o=!1,l=x.current,s=Math.ceil(l),d=!c&&s-l>1e-9,m=!1,y=0,M=null,v=e,k=v.style.cursor,A=v.style.touchAction,P=e=>{g.current?.setAttribute("d",e),f.current?.setAttribute("d",e)},I=()=>{b.current??(b.current=function(){let e=[],t=0,r=0;for(let[,n,i]of a.matchAll(/([A-Z])([^A-Z]*)/g)){let o=(i.match(/-?\d*\.?\d+/g)??[]).map(Number),a=t,l=r;if("Z"!==n)if("H"===n?t=o[0]:"V"===n?r=o[0]:(t=o[o.length-2],r=o[o.length-1]),"C"===n)for(let n=1;n<=24;n++){let i=n/24,s=1-i;e.push({x:s**3*a+3*s**2*i*o[0]+3*s*i**2*o[2]+i**3*t,y:s**3*l+3*s**2*i*o[1]+3*s*i**2*o[3]+i**3*r})}else e.push({x:t,y:r})}let n=24,i=e.findIndex(e=>e.y>=n),o=i;for(;o+1<e.length&&e[o+1].y>=n;)o++;let l=(e,t)=>({x:e.x+(t.x-e.x)*(n-e.y)/(t.y-e.y),y:n}),s=l(e[i-1],e[i]),c=l(e[o],e[o+1]),h=(s.x+c.x)/2,d=(s.x-c.x)/2,u=[s,...e.slice(i,o+1),c].map(e=>{let t=Math.asin(Math.max(-1,Math.min(1,(e.x-h)/d))),r=Math.cos(t);return{longitude:t,height:r>1e-5?(e.y-n)/r:0}}),p=[],m=[8,6.2,8.6,6.5,8],C=[0,1.4,.8,1.8,1.1,0],g=(e,t,r,n)=>{for(let i=0;i<=24;i++){let o=i/24,a=1-o;p.push({longitude:a**3*e[0]+3*a**2*o*t[0]+3*a*o**2*r[0]+o**3*n[0],height:a**3*e[1]+3*a**2*o*t[1]+3*a*o**2*r[1]+o**3*n[1]})}};for(let[e,t]of m.entries()){let r=Math.PI/2+e/m.length*Math.PI,n=r+Math.PI/m.length,i=(r+n)/2,o=.145,a=C[e],l=C[e+1];g([r,a],[i-o,a],[i-o,a+.7],[i-o,t-1.4]);for(let e=0;e<=32;e++){let r=Math.PI*(1-e/32);p.push({longitude:i+o*Math.cos(r),height:t-1.4+1.4*Math.sin(r)})}g([i+o,t-1.4],[i+o,l+.7],[i+o,l],[n,l])}let f=[...u,...p],y=e=>`L${e.x} ${e.y}`,M=`M${e[0].x} ${e[0].y}`+e.slice(1,i).map(y).join("")+y(s),v=y(c)+e.slice(o+1).map(y).join("")+"Z";return e=>{let t=Math.atan2(Math.sin(e),Math.cos(e));if(Math.abs(t)<1e-9)return a;let r=f.map(e=>({longitude:Math.atan2(Math.sin(e.longitude+t),Math.cos(e.longitude+t)),height:e.height})).filter(e=>Math.abs(e.longitude)<Math.PI/2).sort((e,t)=>t.longitude-e.longitude).map(e=>`L${h+d*Math.sin(e.longitude)} ${n+e.height*Math.cos(e.longitude)}`).join("");return M+r+v}}()),P(b.current(-x.current*Math.PI*2))},$=()=>{o=!0,x.current=0,P(a),g.current?.removeAttribute("fill"),g.current?.removeAttribute("stroke"),p?.(!1)},V=e=>{let t=null===n?0:e-n;if(n=e,m){let e=Math.min(t/1e3,.05),r=c?1/15:0,n=Math.exp(-1.8*e);x.current+=r*e+(y-r)*(1-n)/1.8,y=r+(y-r)*n,Math.abs(y-r)<.005&&(m=!1,l=x.current,s=Math.round(l),i=0)}else if(c)x.current+=t/15e3;else{i+=t;let e=Math.min(1,i/250);if(1===e)return void $();let r=1-(1-e)**3;x.current=l+(s-l)*r}I(),r=requestAnimationFrame(V)},w=()=>{cancelAnimationFrame(r),n=null,!M&&!o&&(c||!t.matches&&L.current&&!document.hidden?t.matches?(x.current=0,P(a)):L.current&&!document.hidden&&(r=requestAnimationFrame(V)):$())},j=e=>{M||!e.isPrimary||0!==e.button||(v.setPointerCapture(e.pointerId),M={id:e.pointerId,startX:e.clientX,x:e.clientX,time:e.timeStamp,moved:!1},y=0,cancelAnimationFrame(r),v.style.cursor="grabbing")},E=e=>{if(!M||M.id!==e.pointerId||!M.moved&&Math.abs(e.clientX-M.startX)<3)return;M.moved=!0;let t=-(e.clientX-M.x)/160,r=Math.max((e.timeStamp-M.time)/1e3,.001),n=24/(2*Math.PI);y+=(Math.max(-n,Math.min(n,t/r))-y)*(1-Math.exp(-r/.035)),x.current+=t,M.x=e.clientX,M.time=e.timeStamp,I()},X=e=>{!M||M.id!==e.pointerId||(M.moved&&(y*=Math.exp(-Math.max(0,e.timeStamp-M.time-40)/60),m="pointerup"===e.type&&!t.matches,o=!1,l=x.current,s=Math.round(l),i=0),M=null,v.style.cursor="grab",v.hasPointerCapture(e.pointerId)&&v.releasePointerCapture(e.pointerId),w())};if((u||!c&&!d)&&($(),!h))return;let S=e=>{for(let[t,r]of Object.entries({pointerdown:j,pointermove:E,pointerup:X,pointercancel:X,lostpointercapture:X}))v[e](t,r)};h&&(v.style.cursor="grab",v.style.touchAction="pan-y",S("addEventListener")),p?.(d);let Z=new IntersectionObserver(([e])=>{L.current=e?.isIntersecting??!1,w()});return Z.observe(e),t.addEventListener("change",w),document.addEventListener("visibilitychange",w),w(),()=>{cancelAnimationFrame(r),Z.disconnect(),h&&(S("removeEventListener"),v.style.cursor=k,v.style.touchAction=A,M&&v.hasPointerCapture(M.id)&&v.releasePointerCapture(M.id)),t.removeEventListener("change",w),document.removeEventListener("visibilitychange",w)}},[c,h,p,u]),n("svg",{...m,ref:C,children:[d&&n(i,{children:[o("defs",{children:n("mask",{id:y,x:"0",y:"0",width:"40",height:"40",maskUnits:"userSpaceOnUse",style:{maskType:"luminance"},children:[o("rect",{width:"40",height:"40",fill:"white"}),o("path",{ref:f,d:a,fill:"black",stroke:"black",strokeWidth:"5",strokeLinejoin:"round"})]})}),o("path",{d:s,fill:"none",stroke:"currentColor",strokeWidth:"0.65",mask:`url(#${y})`})]}),void 0!==u&&o("style",{children:'\n @keyframes popmelt-logo-trace { to { stroke-dashoffset: -100; } }\n @media (prefers-reduced-motion: no-preference) {\n [data-popmelt-logo-fill] { transition: fill-opacity 360ms ease-in-out; }\n [data-popmelt-logo-outline] { transition: opacity 360ms ease-in-out; }\n [data-popmelt-logo-outline][opacity="0"] [data-popmelt-logo-sweep] { animation-play-state: paused; }\n [data-popmelt-logo-sweep] { animation: popmelt-logo-trace 1500ms linear infinite; }\n [data-popmelt-logo-tail] { display: inline; }\n [data-popmelt-logo-trace] { stroke-dasharray: 19 81; }\n }\n '}),o("path",{ref:g,d:a,"data-popmelt-logo-fill":void 0!==u||void 0,fillOpacity:void 0===u?void 0:u?0:1}),void 0!==u&&n(i,{children:[o("defs",{children:o("clipPath",{id:M,children:o("path",{clipRule:"evenodd",d:`M0 0H40V40H0Z ${a}`})})}),n("g",{"data-popmelt-logo-outline":!0,opacity:u?1:0,pointerEvents:"none",clipPath:`url(#${M})`,fill:"none",stroke:"currentColor",strokeWidth:"2.7",strokeLinecap:"round",children:[o("g",{opacity:.3,children:o("path",{id:v,d:a,pathLength:"100"})}),n("g",{"data-popmelt-logo-sweep":!0,children:[o("g",{"data-popmelt-logo-tail":!0,display:"none",strokeLinecap:"butt",children:l.map(({dash:e,opacity:t})=>o("use",{href:`#${v}`,strokeDasharray:e,strokeOpacity:t},e))}),o("path",{"data-popmelt-logo-trace":!0,d:a,pathLength:"100"})]})]})]})]})}export{c as a};
|