1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a501e5bd-2b7e-454f-8d52-f22d8862db69",e._sentryDebugIdIdentifier="sentry-dbid-a501e5bd-2b7e-454f-8d52-f22d8862db69")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[33779],{18316:(e,t,n)=>{n.d(t,{MS:()=>r,P3:()=>i,jD:()=>s,le:()=>a,s9:()=>l,sb:()=>o});let r={videoTargetSeconds:90,photoTargetFrames:150,levelToleranceDeg:3,ghostOpacity:.45,ghostFadeMs:1500,levelLineOpacity:.62,levelLineLevelOpacity:.82,coverageRingWidthPx:3,guideTopGapPx:8},a={ringSizePx:44,ringStrokePx:3,updateIntervalMs:220,stateHysteresisMs:1e3,goodDimAfterMs:1e4,goodDimOpacity:.5,windowSamples:18,paceVarianceWarn:.65,paceVarianceSevere:1.8,stabilityVarianceWarn:90,stabilityVarianceSevere:320,rollSmoothingAlpha:.12,rollUpdateIntervalMs:33,rollDeadbandDeg:1.25,rollMaxDeg:15,bubbleTrackWidthPx:150,bubbleTrackHeightPx:26,bubbleSizePx:14,bubblePxPerDeg:4.2};function i(e){return"video"===e.mode?Math.min(1,Math.max(0,(e.isRecording?e.recSeconds:e.totalVideoSeconds)/r.videoTargetSeconds)):Math.min(1,Math.max(0,(e.isRecording?e.activeFrameCount:e.totalPhotoFrames)/r.photoTargetFrames))}function o(e,t){return t>=a.stabilityVarianceSevere?"hold_steady_severe":t>=a.stabilityVarianceWarn?"hold_steady":e>=a.paceVarianceSevere?"slow_down_severe":e>=a.paceVarianceWarn?"slow_down":"good"}function l(e){return e?"good"===e?"SMOOTH \xb7 KEEP GOING":e.startsWith("slow_down")?"SLOW DOWN":"HOLD STEADY":null}function s(e){return e&&"good"!==e?e.endsWith("_severe")?"var(--destructive)":"var(--muted-foreground)":"var(--graphite-primary)"}},33779:(e,t,n)=>{n.d(t,{v:()=>eu});var r=n(95155),a=n(12115),i=n(23361),o=n(5917);let l={topInsetPx:12,topBarHeightPx:44,topBarRadiusPx:12,sideInsetPx:12,railSideInsetPx:16,railLabelBottomPx:44,shutterSizePx:72,shutterRaisePx:16,shutterStopPx:22,hintBottomPx:12,lightButtonSizePx:48,doneButtonSizePx:56,modeSelectorBottomPx:167,qualityLockBottomPx:209,lidarChipTopGapPx:8},s="bg-[color-mix(in_srgb,var(--graphite-canvas)_85%,transparent)]",c="rounded-full border border-[var(--mobile-app-card-border)] ".concat(s," backdrop-blur-md"),u="rounded-xl border border-[var(--mobile-app-card-border)] ".concat(s," backdrop-blur-md"),d="text-[#E8EDF3]";var p=n(18316);function m(e){let{hidden:t,mode:n,clipCount:a,isRecording:s,isStreaming:m,needsResume:h=!1,torchSupported:f,torchOn:b,hasContent:g,finishing:v=!1,coverageProgress:x,onTorchToggle:w,onShutterTap:y,onDone:S}=e;if(t)return null;let C="env(safe-area-inset-bottom)",k="photos"===n,j=Math.round(360*Math.min(1,Math.max(0,x))),P=p.MS.coverageRingWidthPx,R=l.shutterSizePx-2*P,N="var(--destructive)",E=g&&!s&&!v,T=h?"tap to resume camera":s&&1===a?"keep the guide green for a sharp twin":a>=1&&!s?"tap blue to add another clip \xb7 Done when finished":"tap blue to start \xb7 red to stop \xb7 check = review";return(0,r.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-30",children:[(0,r.jsx)("p",{className:"pointer-events-none absolute inset-x-0 mx-auto w-fit max-w-[90%] px-3 py-1 text-center text-[11px] font-medium ".concat(d," ").concat(c),style:{bottom:"calc(".concat(l.hintBottomPx,"px + ").concat(C,")")},"data-twin-chrome":"hint",children:T}),(0,r.jsxs)("div",{className:"pointer-events-auto absolute inset-x-0",style:{bottom:"calc(".concat(l.railLabelBottomPx,"px + ").concat(C,")"),paddingLeft:l.railSideInsetPx,paddingRight:l.railSideInsetPx},"data-twin-chrome":"bottom-rail",children:[(0,r.jsxs)("div",{className:"grid grid-cols-[1fr_auto_1fr] items-end",children:[f?(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),w()},"data-twin-chrome":"light-button",className:"inline-flex items-center justify-center justify-self-start transition active:scale-[0.98] ".concat(u," ").concat(b?"border-[var(--accent-border-blue)] bg-[
1color-mix(in_srgb,var(--twin360-blue)_22%,transparent)] text-[var(--twin360-blue)] ring-2 ring-[var(--accent-border-blue)] ring-offset-1 ring-offset-transparent":d),style:{width:l.lightButtonSizePx,height:l.lightButtonSizePx},"aria-pressed":b,"aria-label":b?"Turn torch off":"Turn torch on",children:(0,r.jsx)(i.A,{className:"h-5 w-5 ".concat(b?"fill-current":"")})}):(0,r.jsx)("span",{"aria-hidden":!0}),(0,r.jsxs)("div",{className:"relative justify-self-center",style:{width:l.shutterSizePx,height:l.shutterSizePx,marginBottom:l.shutterRaisePx},"data-twin-chrome":"coverage-ring",children:[!s&&j>0?(0,r.jsx)("div",{className:"pointer-events-none absolute -inset-[3px] rounded-full",style:{background:"conic-gradient(from -90deg, var(--twin360-blue) 0deg ".concat(j,"deg, transparent ").concat(j,"deg 360deg)"),opacity:.55},"aria-hidden":!0}):null,s?(0,r.jsx)("div",{className:"absolute inset-0 rounded-full border-[3px]",style:{borderColor:N},"aria-hidden":!0}):null,(0,r.jsx)("button",{type:"button",disabled:!(h||m&&!h),onClick:e=>{e.stopPropagation(),y()},"data-twin-chrome":"shutter",className:"absolute left-1/2 top-1/2 inline-flex -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full transition active:scale-95 disabled:opacity-50",style:{width:s?R:l.shutterSizePx,height:s?R:l.shutterSizePx},"aria-label":h?"Resume camera":s?k?"Stop photo capture":"End clip":k?"Start photo capture":"Start recording",children:s?(0,r.jsx)("span",{className:"rounded-md",style:{width:l.shutterStopPx,height:l.shutterStopPx,backgroundColor:N}}):(0,r.jsx)("span",{className:"h-full w-full rounded-full bg-[var(--twin360-blue)] shadow-[var(--mobile-app-card-glow-info)]","aria-hidden":!0})})]}),(0,r.jsx)("button",{type:"button",disabled:!g||v||s,onClick:e=>{e.stopPropagation(),S()},"data-twin-chrome":"done-button","data-twin-chrome-prominent":E?"true":"false",className:"inline-flex items-center justify-center justify-self-end rounded-full text-[var(--graphite-canvas)] transition active:scale-[0.98] ".concat(E?"bg-[var(--twin360-blue)] shadow-[var(--mobile-app-card-glow-info)]":"bg-[var(--twin360-blue)] opacity-35"," disabled:pointer-events-none"),style:{width:l.doneButtonSizePx,height:l.doneButtonSizePx},"aria-label":"Review capture",children:(0,r.jsx)(o.A,{className:"h-6 w-6",strokeWidth:2.5})})]}),(0,r.jsxs)("div",{className:"mt-1 grid grid-cols-[1fr_auto_1fr] gap-1 text-[11px] leading-none",children:[f?(0,r.jsx)("span",{className:"justify-self-start px-2 py-0.5 font-medium ".concat(d," ").concat(c),children:b?"Light on":"Light"}):(0,r.jsx)("span",{"aria-hidden":!0}),(0,r.jsx)("span",{"aria-hidden":!0}),(0,r.jsx)("span",{className:"justify-self-end px-2 py-0.5 font-semibold ".concat(c," ").concat(E?"text-[var(--twin360-blue)]":d," ").concat(E?"":"opacity-50"),children:v?"Preparingâ¦":g?"Review (".concat(a,")"):"Review"})]})]})]})}let h=[.5,1,2];function f(e){return"CLIP ".concat(e.index," \xb7 ").concat(function(e){let t=Math.floor(e/60);return"".concat(t,":").concat((e%60).toString().padStart(2,"0"))}(e.durationSeconds))}function b(e){let{clips:t}=e;return 0===t.length?null:(0,r.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar roun
1ded-xl border border-[var(--mobile-app-card-border)] bg-[color-mix(in_srgb,var(--graphite-canvas)_85%,transparent)] px-3 py-2 backdrop-blur-md","data-twin-chrome":"clip-chips","aria-label":"Recorded clips",children:t.map(e=>{let t=e.recording;return(0,r.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 font-mono text-[10px] font-semibold uppercase tracking-wide ".concat(t?"border border-[var(--accent-border-blue)] bg-[color-mix(in_srgb,var(--twin360-blue)_18%,var(--graphite-canvas)_85%)] text-[var(--twin360-blue)]":"border border-[var(--mobile-app-card-border)] bg-[color-mix(in_srgb,var(--graphite-canvas)_72%,transparent)] ".concat(d)),children:t?"â ".concat(f(e)):f(e)},e.id)})})}let g={0:0,1:.45,2:.72};function v(e){let{imageUrl:t,opacity:n,visible:a,level:i,onSetLevel:o}=e;if(!a||!t)return null;let l=n>0?g[i]:0;return(0,r.jsxs)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex flex-col items-center justify-start gap-2 pt-[184px]","data-twin-chrome":"clip-ghost",children:[(0,r.jsx)("img",{src:t,alt:"","data-twin-chrome":"clip-ghost-frame",className:"absolute inset-0 h-full w-full object-cover",draggable:!1,"aria-hidden":!0,style:{opacity:l,transition:"opacity 320ms ease-out"}}),i>0?(0,r.jsx)("p",{"data-twin-chrome":"clip-ghost-caption",className:"relative max-w-[85%] px-3 py-2 text-center text-xs font-semibold ".concat(d," ").concat(u),style:{opacity:+(n>0),transition:"opacity 320ms ease-out"},children:"Align with your last clip, then record"}):null,(0,r.jsxs)("div",{className:"pointer-events-auto relative flex items-center gap-1 p-1 ".concat(u),style:{opacity:+(n>0),transition:"opacity 320ms ease-out"},"data-twin-chrome":"clip-ghost-level",role:"radiogroup","aria-label":"Overlay strength",children:[(0,r.jsx)("span",{className:"px-1.5 font-mono text-[9px] font-semibold uppercase tracking-wide ".concat(d),children:"Overlay"}),[0,1,2].map(e=>(0,r.jsx)("button",{type:"button",role:"radio","aria-checked":i===e,onClick:t=>{t.stopPropagation(),o(e)},className:"rounded-lg px-2 py-1 font-mono text-[10px] font-semibold uppercase tracking-wide transition ".concat(i===e?"bg-[color-mix(in_srgb,var(--twin360-blue)_22%,transparent)] text-[var(--twin360-blue)]":d),children:0===e?"Off":1===e?"Low":"High"},e))]})]})}function x(e){let{hidden:t,coverageProgress:n,guideState:i,sensorsGranted:o,rollDeg:s=null}=e,[u,m]=(0,a.useState)(!1),h=function(e){let[t,n]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let r=null!=e?e:0,a=Math.abs(r)>6,i=3>Math.abs(r);if(null===t&&a){let e=window.setTimeout(()=>n(r>0?"left":"right"),800);return()=>window.clearTimeout(e)}if(null!==t&&i){let e=window.setTimeout(()=>n(null),500);return()=>window.clearTimeout(e)}},[t,e]),t}(s);if((0,a.useEffect)(()=>{if("good"!==i)return void m(!1);let e=window.setTimeout(()=>m(!0),p.le.goodDimAfterMs);return()=>window.clearTimeout(e)},[i]),t)return null;let f=l.topInsetPx+l.topBarHeightPx+p.MS.guideTopGapPx,b=p.le.ringSizePx,g=p.le.ringStrokePx,v=(b-g)/2,x=2*Math.PI*v,w=Math.min(1,Math.max(0,n)),y=(0,p.jD)(i),S=o?(0,p.s9)(i):null,C=u&&"good"===i?p.le.goodDimOpacity:1;return(0,r.jsxs)("div",{className:"pointer-events-none absolute right-3 z-20 flex flex-col items-end gap-1",style:{to
1p:"calc(max(env(safe-area-inset-top), 0px) + ".concat(f,"px)"),opacity:C,transition:"opacity 400ms ease"},"data-twin-chrome":"capture-guide","data-twin-guide-state":null!=i?i:"none",children:[(0,r.jsx)("span",{className:"px-1.5 py-0.5 font-mono text-[8px] font-semibold uppercase tracking-[0.14em] ".concat(c," ").concat(d),style:{opacity:.7},"aria-hidden":!0,children:"Capture guide"}),(0,r.jsx)("div",{className:"inline-flex items-center justify-center ".concat(c),style:{width:b,height:b,opacity:.85},children:(0,r.jsxs)("svg",{width:b,height:b,viewBox:"0 0 ".concat(b," ").concat(b),"aria-hidden":!0,children:[(0,r.jsx)("circle",{cx:b/2,cy:b/2,r:v,fill:"none",stroke:"rgba(255,255,255,0.12)",strokeWidth:g}),(0,r.jsx)("circle",{cx:b/2,cy:b/2,r:v,fill:"none",stroke:y,strokeWidth:g,strokeLinecap:"round",strokeDasharray:x,strokeDashoffset:x*(1-w),transform:"rotate(-90 ".concat(b/2," ").concat(b/2,")")})]})}),S?(0,r.jsx)("span",{className:"px-2 py-0.5 font-mono text-[10px] font-bold uppercase tracking-wide ".concat(c," ").concat(d),style:{color:y,opacity:.85},"data-twin-guide-label":!0,children:S}):null,h?(0,r.jsx)("span",{className:"px-2 py-0.5 font-mono text-[10px] font-bold uppercase tracking-wide ".concat(c),style:{color:"var(--muted-foreground)",opacity:.85},"data-twin-chrome":"tilt-hint",children:"left"===h?"â² LEVEL PHONE":"â³ LEVEL PHONE"}):null]})}function w(e){return null===e?"â":new Date(e).toISOString().slice(11,23)}function y(e){let{chromeVisible:t,recording:n,recSeconds:a,clipCount:i,completedClipCount:o,cameraStreaming:l,needsResume:s,cameraError:c,recorderRecording:u,recorderError:d,sensorPermission:p,levelLineActive:m,lastOrientationEventAt:h,guideState:f,paceVariance:b,stabilityVariance:g,ghostFrameCaptured:v,ghostFrameByteSize:x,ghostMounted:y,lastFrameCaptureAt:S,lastShutterTapAt:C}=e,k=[["chromeVisible",String(t)],["recording",String(n)],["recSeconds",String(a)],["clips",String(i)],["completedClips",String(o)],["camera.isStreaming",String(l)],["needsResume",String(s)],["camera.error",null!=c?c:"â"],["recorder.recording",String(u)],["recorder.error",null!=d?d:"â"],["sensor.permission",p],["levelLine","denied"===p?"hidden (sensors denied)":"unavailable"===p?"hidden (unavailable)":"unknown"===p?"hidden (awaiting permission)":m?"active":"hidden (no grant yet)"],["lastOrientationEvent",w(h)],["guide.state",null!=f?f:"â"],["guide.paceVariance",b.toFixed(3)],["guide.stabilityVariance",g.toFixed(1)],["ghostFrameCaptured",String(v)],["ghostFrameByteSize",String(x)],["ghostMounted",String(y)],["lastFrameCapture",w(S)],["lastShutterTap",w(C)]];return(0,r.jsx)("div",{className:"pointer-events-none fixed bottom-2 left-2 z-[9999] max-w-[min(92vw,280px)] rounded border border-white/20 bg-black/80 px-2 py-1.5 font-mono text-[10px] leading-tight text-emerald-300","data-twin-capture-debug":!0,"aria-hidden":!0,children:k.map(e=>{let[t,n]=e;return(0,r.jsxs)("div",{className:"truncate",children:[(0,r.jsxs)("span",{className:"text-zinc-400",children:[t,"="]}),n]},t)})})}function S(e){let{message:t,onDismiss:n}=e;return t?(0,r.jsx)("div",{className:"pointer-events-auto absolute inset-x-3 z-40 flex justify-center",style:{top:"calc(max(env(safe-area-inset-top), 12px) + 64px)"},"data-twin-chrome":"toast",role:"status",children:(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),null==n||n()},className:"max-w-sm px-3 py-2 text-center text-xs font-medium leading-snug text-[var(--graphite-text-header)] ".concat(u),children:t})}):null}function C(e){let{hidden:t,frameCount:n,frameCap:a,atCap:i}=e;if(t||0===n)return null;let o=l.topInsetPx+l.topBarHeightPx+52;return(0,r.jsx)("div",{className:"pointer-events-none absolute left-3 z-20",style:{top:"calc(max(env(safe-area-inset-top), 0px) + ".concat(o,"px)")},"data-twin-chrome":"frame-cap-chip",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 font-mono text-[10px] font-bold uppercase tracking-wide ".concat(c),style:{opacity:i?1:.85},children:[(0,r.jsxs)("span",{className:i?"text-[var(--destructive)]":"text-[var(--graphite-text-header)]",children:[n,"/",a," FRAMES"]}),i?(0,r.jsx)("span",{className:"font-semibold text-[var(--destructive)]",children:"CAP REACHED"}):null]})})}function k(e){let{available:t,active:n,pointCount:a,note:i,debug:o}=e,s=l.topBarHeightPx+l.lidarChipTopGapPx;if(!n&&!o)return null;
1let c="number"==typeof a&&a>0?"LIDAR \xb7 ".concat(a>=1e3?"".concat((a/1e3).toFixed(0),"K"):a," pts"):"LIDAR";return(0,r.jsxs)("div",{className:"pointer-events-none absolute left-3 z-20",style:{top:"calc(max(env(safe-area-inset-top), ".concat(l.topInsetPx,"px) + ").concat(s,"px)")},children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-lg border bg-[color-mix(in_srgb,var(--graphite-canvas)_72%,transparent)] px-2.5 py-1 font-mono text-[10px] font-semibold uppercase tracking-wide backdrop-blur-md ".concat(n?"border-[var(--accent-border-blue)] text-[var(--twin360-blue)]":"border-white/15 text-zinc-300"),children:[(0,r.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-sm ".concat(n?"animate-pulse bg-[var(--twin360-blue)]":"bg-zinc-400"),"aria-hidden":!0}),n?c:t?"DEPTH IDLE":"VIDEO"]}),o&&i?(0,r.jsx)("span",{className:"mt-1 block max-w-[64vw] rounded bg-black/55 px-1.5 py-0.5 font-mono text-[9px] leading-tight text-zinc-300",children:i}):null]})}var j=n(95664),P=n(71574);function R(e){let{camera:t,facingMode:n="environment",autoStart:i=!0,fullBleed:o=!1,onResume:l}=e,{videoRef:s,isStreaming:c,needsResume:u,error:d,startCamera:p,clearError:m}=t,[h,f]=(0,a.useState)(1),b=(0,a.useRef)(!1),g=(0,a.useRef)(null),v=(0,a.useCallback)(async()=>{m(),await p(n)},[m,n,p]);(0,a.useEffect)(()=>{!i||b.current||c||(b.current=!0,p(n))},[i,n,c,p]);let x=c&&!d&&!u;return(0,r.jsxs)("div",{className:o?"absolute inset-0 overflow-hidden bg-[var(--graphite-canvas)] touch-manipulation select-none [-webkit-touch-callout:none] [-webkit-user-select:none]":"relative flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--graphite-canvas)] touch-manipulation select-none [-webkit-touch-callout:none] [-webkit-user-select:none]",onTouchStart:function(e){if(2===e.touches.length){e.preventDefault();let[t,n]=[e.touches[0],e.touches[1]];g.current={distance:Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY),scale:h}}},onTouchMove:function(e){if(2!==e.touches.length||!g.current)return;e.preventDefault();let[t,n]=[e.touches[0],e.touches[1]],r=Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY)/g.current.distance;f(Math.min(3,Math.max(1,g.current.scale*r)))},onTouchEnd:()=>{g.current=null},children:[(0,r.jsx)("video",{ref:s,playsInline:!0,muted:!0,autoPlay:!0,className:"absolute inset-0 z-[1] h-full w-full object-cover transition-transform duration-75 ".concat(x?"opacity-100":"pointer-events-none opacity-0"),style:{transform:"scale(".concat(h,")")}}),d?(0,r.jsx)(N,{title:"Camera unavailable",detail:d,actionLabel:"Retry camera",onAction:()=>void v()}):u?(0,r.jsx)(N,{title:"Camera paused",detail:"Tap to resume camera before recording.",actionLabel:"Tap to resume camera",onAction:()=>null==l?void 0:l()}):c?null:(0,r.jsx)(N,{title:"Live camera",detail:"Tap below to enable the camera. Pinch to zoom once streaming.",actionLabel:"Enable camera",onAction:()=>void v()})]})}function N(e){let{title:t,detail:n,actionLabel:a,onAction:i}=e;return(0,r.jsxs)("div",{className:"relative z-[2] flex min-h-0 flex-1 flex-col items-center justify-center gap-4 px-6 text-center",children:[(0,r.jsx)("span",{className:"flex h-14 w-14 items-center justify-center ".concat(u," ").concat(P.t.iconChip),children:(0,r.jsx)(j.A,{className:"h-7 w-7",strokeWidth:1.75})}),(0,r.jsxs)("div",{className:"space-y-1 px-4 py-3 ".concat(u),children:[(0,r.jsx)("p",{className:"text-sm font-bold text-[var(--graphite-text-header)]",children:t}),(0,r.jsx)("p",{className:"text-xs font-medium leading-snug text-[var(--graphite-muted)]",children:n})]}),(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),i()},className:"inline-flex min-h-11 items-center justify-center px-5 text-sm font-bold text-[var(--graphite-text-header)] shadow-[var(--mobile-app-card-shadow)] transition active:scale-[0.99] ".concat(P.t.button),children:a})]})}function E(e){let{hidden:t,mode:n,photoInterval:a,modeLocked:i,isRecording:o=!1,recSeconds:s=0,onModeChange:u,onCycleInterval:p}=e;return t?null:(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 z-20 flex items-center justify-center",style:{bottom:"calc(".concat(l.modeSelectorBottomPx,"px + ").concat("env(safe-area-inset-bottom)",")")},"data-twin-chrome":"mode-selector",role:o?void 0:"tablist","aria-label":o?void 0:"Capture mode",children:o?(0,r.jsxs)("span",{className:"pointer-events-none whitespace-nowrap px-2.5 py-1 font-mono text-[13px] font-semibold tracking-wide text-white ".concat(c),"data-twin-chrome":"rec-timer-chip","aria-live":"polite",children:[(0,r.jsx)("span",{className:"text-[var(--twin360-blue)]",children:"video"===n?"VIDEO":"PHOTOS"}),(0,r.jsx)("span",{className:"text-[var(--graphite-muted)]",children:" \xb7 "}),"video"===n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-[var(--destructive)]",children:"â"})," REC ",function(e){let t=Math.floor(e/60);return"".concat(t,":").concat((e%60).toString().padStart(2,"0"))}(s),(0,r.jsx)("span",{className:"text-[var(--graphite-muted)]",children:" \xb7 target 1:30"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-[var(--twin360-blue)]",children:"â"})," CAPTURING",(0,r.jsxs)("span",{className:"text-[var(--graphite-muted)]",children:[" \xb7 every ",a,"s"]})]})]}):(0,r.jsxs)("div",{className:"pointer-events-auto inline-flex items-center gap-1",children:[(0,r.jsx)("div",{className:"inline-flex items-center gap-1 p-1 ".concat(c),children:["video","photos"].map(e=>{let t=n===e,a="video"===e?"VIDEO":"PHOTOS";return(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":t,disabled:i&&!t,onClick:t=>{t.stopPropagation(),u(e)},className:"rounded-full px-3 py-1 font-mono text-[10px] font-semibold uppercase tracking-wide transition disabled:opacity-40 ".concat(t?"bg-[color-mix(in_srgb,var(--twin360-blue)_18%,transparent)] text-[var(--twin360-blue)]":d),children:a},e)})}),"photos"===n?(0,r.jsxs)("button",{type:"button",disabled:i,onClick:e=>{e.stopPropagation(),p()},className:"ml-2 px-2 py-1 font-mono text-[10px] font-semibold tabular-nums text-[var(--twin360-blue)] disabled:opacity-40 ".concat(c),"aria-label":"Photo interval ".concat(a," seconds"),children:[a,"s"]}):null]})})}var T=n(76907),M=n(99708),A=n(35795),D=n(20908);function _(e){let{hidden:t,controls:n,anySupported:i,onToggle:o}=e,[s,u]=(0,a.useState)(!1);return t?null:(0,r.jsxs)("div",{className:"pointer-events-auto absolute inset-x-0 z-30 flex flex-col items-center",style:{bottom:"calc(".concat(l.qualityLockBottomPx,"px + ").concat("env(safe-area-inset-bottom)",")"),paddingLeft:l.railSideInsetPx,paddingRight:l.railSideInsetPx},"data-twin-chrome":"quality-lock",children:[s?(0,r.jsxs)("div",{className:"mb-1.5 max-w-[19rem] px-3 py-2 text-center text-[11px] leading-snug ".concat(d," ").concat(c," !rounded-2xl"),role:"status",children:["Locking exposure, color, and focus keeps every photo consistent for the best 3D result. Tap any to let the camera adjust it automatically.",i?"":" Full manual lock needs the installed Slate360 app on this device."]}):null,(0,r.jsxs)("div",{className:"flex max-w-full items-center gap-1.5 overflow-x-auto px-2 py-1 ".concat(c," !rounded-full [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"),children:[(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1 pl-1 pr-0.5 text-[10px] font-semibold uppercase tracking-wider ".concat(i?"text-[var(--twin360-blue)]":d),children:[(0,r.jsx)(T.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Quality lock"]}),n.map(e=>{let t=e.supported,n=e.supported&&e.locked;return(0,r.jsxs)("button",{type:"button",disabled:!t,onClick:n=>{n.stopPropagation(),t&&o(e.id)},"data-twin-chrome":"quality-lock-".concat(e.id),"data-locked":n?"true":"false","aria-pressed":n,title:e.supported?n?"".concat(e.label," locked â tap for auto"):"".concat(e.label," auto â tap to lock"):"".concat(e.label," not available on this device"),className:"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-1 text-[11px] font-semibold transition active:scale-[0.97] ".concat(t?n?"border-[var(--accent-border-blue)] bg-[
1color-mix(in_srgb,var(--twin360-blue)_18%,transparent)] text-[var(--twin360-blue)]":"border-[var(--mobile-app-card-border)] ".concat(d):"border-transparent text-[color-mix(in_srgb,var(--graphite-muted)_70%,transparent)] opacity-50"),children:[n?(0,r.jsx)(M.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(A.A,{className:"h-3 w-3","aria-hidden":!0}),(0,r.jsx)("span",{children:e.label}),t&&!n?(0,r.jsx)("span",{className:"opacity-70",children:"Auto"}):null]},e.id)}),(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),u(e=>!e)},"aria-label":"About Quality Lock","aria-expanded":s,"data-twin-chrome":"quality-lock-info",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full ".concat(d," active:scale-95"),children:(0,r.jsx)(D.A,{className:"h-4 w-4","aria-hidden":!0})})]})]})}function L(e){var t;return e&&null!=(t=e.getVideoTracks()[0])?t:null}function F(e){if(!(null==e?void 0:e.getCapabilities))return!1;let t=e.getCapabilities();return!!(t&&"torch"in t&&t.torch)}async function I(e,t){await e.applyConstraints({advanced:[{torch:t}]})}let O=[{id:"exposure",label:"Exposure"},{id:"whiteBalance",label:"White bal."},{id:"focus",label:"Focus"},{id:"iso",label:"ISO"}],B={exposure:!0,whiteBalance:!0,focus:!0,iso:!0},z={exposure:!1,whiteBalance:!1,focus:!1,iso:!1};function V(e){return Array.isArray(e)&&e.includes("manual")}function H(e){return e.exposure||e.whiteBalance||e.focus||e.iso}async function W(e,t,n){var r,a;let i=L(e);if(!(null==i?void 0:i.applyConstraints))return!1;let o=null!=(a=null==(r=i.getSettings)?void 0:r.call(i))?a:{},l={};if(t.exposure&&(l.exposureMode=n.exposure?"manual":"continuous",n.exposure&&"number"==typeof o.exposureTime&&(l.exposureTime=o.exposureTime)),t.whiteBalance&&(l.whiteBalanceMode=n.whiteBalance?"manual":"continuous",n.whiteBalance&&"number"==typeof o.colorTemperature&&(l.colorTemperature=o.colorTemperature)),t.focus&&(l.focusMode=n.focus?"manual":"continuous",n.focus&&"number"==typeof o.focusDistance&&(l.focusDistance=o.focusDistance)),t.iso&&n.iso&&"number"==typeof o.iso&&(l.iso=o.iso),0===Object.keys(l).length)return!1;try{return await i.applyConstraints({advanced:[l]}),!0}catch(e){return!1}}var U=n(90368),q=n(12108),G=n(24033),Y=n(37354),K=n(65993),X=n(20063),Q=n(34743);function Z(e){let{headerLabel:t,hidden:n,onBack:a,onToggleChrome:i,onDoneTap:o,clipCount:s=0,clipsExpanded:c=!1,onClipsToggle:u,clipsPanel:d}=e,p=(0,X.useRouter)();if(n)return null;let m=s>0&&!!u;return(0,r.jsxs)("header",{className:"pointer-events-auto absolute inset-x-0 top-0 z-30",style:{paddingTop:(0,Q.nZ)(l.topInsetPx),paddingLeft:l.sideInsetPx,paddingRight:l.sideInsetPx},children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 border border-[var(--accent-border-blue)] bg-[
1color-mix(in_srgb,var(--graphite-canvas)_85%,transparent)] px-3 backdrop-blur-md",style:{borderRadius:l.topBarRadiusPx,height:l.topBarHeightPx},children:[(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),a()},className:"inline-flex h-8 shrink-0 items-center gap-0.5 rounded-lg border border-[var(--accent-border-blue)] bg-[color-mix(in_srgb,var(--twin360-blue)_14%,transparent)] pl-1.5 pr-2.5 text-[11px] font-bold uppercase tracking-wider text-[var(--twin360-blue)] transition active:scale-[0.98]","aria-label":"Back",children:[(0,r.jsx)(U.A,{className:"h-4 w-4",strokeWidth:2.5}),"Back"]}),(0,r.jsx)("p",{className:"min-w-0 flex-1 truncate text-center font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--twin360-blue)]",title:t,children:t}),m?(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),null==u||u()},"data-twin-chrome":"clips-toggle",className:"inline-flex h-8 shrink-0 items-center justify-center gap-1 rounded-lg border border-[var(--accent-border-blue)] bg-[color-mix(in_srgb,var(--twin360-blue)_12%,transparent)] px-2 text-[var(--twin360-blue)] transition active:scale-[0.98]","aria-expanded":c,"aria-label":c?"Hide clips":"Show clips",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] font-semibold text-[var(--twin360-blue)]",children:s}),c?(0,r.jsx)(q.A,{className:"h-4 w-4 text-[var(--twin360-blue)]"}):(0,r.jsx)(G.A,{className:"h-4 w-4 text-[var(--twin360-blue)]"})]}):null,(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),i()},className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-[var(--accent-border-blue)] bg-[
1color-mix(in_srgb,var(--twin360-blue)_10%,transparent)] text-[var(--twin360-blue)] transition active:scale-[0.98]","aria-label":"Toggle capture controls",children:(0,r.jsx)(Y.A,{className:"h-4 w-4"})}),o?(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),o()},"data-twin-chrome":"top-bar-done",className:"inline-flex h-8 shrink-0 items-center justify-center rounded-lg border border-[var(--accent-border-blue)] bg-[color-mix(in_srgb,var(--twin360-blue)_14%,transparent)] px-2.5 text-[11px] font-bold uppercase tracking-wider text-[var(--twin360-blue)] transition active:scale-[0.98]","aria-label":"Finish capture",children:"Done"}):null,(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),p.push("/app")},"data-twin-chrome":"quick-exit",className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-[var(--accent-border-blue)] bg-[color-mix(in_srgb,var(--twin360-blue)_10%,transparent)] text-[var(--twin360-blue)] transition active:scale-[0.98]","aria-label":"Back to Slate360 home",children:(0,r.jsx)(K.A,{className:"h-4 w-4"})})]}),d?(0,r.jsx)("div",{className:"w-full ".concat(c?"mt-2":"sr-only"),"aria-hidden":!c,children:d}):null]})}async function J(e,t){let n=L(e);return!!n&&!!F(n)&&(await I(n,t),!0)}function $(e){if(e instanceof DOMException){if("NotAllowedError"===e.name)return"Camera permission denied. Allow camera access in Settings, then tap Retry.";if("NotFoundError"===e.name)return"No camera found on this device.";if("NotReadableError"===e.name)return"Camera is in use by another app. Close it and tap Retry.";if("OverconstrainedError"===e.name)return"This camera mode is not available on this device."}return e instanceof Error?e.message:"Camera unavailable"}function ee(e){if(!e)return!1;let t=e.getVideoTracks();return t.length>0&&t.every(e=>"live"===e.readyState)}async function et(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4e3;return e.videoWidth>0&&e.readyState>=2||new Promise(n=>{let r=Date.now()+t,a=t=>{e.removeEventListener("loadeddata",i),e.removeEventListener("loadedmetadata",i),n(t)},i=()=>{e.videoWidth>0&&e.readyState>=2&&a(!0)};e.addEventListener("loadeddata",i),e.addEventListener("loadedmetadata",i);let o=()=>e.videoWidth>0&&e.readyState>=2?void a(!0):Date.now()>r?void a(!1):void requestAnimationFrame(o);requestAnimationFrame(o)})}function en(e){var t;return Math.round(3*(null!=(t=e.split(",")[1])?t:"").length/4)}function er(e){return e.filter(e=>!e.recording&&(e.frameCount>0||e.durationSeconds>0)).length}function ea(e){if(e.length<2)return 0;let t=e.reduce((e,t)=>e+t,0)/e.length;return e.reduce((e,n)=>e+(n-t)**2,0)/e.length}function ei(e,t,n){e.push(t),e.length>n&&e.shift()}async function eo(){let e=DeviceOrientationEvent,t=DeviceMotionEvent,n="function"==typeof e.requestPermission,r="function"==typeof t.requestPermission;if(!n&&!r)return"granted";try{let a=!0;return n&&(a=await e.requestPermission()==="granted"&&a),r&&(a=await t.requestPermission()==="granted"&&a),a?"granted":"denied"}catch(e){return"denied"}}function el(){if("undefined"==typeof MediaRecorder)return null;if(function(){if("undefined"==typeof navigator)return!1;let e=navigator.userAgent,t="MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1;return/iPad|iPhone|iPod/.test(e)||t}()){for(let e of["video/mp4;codecs=avc1","video/mp4","video/quicktime"])if(MediaRecorder.isTypeSupported(e))return e;return null}for(let e of["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"])if(MediaRecorder.isTypeSupported(e))return e;return MediaRecorder.isTypeSupported("video/mp4")?"video/mp4":null}var es=n(32587),ec=n(63417);function eu(e){var t,n;let{projectName:i,spaceName:o="Lobby â Level 1",onCancel:l,onFinish:s,devSeedClipCount:c,devInitialMode:u,devForceRecording:d,devCoverageOverride:f=null,devRollOverride:g=null,devPaceVarianceOverride:w=null,devStabilityVarianceOverride:j=null,devForceGhost:P=!1,devGhostFrameUrl:N=null,debug:T=!1}=e,M=function(){let e=(0,a.useRef)(null),t=(0,a.useRef)(null),[n,r]=(0,a.useState)(!1),[i,o]=(0,a.useState)(!1),[l,s]=(0,a.useState)(null),c=(0,a.useCallback)(e=>{let t=()=>{let t=ee(e);o(!t),t||r(!1)};
1return e.getVideoTracks().forEach(e=>{e.addEventListener("ended",t),e.addEventListener("mute",t)}),()=>{e.getVideoTracks().forEach(e=>{e.removeEventListener("ended",t),e.removeEventListener("mute",t)})}},[]),u=(0,a.useCallback)(()=>{var n;null==(n=t.current)||n.getTracks().forEach(e=>e.stop()),t.current=null,e.current&&(e.current.srcObject=null),r(!1),o(!1)},[]),d=(0,a.useCallback)(async function(){var n;let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"environment";s(null),o(!1),null==(n=t.current)||n.getTracks().forEach(e=>e.stop()),t.current=null,e.current&&(e.current.srcObject=null),r(!1);try{let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:a,width:{ideal:1920},height:{ideal:1080}},audio:!1});t.current=e,r(ee(e)),o(!ee(e))}catch(e){s($(e)),r(!1),o(!1)}},[]),p=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"environment";return d(e)},[d]);(0,a.useEffect)(()=>{let a,l=e.current,u=t.current;if(!n||!l||!u||i)return;let d=!1;return l.srcObject=u,a=c(u),l.play().then(()=>{d||s(null)}).catch(e=>{d||(s($(e)),o(!0),r(!1))}),()=>{d=!0,null==a||a()}},[c,n,i]);let m=(0,a.useCallback)(async()=>{let r=e.current,a=t.current;if(!r||!n||i||!ee(a)||!await et(r)||!r.videoWidth||!r.videoHeight)return null;let{width:o,height:l}=function(e,t,n){let r=Math.max(e,t);if(r<=1920)return{width:e,height:t};let a=1920/r;return{width:Math.round(e*a),height:Math.round(t*a)}}(r.videoWidth,r.videoHeight,1920),s=document.createElement("canvas");s.width=o,s.height=l;let c=s.getContext("2d");if(!c)return null;c.drawImage(r,0,0,o,l);try{let e=await new Promise(e=>{s.toBlob(t=>e(t),"image/jpeg",.8)});if(!e)return null;return{blob:e,url:URL.createObjectURL(e),width:o,height:l}}catch(e){return null}},[n,i]),h=(0,a.useCallback)(()=>{let e=t.current;return e&&ee(e)?e:null},[]);return{videoRef:e,isStreaming:n,needsResume:i,error:l,startCamera:d,resumeCamera:p,stopCamera:u,clearError:(0,a.useCallback)(()=>s(null),[]),capturePhoto:m,getActiveStream:h}}(),A=function(){let e=(0,a.useRef)(null),t=(0,a.useRef)([]),[n,r]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),l=(0,a.useCallback)(()=>o(null),[]);return{recording:n,error:i,clearError:l,startRecording:(0,a.useCallback)(n=>{let a=t=>(o(t),e.current=null,r(!1),{ok:!1,message:t});if(o(null),null===el())return a("Video recording is not supported on this browser.");if(!n.getVideoTracks().filter(e=>"live"===e.readyState).length)return a("Camera stream is not active. Tap to resume camera.");let i=el();if(!i)return a("No supported video format found for this device.");t.current=[];try{let a=new MediaRecorder(n,{mimeType:i});return a.ondataavailable=e=>{e.data.size>0&&t.current.push(e.data)},a.onerror=()=>{o("Recording failed. Try ending the clip and record again."),r(!1),e.current=null},a.start(1e3),e.current=a,r(!0),{ok:!0}}catch(e){return a(e instanceof Error?e.message:"Could not start recording.")}},[]),stopRecording:(0,a.useCallback)(async()=>{let n=e.current;if(!n||"inactive"===n.state)return r(!1),null;let a=await new Promise(e=>{n.onstop=()=>{let r=new Blob(t.current,{type:n.mimeType});if(t.current=[],!r.size){o("Recording produced no data. Try a shorter clip or retry."),e(null);return}let a=n.mimeType.includes("mp4")||n.mimeType.includes("quicktime")?"mp4":"webm";e(new File([r],"walk_".concat(Date.now(),".").concat(a),{type:n.mimeType}))};try{n.stop()}catch(t){o(t instanceof Error?t.message:"Could not stop recording."),e(null)}});return e.current=null,r(!1),a},[])}}(),D=function(){let[e,t]=(0,a.useState)(!1),[n,r]=(0,a.useState)(!1),[i,o]=(0,a.useState)(0),l=(0,a.useRef)(null),s=(0,a.useRef)(!1);(0,a.useEffect)(()=>{let e=!1;return(0,ec.An)().then(n=>{e||t(n)}),()=>{e=!0}},[]),(0,a.useEffect)(()=>{s.current=n},[n]);let c=(0,a.useCallback)(async()=>{if(e&&!s.current)try{await ec.R8.startSession({confidence:"medium"}),r(!0),o(0),l.current=await ec.R8.addListener("progress",e=>{o(e.pointCount)})}catch(e){console.warn("[useLiDARCapture] startCapture failed (non-fatal):",e)}},[e]),u=(0,a.useCallback)(async()=>{if(!e||!s.current)return null;try{var t;await (null==(t=l.current)?void 0:t.remove()),l.current=null,await ec.R8.stopSession();let e=await ec.R8.exportData(),[n,a]=await Promise.all([fetch(e.plyUri).then(e=>e.blob()),fetch(e.posesUri).then(e=>e.blob())]),i=new File([n],"preview_point_cloud.ply",{type:"application/octet-stream"}),s=new File([a],"lidar_poses.json",{type:"application/json"});return await ec.R8.cleanup(),r(!1),o(0),{plyFile:i,posesFile:s}}catch(e){return console.warn("[useLiDARCapture] stopCapture/export failed (non-fatal):",e),r(!1),null}},[e]),d=(0,a.useCallback)(async()=>{try{var t;await (null==(t=l.current)?void 0:t.remove()),l.current=null,e&&await ec.R8.cleanup().catch(()=>{})}catch(e){}r(!1),o(0)},[e]);return(0,a.useEffect)(()=>()=>{var e;s.current&&(ec.R8.stopSession().catch(()=>{}),ec.R8.cleanup().catch(()=>{})),null==(e=l.current)||e.remove().catch(()=>{})},[]),{isAvailable:e,isActive:n,pointCount:i,startCapture:c,stopCapture:u,cleanup:d}}(),[I,U]=(0,a.useState)(null);(0,a.useEffect)(()=>
1{if(!T)return;let e=!1,t="".concat(es.Capacitor.getPlatform(),"/").concat(es.Capacitor.isNativePlatform()?"native":"web"),n=window.Capacitor,r=((null==n?void 0:n.Plugins)?Object.keys(n.Plugins):[]).includes("LiDARCapture"),a=!!Array.isArray(null==n?void 0:n.PluginHeaders)&&n.PluginHeaders.some(e=>(null==e?void 0:e.name)==="LiDARCapture");return ec.R8.isAvailable().then(n=>{var i;e||U("".concat(t," hdr=").concat(a," reg=").concat(r," avail=").concat(n.available," native=").concat(null!=(i=n.nativeCapture)?i:"â"))}).catch(n=>{e||U("".concat(t," hdr=").concat(a," reg=").concat(r," err: ").concat(n instanceof Error?n.message:String(n)))}),()=>{e=!0}},[T]);let[q,G]=(0,a.useState)(null),[Y,K]=(0,a.useState)(null),[X,Q]=(0,a.useState)(!1),eu=(0,a.useRef)(!1),ed=(0,a.useCallback)(e=>{G(e),window.setTimeout(()=>G(t=>t===e?null:t),5e3)},[]),ep=function(e){var t,n;let{camera:r,videoRecorder:i,onError:o,devSeedClipCount:l,devInitialMode:s}=e,c=(0,a.useRef)([]),u=(0,a.useRef)(new Map),[d,p]=(0,a.useState)(null!=s?s:"video"),[m,f]=(0,a.useState)([]),[b,g]=(0,a.useState)(null),[v,x]=(0,a.useState)(1),[w,y]=(0,a.useState)(!1),[S,C]=(0,a.useState)(!1),k=(0,a.useRef)(null),j=(0,a.useRef)(null),P=(0,a.useRef)(!1),R=(0,a.useCallback)(()=>{let e=0;return u.current.forEach(t=>{e+=t.length}),e},[]),N=(0,a.useCallback)(e=>{null==o||o(e)},[o]),{recording:E}=i,T=E||w,M=null!=(t=m.find(e=>e.id===b))?t:null,A=null!=(n=null==M?void 0:M.durationSeconds)?n:0,D=m.some(e=>e.frameCount>0),_=m.reduce((e,t)=>e+t.frameCount,0),L=(0,a.useCallback)(()=>{k.current&&(clearInterval(k.current),k.current=null)},[]),F=(0,a.useCallback)(()=>{j.current&&(clearInterval(j.current),j.current=null)},[]);(0,a.useEffect)(()=>()=>{L(),F()},[L,F]),(0,a.useEffect)(()=>{l&&!(l<=0)&&f(Array.from({length:l},(e,t)=>({id:"dev-clip-".concat(t+1),index:t+1,mode:"video",durationSeconds:12+3*t,frameCount:1,recording:!1})))},[l]),(0,a.useEffect)(()=>T&&b?(k.current=setInterval(()=>{f(e=>e.map(e=>e.id===b?{...e,durationSeconds:e.durationSeconds+1}:e))},1e3),L):void L(),[b,T,L]);let I=(0,a.useCallback)(async e=>{if(!r.isStreaming||r.needsResume)return N("Camera is not ready. Tap to resume camera."),!1;if(R()>=200)return C(!0),N("Frame cap reached (".concat(200,"). End this clip to continue.")),!1;if(P.current)return!1;P.current=!0;try{var t;let n=await r.capturePhoto();if(!n)return N("Could not capture photo frame. Hold steady and try again."),!1;let a=new File([n.blob],"photo_".concat(Date.now(),".jpg"),{type:"image/jpeg"});c.current.push(a);let i=null!=(t=u.current.get(e))?t:[];return u.current.set(e,[...i,a]),f(t=>t.map(t=>t.id===e?{...t,frameCount:t.frameCount+1}:t)),!0}finally{P.current=!1}},[r,R,N]),O=(0,a.useCallback)(e=>{f(t=>t.map(t=>t.id===e?{...t,recording:!1}:t)),g(null)},[]),B=(0,a.useCallback)(async()=>{if(!r.getActiveStream())return void N("Camera stream is not active. Tap to resume camera.");let e="clip-".concat(Date.now()),t=m.length+1;if(f(n=>[...n,{id:e,index:t,mode:"photos",durationSeconds:0,frameCount:0,recording:!0}]),g(e),y(!0),F(),!await I(e)){y(!1),g(null),f(t=>t.filter(t=>t.id!==e));return}j.current=setInterval(()=>{if(R()>=200){F(),C(!0),N("Frame cap reached (".concat(200,"). End this clip to continue."));return}I(e)},1e3*v)},[r,I,m.length,R,v,N,F]),z=(0,a.useCallback)(()=>{F(),y(!1),b&&O(b)},[b,O,F]),V=(0,a.useCallback)(()=>{let e=r.getActiveStream();if(!e)return N("Camera stream is not active. Tap to resume camera."),!1;i.clearError();let t="clip-".concat(Date.now()),n=m.length+1;f(e=>[...e,{id:t,index:n,mode:"video",durationSeconds:0,frameCount:0,recording:!0}]),g(t);let a=i.startRecording(e);return!!a.ok||(f(e=>e.filter(e=>e.id!==t)),g(null),N(a.message),!1)},[r,m.length,N,i]),H=(0,a.useCallback)(async()=>{L();let e=await i.stopRecording();if(e&&b){c.current.push(e),u.current.set(b,[e]),f(e=>e.map(e=>e.id===b?{...e,recording:!1,frameCount:1}:e)),g(null);return}i.error&&N(i.error),b&&f(e=>e.filter(e=>e.id!==b)),g(null)},[b,N,L,i]),W=(0,a.useCallback)(()=>r.needsResume||!r.getActiveStream()?void N("Camera stream is not active. Tap to resume camera."):"photos"===d?void(w?z():B()):void(E?H():V()),[r,d,w,N,B,V,z,H,E]),U=(0,a.useCallback)(()=>
1{if(T)return;let e=h.indexOf(v);x(h[(e+1)%h.length])},[T,v]),q=(0,a.useCallback)(e=>{T||p(e)},[T]),G=(0,a.useCallback)(async()=>{if(F(),L(),E){let e=await i.stopRecording();if(e&&b)c.current.push(e),u.current.set(b,[e]),O(b);else if(b&&(f(e=>e.filter(e=>e.id!==b)),g(null),i.error))throw Error(i.error)}w&&z();let e=m.map(e=>{var t;let n=null!=(t=u.current.get(e.id))?t:[],r=n.find(e=>e.type.startsWith("image/"));return{id:e.id,index:e.index,mode:e.mode,durationSeconds:e.durationSeconds,frameCount:e.frameCount,files:n,thumbnailUrl:r?URL.createObjectURL(r):null}}),t=[...c.current];if(!t.length)throw Error("No capture files â record at least one clip.");return{clips:e,allFiles:t}},[b,m,O,w,L,F,z,E,i]);return{mode:d,clips:m,activeClipId:b,activeClip:M,photoInterval:v,photoAutoActive:w,photoFrameCapHit:S,totalPhotoFrames:_,atPhotoFrameCap:_>=200,isRecording:T,recSeconds:A,hasContent:D,handleShutterTap:W,handleModeChange:q,cyclePhotoInterval:U,collectForReview:G}}({camera:M,videoRecorder:A,onError:ed,devSeedClipCount:c,devInitialMode:u}),[em,eh]=(0,a.useState)(!0),[ef,eb]=(0,a.useState)(!1),[eg,ev]=(0,a.useState)(1),ex=(0,a.useRef)(0),[ew,ey]=(0,a.useState)(null),eS="environment",[eC,ek]=(0,a.useState)(!1),[ej,eP]=(0,a.useState)(!1),eR=(null==i?void 0:i.trim())?i.trim().toUpperCase():"QUICK SCAN",eN=d||ep.isRecording,eE=eN?"video"===ep.mode?"".concat(eR," \xb7 REC ").concat(function(e){let t=Math.floor(e/60);return"".concat(t,":").concat((e%60).toString().padStart(2,"0"))}(ep.recSeconds)):"".concat(eR," \xb7 CAPTURING"):"".concat(eR," \xb7 READY"),eT=ep.totalPhotoFrames,eM=ep.clips.filter(e=>"video"===e.mode).reduce((e,t)=>e+t.durationSeconds,0),eA=null!=(n=null==(t=ep.activeClip)?void 0:t.frameCount)?n:0,eD=null!=f?f:(0,p.P3)({mode:ep.mode,isRecording:eN,recSeconds:ep.recSeconds,activeFrameCount:eA,totalVideoSeconds:eM,totalPhotoFrames:eT}),e_=function(){let{enabled:e=!0,guideActive:t=!1,devRollOverride:n=null,devPaceVarianceOverride:r=null,devStabilityVarianceOverride:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=null!==r&&null!==i,l=null!==n||o,[s,c]=(0,a.useState)(n),[u,d]=(0,a.useState)(l?"granted":"unknown"),[m,h]=(0,a.useState)(l),[f,b]=(0,a.useState)(null),[g,v]=(0,a.useState)(o?r:0),[x,w]=(0,a.useState)(o?i:0),[y,S]=(0,a.useState)(()=>o?(0,p.sb)(r,i):null),C=(0,a.useRef)([]),k=(0,a.useRef)([]),j=(0,a.useRef)(null),P=(0,a.useRef)(null),R=(0,a.useRef)(o?(0,p.sb)(r,i):null),N=(0,a.useRef)(0),E=e&&"granted"===u,T="granted"===u,M=E&&t,A=(0,a.useCallback)(e=>{R.current=e,S(e)},[]),D=(0,a.useCallback)((e,t)=>{let n=(0,p.sb)(e,t),r=Date.now();if(R.current===n){j.current=null,P.current=null;return}if(j.current!==n){j.current=n,P.current=r;return}null!==P.current&&r-P.current>=p.le.stateHysteresisMs&&(A(n),j.current=null,P.current=null)},[A]),_=(0,a.useCallback)(async()=>{if(null!==n)return"granted";if("granted"===u||"denied"===u)return u;let e=await eo();return d(e),"granted"===e?h(!0):(h(!1),c(null),S(null),v(0),w(0),b(null),C.current=[],k.current=[],R.current=null,j.current=null,P.current=null),e},[n,u]);return(0,a.useEffect)(()=>{null!=n&&(c(n),h(!0),d("granted"),b(Date.now()))},[n]),(0,a.useEffect)(()=>{if(!M){S(null),R.current=null,j.current=null,P.current=null;return}if(null!==r&&null!==i){v(r),w(i),A((0,p.sb)(r,i));return}let e=!0,t=t=>{var n;if(!e)return;let r=Date.now();if(r-N.current<p.le.updateIntervalMs)return;N.current=r;let a=null!=(n=t.accelerationIncludingGravity)?n:t.acceleration;a&&null!==a.x&&null!==a.y&&null!==a.z&&ei(C.current,Math.hypot(a.x,a.y,a.z),p.le.windowSamples);let i=t.rotationRate;i&&null!==i.alpha&&null!==i.beta&&null!==i.gamma&&ei(k.current,Math.hypot(i.alpha,i.beta,i.gamma),p.le.windowSamples);let o=ea(C.current),l=ea(k.current);v(o),w(l),D(o,l)};return window.addEventListener("devicemotion",t),()=>{e=!1,window.removeEventListener("devicemotion",t)}},[A,r,i,D,M]),(0,a.useEffect)(()=>{if(!E||null!==n)return;let e=!0,t=null,r=0,a=n=>{if(!e||(b(Date.now()),null===n.gamma))return;h(!0),t=null===t?n.gamma:t+p.le.rollSmoothingAlpha*(n.gamma-t);let a=Date.now();a-r<p.le.rollUpdateIntervalMs||(r=a,c(t))};return window.addEventListener("deviceorientation",a),()=>{e=!1,window.removeEventListener("deviceorientation",a)}},[n,E]),{rollDeg:s,orientationSupported:m,levelLineActive:T,lastOrientationEventAt:f,guideState:y,paceVariance:g,stabilityVariance:x,permission:u,requestPermission:_}}({devRollOverride:g,devPaceVarianceOverride:w,devStabilityVarianceOverride:j,guideActive:eN}),eL=function(e){let{clips:t,isRecording:n,videoRef:r,onShutterTap:i,devGhostFrameUrl:o=null,devForceGhost:l=!1}=e,s=(0,a.useRef)(o),c=(0,a.useRef)(n),u=(0,a.useRef)(n),d=(0,a.useRef)(t);u.current=n,d.current=t;let m=(0,a.useRef)(null),h=(0,a.useRef)(null),[f,b]=(0,a.useState)(l?o:null),[g,v]=(0,a.useState)(l?p.MS.ghostOpacity:0),[x,w]=(0,a.useState)({ghostFrameCaptured:!!o,ghostFrameByteSize:o?en(o):0,ghostMounted:!!(l&&o),lastFrameCaptureAt:null}),y=(0,a.useCallback)(()=>{m.current&&clearTimeout(m.current),h.current&&clearTimeout(h.current),m.current=null,h.current=null},[]),S=(0,a.useCallback)(e=>{y(),b(e),v(p.MS.ghostOpacity)},[y]),C=(0,a.useCallback)(e=>{e&&(s.current=e),w(t=>({...t,ghostFrameCaptured:!!e,ghostFrameByteSize:e?en(e):0,lastFrameCaptureAt:e?Date.now():t.lastFrameCaptureAt})),e&&u.current&&er(d.current)>=1&&S(e)},[S]);(0,a.useEffect)(()=>{o&&(s.current=o)},[o]),(0,a.useEffect)(()=>{l&&(b(o),v(p.MS.ghostOpacity))},[l,o]),(0,a.useEffect)(()=>()=>y(),[y]);let k=(0,a.useCallback)(()=>{i()},[i]);(0,a.useEffect)(()=>
1{let e=c.current;c.current=n,e&&!n&&function e(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=function(e){if(!e||e.readyState<2||!e.videoWidth||!e.videoHeight)return null;let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;let n=t.getContext("2d");if(!n)return null;n.drawImage(e,0,0,t.width,t.height);try{return t.toDataURL("image/jpeg",.62)}catch(e){return null}}(t.current);return a?void n(a):r>=10?void n(null):void window.setTimeout(()=>{e(t,n,r+1)},r<4?32:80)}(r,C)},[C,n,r]),(0,a.useEffect)(()=>{let e=er(t);if(n&&e>=1&&s.current)return void S(s.current);!n&&f&&(y(),m.current=setTimeout(()=>{v(0)},p.MS.ghostFadeMs),h.current=setTimeout(()=>{b(null)},p.MS.ghostFadeMs+320))},[y,t,f,n,S]);let j=!!(f&&g>.01);return(0,a.useEffect)(()=>{w(e=>({...e,ghostMounted:j}))},[j]),{ghostUrl:f,ghostOpacity:g,ghostVisible:j,handleShutterTap:k,ghostDebug:x}}({clips:ep.clips,isRecording:eN,videoRef:M.videoRef,onShutterTap:ep.handleShutterTap,devGhostFrameUrl:N,devForceGhost:P}),eF=38e4*eT+185e4*eM,eI=M.isStreaming&&!M.needsResume;(0,a.useEffect)(()=>{eI&&D.isAvailable&&!D.isActive&&D.startCapture()},[eI,D.isAvailable,D.isActive,D.startCapture]),(0,a.useEffect)(()=>()=>{D.cleanup()},[D.cleanup]);let eO=function(e){let{getActiveStream:t,streamReady:n,active:r}=e,[i,o]=(0,a.useState)(z),[l,s]=(0,a.useState)(B),c=(0,a.useRef)(l);c.current=l,(0,a.useEffect)(()=>{var e;if(!n||!r)return;let a=t(),i=function(e){if(!(null==e?void 0:e.getCapabilities))return{...z};let t=e.getCapabilities();return t?{exposure:V(t.exposureMode),whiteBalance:V(t.whiteBalanceMode),focus:V(t.focusMode),iso:!!(t.iso&&"number"==typeof t.iso.max)}:{...z}}(null!=(e=null==a?void 0:a.getVideoTracks()[0])?e:null);o(i),H(i)&&W(a,i,c.current)},[r,t,n]);let u=(0,a.useCallback)(e=>{s(n=>{let r={...n,[e]:!n[e]};return W(t(),i,r),r})},[t,i]),d=(0,a.useCallback)(()=>{s(B),W(t(),i,B)},[t,i]);return{controls:(0,a.useMemo)(()=>O.map(e=>({...e,supported:i[e.id],locked:l[e.id]})),[l,i]),toggle:u,relock:d,anySupported:H(i)}}({getActiveStream:M.getActiveStream,streamReady:eI,active:"photos"===ep.mode});(0,a.useEffect)(()=>{var e;if(!eI)return void eP(!1);let t=null==(e=M.videoRef.current)?void 0:e.srcObject;eP(F(L(t instanceof MediaStream?t:null)))},[M.isStreaming,M.needsResume,M.videoRef,eI]),(0,a.useEffect)(()=>{!eI&&eC&&ek(!1)},[eI,eC]),(0,a.useEffect)(()=>{A.error&&ed(A.error)},[ed,A.error]),(0,a.useEffect)(()=>{eN&&eh(!0)},[eN]);let eB=(0,a.useCallback)(e=>{eN||eh(e)},[eN]),ez=(0,a.useCallback)(async()=>{var e;let t=null==(e=M.videoRef.current)?void 0:e.srcObject;if(!(t instanceof MediaStream))return;let n=!eC;try{await J(t,n)?ek(n):ed("Torch is not available on this device.")}catch(e){ed(n?"Could not turn torch on.":"Could not turn torch off.")}},[M.videoRef,ed,eC]),eV=(0,a.useCallback)(()=>{if(ep.isRecording)return void ed("End the current clip before leaving.");M.stopCamera(),null==l||l()},[M,l,ep.isRecording,ed]),eH=(0,a.useCallback)(async()=>{if(!X&&ep.hasContent){Q(!0),K(null);try{let[e,t]=await Promise.all([ep.collectForReview(),D.stopCapture()]),n=t?[t.plyFile,t.posesFile]:[];await (null==s?void 0:s({files:e.allFiles,clips:e.clips,photoCount:eT,videoSeconds:eM,estimatedBytes:eF,lidarFiles:n})),M.stopCamera()}catch(t){let e=t instanceof Error?t.message:"Could not prepare review";K(e),ed(e)}finally{Q(!1)}}},[M,eF,X,D,s,eT,ep,ed,eM]),eW=(0,a.useCallback)(()=>{if(ey(Date.now()),eu.current||(eu.current=!0,e_.requestPermission()),M.needsResume)return void M.resumeCamera(eS);eL.handleShutterTap()},[M,eS,eL,e_]);(0,a.useEffect)(()=>{if(eN)return void eb(!1);let e=ep.clips.filter(e=>!e.recording).length;if(e>ex.current){eb(!0);let t=window.setTimeout(()=>eb(!1),2600);return ex.current=e,()=>window.clearTimeout(t)}ex.current=e},[eN,ep.clips]);let eU=(0,a.useCallback)(()=>{if(!eN){if(M.needsResume)return void M.resumeCamera(eS);eB(e=>!e)}},[M,eS,eN,eB]);return(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--graphite-canvas)] touch-manipulation select-none","data-twin-capture-screen":!0,children:[(0,r.jsxs)("div",{role:eN?void 0:"button",tabIndex:eN?void 0:0,className:"relative min-h-0 flex-1 overflow-hidden",onClick:eN?void 0:eU,onKeyDown:eN?void 0:e=>
1{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eU())},"aria-label":eN?void 0:"Toggle capture controls",children:[eN&&"video"===ep.mode?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-40 h-2 animate-pulse bg-[var(--destructive)]",style:{boxShadow:"0 0 12px 2px var(--destructive)"},"data-twin-chrome":"recording-bar","aria-hidden":!0}):(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-40 h-1 bg-[var(--twin360-blue)]","data-twin-chrome":"accent-bar","aria-hidden":!0}),(0,r.jsx)(R,{camera:M,facingMode:eS,autoStart:!0,fullBleed:!0,onResume:()=>void M.resumeCamera(eS)}),(0,r.jsx)(v,{imageUrl:eL.ghostUrl,opacity:eL.ghostOpacity,visible:eL.ghostVisible,level:eg,onSetLevel:ev}),(0,r.jsx)(Z,{headerLabel:eE,hidden:!em,onBack:eV,onToggleChrome:()=>eB(e=>!e),onDoneTap:!ep.hasContent||eN||X?void 0:()=>void eH(),clipCount:ep.clips.length,clipsExpanded:ef,onClipsToggle:()=>eb(e=>!e),clipsPanel:(0,r.jsx)(b,{clips:ep.clips})}),(0,r.jsx)(S,{message:null!=q?q:Y,onDismiss:()=>{G(null),K(null)}}),(0,r.jsx)(k,{available:D.isAvailable,active:D.isActive,pointCount:D.pointCount,note:T?I:null,debug:T}),(0,r.jsx)(C,{hidden:!em||"photos"!==ep.mode,frameCount:ep.totalPhotoFrames,frameCap:200,atCap:ep.atPhotoFrameCap||ep.photoFrameCapHit}),(0,r.jsx)(x,{hidden:!em||!eN,coverageProgress:eD,guideState:e_.guideState,sensorsGranted:"granted"===e_.permission,rollDeg:e_.levelLineActive?e_.rollDeg:null}),(0,r.jsx)(_,{hidden:!em||"photos"!==ep.mode||!eI,controls:eO.controls,anySupported:eO.anySupported,onToggle:eO.toggle}),(0,r.jsx)(E,{hidden:!em,mode:ep.mode,photoInterval:ep.photoInterval,modeLocked:eN,isRecording:eN,recSeconds:ep.recSeconds,onModeChange:ep.handleModeChange,onCycleInterval:ep.cyclePhotoInterval}),(0,r.jsx)(m,{hidden:!em,mode:ep.mode,clipCount:ep.clips.length,isRecording:eN,isStreaming:eI,needsResume:M.needsResume,torchSupported:ej,torchOn:eC,hasContent:ep.hasContent,finishing:X,coverageProgress:eD,onTorchToggle:()=>void ez(),onShutterTap:eW,onDone:()=>void eH()})]}),T?(0,r.jsx)(y,{chromeVisible:em,recording:eN,recSeconds:ep.recSeconds,clipCount:ep.clips.length,completedClipCount:ep.clips.filter(e=>!e.recording&&(e.frameCount>0||e.durationSeconds>0)).length,cameraStreaming:M.isStreaming,needsResume:M.needsResume,cameraError:M.error,recorderRecording:A.recording,recorderError:A.error,sensorPermission:e_.permission,levelLineActive:e_.levelLineActive,lastOrientationEventAt:e_.lastOrientationEventAt,guideState:e_.guideState,paceVariance:e_.paceVariance,stabilityVariance:e_.stabilityVariance,ghostFrameCaptured:eL.ghostDebug.ghostFrameCaptured,ghostFrameByteSize:eL.ghostDebug.ghostFrameByteSize,ghostMounted:eL.ghostDebug.ghostMounted,lastFrameCaptureAt:eL.ghostDebug.lastFrameCaptureAt,lastShutterTapAt:ew}):null]})}},63417:(e,t,n)=>{n.d(t,{An:()=>a,Kd:()=>i,R8:()=>r});let r=(0,n(32587).F3)("LiDARCapture");async function a(){try{return(await r.isAvailable()).available}catch(e){return!1}}async function i(){try{var e,t;let n=await r.isAvailable(),a=null!=(e=n.buildCommit)?e:null,i=null!=(t=n.buildNumber)?t:null;if(!0===n.available&&!0===n.nativeCapture)return{nativeCapture:!0,reason:"ok",buildCommit:a,buildNumber:i};if(!0!==n.available)return{nativeCapture:!1,reason:"no_lidar_device",buildCommit:a,buildNumber:i};return{nativeCapture:!1,reason:"old_build",buildCommit:a,buildNumber:i}}catch(e){return{nativeCapture:!1,reason:"not_native_app",buildCommit:null,buildNumber:null}}}},71574:(e,t,n)=>{n.d(t,{t:()=>r});let r={text:"text-[var(--twin360-blue)]",textMuted:"text-[color-mix(in_srgb,var(--twin360-blue)_75%,white)]",textHover:"hover:text-[color-mix(in_srgb,var(--twin360-blue)_85%,white)]",link:"font-medium text-[var(--twin360-blue)] hover:text-[color-mix(in_srgb,var(--twin360-blue)_80%,white)] hover:underline",iconChip:"border-[var(--accent-border-blue)] bg-[
1color-mix(in_srgb,var(--twin360-blue)_10%,transparent)] text-[var(--twin360-blue)]",cardHover:"hover:border-[var(--accent-border-blue)] hover:bg-white/[0.06]",spinner:"text-[var(--twin360-blue)]",button:"rounded-xl border border-[var(--accent-border-blue)] bg-[color-mix(in_srgb,var(--twin360-blue)_12%,transparent)] px-3 py-2 text-xs font-semibold text-[var(--twin360-blue)] transition-colors hover:bg-[color-mix(in_srgb,var(--twin360-blue)_18%,transparent)] disabled:opacity-50",buttonDanger:"rounded-xl border border-red-500/25 bg-red-500/10 px-3 py-2 text-xs font-semibold text-red-200 transition-colors hover:bg-red-500/15 disabled:opacity-50"}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.