PageSourceSearch

https://ameenz.com/assets/index-DA9jS39E.js

js ameenz.com collected 2026-10-06 22:57:20 UTC 2,561,141 bytes, 5,211 lines download raw bytes

vendor: 5,937 bytes, line 1
1var OP=n=>{throw TypeError(n)};var FP=(n,e,t)=>e.has(n)||OP("Cannot "+t);var Aa=(n,e,t)=>(FP(n,e,"read from private field"),t?t.call(n):e.get(n)),UP=(n,e,t)=>e.has(n)?OP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),QA=(n,e,t,r)=>(FP(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t);function NH(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in n)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=t(s);fetch(s.href,a)}})();function LM(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function cbe(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}),t}var KA={exports:{}},Eb={};var zP;function AH(){if(zP)return Eb;zP=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:n,type:r,key:o,ref:s!==void 0?s:null,props:a}}return Eb.Fragment=e,Eb.jsx=t,Eb.jsxs=t,Eb}var GP;function CH(){return GP||(GP=1,KA.exports=AH()),KA.exports}var i=CH(),JA={exports:{}},Hn={};var HP;function EH(){if(HP)return Hn;HP=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),x=Symbol.iterator;function y(F){return F===null||typeof F!="object"?null:(F=x&&F[x]||F["@@iterator"],typeof F=="function"?F:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,M={};function S(F,O,J){this.props=F,this.context=O,this.refs=M,this.updater=J||v}S.prototype.isReactComponent={},S.prototype.setState=function(F,O){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,O,"setState")},S.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function A(){}A.prototype=S.prototype;function E(F,O,J){this.props=F,this.context=O,this.refs=M,this.updater=J||v}var C=E.prototype=new A;C.constructor=E,_(C,S.prototype),C.isPureReactComponent=!0;var I=Array.isArray;function D(){}var B={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function G(F,O,J){var q=J.ref;return{$$typeof:n,type:F,key:O,ref:q!==void 0?q:null,props:J}}function k(F,O){return G(F.type,O,F.props)}function V(F){return typeof F=="object"&&F!==null&&F.$$typeof===n}function U(F){var O={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(J){return O[J]})}var $=/\/+/g;function X(F,O){return typeof F=="object"&&F!==null&&F.key!=null?U(""+F.key):O.toString(36)}function ee(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(D,D):(F.status="pending",F.then(function(O){F.status==="pending"&&(F.status="fulfilled",F.value=O)},function(O){F.status==="pending"&&(F.status="rejected",F.reason=O)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function z(F,O,J,q,Q){var ne=typeof F;(ne==="undefined"||ne==="boolean")&&(F=null);var Z=!1;if(F===null)Z=!0;else switch(ne){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(F.$$typeof){case n:case e:Z=!0;break;case h:return Z=F._init,z(Z(F._payload),O,J,q,Q)}}if(Z)return Q=Q(F),Z=q===""?"."+X(F,0):q,I(Q)?(J="",Z!=null&&(J=Z.replace($,"$&/")+"/"),z(Q,O,J,"",function(ze){return ze})):Q!=null&&(V(Q)&&(Q=k(Q,J+(Q.key==null||F&&F.key===Q.key?"":(""+Q.key).replace($,"$&/")+"/")+Z)),O.push(Q)),1;Z=0;var se=q===""?".":q+":";if(I(F))for(var me=0;me<F.length;me++)q=F[me],ne=se+X(q,me),Z+=z(q,O,J,ne,Q);else if(me=y(F),typeof me=="function")for(F=me.call(F),me=0;!(q=F.next()).done;)q=q.value,ne=se+X(q,me++),Z+=z(q,O,J,ne,Q);else if(ne==="object"){if(typeof F.then=="function")return z(ee(F),O,J,q,Q);throw O=String(F),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}return Z}function K(F,O,J){if(F==null)return F;var q=[],Q=0;return z(F,q,"","",function(ne){return O.call(J,ne,Q++)}),q}
vendor: 8,961 bytes, line 1
1function ae(F){if(F._status===-1){var O=F._result;O=O(),O.then(function(J){(F._status===0||F._status===-1)&&(F._status=1,F._result=J)},function(J){(F._status===0||F._status===-1)&&(F._status=2,F._result=J)}),F._status===-1&&(F._status=0,F._result=O)}if(F._status===1)return F._result.default;throw F._result}var oe=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var O=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(O))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},re={map:K,forEach:function(F,O,J){K(F,function(){O.apply(this,arguments)},J)},count:function(F){var O=0;return K(F,function(){O++}),O},toArray:function(F){return K(F,function(O){return O})||[]},only:function(F){if(!V(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return Hn.Activity=p,Hn.Children=re,Hn.Component=S,Hn.Fragment=t,Hn.Profiler=s,Hn.PureComponent=E,Hn.StrictMode=r,Hn.Suspense=u,Hn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Hn.__COMPILER_RUNTIME={__proto__:null,c:function(F){return B.H.useMemoCache(F)}},Hn.cache=function(F){return function(){return F.apply(null,arguments)}},Hn.cacheSignal=function(){return null},Hn.cloneElement=function(F,O,J){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var q=_({},F.props),Q=F.key;if(O!=null)for(ne in O.key!==void 0&&(Q=""+O.key),O)!P.call(O,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&O.ref===void 0||(q[ne]=O[ne]);var ne=arguments.length-2;if(ne===1)q.children=J;else if(1<ne){for(var Z=Array(ne),se=0;se<ne;se++)Z[se]=arguments[se+2];q.children=Z}return G(F.type,Q,q)},Hn.createContext=function(F){return F={$$typeof:o,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:a,_context:F},F},Hn.createElement=function(F,O,J){var q,Q={},ne=null;if(O!=null)for(q in O.key!==void 0&&(ne=""+O.key),O)P.call(O,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(Q[q]=O[q]);var Z=arguments.length-2;if(Z===1)Q.children=J;else if(1<Z){for(var se=Array(Z),me=0;me<Z;me++)se[me]=arguments[me+2];Q.children=se}if(F&&F.defaultProps)for(q in Z=F.defaultProps,Z)Q[q]===void 0&&(Q[q]=Z[q]);return G(F,ne,Q)},Hn.createRef=function(){return{current:null}},Hn.forwardRef=function(F){return{$$typeof:l,render:F}},Hn.isValidElement=V,Hn.lazy=function(F){return{$$typeof:h,_payload:{_status:-1,_result:F},_init:ae}},Hn.memo=function(F,O){return{$$typeof:d,type:F,compare:O===void 0?null:O}},Hn.startTransition=function(F){var O=B.T,J={};B.T=J;try{var q=F(),Q=B.S;Q!==null&&Q(J,q),typeof q=="object"&&q!==null&&typeof q.then=="function"&&q.then(D,oe)}catch(ne){oe(ne)}finally{O!==null&&J.types!==null&&(O.types=J.types),B.T=O}},Hn.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Hn.use=function(F){return B.H.use(F)},Hn.useActionState=function(F,O,J){return B.H.useActionState(F,O,J)},Hn.useCallback=function(F,O){return B.H.useCallback(F,O)},Hn.useContext=function(F){return B.H.useContext(F)},Hn.useDebugValue=function(){},Hn.useDeferredValue=function(F,O){return B.H.useDeferredValue(F,O)},Hn.useEffect=function(F,O){return B.H.useEffect(F,O)},Hn.useEffectEvent=function(F){return B.H.useEffectEvent(F)},Hn.useId=function(){return B.H.useId()},Hn.useImperativeHandle=function(F,O,J){return B.H.useImperativeHandle(F,O,J)},Hn.useInsertionEffect=function(F,O){return B.H.useInsertionEffect(F,O)},Hn.useLayoutEffect=function(F,O){return B.H.useLayoutEffect(F,O)},Hn.useMemo=function(F,O){return B.H.useMemo(F,O)},Hn.useOptimistic=function(F,O){return B.H.useOptimistic(F,O)},Hn.useReducer=function(F,O,J){return B.H.useReducer(F,O,J)},Hn.useRef=function(F){return B.H.useRef(F)},Hn.useState=function(F){return B.H.useState(F)},Hn.useSyncExternalStore=function(F,O,J){return B.H.useSyncExternalStore(F,O,J)},Hn.useTransition=function(){return B.H.useTransition()},Hn.version="19.2.8",Hn}var VP;function lv(){return VP||(VP=1,JA.exports=EH()),JA.exports}var T=lv();const Ft=LM(T),_h=NH({__proto__:null,default:Ft},[T]),WB=T.createContext(void 0),cv=n=>{const e=T.useContext(WB);if(n)return n;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},jH=({client:n,children:e})=>(T.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),i.jsx(WB.Provider,{value:n,children:e})),TH={setTimeout:(n,e)=>setTimeout(n,e),clearTimeout:n=>clearTimeout(n),setInterval:(n,e)=>setInterval(n,e),clearInterval:n=>clearInterval(n)};var RH=class{#t=TH;#e=!1;setTimeoutProvider(n){this.#t=n}setTimeout(n,e){return this.#t.setTimeout(n,e)}clearTimeout(n){this.#t.clearTimeout(n)}setInterval(n,e){return this.#t.setInterval(n,e)}clearInterval(n){this.#t.clearInterval(n)}};const Lm=new RH;function PH(n){setTimeout(n,0)}const DH=typeof window>"u"||"Deno"in globalThis;function qi(){}function kH(n,e){return typeof n=="function"?n(e):n}function $B(n){return typeof n=="number"&&n>=0&&n!==1/0}function XB(n,e){return Math.max(n+(e||0)-Date.now(),0)}function Ks(n,e){return typeof n=="function"?n(e):n}function WP(n,e){const{type:t="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=n;if(o){if(r){if(e.queryHash!==l2(o,e.options))return!1}else if(!Cx(e.queryKey,o))return!1}if(t!=="all"){const u=e.isActive();if(t==="active"&&!u||t==="inactive"&&u)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||a&&!a(e))}function $P(n,e){const{exact:t,status:r,predicate:s,mutationKey:a}=n;if(a){if(!e.options.mutationKey)return!1;if(t){if(lh(e.options.mutationKey)!==lh(a))return!1}else if(!Cx(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function l2(n,e){return(e?.queryKeyHashFn||lh)(n)}function lh(n){return JSON.stringify(n,(e,t)=>uj(t)?Object.keys(t).sort().reduce((r,s)=>(r[s]=t[s],r),{}):t)}function Cx(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(n&&e&&typeof n=="object"&&typeof e=="object"){if(Array.isArray(n)&&Array.isArray(e)){for(let r=0;r<e.length;r++)if(!Cx(n[r],e[r]))return!1;return!0}const t=Object.keys(e);for(const r of t)if(!Cx(n[r],e[r]))return!1;return!0}return!1}const IH=Object.prototype.hasOwnProperty;function c2(n,e,t=0){if(n===e)return n;if(t>500)return e;const r=XP(n)&&XP(e);if(!r&&!(uj(n)&&uj(e)))return e;const s=(r?n:Object.keys(n)).length,a=r?e:Object.keys(e),o=a.length,l=r?new Array(o):{};let u=0;for(let d=0;d<o;d++){const h=r?d:a[d],p=n[h],x=e[h];if(p===x){l[h]=p,(r?d<s:IH.call(n,h))&&u++;continue}if(p===null||x===null||typeof p!="object"||typeof x!="object"){l[h]=x;continue}const y=c2(p,x,t+1);l[h]=y,y===p&&u++}return s===o&&u===s?n:l}function oy(n,e){if(!e||Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(n[t]!==e[t])return!1;return!0}function XP(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function uj(n){if(!qP(n))return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!qP(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function qP(n){return Object.prototype.toString.call(n)==="[object Object]"}function BH(n){return new Promise(e=>{Lm.setTimeout(e,n)})}function dj(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?c2(n,e):e}function LH(n,e,t=0){const r=[...n,e];return t&&r.length>t?r.slice(1):r}function OH(n,e,t=0){const r=[e,...n];return t&&r.length>t?r.slice(0,-1):r}const qo=Symbol();function qB(n,e){return!n.queryFn&&e?.initialPromise?()=>e.initialPromise:!n.queryFn||n.queryFn===qo?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function u2(n,e){return typeof n=="function"?n(...e):!!n}function FH(n,e,t){let r=!1,s;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(s??=e(),r||(r=!0,s.aborted?t():s.addEventListener("abort",t,{once:!0})),s)}),n}let UH=()=>DH;const d2=()=>UH();var wp=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},zH=class extends wp{#t;#e;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const e=()=>n();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(n){this.#n=n,this.#e?.(),this.#e=n(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(n){this.#t!==n&&(this.#t=n,this.onFocus())}onFocus(){const n=this.isFocused();
1this.listeners.forEach(e=>{e(n)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}};const f2=new zH,GH=PH;function HH(){let n=[],e=0,t=l=>{l()},r=l=>{l()},s=GH;const a=l=>{e?n.push(l):s(()=>{t(l)})},o=()=>{const l=n;n=[],l.length&&s(()=>{r(()=>{l.forEach(u=>{t(u)})})})};return{batch:l=>{let u;e++;try{u=l()}finally{e--,e||o()}return u},batchCalls:l=>(...u)=>{a(()=>{l(...u)})},schedule:a,setNotifyFunction:l=>{t=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}const ei=HH();var VH=class extends wp{#t=!0;#e;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const e=()=>n(!0),t=()=>n(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(n){this.#n=n,this.#e?.(),this.#e=n(this.setOnline.bind(this))}setOnline(n){this.#t!==n&&(this.#t=n,this.listeners.forEach(e=>{e(n)}))}isOnline(){return this.#t}};const p_=new VH;function WH(n){return Math.min(1e3*2**n,3e4)}function YB(n){return(n??"online")==="online"?p_.isOnline():!0}var fj=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function QB(n){let e=!1,t=0,r,s="pending",a,o;const l=new Promise((A,E)=>{a=A,o=E});l.catch(qi);const u=()=>s!=="pending",d=A=>{if(!u()){const E=new fj(A);_(E),n.onCancel?.(E)}},h=()=>{e=!0},p=()=>{e=!1},x=()=>f2.isFocused()&&(n.networkMode==="always"||p_.isOnline())&&n.canRun(),y=()=>YB(n.networkMode)&&n.canRun(),v=A=>{u()||(r?.(),s="resolved",a(A))},_=A=>{u()||(r?.(),s="rejected",o(A))},M=()=>new Promise(A=>{r=E=>{(u()||x())&&A(E)},n.onPause?.()}).then(()=>{r=void 0,u()||n.onContinue?.()}),S=()=>{if(u())return;let A;const E=t===0?n.initialPromise:void 0;try{A=E??n.fn()}catch(C){A=Promise.reject(C)}Promise.resolve(A).then(v).catch(C=>{if(u())return;const I=n.retry??(d2()?0:3),D=n.retryDelay??WH,B=typeof D=="function"?D(t,C):D,P=I===!0||typeof I=="number"&&t<I||typeof I=="function"&&I(t,C);if(e||!P){_(C);return}t++,n.onFail?.(t,C),BH(B).then(()=>x()?void 0:M()).then(()=>{e?_(C):S()})})};return{promise:l,status:()=>s,cancel:d,continue:()=>(r?.(),l),cancelRetry:h,continueRetry:p,canStart:y,start:()=>(y()?S():M().then(S),l)}}var KB=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$B(this.gcTime)&&(this.#t=Lm.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(d2()?1/0:3e5))}clearGcTimeout(){this.#t!==void 0&&(Lm.clearTimeout(this.#t),this.#t=void 0)}};function $H(n){return{onFetch:(e,t)=>{const r=e.options,s=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let l={pages:[],pageParams:[]},u=0;const d=async()=>{let h=!1;const p=v=>{FH(v,()=>e.signal,()=>h=!0)},x=qB(e.options,e.fetchOptions),y=async(v,_,M)=>{if(h)return Promise.reject(e.signal.reason);if(_==null&&v.pages.length)return Promise.resolve(v);const A=(()=>{const D={client:e.client,queryKey:e.queryKey,pageParam:_,direction:M?"backward":"forward",meta:e.options.meta};return p(D),D})(),E=await x(A),{maxPages:C}=e.options,I=M?OH:LH;return{pages:I(v.pages,E,C),pageParams:I(v.pageParams,_,C)}};if(s&&a.length){const v=s==="backward",_=v?JB:hj,M={pages:a,pageParams:o};l=await y(M,_(r,M),v)}else{const v=n??a.length;do{const _=u===0?o[0]??r.initialPageParam:hj(r,l);if(u>0&&_==null)break;l=await y(l,_),u++}while(u<v)}return l};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t):e.fetchFn=d}}}function hj(n,{pages:e,pageParams:t}){const r=e.length-1;return e.length>0?n.getNextPageParam(e[r],e,t[r],t):void 0}function JB(n,{pages:e,pageParams:t}){return e.length>0?n.getPreviousPageParam?.(e[0],e,t[0],t):void 0}function XH(n,e){return e?hj(n,e)!=null:!1}function qH(n,e){return!e||!n.getPreviousPageParam?!1:JB(n,e)!=null}var YH=class extends KB{#t;#e;#n;#r;#s;#i;#a;#l;constructor(n){super(),this.#l=!1,this.#a=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#s=n.client,this.#r=this.#s.getQueryCache(),this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#e=QP(this.options),this.state=n.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#i?.promise}setOptions(n){if(this.options={...this.#a,...n},n?._type&&(this.#t=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=QP(this.options);e.data!==void 0&&(this.setState(YP(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(n,e){const t=dj(this.state.data,n,this.options);return this.#o({data:t,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),t}setState(n){this.#o({type:"setState",state:n})}cancel(n){const e=this.#i?.promise;return this.#i?.cancel(n),e?e.then(qi).catch(qi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>Ks(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qo||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdate
vendor: 4,710 bytes, line 1
1Count>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Ks(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!XB(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const e=this.observers.indexOf(n);e!==-1&&(this.observers.splice(e,1),this.observers.length||(this.#i&&(this.#l||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(n&&this.setOptions(n),!this.options.queryFn){const u=this.observers.find(d=>d.options.queryFn);u&&this.setOptions(u.options)}const t=new AbortController,r=u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(this.#l=!0,t.signal)})},s=()=>{const u=qB(this.options,e),h=(()=>{const p={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(p),p})();return this.#l=!1,this.options.persister?this.options.persister(u,h,this):u(h)},o=(()=>{const u={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(u),u})();(this.#t==="infinite"?$H(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#o({type:"fetch",meta:o.fetchOptions?.meta});const l=this.#i=QB({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:u=>{u instanceof fj&&u.revert&&this.setState({...this.#n,fetchStatus:"idle"}),t.abort()},onFail:(u,d)=>{this.#o({type:"failed",failureCount:u,error:d})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const u=await l.start();if(u===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#r.config.onSuccess?.(u,this),this.#r.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof fj){if(u.silent)return this.#i.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#o({type:"error",error:u}),this.#r.config.onError?.(u,this),this.#r.config.onSettled?.(this.state.data,u,this),u}finally{this.#i===l&&(this.#i=void 0),this.scheduleGc()}}#o(n){const e=t=>{switch(n.type){case"failed":return{...t,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...ZB(t.data,this.options),fetchMeta:n.meta??null};case"success":const r={...t,...YP(n.data,n.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?r:void 0,r;case"error":const s=n.error;return{...t,error:s,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...n.state}}};this.state=e(this.state),ei.batch(()=>{this.observers.slice().forEach(t=>{t.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:n})})}};function ZB(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:YB(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function YP(n,e){return{data:n,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function QP(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,r=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdate
1Count:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var uv=class extends wp{#t;#e=void 0;#n=void 0;#r=void 0;#s;#i;#a;#l;#o;#h;#c;#u;#d;#m=new Set;constructor(n,e){super(),this.options=e,this.#t=n,this.#a=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),KP(this.#e,this.options)?this.#f():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return mj(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return mj(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#e.removeObserver(this)}setOptions(n){const e=this.options,t=this.#e;if(this.options=this.#t.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ks(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),e._defaulted&&!oy(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&JP(this.#e,t,this.options,e)&&this.#f(),this.updateResult(),r&&(this.#e!==t||Ks(this.options.enabled,this.#e)!==Ks(e.enabled,this.#e)||Ks(this.options.staleTime,this.#e)!==Ks(e.staleTime,this.#e))&&this.#g();const s=this.#x();r&&(this.#e!==t||Ks(this.options.enabled,this.#e)!==Ks(e.enabled,this.#e)||s!==this.#d)&&this.#b(s)}getOptimisticResult(n){const e=this.#t.getQueryCache().build(this.#t,n),t=this.createResult(e,n);return oy(this.getCurrentResult(),t)||(this.#r=t,this.#i=this.options,this.#s=this.#e.state),t}getCurrentResult(){return this.#r}trackResult(n,e){return new Proxy(n,{get:(t,r)=>(this.trackProp(r),e?.(r),Reflect.get(t,r))})}trackProp(n){this.#m.add(n)}getCurrentQuery(){return this.#e}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const e=this.#t.defaultQueryOptions(n),t=this.#t.getQueryCache().build(this.#t,e);let r=()=>{},s;const a=new Promise(o=>{s=o,r=this.#t.getQueryCache().subscribe(l=>{l.type==="updated"&&l.query.queryHash===t.queryHash&&t.state.data!==void 0&&(r(),o(this.createResult(t,e)))})});return Promise.race([t.fetch().then(()=>{const o=this.createResult(t,e);return s?.(o),o}).finally(()=>{r()}),a])}fetch(n){return this.#f({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#f(n){this.#S();let e=this.#e.fetch(this.options,n);return n?.throwOnError||(e=e.catch(qi)),e}#p(n){return!d2()&&Ks(this.options.enabled,this.#e)!==!1&&$B(n)}#g(){this.#v();const n=Ks(this.options.staleTime,this.#e);if(this.#r.isStale||!this.#p(n))return;const e=XB(this.#r.dataUpdatedAt,n)+1;this.#c=Lm.setTimeout(()=>{this.#r.isStale||this.updateResult()},e)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#b(n){this.#w(),this.#d=n,!(this.#d===0||!this.#p(this.#d))&&(this.#u=Lm.setInterval(()=>{(this.options.refetchIntervalInBackground||f2.isFocused())&&this.#f()},this.#d))}#y(){this.#g(),this.#b(this.#x())}#v(){this.#c!==void 0&&(Lm.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u!==void 0&&(Lm.clearInterval(this.#u),this.#u=void 0)}createResult(n,e){const t=this.#e,r=this.options,s=this.#r,a=this.#s,o=this.#i,l=n!==t?n.state:this.#n,{state:u}=n;let d={...u},h=!1,p;if(e._optimisticResults){const I=this.hasListeners(),D=!I&&KP(n,e),B=I&&JP(n,t,e,r);(D||B)&&(d={...d,...ZB(u.data,n.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:x,errorUpdatedAt:y,status:v}=d;p=d.data;let _=!1;if(e.placeholderData!==void 0&&p===void 0&&v==="pending"){let I;s?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(I=s.data,_=!0):I=typeof e.placeholderData=="function"?e.placeholderData(this.#h?.state.data,this.#h):e.placeholderData,I!==void 0&&(v="success",p=dj(s?.data,I,e),h=!0)}if(e.select&&p!==void 0&&!_)if(s&&p===a?.data&&e.select===this.#l)p=this.#o;else try{this.#l=e.select,p=e.select(p),p=dj(s?.data,p,e),this.#o=p,this.#a=null}catch(I){this.#a=I}else p===void 0&&(this.#a=null);this.#a&&(x=this.#a,p=this.#o,y=Date.now(),v="error",h=!1);const M=d.fetchStatus==="fetching",S=v==="pending",A=v==="error",E=S&&M,C=p!==void 0;return{status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v==="success",isError:A,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:x,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdate
1Count:d.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:M,isRefetching:M&&!S,isLoadingError:A&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:A&&C,isStale:h2(n,e),refetch:this.refetch,isEnabled:Ks(e.enabled,n)!==!1}}updateResult(){const n=this.#r,e=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#i=this.options,this.#s.data!==void 0&&(this.#h=this.#e),oy(e,n))return;this.#r=e;const r=(()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!this.#m.size)return!0;const o=new Set(a??this.#m);return this.options.throwOnError&&o.add("error"),Object.keys(this.#r).some(l=>{const u=l;return this.#r[u]!==n[u]&&o.has(u)})})();ei.batch(()=>{r&&this.listeners.forEach(s=>{s(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}#S(){const n=this.#t.getQueryCache().build(this.#t,this.options);if(n===this.#e)return;const e=this.#e;this.#e=n,this.#n=n.state,this.hasListeners()&&(e?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function QH(n,e){return Ks(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&Ks(e.retryOnMount,n)===!1)}function KP(n,e){return QH(n,e)||n.state.data!==void 0&&mj(n,e,e.refetchOnMount)}function mj(n,e,t){if(Ks(e.enabled,n)!==!1&&Ks(e.staleTime,n)!=="static"){const r=typeof t=="function"?t(n):t;return r==="always"||r!==!1&&h2(n,e)}return!1}function JP(n,e,t,r){return(n!==e||Ks(r.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&h2(n,t)}function h2(n,e){return Ks(e.enabled,n)!==!1&&n.isStaleByTime(Ks(e.staleTime,n))}var eL=class extends uv{constructor(n,e){super(n,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(n){n._type="infinite",super.setOptions(n)}getOptimisticResult(n){return n._type="infinite",super.getOptimisticResult(n)}fetchNextPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"backward"}}})}createResult(n,e){const{state:t}=n,r=super.createResult(n,e),{isFetching:s,isRefetching:a,isError:o,isRefetchError:l}=r,u=t.fetchMeta?.fetchMore?.direction,d=o&&u==="forward",h=s&&u==="forward",p=o&&u==="backward",x=s&&u==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:XH(e,t.data),hasPreviousPage:qH(e,t.data),isFetchNextPageError:d,isFetchingNextPage:h,isFetchPreviousPageError:p,isFetchingPreviousPage:x,isRefetchError:l&&!d&&!p,isRefetching:a&&!h&&!x}}},KH=class extends KB{#t;#e;#n;#r;constructor(n){super(),this.#t=n.client,this.mutationId=n.mutationId,this.#n=n.mutationCache,this.#e=[],this.state=n.state||tL(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#e.includes(n)||(this.#e.push(n),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#e=this.#e.filter(e=>e!==n),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){const e=()=>{this.#s({type:"continue"})},t={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=QB({fn:()=>this.options.mutationFn?this.options.mutationFn(n,t):Promise.reject(new Error("No mutationFn found")),onFail:(o,l)=>{this.#s({type:"failed",failureCount:o,error:l})},onPause:()=>{this.#s({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),s=this.state.status==="pending",a=!r.canStart();try{if(s)e();else{this.#s({type:"pending",variables:n,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,t);const l=await this.options.onMutate?.(n,t);l!==this.state.context&&this.#s({type:"pending",context:l,variables:n,isPaused:a})}const o=await r.start();return await this.#n.config.onSuccess?.(o,n,this.state.context,this,t),await this.options.onSuccess?.(o,n,this.state.context,t),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,t),await this.options.onSettled?.(o,null,n,this.state.context,t),this.#s({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,n,this.state.context,this,t)}catch(l){Promise.reject(l)}try{await this.options.onError?.(o,n,this.state.context,t)}catch(l){Promise.reject(l)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,t)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,o,n,this.state.context,t)}catch(l){Promise.reject(l)}throw this.#s({type:"error",error:o}),o}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#s(n){const e=t=>{switch(n.type){case"failed":return{...t,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};
vendor: 1,577 bytes, line 1
1case"pending":return{...t,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...t,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:n.error,failureCount:t.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=e(this.state),ei.batch(()=>{this.#e.forEach(t=>{t.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function tL(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var JH=class extends wp{#t;#e;#n;constructor(n={}){super(),this.config=n,this.#t=new Set,this.#e=new Map,this.#n=0}build(n,e,t){const r=new KH({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(e),state:t});return this.add(r),r}add(n){this.#t.add(n);const e=hw(n);if(typeof e=="string"){const t=this.#e.get(e);t?t.push(n):this.#e.set(e,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#t.delete(n)){const e=hw(n);if(typeof e=="string"){const t=this.#e.get(e);if(t)if(t.length>1){const r=t.indexOf(n);r!==-1&&t.splice(r,1)}else t[0]===n&&this.#e.delete(e)}}this.notify({type:"removed",mutation:n})}canRun(n){const e=hw(n);if(typeof e=="string"){const t=this.#e.get(e)?.find(r=>r.state.status==="pending");return!t||t===n}else return!0}runNext(n){const e=hw(n);return typeof e=="string"?this.#e.get(e)?.find(t=>
1t!==n&&t.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ei.batch(()=>{this.#t.forEach(n=>{this.notify({type:"removed",mutation:n})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(n){const e={exact:!0,...n};return this.getAll().find(t=>$P(e,t))}findAll(n={}){return this.getAll().filter(e=>$P(n,e))}notify(n){ei.batch(()=>{this.listeners.forEach(e=>{e(n)})})}resumePausedMutations(){const n=this.getAll().filter(e=>e.state.isPaused);return ei.batch(()=>Promise.all(n.map(e=>e.continue().catch(qi))))}};function hw(n){return n.options.scope?.id}var ZH=class extends wp{#t;#e=void 0;#n;#r;constructor(e,t){super(),this.#t=e,this.setOptions(t),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#t.defaultMutationOptions(e),oy(this.options,t)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&lh(t.mutationKey)!==lh(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#s())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#s(),this.#i(e)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#s(),this.#i()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(e)}#s(){const e=this.#n?.state??tL();this.#e={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#i(e){ei.batch(()=>{if(this.#r&&this.hasListeners()){const t=this.#e.variables,r=this.#e.context,s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,t,r,s)}catch(a){Promise.reject(a)}try{this.#r.onSettled?.(e.data,null,t,r,s)}catch(a){Promise.reject(a)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,t,r,s)}catch(a){Promise.reject(a)}try{this.#r.onSettled?.(void 0,e.error,t,r,s)}catch(a){Promise.reject(a)}}}this.listeners.forEach(t=>{t(this.#e)})})}};function ZP(n,e){const t=new Set(e);return n.filter(r=>!t.has(r))}var eV=class extends wp{#t;#e;#n;#r;#s;#i;#a;#l;#o;#h=[];constructor(n,e,t){super(),this.#t=n,this.#r=t,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(n=>{n.subscribe(e=>{this.#f(n,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(n=>{n.destroy()})}setQueries(n,e){this.#n=n,this.#r=e,ei.batch(()=>{const t=this.#s,r=this.#m(this.#n);r.forEach(h=>h.observer.setOptions(h.defaultedQueryOptions));const s=r.map(h=>h.observer),a=s.map(h=>h.getCurrentResult()),o=t.length!==s.length,l=s.some((h,p)=>h!==t[p]),u=o||l,d=u?!0:a.some((h,p)=>{const x=this.#e[p];return!x||!oy(h,x)});!u&&!d||(u&&(this.#h=r,this.#s=s),this.#e=a,this.hasListeners()&&(u&&(ZP(t,s).forEach(h=>{h.destroy()}),ZP(s,t).forEach(h=>{h.subscribe(p=>{this.#f(h,p)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(n=>n.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(n,e){const t=this.#m(n),r=t.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),s=t.map(a=>a.defaultedQueryOptions.queryHash);return[r,a=>this.#u(a??r,e,s),()=>this.#c(r,t)]}#c(n,e){const t=new Set;return e.map((r,s)=>{const a=n[s];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,o=>{t.has(o)||(t.add(o),e.forEach(l=>{l.observer.trackProp(o)}))})})}#u(n,e,t){if(e){const r=this.#o,s=t!==void 0&&r!==void 0&&(r.length!==t.length||t.some((a,o)=>a!==r[o]));return(this.#e!==this.#l||s||e!==this.#a)&&(this.#a=e,this.#l=this.#e,t!==void 0&&(this.#o=t),this.#i=c2(this.#i,e(n))),this.#i}return n}#d(){return!this.#r?.combine||this.#s.some((n,e)=>n.options.suspense&&this.#e[e]?.data===void 0)}#m(n){const e=new Map;
1this.#s.forEach(r=>{const s=r.options.queryHash;if(!s)return;const a=e.get(s);a?a.push(r):e.set(s,[r])});const t=[];return n.forEach(r=>{const s=this.#t.defaultQueryOptions(r),a=e.get(s.queryHash)?.shift()??new uv(this.#t,s);t.push({defaultedQueryOptions:s,observer:a})}),t}#f(n,e){const t=this.#s.indexOf(n);t!==-1&&(this.#e=this.#e.slice(),this.#e[t]=e,this.#p())}#p(){if(this.hasListeners()){const n=this.#d(),e=this.#i,t=n?e:this.#u(this.#c(this.#e,this.#h),this.#r?.combine);(n||e!==t)&&ei.batch(()=>{this.listeners.forEach(r=>{r(this.#e)})})}}},tV=class extends wp{#t;constructor(n={}){super(),this.config=n,this.#t=new Map}build(n,e,t){const r=e.queryKey,s=e.queryHash??l2(r,e);let a=this.get(s);return a||(a=new YH({client:n,queryKey:r,queryHash:s,options:n.defaultQueryOptions(e),state:t,defaultOptions:n.getQueryDefaults(r)}),this.add(a)),a}add(n){this.#t.has(n.queryHash)||(this.#t.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const e=this.#t.get(n.queryHash);e&&(n.destroy(),e===n&&this.#t.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){ei.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#t.get(n)}getAll(){return[...this.#t.values()]}find(n){const e={exact:!0,...n};return this.getAll().find(t=>WP(e,t))}findAll(n={}){const e=this.getAll();return Object.keys(n).length>0?e.filter(t=>WP(n,t)):e}notify(n){ei.batch(()=>{this.listeners.forEach(e=>{e(n)})})}onFocus(){ei.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){ei.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},nV=class{#t;#e;#n;#r;#s;#i;#a;#l;constructor(n={}){this.#t=n.queryCache||new tV,this.#e=n.mutationCache||new JH,this.#n=n.defaultOptions||{},this.#r=new Map,this.#s=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#a=f2.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#l=p_.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#a?.(),this.#a=void 0,this.#l?.(),this.#l=void 0)}isFetching(n){return this.#t.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#e.findAll({...n,status:"pending"}).length}getQueryData(n){const e=this.defaultQueryOptions({queryKey:n});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=this.#t.build(this,e),r=t.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(Ks(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(n){return this.#t.findAll(n).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(n,e,t){const r=this.defaultQueryOptions({queryKey:n}),s=this.#t.get(r.queryHash)?.state.data,a=kH(e,s);if(a!==void 0)return this.#t.build(this,r).setData(a,{...t,manual:!0})}setQueriesData(n,e,t){return ei.batch(()=>this.#t.findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,e,t)]))}getQueryState(n){const e=this.defaultQueryOptions({queryKey:n});return this.#t.get(e.queryHash)?.state}removeQueries(n){const e=this.#t;ei.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=this.#t;return ei.batch(()=>{const r=t.findAll(n),s=new Set(r);return r.forEach(a=>{a.reset()}),this.refetchQueries({type:"active",predicate:a=>s.has(a)},e)})}cancelQueries(n,e={}){const t={revert:!0,...e},r=ei.batch(()=>this.#t.findAll(n).map(s=>s.cancel(t)));return Promise.all(r).then(qi).catch(qi)}invalidateQueries(n,e={}){return ei.batch(()=>(this.#t.findAll(n).forEach(t=>{t.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},e)))}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},r=ei.batch(()=>this.#t.findAll(n).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,t);return t.throwOnError||(a=a.catch(qi)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(qi)}async query(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=this.#t.build(this,e),r=t.isStaleByTime(Ks(e.staleTime,t))?await t.fetch(e):t.state.data,s=e.select;return s?s(r):r}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=this.#t.build(this,e);return t.isStaleByTime(Ks(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(qi).catch(qi)}infiniteQuery(n){return n._type="infinite",this.query(n)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(qi).catch(qi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return p_.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(n){this.#n=n}setQueryDefaults(n,e){this.#r.set(lh(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...this.#r.values()],t={};return e.forEach(r=>{Cx(n,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(n,e){this.#s.set(lh(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...this.#s.values()],t={};return e.forEach(r=>{Cx(n,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=l2(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===qo&&(e.enabled=!1),e}defaultMutationOptions(n){return n?._defaulted?n:{...this.#n.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};const nL=T.createContext(!1),rL=()=>T.useContext(nL);nL.Provider;function rV(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}const sV=T.createContext(rV()),sL=()=>T.useContext(sV),iL=(n,e,t)=>{const r=t?.state.error&&typeof n.throwOnError=="function"?u2(n.throwOnError,[t.state.error,t]):n.throwOnError;(n.suspense||r)&&(e.isReset()||(n.retryOnMount=!1))},aL=n=>{T.useEffect(()=>{n.clearReset()},[n])},oL=({result:n,errorResetBoundary:e,throwOnError:t,query:r,suspense:s}
1)=>n.isError&&!e.isReset()&&!n.isFetching&&r&&(s&&n.data===void 0||u2(t,[n.error,r])),m2=(n,e)=>e.state.data===void 0,lL=n=>{if(n.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...s)=>t(r(...s)):t(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},pj=(n,e)=>n?.suspense&&e.isPending,cL=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function uL({queries:n,...e},t){const r=cv(t),s=rL(),a=sL(),o=e.subscribed!==!1,l=T.useMemo(()=>n.map(_=>{const M=r.defaultQueryOptions(_);return M._optimisticResults=s?"isRestoring":o?"optimistic":void 0,M}),[n,r,s,o]);l.forEach(_=>{lL(_);const M=r.getQueryCache().get(_.queryHash);iL(_,a,M)}),aL(a);const[u]=T.useState(()=>new eV(r,l,e)),[d,h,p]=u.getOptimisticResult(l,e.combine),x=!s&&o;T.useSyncExternalStore(T.useCallback(_=>x?u.subscribe(ei.batchCalls(_)):qi,[u,x]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),T.useEffect(()=>{u.setQueries(l,e)},[l,e,u]);const y=d.some((_,M)=>pj(l[M],_))?d.flatMap((_,M)=>{const S=l[M];if(S&&pj(S,_)){const A=new uv(r,S);return cL(S,A,a)}return[]}):[];if(y.length>0)throw Promise.all(y);const v=d.find((_,M)=>{const S=l[M];return S&&oL({result:_,errorResetBoundary:a,throwOnError:S.throwOnError,query:r.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(v)throw v.error;return h(p())}function OM(n,e,t){const r=rL(),s=sL(),a=cv(t),o=a.defaultQueryOptions(n),l=a.getQueryCache().get(o.queryHash),u=n.subscribed!==!1;o._optimisticResults=r?"isRestoring":u?"optimistic":void 0,lL(o),iL(o,s,l),aL(s);const[d]=T.useState(()=>new e(a,o)),h=d.getOptimisticResult(o),p=!r&&u;if(T.useSyncExternalStore(T.useCallback(x=>{const y=p?d.subscribe(ei.batchCalls(x)):qi;return d.updateResult(),y},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),T.useEffect(()=>{d.setOptions(o)},[o,d]),pj(o,h))throw cL(o,d,s);if(oL({result:h,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw h.error;return o.notifyOnChangeProps?h:d.trackResult(h)}function iV(n,e){return OM(n,uv,e)}function aV(n,e){return OM({...n,enabled:!0,suspense:!0,throwOnError:m2,placeholderData:void 0},uv,e)}function oV(n,e){return OM({...n,enabled:!0,suspense:!0,throwOnError:m2,placeholderData:void 0},eL,e)}function lV(n,e){return uL({...n,queries:n.queries.map(t=>({...t,suspense:!0,throwOnError:m2,enabled:!0,placeholderData:void 0}))},e)}function cV(n,e){const t=cv(e);t.getQueryState(n.queryKey)||t.query(n).catch(qi)}function uV(n,e){const t=cv(e);t.getQueryState(n.queryKey)||t.infiniteQuery(n).catch(qi)}function dV(n,e){const t=cv(e),[r]=T.useState(()=>new ZH(t,n));T.useEffect(()=>{r.setOptions(n)},[r,n]);const s=T.useSyncExternalStore(T.useCallback(o=>r.subscribe(ei.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=T.useCallback((...o)=>{r.mutate(o[0],o[1]).catch(qi)},[r]);if(s.error&&u2(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function fV(n,e){return OM(n,eL,e)}function ap(n){return!!n&&!Array.isArray(n)&&typeof n=="object"}function hV(){return Object.create(null)}const mV=typeof Symbol=="function"&&!!Symbol.asyncIterator;function dL(n){return mV&&ap(n)&&Symbol.asyncIterator in n}var pV=Object.create,fL=Object.defineProperty,gV=Object.getOwnPropertyDescriptor,hL=Object.getOwnPropertyNames,xV=Object.getPrototypeOf,bV=Object.prototype.hasOwnProperty,dv=(n,e)=>function(){return e||(0,n[hL(n)[0]])((e={exports:{}}).exports,e),e.exports},yV=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=hL(e),a=0,o=s.length,l;a<o;a++)l=s[a],!bV.call(n,l)&&l!==t&&fL(n,l,{get:(u=>e[u]).bind(null,l),enumerable:!(r=gV(e,l))||r.enumerable});return n},FM=(n,e,t)=>(t=n!=null?pV(xV(n)):{},yV(fL(t,"default",{value:n,enumerable:!0}),n));const mL=()=>{},eD=n=>{Object.freeze&&Object.freeze(n)};function pL(n,e,t){var r;const s=e.join(".");return(r=t[s])!==null&&r!==void 0||(t[s]=new Proxy(mL,{get(a,o){if(!(typeof o!="string"||o==="then"))return pL(n,[...e,o],t)},apply(a,o,l){const u=e[e.length-1];if(u==="valueOf"||u==="toString"||u==="toJSON")return`tRPC.proxy(${e.slice(0,-1).join(".")})`;let d={args:l,path:e};return u==="call"?d={args:l.length>=2?[l[1]]:[],path:e.slice(0,-1)}:u==="apply"&&(d={args:l.length>=2?l[1]:[],path:e.slice(0,-1)}),eD(d.args),eD(d.path),n(d)}})),t[s]}const UM=n=>pL(n,[],hV()),p2=n=>new Proxy(mL,{get(e,t){if(t!=="then")return n(t)}});var gL=dv({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(n,e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),vV=dv({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(n,e){var t=gL().default;function r(s,a){if(t(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var l=o.call(s,a||"default");if(t(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}
1return(a==="string"?String:Number)(s)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),wV=dv({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(n,e){var t=gL().default,r=vV();function s(a){var o=r(a,"string");return t(o)=="symbol"?o:o+""}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),xL=dv({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(n,e){var t=wV();function r(s,a,o){return(a=t(a))in s?Object.defineProperty(s,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[a]=o,s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),g2=dv({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(n,e){var t=xL();function r(a,o){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);o&&(u=u.filter(function(d){return Object.getOwnPropertyDescriptor(a,d).enumerable})),l.push.apply(l,u)}return l}function s(a){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?r(Object(l),!0).forEach(function(u){t(a,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEac
1h(function(u){Object.defineProperty(a,u,Object.getOwnPropertyDescriptor(l,u))})}return a}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}});FM(g2());FM(xL());var mw=FM(g2());function SV(n,e){if("error"in n){const r=e.deserialize(n.error);return{ok:!1,error:(0,mw.default)((0,mw.default)({},n),{},{error:r})}}return{ok:!0,result:(0,mw.default)((0,mw.default)({},n.result),(!n.result.type||n.result.type==="data")&&{type:"data",data:e.deserialize(n.result.data)})}}var ZA=class extends Error{constructor(){super("Unable to transform response from server")}};function _V(n,e){let t;try{t=SV(n,e)}catch{throw new ZA}if(!t.ok&&(!ap(t.error.error)||typeof t.error.error.code!="number"))throw new ZA;if(t.ok&&!ap(t.result))throw new ZA;return t}FM(g2());function zM(n){const e={subscribe(t){let r=null,s=!1,a=!1,o=!1;function l(){if(r===null){o=!0;return}a||(a=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=n({next(u){var d;s||(d=t.next)===null||d===void 0||d.call(t,u)},error(u){var d;s||(s=!0,(d=t.error)===null||d===void 0||d.call(t,u),l())},complete(){var u;s||(s=!0,(u=t.complete)===null||u===void 0||u.call(t),l())}}),o&&l(),{unsubscribe:l}},pipe(...t){return t.reduce(MV,e)}};return e}function MV(n,e){return e(n)}function NV(n){const e=new AbortController;return new Promise((r,s)=>{let a=!1;function o(){a||(a=!0,l.unsubscribe())}e.signal.addEventListener("abort",()=>{s(e.signal.reason)});const l=n.subscribe({next(u){a=!0,r(u),o()},error(u){s(u)},complete(){e.abort(),o()}})})}var AV=Object.create,bL=Object.defineProperty,CV=Object.getOwnPropertyDescriptor,yL=Object.getOwnPropertyNames,EV=Object.getPrototypeOf,jV=Object.prototype.hasOwnProperty,Mh=(n,e)=>function(){return e||(0,n[yL(n)[0]])((e={exports:{}}).exports,e),e.exports},TV=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=yL(e),a=0,o=s.length,l;a<o;a++)l=s[a],!jV.call(n,l)&&l!==t&&bL(n,l,{get:(u=>e[u]).bind(null,l),enumerable:!(r=CV(e,l))||r.enumerable});return n},Sp=(n,e,t)=>(t=n!=null?AV(EV(n)):{},TV(e||!n||!n.__esModule?bL(t,"default",{value:n,enumerable:!0}):t,n)),RV=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(n,e){function t(r,s){if(r==null)return{};var a={};for(var o in r)if({}.hasOwnProperty.call(r,o)){if(s.includes(o))continue;a[o]=r[o]}return a}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),PV=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(n,e){var t=RV();function r(s,a){if(s==null)return{};var o,l,u=t(s,a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(s);for(l=0;l<d.length;l++)o=d[l],a.includes(o)||{}.propertyIsEnumerable.call(s,o)&&(u[o]=s[o])}return u}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),vL=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(n,e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),DV=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(n,e){var t=vL().default;function r(s,a){if(t(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var l=o.call(s,a||"default");if(t(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),kV=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(n,e){var t=vL().default,r=DV();function s(a){var o=r(a,"string");return t(o)=="symbol"?o:o+""}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),IV=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/
1defineProperty.js"(n,e){var t=kV();function r(s,a,o){return(a=t(a))in s?Object.defineProperty(s,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[a]=o,s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),fv=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(n,e){var t=IV();function r(a,o){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);o&&(u=u.filter(function(d){return Object.getOwnPropertyDescriptor(a,d).enumerable})),l.push.apply(l,u)}return l}function s(a){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?r(Object(l),!0).forEach(function(u){t(a,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEach(function(u){Object.defineProperty(a,u,Object.getOwnPropertyDescriptor(l,u))})}return a}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),BV=Sp(PV(),1),tD=Sp(fv(),1);const LV=["cursor","direction"];function vu(n,e,t){const r=n.flatMap(s=>s.split("."));if(!e&&(!t||t==="any"))return r.length?[r]:[];if(t==="infinite"&&ap(e)&&("direction"in e||"cursor"in e)){const{cursor:s,direction:a}=e,o=(0,BV.default)(e,LV);return[r,{input:o,type:"infinite"}]}return[r,(0,tD.default)((0,tD.default)({},typeof e<"u"&&e!==qo&&{input:e}),t&&t!=="any"&&{type:t})]}function US(n){return vu(n,void 0,"any")}var OV=Object.create,wL=Object.defineProperty,FV=Object.getOwnPropertyDescriptor,SL=Object.getOwnPropertyNames,UV=Object.getPrototypeOf,zV=Object.prototype.hasOwnProperty,Uu=(n,e)=>function(){return e||(0,n[SL(n)[0]])((e={exports:{}}).exports,e),e.exports},GV=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=SL(e),a=0,o=s.length,l;a<o;a++)l=s[a],!zV.call(n,l)&&l!==t&&wL(n,l,{get:(u=>e[u]).bind(null,l),enumerable:!(r=FV(e,l))||r.enumerable});return n},pi=(n,e,t)=>(t=n!=null?OV(UV(n)):{},GV(e||!n||!n.__esModule?wL(t,"default",{value:n,enumerable:!0}):t,n)),_L=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(n,e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),HV=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(n,e){var t=_L().default;function r(s,a){if(t(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var l=o.call(s,a||"default");if(t(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),VV=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(n,e){var t=_L().default,r=HV();function s(a){var o=r(a,"string");return t(o)=="symbol"?o:o+""}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),_p=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(n,e){var t=VV();function r(s,a,o){return(a=t(a))in s?Object.defineProperty(s,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[a]=o,s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Cc=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(n,e){var t=_p();function r(a,o){var l=Object.keys(a);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);o&&(u=u.filter(function(d){return Object.getOwnPropertyDescriptor(a,d).enumerable})),l.push.apply(l,u)}return l}function s(a){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};
1o%2?r(Object(l),!0).forEach(function(u){t(a,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):r(Object(l)).forEach(function(u){Object.defineProperty(a,u,Object.getOwnPropertyDescriptor(l,u))})}return a}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}});function WV(n){return e=>{let t=0,r=null;const s=[];function a(){r||(r=e.subscribe({next(l){for(const d of s){var u;(u=d.next)===null||u===void 0||u.call(d,l)}},error(l){for(const d of s){var u;(u=d.error)===null||u===void 0||u.call(d,l)}},complete(){for(const u of s){var l;(l=u.complete)===null||l===void 0||l.call(u)}}}))}function o(){if(t===0&&r){const l=r;r=null,l.unsubscribe()}}return zM(l=>(t++,s.push(l),a(),{unsubscribe(){t--,o();const u=s.findIndex(d=>d===l);u>-1&&s.splice(u,1)}}))}}function $V(n){let e=n;const t=[],r=o=>{e!==void 0&&o.next(e),t.push(o)},s=o=>{t.splice(t.indexOf(o),1)},a=zM(o=>(r(o),()=>{s(o)}));return a.next=o=>{if(e!==o){e=o;for(const l of t)l.next(o)}},a.get=()=>e,a}function XV(n){return zM(e=>{function t(s=0,a=n.op){const o=n.links[s];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:a,next(u){return t(s+1,u)}})}return t().subscribe(e)})}var pw=pi(_p(),1),Pg=pi(Cc(),1);function qV(n){return n instanceof Ty}function YV(n){return ap(n)&&ap(n.error)&&typeof n.error.code=="number"&&typeof n.error.message=="string"}function QV(n,e){return typeof n=="string"?n:ap(n)&&typeof n.message=="string"?n.message:e}var Ty=class zS extends Error{constructor(e,t){var r,s;const a=t?.cause;super(e,{cause:a}),(0,pw.default)(this,"cause",void 0),(0,pw.default)(this,"shape",void 0),(0,pw.default)(this,"data",void 0),(0,pw.default)(this,"meta",void 0),this.meta=t?.meta,this.cause=a,this.shape=t==null||(r=t.result)===null||r===void 0?void 0:r.error,this.data=t==null||(s=t.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,zS.prototype)}static from(e,t={}){const r=e;return qV(r)?(t.meta&&(r.meta=(0,Pg.default)((0,Pg.default)({},r.meta),t.meta)),r):YV(r)?new zS(r.error.message,(0,Pg.default)((0,Pg.default)({},t),{},{result:r,cause:t.cause})):new zS(QV(r,"Unknown error"),(0,Pg.default)((0,Pg.default)({},t),{},{cause:r}))}};function KV(n){const e=n;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:t=>t,deserialize:t=>t},output:{serialize:t=>t,deserialize:t=>t}}}const nD=n=>typeof n=="function";function JV(n){if(n)return n;if(typeof window<"u"&&nD(window.fetch))return window.fetch;if(typeof globalThis<"u"&&nD(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var ly=pi(Cc());function ZV(n){return{url:n.url.toString(),fetch:n.fetch,transformer:KV(n.transformer),methodOverride:n.methodOverride}}function e7(n){const e={};for(let t=0;t<n.length;t++){const r=n[t];e[t]=r}return e}const t7={query:"GET",mutation:"POST",subscription:"PATCH"};function ML(n){return"input"in n?n.transformer.input.serialize(n.input):e7(n.inputs.map(e=>n.transformer.input.serialize(e)))}const NL=n=>{const e=n.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+n.path;const s=[];if(e[1]&&s.push(e[1]),"inputs"in n&&s.push("batch=1"),n.type==="query"||n.type==="subscription"){const a=ML(n);a!==void 0&&n.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(a))}`)}return s.length&&(r+="?"+s.join("&")),r},n7=n=>{if(n.type==="query"&&n.methodOverride!=="POST")return;const e=ML(n);return e!==void 0?JSON.stringify(e):void 0},r7=n=>o7((0,ly.default)((0,ly.default)({},n),{},{contentTypeHeader:"application/json",getUrl:NL,getBody:n7}));var s7=class extends Error{constructor(){const n="AbortError";super(n),this.name=n,this.message=n}};const i7=n=>{var e;if(n?.aborted)throw(e=n.throwIfAborted)===null||e===void 0||e.call(n),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new s7};async function a7(n){var e,t;i7(n.signal);const r=n.getUrl(n),s=n.getBody(n),a=(e=n.methodOverride)!==null&&e!==void 0?e:t7[n.type],o=await(async()=>{const u=await n.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),l=(0,ly.default)((0,ly.default)((0,ly.default)({},n.contentTypeHeader&&a!=="GET"?{"content-type":n.contentTypeHeader}:{}),n.trpcAcceptHeader?{[(t=n.trpcAcceptHeaderKey)!==null&&t!==void 0?t:"trpc-accept"]:n.trpcAcceptHeader}:void 0),o);return JV(n.fetch)(r,{method:a,signal:n.signal,body:s,headers:l})}async function o7(n){const e={},t=await a7(n);e.response=t;const r=await t.json();return e.responseJSON=r,{json:r,meta:e}}pi(Cc(),1);const rD=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function sD(n){let e=null,t=null;const r=()=>{clearTimeout(t),t=null,e=null};function s(l){const u=[[]];let d=0;for(;;){const x=l[d];if(!x)break;const y=u[u.length-1];if(x.aborted){var h;(h=x.reject)===null||h===void 0||h.call(x,new Error("Aborted")),d++;continue}if(n.validate(y.concat(x).map(_=>_.key))){y.push(x),d++;continue}if(y.length===0){var p;(p=x.reject)===null||p===void 0||p.call(x,new Error("Input is too big for a single dispatch")),d++;continue}u.push([])}return u}function a(){const l=s(e);r();for(const u of l){if(!u.length)continue;const d={items:u};for(const p of u)p.batch=d;n.fetch(d.items.map(p=>p.key)).then(async p=>{await Promise.all(p.map(async(y,v)=>{const _=d.items[v];try{var M;const A=await Promise.resolve(y);(M=_.resolve)===null||M===void 0||M.call(_,A)}catch(A){var S;(S=_.reject)===null||S===void 0||S.call(_,A)}_.batch=null,_.reject=null,_.resolve=null}));for(const y of d.items){var x;(x=y.reject)===null||x===void 0||x.call(y,new Error("Missing result")),y.batch=null}}).catch(p=>{for(const y of d.items){var x;(x=y.reject)===null||x===void 0||x.call(y,p),y.batch=null}})}}function o(l){var u;const d={aborted:!1,key:l,batch:null,resolve:rD,reject:rD},h=new Promise((p,x)=>{var y;d.reject=x,d.resolve=p,(y=e)!==null&&y!==void 0||(e=[]),e.push(d)});return(u=t)!==null&&u!==void 0||(t=setTimeout(a)),h}return{load:o}}function l7(...n){const e=new AbortController,t=n.length;let r=0;const s=()=>{++r===t&&e.abort()};
1for(const a of n)a?.aborted?s():a?.addEventListener("abort",s,{once:!0});return e.signal}var gw=pi(Cc(),1);function c7(n){var e,t;const r=ZV(n),s=(e=n.maxURLLength)!==null&&e!==void 0?e:1/0,a=(t=n.maxItems)!==null&&t!==void 0?t:1/0;return()=>{const o=h=>({validate(p){if(s===1/0&&a===1/0)return!0;if(p.length>a)return!1;const x=p.map(_=>_.path).join(","),y=p.map(_=>_.input);return NL((0,gw.default)((0,gw.default)({},r),{},{type:h,path:x,inputs:y,signal:null})).length<=s},async fetch(p){const x=p.map(A=>A.path).join(","),y=p.map(A=>A.input),v=l7(...p.map(A=>A.signal)),_=await r7((0,gw.default)((0,gw.default)({},r),{},{path:x,inputs:y,type:h,headers(){return n.headers?typeof n.headers=="function"?n.headers({opList:p}):n.headers:{}},signal:v}));return(Array.isArray(_.json)?_.json:p.map(()=>_.json)).map(A=>({meta:_.meta,json:A}))}}),l=sD(o("query")),u=sD(o("mutation")),d={query:l,mutation:u};return({op:h})=>zM(p=>{if(h.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const y=d[h.type].load(h);let v;return y.then(_=>{v=_;const M=_V(_.json,r.transformer.output);if(!M.ok){p.error(Ty.from(M.error,{meta:_.meta}));return}p.next({context:_.meta,result:M.result}),p.complete()}).catch(_=>{p.error(Ty.from(_,{meta:v?.meta}))}),()=>{}})}}pi(Cc(),1);const AL=(n,...e)=>typeof n=="function"?n(...e):n;pi(_p(),1);function u7(){let n,e;return{promise:new Promise((r,s)=>{n=r,e=s}),resolve:n,reject:e}}async function d7(n){const e=await AL(n.url);if(!n.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function f7(n,e){const t={method:"connectionParams",data:await AL(n)};return e.encode(t)}pi(_p(),1);var Yf=pi(_p(),1);function h7(n){const{promise:e,resolve:t,reject:r}=u7();return n.addEventListener("open",()=>{n.removeEventListener("error",r),t()}),n.addEventListener("error",r),e}function m7(n,{intervalMs:e,pongTimeoutMs:t}){let r,s;function a(){r=setTimeout(()=>{n.send("PING"),s=setTimeout(()=>{n.close()},t)},e)}function o(){clearTimeout(r),a()}function l(){clearTimeout(s),o()}n.addEventListener("open",a),n.addEventListener("message",({data:u})=>{clearTimeout(r),a(),u==="PONG"&&l()}),n.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var p7=class gj{constructor(e){var t;if((0,Yf.default)(this,"id",++gj.connectCount),(0,Yf.default)(this,"WebSocketPonyfill",void 0),(0,Yf.default)(this,"urlOptions",void 0),(0,Yf.default)(this,"keepAliveOpts",void 0),(0,Yf.default)(this,"encoder",void 0),(0,Yf.default)(this,"wsObservable",$V(null)),(0,Yf.default)(this,"openPromise",null),this.WebSocketPonyfill=(t=e.WebSocketPonyfill)!==null&&t!==void 0?t:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive,this.encoder=e.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++gj.connectCount;const t=d7(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=t.then(async r=>{e.ws=r,r.binaryType="arraybuffer",r.addEventListener("message",function({data:s}){s==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&m7(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await h7(r),e.urlOptions.connectionParams&&r.send(await f7(e.urlOptions.connectionParams,e.encoder))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var t;(t=e.ws)===null||t===void 0||t.close()}}};(0,Yf.default)(p7,"connectCount",0);pi(_p(),1);pi(Cc(),1);var eC=pi(_p(),1),iD=pi(Cc(),1),GM=class{constructor(n){(0,eC.default)(this,"links",void 0),(0,eC.default)(this,"runtime",void 0),(0,eC.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=n.links.map(e=>e(this.runtime))}$request(n){var e;return XV({links:this.links,op:(0,iD.default)((0,iD.default)({},n),{},{context:(e=n.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(WV())}async requestAsPromise(n){var e=this;try{const t=e.$request(n);return(await NV(t)).result.data}catch(t){throw Ty.from(t)}}query(n,e,t){return this.requestAsPromise({type:"query",path:n,input:e,context:t?.context,signal:t?.signal})}mutation(n,e,t){return this.requestAsPromise({type:"mutation",path:n,input:e,context:t?.context,signal:t?.signal})}subscription(n,e,t){return this.$request({type:"subscription",path:n,input:e,context:t.context,signal:t.signal}).subscribe({next(s){switch(s.result.type){case"state":{var a;(a=t.onConnectionStateChange)===null||a===void 0||a.call(t,s.result);break}case"started":{var o;(o=t.onStarted)===null||o===void 0||o.call(t,{context:s.context});break}case"stopped":{var l;(l=t.onStopped)===null||l===void 0||l.call(t);break}case"data":case void 0:{var u;(u=t.onData)===null||u===void 0||u.call(t,s.result.data);break}}},error(s){var a;(a=t.onError)===null||a===void 0||a.call(t,s)},complete(){var s;(s=t.onComplete)===null||s===void 0||s.call(t)}})}};const CL=Symbol.for("trpc_untypedClient"),g7={query:"query",mutate:"mutation",subscribe:"subscription"},x7=n=>g7[n];function EL(n){const e=UM(({path:t,args:r})=>{const s=[...t],a=x7(s.pop()),o=s.join(".");return n[a](o,...r)});return p2(t=>t===CL?n:e[t])}function b7(n){const e=new GM(n);return EL(e)}function x2(n){return n[CL]}pi(Cc(),1);pi(Cc(),1);var y7=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(n,e){function t(s){var a,o,l,u=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,l=Symbol.iterator);u--;){if(o&&(a=s[o])!=null)return a.call(s);if(l&&(a=s[l])!=null)return new r(a.call(s));o="@@asyncIterator",l="@@iterator"}throw new TypeError("Object is not async iterable")}function r(s){function a(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var l=o.done;return Promise.resolve(o.value).then(function(u){return{value:u,done:l}})}return r=function(l){this.s=l,this.n=l.next},r.prototype={s:null,n:null,next:function(){return a(this.n.apply(this.s,arguments))},return:function(l){var u=this.s.return;return u===void 0?Promise.resolve({value:l,done:!0}):a(u.apply(this.s,arguments))},throw:function(l){var u=this.s.return;return u===void 0?Promise.reject(l):a(u.apply(this.s,arguments))}},new r(s)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}});pi(y7(),1);pi(Cc(),1);var v7=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(n,e){function t(){var r=typeof SuppressedError=="function"?SuppressedError:function(l,u){var d=Error();return d.name="SuppressedError",d.error=l,d.suppressed=u,d},s={},a=[];function o(l,u){if(u!=null){if(Object(u)!==u)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(l)var d=u[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(d===void 0&&(d=u[Symbol.dispose||Symbol.for("Symbol.dispose")],l))var h=d;if(typeof d!="function")throw new TypeError("Object is not disposable.");h&&(d=function(){try{h.call(u)}catch(x){return Promise.reject(x)}}),a.push({v:u,d,a:l})}else l&&a.push({d:u,a:l});return u}return{e:s,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var u,d=this.e,h=0;function p(){for(;u=a.pop();)try{if(!u.a&&h===1)return h=0,a.push(u),Promise.resolve().then(p);if(u.d){var y=u.d.call(u.v);if(u.a)return h|=2,Promise.resolve(y).then(p,x)}else h|=1}catch(v){return x(v)}if(h===1)return d!==s?Promise.reject(d):Promise.resolve();if(d!==s)throw d}function x(y){return d=d!==s?new r(y,d):y,p()}return p()}}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),jL=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(n,e){function t(r,s){this.v=r,this.k=s}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),w7=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(n,e){var t=jL();function r(s){return new t(s,0)}
1e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),S7=Uu({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(n,e){var t=jL();function r(a){return function(){return new s(a.apply(this,arguments))}}function s(a){var o,l;function u(h,p){try{var x=a[h](p),y=x.value,v=y instanceof t;Promise.resolve(v?y.v:y).then(function(_){if(v){var M=h==="return"?"return":"next";if(!y.k||_.done)return u(M,_);_=a[M](_).value}d(x.done?"return":"normal",_)},function(_){u("throw",_)})}catch(_){d("throw",_)}}function d(h,p){switch(h){case"return":o.resolve({value:p,done:!0});break;case"throw":o.reject(p);break;default:o.resolve({value:p,done:!1})}(o=o.next)?u(o.key,o.arg):l=null}this._invoke=function(h,p){return new Promise(function(x,y){var v={key:h,arg:p,resolve:x,reject:y,next:null};l?l=l.next=v:(o=l=v,u(h,p))})},typeof a.return!="function"&&(this.return=void 0)}s.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},s.prototype.next=function(a){return this._invoke("next",a)},s.prototype.throw=function(a){return this._invoke("throw",a)},s.prototype.return=function(a){return this._invoke("return",a)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});pi(v7(),1);pi(w7(),1);pi(S7(),1);pi(Cc(),1);function _7(n){return UM(({path:e,args:t})=>{var r;const s=[...e],a=s.pop();if(a==="useMutation")return n[a](s,...t);if(a==="_def")return{path:s};const[o,...l]=t,u=(r=l[0])!==null&&r!==void 0?r:{};return n[a](s,o,u)})}var tC;const M7=["client","ssrContext","ssrState","abortOnUnmount"],N7=(tC=T.createContext)===null||tC===void 0?void 0:tC.c
1all(_h,null),A7=n=>{switch(n){case"queryOptions":case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"infiniteQueryOptions":case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};function C7(n){return UM(e=>{const t=[...e.path],r=t.pop(),s=[...e.args],a=s.shift(),o=A7(r),l=vu(t,a,o);return{infiniteQueryOptions:()=>n.infiniteQueryOptions(t,l,s[0]),queryOptions:()=>n.queryOptions(t,l,...s),fetch:()=>n.fetchQuery(l,...s),fetchInfinite:()=>n.fetchInfiniteQuery(l,s[0]),prefetch:()=>n.prefetchQuery(l,...s),prefetchInfinite:()=>n.prefetchInfiniteQuery(l,s[0]),ensureData:()=>n.ensureQueryData(l,...s),invalidate:()=>n.invalidateQueries(l,...s),reset:()=>n.resetQueries(l,...s),refetch:()=>n.refetchQueries(l,...s),cancel:()=>n.cancelQuery(l,...s),setData:()=>{n.setQueryData(l,s[0],s[1])},setQueriesData:()=>n.setQueriesData(l,s[0],s[1],s[2]),setInfiniteData:()=>{n.setInfiniteQueryData(l,s[0],s[1])},getData:()=>n.getQueryData(l),getInfiniteData:()=>n.getInfiniteQueryData(l),setMutationDefaults:()=>n.setMutationDefaults(US(t),a),getMutationDefaults:()=>n.getMutationDefaults(US(t)),isMutating:()=>n.isMutating({mutationKey:US(t)})}[r]()})}function E7(n){const e=EL(n.client),t=C7(n);return p2(r=>{const s=r;return s==="client"?e:M7.includes(s)?n[s]:t[r]})}var j7=Sp(fv(),1);function aD(n){const e=n instanceof GM?n:x2(n);return UM(t=>{const r=t.path,s=r.join("."),[a,o]=t.args;return(0,j7.default)({queryKey:vu(r,a,"query"),queryFn:()=>e.query(s,a,o?.trpc)},o)})}var nC=Sp(fv(),1);function qa(n,e,t){var r;const s=n[0];let a=(r=n[1])===null||r===void 0?void 0:r.input;if(t){var o;a=(0,nC.default)((0,nC.default)((0,nC.default)({},(o=a)!==null&&o!==void 0?o:{}),t.pageParam?{cursor:t.pageParam}:{}),{},{direction:t.direction})}return[s.join("."),a,e?.trpc]}var T7=Mh({"../../node_modules/.pnpm/@[email protected]/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(n,e){function t(s){var a,o,l,u=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,l=Symbol.iterator);u--;){if(o&&(a=s[o])!=null)return a.call(s);if(l&&(a=s[l])!=null)return new r(a.call(s));o="@@asyncIterator",l="@@iterator"}throw new TypeError("Object is not async iterable")}function r(s){function a(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var l=o.done;return Promise.resolve(o.value).then(function(u){return{value:u,done:l}})}return r=function(l){this.s=l,this.n=l.next},r.prototype={s:null,n:null,next:function(){return a(this.n.apply(this.s,arguments))},return:function(l){var u=this.s.return;return u===void 0?Promise.resolve({value:l,done:!0}):a(u.apply(this.s,arguments))},throw:function(l){var u=this.s.return;return u===void 0?Promise.reject(l):a(u.apply(this.s,arguments))}},new r(s)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}),R7=Sp(T7(),1);function xj(n){return{path:n.path.join(".")}}function jb(n){const e=xj(n);return T.useMemo(()=>e,[e])}async function TL(n,e,t){const s=e.getQueryCache().build(e,{queryKey:t});s.setState({data:[],status:"success"});const a=[];var o=!1,l=!1,u;try{for(var d=(0,R7.default)(n),h;o=!(h=await d.next()).done;o=!1){const p=h.value;a.push(p),s.setState({data:[...a]})}}catch(p){l=!0,u=p}finally{try{o&&d.return!=null&&await d.return()}finally{if(l)throw u}}return a}var kr=Sp(fv(),1);function P7(n){const{client:e,queryClient:t}=n,r=e instanceof GM?e:x2(e);return{infiniteQueryOptions:(s,a,o)=>{var l,u;const d=((l=a[1])===null||l===void 0?void 0:l.input)===qo,h=async p=>{var x;const y=(0,kr.default)((0,kr.default)({},o),{},{trpc:(0,kr.default)((0,kr.default)({},o?.trpc),!(o==null||(x=o.trpc)===null||x===void 0)&&x.abortOnUnmount?{signal:p.signal}:{signal:null})});return await r.query(...qa(a,y,{direction:p.direction,pageParam:p.pageParam}))};return Object.assign((0,kr.default)((0,kr.default)({},o),{},{initialData:o?.initialData,queryKey:a,queryFn:d?qo:h,initialPageParam:(u=o?.initialCursor)!==null&&u!==void 0?u:null}),{trpc:xj({path:s})})},queryOptions:(s,a,o)=>{var l;const u=((l=a[1])===null||l===void 0?void 0:l.input)===qo,d=async h=>{var p;const x=(0,kr.default)((0,kr.default)({},o),{},{trpc:(0,kr.default)((0,kr.default)({},o?.trpc),!(o==null||(p=o.trpc)===null||p===void 0)&&p.abortOnUnmount?{signal:h.signal}:{signal:null})}),y=await r.query(...qa(a,x));return dL(y)?TL(y,t,a):y};return Object.assign((0,kr.default)((0,kr.default)({},o),{},{initialData:o?.initialData,queryKey:a,queryFn:u?qo:d}),{trpc:xj({path:s})})},fetchQuery:(s,a)=>t.fetchQuery((0,kr.default)((0,kr.default)({},a),{},{queryKey:s,queryFn:()=>r.query(...qa(s,a))})),fetchInfiniteQuery:(s,a)=>{var o;return t.fetchInfiniteQuery((0,kr.default)((0,kr.default)({},a),{},{queryKey:s,queryFn:({pageParam:l,direction:u})=>r.query(...qa(s,a,{pageParam:l,direction:u})),initialPageParam:(o=a?.initialCursor)!==null&&o!==void 0?o:null}))},prefetchQuery:(s,a)=>t.prefetchQuery((0,kr.default)((0,kr.default)({},a),{},{queryKey:s,queryFn:()=>r.query(...qa(s,a))})),prefetchInfiniteQuery:(s,a)=>{var o;return t.prefetchInfiniteQuery((0,kr.default)((0,kr.default)({},a),{},{queryKey:s,queryFn:({pageParam:l,direction:u})=>r.query(...qa(s,a,{pageParam:l,direction:u})),initialPageParam:(o=a?.initialCursor)!==null&&o!==void 0?o:null}))},ensureQueryData:(s,a)=>t.ensureQueryData((0,kr.default)((0,kr.default)({},a),{},{queryKey:s,queryFn:()=>r.query(...qa(s,a))})),invalidateQueries:(s,a,o)=>
1t.invalidateQueries((0,kr.default)((0,kr.default)({},a),{},{queryKey:s}),o),resetQueries:(s,a,o)=>t.resetQueries((0,kr.default)((0,kr.default)({},a),{},{queryKey:s}),o),refetchQueries:(s,a,o)=>t.refetchQueries((0,kr.default)((0,kr.default)({},a),{},{queryKey:s}),o),cancelQuery:(s,a)=>t.cancelQueries({queryKey:s},a),setQueryData:(s,a,o)=>t.setQueryData(s,a,o),setQueriesData:(s,a,o,l)=>t.setQueriesData((0,kr.default)((0,kr.default)({},a),{},{queryKey:s}),o,l),getQueryData:s=>t.getQueryData(s),setInfiniteQueryData:(s,a,o)=>t.setQueryData(s,a,o),getInfiniteQueryData:s=>t.getQueryData(s),setMutationDefaults:(s,a)=>{const o=s[0],l=u=>r.mutation(...qa([o,{input:u}],n));return t.setMutationDefaults(s,typeof a=="function"?a({canonicalMutationFn:l}):a)},getMutationDefaults:s=>t.getMutationDefaults(s),isMutating:s=>t.isMutating((0,kr.default)((0,kr.default)({},s),{},{exact:!0}))}}var Jt=Sp(fv());const oD=(n,e)=>new Proxy(n,{get(r,s){return e(s),r[s]}});function D7(n){var e,t;const r=(e=void 0)!==null&&e!==void 0?e:I=>I.originalFn(),s=(t=void 0)!==null&&t!==void 0?t:N7,a=b7,o=I=>{var D;const{abortOnUnmount:B=!1,queryClient:P,ssrContext:G}=I,[k,V]=T.useState((D=I.ssrState)!==null&&D!==void 0?D:!1),U=I.client instanceof GM?I.client:x2(I.client),$=T.useMemo(()=>P7({client:U,queryClient:P}),[U,P]),X=T.useMemo(()=>(0,Jt.default)({abortOnUnmount:B,queryClient:P,client:U,ssrContext:G??null,ssrState:k},$),[B,U,$,P,G,k]);return T.useEffect(()=>{V(ee=>ee?"mounted":!1)},[]),i.jsx(s.Provider,{value:X,children:I.children})};function l(){const I=T.useContext(s);if(!I)throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return I}function u(I,D){var B;const{queryClient:P,ssrState:G}=l();return G&&G!=="mounted"&&((B=P.getQueryCache().find({queryKey:I}))===null||B===void 0?void 0:B.state.status)==="error"?(0,Jt.default)({retryOnMount:!1},D):D}function d(I,D,B){var P,G,k,V,U;const $=l(),{abortOnUnmount:X,client:ee,ssrState:z,queryClient:K,prefetchQuery:ae}=$,oe=vu(I,D,"query"),re=K.getQueryDefaults(oe),F=D===qo;typeof window>"u"&&z==="prepass"&&(B==null||(P=B.trpc)===null||P===void 0?void 0:P.ssr)!==!1&&((G=B?.enabled)!==null&&G!==void 0?G:re?.enabled)!==!1&&!F&&!K.getQueryCache().find({queryKey:oe})&&ae(oe,B);const O=u(oe,(0,Jt.default)((0,Jt.default)({},re),B)),J=(k=(V=B==null||(U=B.trpc)===null||U===void 0?void 0:U.abortOnUnmount)!==null&&V!==void 0?V:void 0)!==null&&k!==void 0?k:X,q=iV((0,Jt.default)((0,Jt.default)({},O),{},{queryKey:oe,queryFn:F?D:async Q=>{const ne=(0,Jt.default)((0,Jt.default)({},O),{},{trpc:(0,Jt.default)((0,Jt.default)({},O?.trpc),J?{signal:Q.signal}:{signal:null})}),Z=await ee.query(...qa(oe,ne));return dL(Z)?TL(Z,K,oe):Z}}),K);return q.trpc=jb({path:I}),q}function h(I,D,B){var P,G,k;const V=l(),U=vu(I,D,"query"),$=D===qo,X=(P=(G=B==null||(k=B.trpc)===null||k===void 0?void 0:k.abortOnUnmount)!==null&&G!==void 0?G:void 0)!==null&&P!==void 0?P:V.abortOnUnmount;cV((0,Jt.default)((0,Jt.default)({},B),{},{queryKey:U,queryFn:$?D:ee=>{const z={trpc:(0,Jt.default)((0,Jt.default)({},B?.trpc),X?{signal:ee.signal}:{})};return V.client.query(...qa(U,z))}}))}function p(I,D,B){var P,G,k;const V=l(),U=vu(I,D,"query"),$=(P=(G=B==null||(k=B.trpc)===null||k===void 0?void 0:k.abortOnUnmount)!==null&&G!==void 0?G:void 0)!==null&&P!==void 0?P:V.abortOnUnmount,X=aV((0,Jt.default)((0,Jt.default)({},B),{},{queryKey:U,queryFn:ee=>{const z=(0,Jt.default)((0,Jt.default)({},B),{},{trpc:(0,Jt.default)((0,Jt.default)({},B?.trpc),$?{signal:ee.signal}:{signal:null})});return V.client.query(...qa(U,z))}}),V.queryClient);return X.trpc=jb({path:I}),[X.data,X]}function x(I,D){const{client:B,queryClient:P}=l(),G=US(I),k=P.defaultMutationOptions(P.getMutationDefaults(G)),V=dV((0,Jt.default)((0,Jt.default)({},D),{},{mutationKey:G,mutationFn:U=>B.mutation(...qa([I,{input:U}],D)),onSuccess(...U){var $,X;return r({originalFn:()=>{var z,K,ae;return(z=D==null||(K=D.onSuccess)===null||K===void 0?void 0:K.call(D,...U))!==null&&z!==void 0?z:k==null||(ae=k.onSuccess)===null||ae===void 0?void 0:ae.call(k,...U)},queryClient:P,meta:($=(X=D?.meta)!==null&&X!==void 0?X:k?.meta)!==null&&$!==void 0?$:{}})}}),P);return V.trpc=jb({path:I}),V}const y={data:void 0,error:null,status:"idle"},v={data:void 0,error:null,status:"connecting"};function _(I,D,B){var P;
1const G=(P=B?.enabled)!==null&&P!==void 0?P:D!==qo,k=lh(vu(I,D,"any")),{client:V}=l(),U=T.useRef(B);T.useEffect(()=>{U.current=B});const[$]=T.useState(new Set([])),X=T.useCallback(F=>{$.add(F)},[$]),ee=T.useRef(null),z=T.useCallback(F=>{const O=ae.current,J=ae.current=F(O);let q=!1;for(const Q of $)if(O[Q]!==J[Q]){q=!0;break}q&&re(oD(J,X))},[X,$]),K=T.useCallback(()=>{var F;if((F=ee.current)===null||F===void 0||F.unsubscribe(),!G){z(()=>(0,Jt.default)((0,Jt.default)({},y),{},{reset:K}));return}z(()=>(0,Jt.default)((0,Jt.default)({},v),{},{reset:K}));const O=V.subscription(I.join("."),D??void 0,{onStarted:()=>{var J,q;(J=(q=U.current).onStarted)===null||J===void 0||J.call(q),z(Q=>(0,Jt.default)((0,Jt.default)({},Q),{},{status:"pending",error:null}))},onData:J=>{var q,Q;(q=(Q=U.current).onData)===null||q===void 0||q.call(Q,J),z(ne=>(0,Jt.default)((0,Jt.default)({},ne),{},{status:"pending",data:J,error:null}))},onError:J=>{var q,Q;(q=(Q=U.current).onError)===null||q===void 0||q.call(Q,J),z(ne=>(0,Jt.default)((0,Jt.default)({},ne),{},{status:"error",error:J}))},onConnectionStateChange:J=>{z(q=>{switch(J.state){case"idle":return(0,Jt.default)((0,Jt.default)({},q),{},{status:J.state,error:null,data:void 0});case"connecting":return(0,Jt.default)((0,Jt.default)({},q),{},{error:J.error,status:J.state});case"pending":return q}})},onComplete:()=>{var J,q;(J=(q=U.current).onComplete)===null||J===void 0||J.call(q),z(Q=>(0,Jt.default)((0,Jt.default)({},Q),{},{status:"idle",error:null,data:void 0}))}});ee.current=O},[V,k,G,z]);T.useEffect(()=>(K(),()=>{var F;(F=ee.current)===null||F===void 0||F.unsubscribe()}),[K]);const ae=T.useRef(G?(0,Jt.default)((0,Jt.default)({},v),{},{reset:K}):(0,Jt.default)((0,Jt.default)({},y),{},{reset:K})),[oe,re]=T.useState(oD(ae.current,X));return oe}function M(I,D,B){var P,G,k,V,U;const{client:$,ssrState:X,prefetchInfiniteQuery:ee,queryClient:z,abortOnUnmount:K}=l(),ae=vu(I,D,"infinite"),oe=z.getQueryDefaults(ae),re=D===qo;typeof window>"u"&&X==="prepass"&&(B==null||(P=B.trpc)===null||P===void 0?void 0:P.ssr)!==!1&&((G=B?.enabled)!==null&&G!==void 0?G:oe?.enabled)!==!1&&!re&&!z.getQueryCache().find({queryKey:ae})&&ee(ae,(0,Jt.default)((0,Jt.default)({},oe),B));const F=u(ae,(0,Jt.default)((0,Jt.default)({},oe),B)),O=(k=B==null||(V=B.trpc)===null||V===void 0?void 0:V.abortOnUnmount)!==null&&k!==void 0?k:K,J=fV((0,Jt.default)((0,Jt.default)({},F),{},{initialPageParam:(U=B.initialCursor)!==null&&U!==void 0?U:null,persister:B.persister,queryKey:ae,queryFn:re?D:q=>{var Q;const ne=(0,Jt.default)((0,Jt.default)({},F),{},{trpc:(0,Jt.default)((0,Jt.default)({},F?.trpc),O?{signal:q.signal}:{signal:null})});return $.query(...qa(ae,ne,{pageParam:(Q=q.pageParam)!==null&&Q!==void 0?Q:B.initialCursor,direction:q.direction}))}}),z);return J.trpc=jb({path:I}),J}function S(I,D,B){var P,G,k;const V=l(),U=vu(I,D,"infinite"),$=V.queryClient.getQueryDefaults(U),X=D===qo,ee=u(U,(0,Jt.default)((0,Jt.default)({},$),B)),z=(P=B==null||(G=B.trpc)===null||G===void 0?void 0:G.abortOnUnmount)!==null&&P!==void 0?P:V.abortOnUnmount;uV((0,Jt.default)((0,Jt.default)({},B),{},{initialPageParam:(k=B.initialCursor)!==null&&k!==void 0?k:null,queryKey:U,queryFn:X?D:K=>{var ae;const oe=(0,Jt.default)((0,Jt.default)({},ee),{},{trpc:(0,Jt.default)((0,Jt.default)({},ee?.trpc),z?{signal:K.signal}:{})});return V.client.query(...qa(U,oe,{pageParam:(ae=K.pageParam)!==null&&ae!==void 0?ae:B.initialCursor,direction:K.direction}))}}))}function A(I,D,B){var P,G,k;const V=l(),U=vu(I,D,"infinite"),$=V.queryClient.getQueryDefaults(U),X=u(U,(0,Jt.default)((0,Jt.default)({},$),B)),ee=(P=B==null||(G=B.trpc)===null||G===void 0?void 0:G.abortOnUnmount)!==null&&P!==void 0?P:V.abortOnUnmount,z=oV((0,Jt.default)((0,Jt.default)({},B),{},{initialPageParam:(k=B.initialCursor)!==null&&k!==void 0?k:null,queryKey:U,queryFn:K=>{var ae;const oe=(0,Jt.default)((0,Jt.default)({},X),{},{trpc:(0,Jt.default)((0,Jt.default)({},X?.trpc),ee?{signal:K.signal}:{})});return V.client.query(...qa(U,oe,{pageParam:(ae=K.pageParam)!==null&&ae!==void 0?ae:B.initialCursor,direction:K.direction}))}}),V.queryClient);return z.trpc=jb({path:I}),[z.data,z]}return{Provider:o,createClient:a,useContext:l,useUtils:l,useQuery:d,usePrefetchQuery:h,use
1SuspenseQuery:p,useQueries:(I,D)=>{const{ssrState:B,queryClient:P,prefetchQuery:G,client:k}=l(),V=aD(k),U=I(V);if(typeof window>"u"&&B==="prepass")for(const X of U){var $;const ee=X;(($=ee.trpc)===null||$===void 0?void 0:$.ssr)!==!1&&!P.getQueryCache().find({queryKey:ee.queryKey})&&G(ee.queryKey,ee)}return uL({queries:U.map(X=>(0,Jt.default)((0,Jt.default)({},X),{},{queryKey:X.queryKey})),combine:D?.combine},P)},useSuspenseQueries:I=>{const{queryClient:D,client:B}=l(),P=aD(B),G=I(P),k=lV({queries:G.map(V=>(0,Jt.default)((0,Jt.default)({},V),{},{queryFn:V.queryFn,queryKey:V.queryKey}))},D);return[k.map(V=>V.data),k]},useMutation:x,useSubscription:_,useInfiniteQuery:M,usePrefetchInfiniteQuery:S,useSuspenseInfiniteQuery:A}}function k7(n){const e=_7(n);return p2(t=>t==="useContext"||t==="useUtils"?()=>{const r=n.useUtils();return T.useMemo(()=>E7(r),[r])}:n.hasOwnProperty(t)?n[t]:e[t])}function I7(n){const e=D7();return k7(e)}const Pe=I7();var rC={exports:{}},Tb={},sC={exports:{}},iC={};var lD;function B7(){return lD||(lD=1,(function(n){function e(z,K){var ae=z.length;z.push(K);e:for(;0<ae;){var oe=ae-1>>>1,re=z[oe];if(0<s(re,K))z[oe]=K,z[ae]=re,ae=oe;else break e}}function t(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var K=z[0],ae=z.pop();if(ae!==K){z[0]=ae;e:for(var oe=0,re=z.length,F=re>>>1;oe<F;){var O=2*(oe+1)-1,J=z[O],q=O+1,Q=z[q];if(0>s(J,ae))q<re&&0>s(Q,J)?(z[oe]=Q,z[q]=ae,oe=q):(z[oe]=J,z[O]=ae,oe=O);else if(q<re&&0>s(Q,ae))z[oe]=Q,z[q]=ae,oe=q;else break e}}return K}function s(z,K){var ae=z.sortIndex-K.sortIndex;
vendor: 4,466 bytes, line 1
1return ae!==0?ae:z.id-K.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;n.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();n.unstable_now=function(){return o.now()-l}}var u=[],d=[],h=1,p=null,x=3,y=!1,v=!1,_=!1,M=!1,S=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(z){for(var K=t(d);K!==null;){if(K.callback===null)r(d);else if(K.startTime<=z)r(d),K.sortIndex=K.expirationTime,e(u,K);else break;K=t(d)}}function I(z){if(_=!1,C(z),!v)if(t(u)!==null)v=!0,D||(D=!0,U());else{var K=t(d);K!==null&&ee(I,K.startTime-z)}}var D=!1,B=-1,P=5,G=-1;function k(){return M?!0:!(n.unstable_now()-G<P)}function V(){if(M=!1,D){var z=n.unstable_now();G=z;var K=!0;try{e:{v=!1,_&&(_=!1,A(B),B=-1),y=!0;var ae=x;try{t:{for(C(z),p=t(u);p!==null&&!(p.expirationTime>z&&k());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,x=p.priorityLevel;var re=oe(p.expirationTime<=z);if(z=n.unstable_now(),typeof re=="function"){p.callback=re,C(z),K=!0;break t}p===t(u)&&r(u),C(z)}else r(u);p=t(u)}if(p!==null)K=!0;else{var F=t(d);F!==null&&ee(I,F.startTime-z),K=!1}}break e}finally{p=null,x=ae,y=!1}K=void 0}}finally{K?U():D=!1}}}var U;if(typeof E=="function")U=function(){E(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,X=$.port2;$.port1.onmessage=V,U=function(){X.postMessage(null)}}else U=function(){S(V,0)};function ee(z,K){B=S(function(){z(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(z){switch(x){case 1:case 2:case 3:var K=3;break;default:K=x}var ae=x;x=K;try{return z()}finally{x=ae}},n.unstable_requestPaint=function(){M=!0},n.unstable_runWithPriority=function(z,K){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var ae=x;x=z;try{return K()}finally{x=ae}},n.unstable_scheduleCallback=function(z,K,ae){var oe=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?oe+ae:oe):ae=oe,z){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=ae+re,z={id:h++,callback:K,priorityLevel:z,startTime:ae,expirationTime:re,sortIndex:-1},ae>oe?(z.sortIndex=ae,e(d,z),t(u)===null&&z===t(d)&&(_?(A(B),B=-1):_=!0,ee(I,ae-oe))):(z.sortIndex=re,e(u,z),v||y||(v=!0,D||(D=!0,U()))),z},n.unstable_shouldYield=k,n.unstable_wrapCallback=function(z){var K=x;return function(){var ae=x;x=K;try{return z.apply(this,arguments)}finally{x=ae}}}})(iC)),iC}var cD;function RL(){return cD||(cD=1,sC.exports=B7()),sC.exports}var aC={exports:{}},Ca={};var uD;function L7(){if(uD)return Ca;uD=1;var n=lv();function e(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)d+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var r={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(u,d,h){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:u,containerInfo:d,implementation:h}}var o=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ca.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ca.createPortal=function(u,d){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return a(u,d,null,h)},Ca.flushSync=function(u){var d=o.T,h=r.p;try{if(o.T=null,r.p=2,u)return u()}finally{o.T=d,r.p=h,r.d.f()}},Ca.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="str
1ing"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(u,d))},Ca.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Ca.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var h=d.as,p=l(h,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;h==="style"?r.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:p,integrity:x,fetchPriority:y}):h==="script"&&r.d.X(u,{crossOrigin:p,integrity:x,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ca.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var h=l(d.as,d.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(u)},Ca.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var h=d.as,p=l(h,d.crossOrigin);r.d.L(u,h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Ca.preloadModule=function(u,d){if(typeof u=="string")if(d){var h=l(d.as,d.crossOrigin);r.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(u)},Ca.requestFormReset=function(u){r.d.r(u)},Ca.unstable_batchedUpdates=function(u,d){return u(d)},Ca.useFormState=function(u,d,h){return o.H.useFormState(u,d,h)},Ca.useFormStatus=function(){return o.H.useHostTransitionStatus()},Ca.version="19.2.8",Ca}var dD;function PL(){if(dD)return aC.exports;dD=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),aC.exports=L7(),aC.exports}var fD;function O7(){if(fD)return Tb;fD=1;var n=RL(),e=lv(),t=PL();function r(c){var f="https://react.dev/errors/"+c;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)f+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+c+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function a(c){var f=c,b=c;if(c.alternate)for(;f.return;)f=f.return;else{c=f;do f=c,(f.flags&4098)!==0&&(b=f.return),c=f.return;while(c)}return f.tag===3?b:null}function o(c){if(c.tag===13){var f=c.memoizedState;if(f===null&&(c=c.alternate,c!==null&&(f=c.memoizedState)),f!==null)return f.dehydrated}return null}function l(c){if(c.tag===31){var f=c.memoizedState;if(f===null&&(c=c.alternate,c!==null&&(f=c.memoizedState)),f!==null)return f.dehydrated}return null}function u(c){if(a(c)!==c)throw Error(r(188))}function d(c){var f=c.alternate;if(!f){if(f=a(c),f===null)throw Error(r(188));return f!==c?null:c}for(var b=c,w=f;;){var R=b.return;if(R===null)break;var L=R.alternate;if(L===null){if(w=R.return,w!==null){b=w;continue}break}if(R.child===L.child){for(L=R.child;L;){if(L===b)return u(R),c;if(L===w)return u(R),f;L=L.sibling}throw Error(r(188))}if(b.return!==w.return)b=R,w=L;else{for(var te=!1,xe=R.child;xe;){if(xe===b){te=!0,b=R,w=L;break}if(xe===w){te=!0,w=R,b=L;break}xe=xe.sibling}if(!te){for(xe=L.child;xe;){if(xe===b){te=!0,b=L,w=R;break}if(xe===w){te=!0,w=L,b=R;break}xe=xe.sibling}if(!te)throw Error(r(189))}}if(b.alternate!==w)throw Error(r(190))}if(b.tag!==3)throw Error(r(188));return b.stateNode.current===b?c:f}function h(c){var f=c.tag;if(f===5||f===26||f===27||f===6)return c;for(c=c.child;c!==null;){if(f=h(c),f!==null)return f;c=c.sibling}return null}var p=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),k=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function U(c){return c===null||typeof c!="object"?null:(c=V&&c[V]||c["@@iterator"],typeof c=="function"?c:null)}var $=Symbol.for("react.client.reference");function X(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===$?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case _:return"Fragment";case S:return"Profiler";case M:return"StrictMode";case I:return"Suspense";case D:return"SuspenseList";case G:return"Activity"}if(typeof c=="object")switch(c.$$typeof){case v:return"Portal";case E:return c.displayName||"Context";case A:return(c._context.displayName||"Context")+".Consumer";case C:var f=c.render;return c=c.displayName,c||(c=f.displayName||f.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case B:return f=c.displayName||null,f!==null?f:X(c.type)||"Memo";case P:f=c._payload,c=c._init;try{return X(c(f))}catch{}}return null}var ee=Array.isArray,z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},oe=[],re=-1;function F(c){return{current:c}}function O(c){0>re||(c.current=oe[re],oe[re]=null,re--)}function J(c,f){re++,oe[re]=c.current,c.current=f}var q=F(null),Q=F(null),ne=F(null),Z=F(null);function se(c,f){switch(J(ne,f),J(Q,c),J(q,null),f.nodeType){case 9:case 11:c=(c=f.documentElement)&&(c=c.namespaceURI)?oP(c):0;break;default:if(c=f.tagName,f=f.namespaceURI)f=oP(f),c=lP(f,c);else switch(c){case"svg":c=1;break;case"math":c=2;break;default:c=0}}O(q),J(q,c)}function me(){O(q),O(Q),O(ne)}function ze(c){c.memoizedState!==null&&J(Z,c);var f=q.current,b=lP(f,c.type);f!==b&&(J(Q,c),J(q,b))}function Be(c){Q.current===c&&(O(q),O(Q)),Z.current===c&&(O(Z),Mb._currentValue=ae)}var ye,Le;function Ce(c){if(ye===void 0)try{throw Error()}catch(b){var f=b.stack.trim().match(/\n( *(at )?)/);ye=f&&f[1]||"",Le=-1<b.stack.indexOf(`
2    at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
3`+ye+c+Le}var Re=!1;function De(c,f){if(!c||Re)return"";Re=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var w={DetermineComponentFrameRoot:function(){try{if(f){var jt=function(){throw Error()};if(Object.defineProperty(jt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(jt,[])}catch(gt){var dt=gt}Reflect.construct(c,[],jt)}
vendor: 8,734 bytes, lines 3-8
3else{try{jt.call()}catch(gt){dt=gt}c.call(jt.prototype)}}else{try{throw Error()}catch(gt){dt=gt}(jt=c())&&typeof jt.catch=="function"&&jt.catch(function(){})}}catch(gt){if(gt&&dt&&typeof gt.stack=="string")return[gt.stack,dt.stack]}return[null,null]}};w.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var R=Object.getOwnPropertyDescriptor(w.DetermineComponentFrameRoot,"name");R&&R.configurable&&Object.defineProperty(w.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var L=w.DetermineComponentFrameRoot(),te=L[0],xe=L[1];if(te&&xe){var Oe=te.split(`
4`),ct=xe.split(`
5`);for(R=w=0;w<Oe.length&&!Oe[w].includes("DetermineComponentFrameRoot");)w++;for(;R<ct.length&&!ct[R].includes("DetermineComponentFrameRoot");)R++;if(w===Oe.length||R===ct.length)for(w=Oe.length-1,R=ct.length-1;1<=w&&0<=R&&Oe[w]!==ct[R];)R--;for(;1<=w&&0<=R;w--,R--)if(Oe[w]!==ct[R]){if(w!==1||R!==1)do if(w--,R--,0>R||Oe[w]!==ct[R]){var St=`
6`+Oe[w].replace(" at new "," at ");return c.displayName&&St.includes("<anonymous>")&&(St=St.replace("<anonymous>",c.displayName)),St}while(1<=w&&0<=R);break}}}finally{Re=!1,Error.prepareStackTrace=b}return(b=c?c.displayName||c.name:"")?Ce(b):""}function he(c,f){switch(c.tag){case 26:case 27:case 5:return Ce(c.type);case 16:return Ce("Lazy");case 13:return c.child!==f&&f!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return De(c.type,!1);case 11:return De(c.type.render,!1);case 1:return De(c.type,!0);case 31:return Ce("Activity");default:return""}}function le(c){try{var f="",b=null;do f+=he(c,b),b=c,c=c.return;while(c);return f}catch(w){return`
7Error generating stack: `+w.message+`
8`+w.stack}}var Xe=Object.prototype.hasOwnProperty,qe=n.unstable_scheduleCallback,Ge=n.unstable_cancelCallback,ot=n.unstable_shouldYield,ve=n.unstable_requestPaint,mt=n.unstable_now,xt=n.unstable_getCurrentPriorityLevel,ge=n.unstable_ImmediatePriority,Y=n.unstable_UserBlockingPriority,je=n.unstable_NormalPriority,Ie=n.unstable_LowPriority,Ve=n.unstable_IdlePriority,ft=n.log,vt=n.unstable_setDisableYieldValue,ce=null,Me=null;function Fe(c){if(typeof ft=="function"&&vt(c),Me&&typeof Me.setStrictMode=="function")try{Me.setStrictMode(ce,c)}catch{}}var ie=Math.clz32?Math.clz32:at,Se=Math.log,Ae=Math.LN2;function at(c){return c>>>=0,c===0?32:31-(Se(c)/Ae|0)|0}var pe=256,Ke=262144,Ne=4194304;function Ye(c){var f=c&42;if(f!==0)return f;switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return c&261888;case 262144:case 524288:case 1048576:case 2097152:return c&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return c&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return c}}function Te(c,f,b){var w=c.pendingLanes;if(w===0)return 0;var R=0,L=c.suspendedLanes,te=c.pingedLanes;c=c.warmLanes;var xe=w&134217727;return xe!==0?(w=xe&~L,w!==0?R=Ye(w):(te&=xe,te!==0?R=Ye(te):b||(b=xe&~c,b!==0&&(R=Ye(b))))):(xe=w&~L,xe!==0?R=Ye(xe):te!==0?R=Ye(te):b||(b=w&~c,b!==0&&(R=Ye(b)))),R===0?0:f!==0&&f!==R&&(f&L)===0&&(L=R&-R,b=f&-f,L>=b||L===32&&(b&4194048)!==0)?f:R}function st(c,f){return(c.pendingLanes&~(c.suspendedLanes&~c.pingedLanes)&f)===0}function et(c,f){switch(c){case 1:case 2:case 4:case 8:case 64:return f+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qe(){var c=Ne;return Ne<<=1,(Ne&62914560)===0&&(Ne=4194304),c}function Mt(c){for(var f=[],b=0;31>b;b++)f.push(c);return f}function ue(c,f){c.pendingLanes|=f,f!==268435456&&(c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0)}function Je(c,f,b,w,R,L){var te=c.pendingLanes;c.pendingLanes=b,c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0,c.expiredLanes&=b,c.entangledLanes&=b,c.errorRecoveryDisabledLanes&=b,c.shellSuspendCounter=0;var xe=c.entanglements,Oe=c.expirationTimes,ct=c.hiddenUpdates;for(b=te&~b;0<b;){var St=31-ie(b),jt=1<<St;xe[St]=0,Oe[St]=-1;var dt=ct[St];if(dt!==null)for(ct[St]=null,St=0;St<dt.length;St++){var gt=dt[St];gt!==null&&(gt.lane&=-536870913)}b&=~jt}w!==0&&it(c,w,0),L!==0&&R===0&&c.tag!==0&&(c.suspendedLanes|=L&~(te&~f))}function it(c,f,b){c.pendingLanes|=f,c.suspendedLanes&=~f;var w=31-ie(f);c.entangledLanes|=f,c.entanglements[w]=c.entanglements[w]|1073741824|b&261930}function Et(c,f){var b=c.entangledLanes|=f;for(c=c.entanglements;b;){var w=31-ie(b),R=1<<w;R&f|c[w]&f&&(c[w]|=f),b&=~R}}function Wt(c,f){var b=f&-f;return b=(b&42)!==0?1:an(b),(b&(c.suspendedLanes|f))!==0?0:b}function an(c){switch(c){case 2:c=1;break;case 8:c=4;break;case 32:c=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:c=128;break;case 268435456:c=134217728;break;default:c=0}return c}function Sn(c){return c&=-c,2<c?8<c?(c&134217727)!==0?32:268435456:8:2}function Lr(){var c=K.p;return c!==0?c:(c=window.event,c===void 0?32:RP(c.type))}function Gr(c,f){var b=K.p;try{return K.p=c,f()}finally{K.p=b}}var Nr=Math.random().toString(36).slice(2),Wn="__reactFiber$"+Nr,jr="__reactProps$"+Nr,es="__reactContainer$"+Nr,Tr="__reactEvents$"+Nr,as="__reactListeners$"+Nr,Ps="__reactHandles$"+Nr,gi="__reactResources$"+Nr,Xr="__reactMarker$"+Nr;function ps(c){delete c[Wn],delete c[jr],delete c[Tr],delete c[as],delete c[Ps]}function xi(c){var f=c[Wn];if(f)return f;for(var b=c.parentNode;b;){if(f=b[es]||b[Wn]){if(b=f.alternate,f.child!==null||b!==null&&b.child!==null)for(c=pP(c);c!==null;){if(b=c[Wn])return b;c=pP(c)}return f}c=b,b=c.parentNode}return null}function Ds(c){if(c=c[Wn]||c[es]){var f=c.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return c}return null}function Vs(c){var f=c.tag;if(f===5||f===26||f===27||f===6)return c.stateNode;throw Error(r(33))}function Yt(c){var f=c[gi];return f||(f=c[gi]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function or(c){c[Xr]=!0}var ks=new Set,de={};function He(c,f){rt(c,f),rt(c+"Capture",f)}function rt(c,f){for(de[c]=f,c=0;c<f.length;c++)ks.add(f[c])}var Ze=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),We={},Ct={};function zt(c){return Xe.call(Ct,c)?!0:Xe.call(We,c)?!1:Ze.test(c)?Ct[c]=!0:(We[c]=!0,!1)}function Pt(c,f,b){if(zt(f))if(b===null)c.removeAttribute(f);else{switch(typeof b){case"undefined":case"function":case"symbol":c.removeAttribute(f);return;case"boolean":var w=f.toLowerCase().slice(0,5);if(w!=="data-"&&w!=="aria-"){c.removeAttribute(f);return}}c.setAttribute(f,""+b)}}function _t(c,f,b){if(b===null)c.removeAttribute(f);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":c.removeAttribute(f);return}c.setAttribute(f,""+b)}}function kt(c,f,b,w){if(w===null)c.removeAttribute(b);else{switch(typeof w){case"undefined":case"function":case"symbol":case"boolean":c.removeAttribute(b);return}c.setAttributeNS(f,b,""+w)}}function Rt(c){switch(typeof c){case"bigint":case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function qt(c){var f=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Qt(c,f,b){var w=Object.getOwnPropertyDescriptor(c.constructor.prototype,f);if(!c.hasOwnProperty(f)&&typeof w<"u"&&typeof w.get=="function"&&typeof w.set=="function"){var R=w.get,L=w.set;return Object.defineProperty(c,f,{configurable:!0,get:function(){return R.call(this)},set:function(te){b=""+te,L.call(this,te)}}),Object.defineProperty(c,f,{enumerable:w.enumerable}),{getValue:function(){return b},setValue:function(te){b=""+te},stopTracking:function(){c._valueTracker=null,delete c[f]}}}}function nn(c){if(!c._valueTracker){var f=qt(c)?"checked":"value";c._valueTracker=Qt(c,f,""+c[f])}}function Cn(c){if(!c)return!1;var f=c._valueTracker;if(!f)return!0;var b=f.getValue(),w="";
vendor: 4,755 bytes, line 8
8return c&&(w=qt(c)?c.checked?"true":"false":c.value),c=w,c!==b?(f.setValue(c),!0):!1}function Zt(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}var Fn=/[\n"\\]/g;function _n(c){return c.replace(Fn,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function Gt(c,f,b,w,R,L,te,xe){c.name="",te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?c.type=te:c.removeAttribute("type"),f!=null?te==="number"?(f===0&&c.value===""||c.value!=f)&&(c.value=""+Rt(f)):c.value!==""+Rt(f)&&(c.value=""+Rt(f)):te!=="submit"&&te!=="reset"||c.removeAttribute("value"),f!=null?mn(c,te,Rt(f)):b!=null?mn(c,te,Rt(b)):w!=null&&c.removeAttribute("value"),R==null&&L!=null&&(c.defaultChecked=!!L),R!=null&&(c.checked=R&&typeof R!="function"&&typeof R!="symbol"),xe!=null&&typeof xe!="function"&&typeof xe!="symbol"&&typeof xe!="boolean"?c.name=""+Rt(xe):c.removeAttribute("name")}function Rr(c,f,b,w,R,L,te,xe){if(L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(c.type=L),f!=null||b!=null){if(!(L!=="submit"&&L!=="reset"||f!=null)){nn(c);return}b=b!=null?""+Rt(b):"",f=f!=null?""+Rt(f):b,xe||f===c.value||(c.value=f),c.defaultValue=f}w=w??R,w=typeof w!="function"&&typeof w!="symbol"&&!!w,c.checked=xe?c.checked:!!w,c.defaultChecked=!!w,te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"&&(c.name=te),nn(c)}function mn(c,f,b){f==="number"&&Zt(c.ownerDocument)===c||c.defaultValue===""+b||(c.defaultValue=""+b)}function Or(c,f,b,w){if(c=c.options,f){f={};for(var R=0;R<b.length;R++)f["$"+b[R]]=!0;for(b=0;b<c.length;b++)R=f.hasOwnProperty("$"+c[b].value),c[b].selected!==R&&(c[b].selected=R),R&&w&&(c[b].defaultSelected=!0)}else{for(b=""+Rt(b),f=null,R=0;R<c.length;R++){if(c[R].value===b){c[R].selected=!0,w&&(c[R].defaultSelected=!0);return}f!==null||c[R].disabled||(f=c[R])}f!==null&&(f.selected=!0)}}function os(c,f,b){if(f!=null&&(f=""+Rt(f),f!==c.value&&(c.value=f),b==null)){c.defaultValue!==f&&(c.defaultValue=f);return}c.defaultValue=b!=null?""+Rt(b):""}function gs(c,f,b,w){if(f==null){if(w!=null){if(b!=null)throw Error(r(92));if(ee(w)){if(1<w.length)throw Error(r(93));w=w[0]}b=w}b==null&&(b=""),f=b}b=Rt(f),c.defaultValue=b,w=c.textContent,w===b&&w!==""&&w!==null&&(c.value=w),nn(c)}function As(c,f){if(f){var b=c.firstChild;if(b&&b===c.lastChild&&b.nodeType===3){b.nodeValue=f;return}}c.textContent=f}var At=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ht(c,f,b){var w=f.indexOf("--")===0;b==null||typeof b=="boolean"||b===""?w?c.setProperty(f,""):f==="float"?c.cssFloat="":c[f]="":w?c.setProperty(f,b):typeof b!="number"||b===0||At.has(f)?f==="float"?c.cssFloat=b:c[f]=(""+b).trim():c[f]=b+"px"}function Dn(c,f,b){if(f!=null&&typeof f!="object")throw Error(r(62));if(c=c.style,b!=null){for(var w in b)!b.hasOwnProperty(w)||f!=null&&f.hasOwnProperty(w)||(w.indexOf("--")===0?c.setProperty(w,""):w==="float"?c.cssFloat="":c[w]="");for(var R in f)w=f[R],f.hasOwnProperty(R)&&b[R]!==w&&Ht(c,R,w)}else for(var L in f)f.hasOwnProperty(L)&&Ht(c,L,f[L])}function In(c){if(c.indexOf("-")===-1)return!1;switch(c){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xs=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
8dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ii=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cs(c){return ii.test(""+c)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":c}function ts(){}var pa=null;function Bo(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var zi=null,Ei=null;function il(c){var f=Ds(c);if(f&&(c=f.stateNode)){var b=c[jr]||null;e:switch(c=f.stateNode,f.type){case"input":if(Gt(c,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name),f=b.name,b.type==="radio"&&f!=null){for(b=c;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll('input[name="'+_n(""+f)+'"][type="radio"]'),f=0;f<b.length;f++){var w=b[f];if(w!==c&&w.form===c.form){var R=w[jr]||null;if(!R)throw Error(r(90));Gt(w,R.value,R.defaultValue,R.defaultValue,R.checked,R.defaultChecked,R.type,R.name)}}for(f=0;f<b.length;f++)w=b[f],w.form===c.form&&Cn(w)}break e;case"textarea":os(c,b.value,b.defaultValue);break e;case"select":f=b.value,f!=null&&Or(c,!!b.multiple,f,!1)}}}var wr=!1;function Is(c,f,b){if(wr)return c(f,b);wr=!0;try{var w=c(f);return w}finally{if(wr=!1,(zi!==null||Ei!==null)&&(Ho(),zi&&(f=zi,c=Ei,Ei=zi=null,il(f),c)))for(f=0;f<c.length;f++)il(c[f])}}function lo(c,f){var b=c.stateNode;if(b===null)return null;var w=b[jr]||null;if(w===null)return null;b=w[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(c=c.type,w=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!w;break e;default:c=!1}if(c)return null;if(b&&typeof b!="function")throw Error(r(231,f,typeof b));return b}var be=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),It=!1;if(be)try{var en={};Object.defineProperty(en,"passive",{get:function(){It=!0}}),window.addEventListener("test",en,en),window.removeEventListener("test",en,en)}catch{It=!1}var ln=null,Un=null,Zn=null;function Hr(){if(Zn)return Zn;var c,f=Un,b=f.length,w,R="value"in ln?ln.value:ln.textContent,L=R.length;for(c=0;c<b&&f[c]===R[c];c++);var te=b-c;for(w=1;w<=te&&f[b-w]===R[L-w];w++);return Zn=R.slice(c,1<w?1-w:void 0)}function kc(c){var f=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&f===13&&(c=13)):c=f,c===10&&(c=13),32<=c||c===13?c:0}function co(){return!0}function Ic(){return!1}function ls(c){function f(b,w,R,L,te){this._reactName=b,this._targetInst=R,this.type=w,this.nativeEvent=L,this.target=te,this.currentTarget=null;for(var xe in c)c.hasOwnProperty(xe)&&(b=c[xe],this[xe]=b?b(L):L[xe]);return this.isDefaultPrevented=(L.defaultPrevented!=null?L.defaultPrevented:L.returnValue===!1)?co:Ic,this.isPropagationStopped=Ic,this}return p(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=co)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=co)},persist:function(){},isPersistent:co}),f}var Lo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ql=ls(Lo),al=p({},Lo,{view:0,detail:0}),Bc=ls(al),Lc,ol,ll,Ws=p({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kp,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==ll&&(ll&&c.type==="mousemove"?(Lc=c.screenX-ll.screenX,ol=c.screenY-ll.screenY):ol=Lc=0,ll=c),Lc)},movementY:function(c){return"movementY"in c?c.movementY:ol}}),Ph=ls(Ws),Gu=p({},Ws,{dataTransfer:0}),Hu=ls(Gu),Qd=p({},al,{relatedTarget:0}),Kd=ls(Qd),ji=p({},Lo,{animationName:0,elapsedTime:0,pseudoElement:0}),Ba=ls(ji),Gi=p({},Lo,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),Oo=ls(Gi),Oc=p({},Lo,{data:0}),Pp=ls(Oc),Dp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ov={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function u0(c){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(c):(c=Ov[c])?!!f[c]:!1}function kp(){return u0}var Fv=p({},al,{key:function(c){if(c.key){var f=Dp[c.key]||c.key;if(f!=="Unidentified")return f}
vendor: 8,017 bytes, line 8
8return c.type==="keypress"?(c=kc(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?Lv[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kp,charCode:function(c){return c.type==="keypress"?kc(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?kc(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),Vu=ls(Fv),Ip=p({},Ws,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),d0=ls(Ip),f0=p({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kp}),Uv=ls(f0),zv=p({},Lo,{propertyName:0,elapsedTime:0,pseudoElement:0}),bA=ls(zv),Ti=p({},Ws,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),Gv=ls(Ti),Hv=p({},Lo,{newState:0,oldState:0}),Vv=ls(Hv),Wv=[9,13,27,32],Wu=be&&"CompositionEvent"in window,Jd=null;be&&"documentMode"in document&&(Jd=document.documentMode);var Bp=be&&"TextEvent"in window&&!Jd,h0=be&&(!Wu||Jd&&8<Jd&&11>=Jd),$v=" ",Dh=!1;function Lp(c,f){switch(c){case"keyup":return Wv.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function m0(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var $u=!1;function Xv(c,f){switch(c){case"compositionend":return m0(f);case"keypress":return f.which!==32?null:(Dh=!0,$v);case"textInput":return c=f.data,c===$v&&Dh?null:c;default:return null}}function p0(c,f){if($u)return c==="compositionend"||!Wu&&Lp(c,f)?(c=Hr(),Zn=Un=ln=null,$u=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return h0&&f.locale!=="ko"?null:f.data;default:return null}}var g0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function x0(c){var f=c&&c.nodeName&&c.nodeName.toLowerCase();return f==="input"?!!g0[c.type]:f==="textarea"}function Op(c,f,b,w){zi?Ei?Ei.push(w):Ei=[w]:zi=w,f=J1(f,"onChange"),0<f.length&&(b=new ql("onChange","change",null,b,w),c.push({event:b,listeners:f}))}var Fc=null,Xu=null;function qv(c){tP(c,0)}function Zd(c){var f=Vs(c);if(Cn(f))return c}function b0(c,f){if(c==="change")return f}var cl=!1;if(be){var kh;if(be){var y0="oninput"in document;if(!y0){var v0=document.createElement("div");v0.setAttribute("oninput","return;"),y0=typeof v0.oninput=="function"}kh=y0}else kh=!1;cl=kh&&(!document.documentMode||9<document.documentMode)}function uo(){Fc&&(Fc.detachEvent("onpropertychange",Ih),Xu=Fc=null)}function Ih(c){if(c.propertyName==="value"&&Zd(Xu)){var f=[];Op(f,Xu,c,Bo(c)),Is(qv,f)}}function Yv(c,f,b){c==="focusin"?(uo(),Fc=f,Xu=b,Fc.attachEvent("onpropertychange",Ih)):c==="focusout"&&uo()}function w0(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return Zd(Xu)}function Qv(c,f){if(c==="click")return Zd(f)}function Kv(c,f){if(c==="input"||c==="change")return Zd(f)}function S0(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var Zi=typeof Object.is=="function"?Object.is:S0;function ef(c,f){if(Zi(c,f))return!0;if(typeof c!="object"||c===null||typeof f!="object"||f===null)return!1;var b=Object.keys(c),w=Object.keys(f);if(b.length!==w.length)return!1;for(w=0;w<b.length;w++){var R=b[w];if(!Xe.call(f,R)||!Zi(c[R],f[R]))return!1}return!0}function Bh(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function tf(c,f){var b=Bh(c);c=0;for(var w;b;){if(b.nodeType===3){if(w=c+b.textContent.length,c<=f&&w>=f)return{node:b,offset:f-c};c=w}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Bh(b)}}function Yr(c,f){return c&&f?c===f?!0:c&&c.nodeType===3?!1:f&&f.nodeType===3?Yr(c,f.parentNode):"contains"in c?c.contains(f):c.compareDocumentPosition?!!(c.compareDocumentPosition(f)&16):!1:!1}function Jv(c){c=c!=null&&c.ownerDocument!=null&&c.ownerDocument.defaultView!=null?c.ownerDocument.defaultView:window;for(var f=Zt(c.document);f instanceof c.HTMLIFrameElement;){try{var b=typeof f.contentWindow.location.href=="string"}catch{b=!1}if(b)c=f.contentWindow;else break;f=Zt(c.document)}return f}function _0(c){var f=c&&c.nodeName&&c.nodeName.toLowerCase();return f&&(f==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||f==="textarea"||c.contentEditable==="true")}var Zv=be&&"documentMode"in document&&11>=document.documentMode,ul=null,dl=null,nf=null,Fp=!1;function rf(c,f,b){var w=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Fp||ul==null||ul!==Zt(w)||(w=ul,"selectionStart"in w&&_0(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),nf&&ef(nf,w)||(nf=w,w=J1(dl,"onSelect"),0<w.length&&(f=new ql("onSelect","select",null,f,b),c.push({event:f,listeners:w}),f.target=ul)))}function Hi(c,f){var b={};return b[c.toLowerCase()]=f.toLowerCase(),b["Webkit"+c]="webkit"+f,b["Moz"+c]="moz"+f,b}var qu={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},Lh={},M0={};be&&(M0=document.createElement("div").style,"AnimationEvent"in window||(delete qu.animationend.animation,delete qu.animationiteration.animation,delete qu.animationstart.animation),"TransitionEvent"in window||delete qu.transitionend.transition);function Yl(c){if(Lh[c])return Lh[c];if(!qu[c])return c;var f=qu[c],b;for(b in f)if(f.hasOwnProperty(b)&&b in M0)return Lh[c]=f[b];return c}var Up=Yl("animationend"),Oh=Yl("animationiteration"),N0=Yl("animationstart"),e1=Yl("transitionrun"),yA=Yl("transitionstart"),t1=Yl("transitioncancel"),A0=Yl("transitionend"),fo=new Map,Fh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Fh.push("scrollEnd");function ho(c,f){fo.set(c,f),He(f,[c])}var Uh=typeof reportError=="function"?reportError:function(c){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof c=="object"&&c!==null&&typeof c.message=="string"?String(c.message):String(c),error:c});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",c);return}console.error(c)},mo=[],Ql=0,bi=0;function zh(){for(var c=Ql,f=bi=Ql=0;f<c;){var b=mo[f];mo[f++]=null;var w=mo[f];mo[f++]=null;var R=mo[f];mo[f++]=null;var L=mo[f];if(mo[f++]=null,w!==null&&R!==null){var te=w.pending;te===null?R.next=R:(R.next=te.next,te.next=R),w.pending=R}L!==0&&Uc(b,R,L)}}function yi(c,f,b,w){mo[Ql++]=c,mo[Ql++]=f,mo[Ql++]=b,mo[Ql++]=w,bi|=w,c.lanes|=w,c=c.alternate,c!==null&&(c.lanes|=w)}function zp(c,f,b,w){return yi(c,f,b,w),po(c)}
vendor: 1,957 bytes, line 8
8function ea(c,f){return yi(c,null,null,f),po(c)}function Uc(c,f,b){c.lanes|=b;var w=c.alternate;w!==null&&(w.lanes|=b);for(var R=!1,L=c.return;L!==null;)L.childLanes|=b,w=L.alternate,w!==null&&(w.childLanes|=b),L.tag===22&&(c=L.stateNode,c===null||c._visibility&1||(R=!0)),c=L,L=L.return;return c.tag===3?(L=c.stateNode,R&&f!==null&&(R=31-ie(b),c=L.hiddenUpdates,w=c[R],w===null?c[R]=[f]:w.push(f),f.lane=b|536870912),L):null}function po(c){if(50<iu)throw iu=0,hd=null,Error(r(185));for(var f=c.return;f!==null;)c=f,f=c.return;return c.tag===3?c.stateNode:null}var zc={};function C0(c,f,b,w){this.tag=c,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bs(c,f,b,w){return new C0(c,f,b,w)}function Gp(c){return c=c.prototype,!(!c||!c.isReactComponent)}function ga(c,f){var b=c.alternate;return b===null?(b=bs(c.tag,f,c.key,c.mode),b.elementType=c.elementType,b.type=c.type,b.stateNode=c.stateNode,b.alternate=c,c.alternate=b):(b.pendingProps=f,b.type=c.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=c.flags&65011712,b.childLanes=c.childLanes,b.lanes=c.lanes,b.child=c.child,b.memoizedProps=c.memoizedProps,b.memoizedState=c.memoizedState,b.updateQueue=c.updateQueue,f=c.dependencies,b.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},b.sibling=c.sibling,b.index=c.index,b.ref=c.ref,b.refCleanup=c.refCleanup,b}function sf(c,f){c.flags&=65011714;var b=c.alternate;return b===null?(c.childLanes=0,c.lanes=f,c.child=null,c.subtreeFlags=0,c.memoizedProps=null,c.memoizedState=null,c.updateQueue=null,c.dependencies=null,c.stateNode=null):(c.childLanes=b.childLanes,c.lanes=b.lanes,c.child=b.child,c.subtreeFlags=0,c.deleti
vendor: 12,601 bytes, line 8
8ons=null,c.memoizedProps=b.memoizedProps,c.memoizedState=b.memoizedState,c.updateQueue=b.updateQueue,c.type=b.type,f=b.dependencies,c.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),c}function fl(c,f,b,w,R,L){var te=0;if(w=c,typeof c=="function")Gp(c)&&(te=1);else if(typeof c=="string")te=hH(c,b,q.current)?26:c==="html"||c==="head"||c==="body"?27:5;else e:switch(c){case G:return c=bs(31,b,f,R),c.elementType=G,c.lanes=L,c;case _:return Gc(b.children,R,L,f);case M:te=8,R|=24;break;case S:return c=bs(12,b,f,R|2),c.elementType=S,c.lanes=L,c;case I:return c=bs(13,b,f,R),c.elementType=I,c.lanes=L,c;case D:return c=bs(19,b,f,R),c.elementType=D,c.lanes=L,c;default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case E:te=10;break e;case A:te=9;break e;case C:te=11;break e;case B:te=14;break e;case P:te=16,w=null;break e}te=29,b=Error(r(130,c===null?"null":typeof c,"")),w=null}return f=bs(te,b,f,R),f.elementType=c,f.type=w,f.lanes=L,f}function Gc(c,f,b,w){return c=bs(7,c,w,f),c.lanes=b,c}function Hp(c,f,b){return c=bs(6,c,null,f),c.lanes=b,c}function af(c){var f=bs(18,null,null,0);return f.stateNode=c,f}function Vp(c,f,b){return f=bs(4,c.children!==null?c.children:[],c.key,f),f.lanes=b,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}var Gh=new WeakMap;function La(c,f){if(typeof c=="object"&&c!==null){var b=Gh.get(c);return b!==void 0?b:(f={value:c,source:f,stack:le(f)},Gh.set(c,f),f)}return{value:c,source:f,stack:le(f)}}var Hc=[],Vc=0,of=null,lf=0,xa=[],cs=0,Kl=null,ys=1,Fo="";function hl(c,f){Hc[Vc++]=lf,Hc[Vc++]=of,of=c,lf=f}function n1(c,f,b){xa[cs++]=ys,xa[cs++]=Fo,xa[cs++]=Kl,Kl=c;var w=ys;c=Fo;var R=32-ie(w)-1;w&=~(1<<R),b+=1;var L=32-ie(f)+R;if(30<L){var te=R-R%5;L=(w&(1<<te)-1).toString(32),w>>=te,R-=te,ys=1<<32-ie(f)+R|b<<R|w,Fo=L+c}else ys=1<<L|b<<R|w,Fo=c}function ml(c){c.return!==null&&(hl(c,1),n1(c,1,0))}function Wp(c){for(;c===of;)of=Hc[--Vc],Hc[Vc]=null,lf=Hc[--Vc],Hc[Vc]=null;for(;c===Kl;)Kl=xa[--cs],xa[cs]=null,Fo=xa[--cs],xa[cs]=null,ys=xa[--cs],xa[cs]=null}function $p(c,f){xa[cs++]=ys,xa[cs++]=Fo,xa[cs++]=Kl,ys=f.id,Fo=f.overflow,Kl=c}var Es=null,Qr=null,lr=!1,Jl=null,Oa=!1,cf=Error(r(519));function pl(c){var f=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gl(La(f,c)),cf}function r1(c){var f=c.stateNode,b=c.type,w=c.memoizedProps;switch(f[Wn]=c,f[jr]=w,b){case"dialog":fr("cancel",f),fr("close",f);break;case"iframe":case"object":case"embed":fr("load",f);break;case"video":case"audio":for(b=0;b<Eo.length;b++)fr(Eo[b],f);break;case"source":fr("error",f);break;case"img":case"image":case"link":fr("error",f),fr("load",f);break;case"details":fr("toggle",f);break;case"input":fr("invalid",f),Rr(f,w.value,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name,!0);break;case"select":fr("invalid",f);break;case"textarea":fr("invalid",f),gs(f,w.value,w.defaultValue,w.children)}b=w.children,typeof b!="string"&&typeof b!="number"&&typeof b!="bigint"||f.textContent===""+b||w.suppressHydrationWarning===!0||iP(f.textContent,b)?(w.popover!=null&&(fr("beforetoggle",f),fr("toggle",f)),w.onScroll!=null&&fr("scroll",f),w.onScrollEnd!=null&&fr("scrollend",f),w.onClick!=null&&(f.onclick=ts),f=!0):f=!1,f||pl(c,!0)}function s1(c){for(Es=c.return;Es;)switch(Es.tag){case 5:case 31:case 13:Oa=!1;return;case 27:case 3:Oa=!0;return;default:Es=Es.return}}function uf(c){if(c!==Es)return!1;if(!lr)return s1(c),lr=!0,!1;var f=c.tag,b;if((b=f!==3&&f!==27)&&((b=f===5)&&(b=c.type,b=!(b!=="form"&&b!=="button")||IA(c.type,c.memoizedProps)),b=!b),b&&Qr&&pl(c),s1(c),f===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(317));Qr=mP(c)}else if(f===31){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(317));Qr=mP(c)}else f===27?(f=Qr,Tf(c.type)?(c=UA,UA=null,Qr=c):Qr=f):Qr=Es?Tl(c.stateNode.nextSibling):null;return!0}function Wc(){Qr=Es=null,lr=!1}function Xp(){var c=Jl;return c!==null&&(Ts===null?Ts=c:Ts.push.apply(Ts,c),Jl=null),c}function gl(c){Jl===null?Jl=[c]:Jl.push(c)}var df=F(null),$c=null,xl=null;function Zl(c,f,b){J(df,f._currentValue),f._currentValue=b}function bl(c){c._currentValue=df.current,O(df)}function qp(c,f,b){for(;c!==null;){var w=c.alternate;if((c.childLanes&f)!==f?(c.childLanes|=f,w!==null&&(w.childLanes|=f)):w!==null&&(w.childLanes&f)!==f&&(w.childLanes|=f),c===b)break;c=c.return}}function Yp(c,f,b,w){var R=c.child;for(R!==null&&(R.return=c);R!==null;){var L=R.dependencies;if(L!==null){var te=R.child;L=L.firstContext;e:for(;L!==null;){var xe=L;L=R;for(var Oe=0;Oe<f.length;Oe++)if(xe.context===f[Oe]){L.lanes|=b,xe=L.alternate,xe!==null&&(xe.lanes|=b),qp(L.return,b,c),w||(te=null);break e}L=xe.next}}else if(R.tag===18){if(te=R.return,te===null)throw Error(r(341));te.lanes|=b,L=te.alternate,L!==null&&(L.lanes|=b),qp(te,b,c),te=null}else te=R.child;if(te!==null)te.return=R;else for(te=R;te!==null;){if(te===c){te=null;break}if(R=te.sibling,R!==null){R.return=te.return,te=R;break}te=te.return}R=te}}function yl(c,f,b,w){c=null;for(var R=f,L=!1;R!==null;){if(!L){if((R.flags&524288)!==0)L=!0;else if((R.flags&262144)!==0)break}if(R.tag===10){var te=R.alternate;if(te===null)throw Error(r(387));if(te=te.memoizedProps,te!==null){var xe=R.type;Zi(R.pendingProps.value,te.value)||(c!==null?c.push(xe):c=[xe])}}else if(R===Z.current){if(te=R.alternate,te===null)throw Error(r(387));te.memoizedState.memoizedState!==R.memoizedState.memoizedState&&(c!==null?c.push(Mb):c=[Mb])}R=R.return}c!==null&&Yp(f,c,b,w),f.flags|=262144}function Hh(c){for(c=c.firstContext;c!==null;){if(!Zi(c.context._currentValue,c.memoizedValue))return!0;c=c.next}return!1}function Xc(c){$c=c,xl=null,c=c.dependencies,c!==null&&(c.firstContext=null)}function An(c){return i1($c,c)}function ff(c,f){return $c===null&&Xc(c),i1(c,f)}function i1(c,f){var b=f._currentValue;if(f={context:f,memoizedValue:b,next:null},xl===null){if(c===null)throw Error(r(308));xl=f,c.dependencies={lanes:0,firstContext:f},c.flags|=524288}else xl=xl.next=f;return b}var a1=typeof AbortController<"u"?AbortController:function(){var c=[],f=this.signal={aborted:!1,addEventListener:function(b,w){c.push(w)}};this.abort=function(){f.aborted=!0,c.forEach(function(b){return b()})}},vA=n.unstable_scheduleCallback,wA=n.unstable_NormalPriority,$s={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function E0(){return{controller:new a1,data:new Map,refCount:0}}function Yu(c){c.refCount--,c.refCount===0&&vA(wA,function(){c.controller.abort()})}var Fa=null,Qp=0,ec=0,go=null;function j0(c,f){if(Fa===null){var b=Fa=[];Qp=0,ec=ht(),go={status:"pending",value:void 0,then:function(w){b.push(w)}}}return Qp++,f.then(T0,T0),f}function T0(){if(--Qp===0&&Fa!==null){go!==null&&(go.status="fulfilled");var c=Fa;Fa=null,ec=0,go=null;for(var f=0;f<c.length;f++)(0,c[f])()}}function R0(c,f){var b=[],w={status:"pending",value:null,reason:null,then:function(R){b.push(R)}};return c.then(function(){w.status="fulfilled",w.value=f;for(var R=0;R<b.length;R++)(0,b[R])(f)},function(R){for(w.status="rejected",w.reason=R,R=0;R<b.length;R++)(0,b[R])(void 0)}),w}var o1=z.S;z.S=function(c,f){bb=mt(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&j0(c,f),o1!==null&&o1(c,f)};var qc=F(null);function Kp(){var c=qc.current;return c!==null?c:kn.pooledCache}function Vh(c,f){f===null?J(qc,qc.current):J(qc,f.pool)}function P0(){var c=Kp();return c===null?null:{parent:$s._currentValue,pool:c}}var Qu=Error(r(460)),Wh=Error(r(474)),$n=Error(r(542)),Jp={then:function(){}};function ba(c){return c=c.status,c==="fulfilled"||c==="rejected"}function Zp(c,f,b){switch(b=c[b],b===void 0?c.push(f):b!==f&&(f.then(ts,ts),f=b),f.status){case"fulfilled":return f.value;case"rejected":throw c=f.reason,Zu(c),c;default:if(typeof f.status=="string")f.then(ts,ts);else{if(c=kn,c!==null&&100<c.shellSuspendCounter)throw Error(r(482));c=f,c.status="pending",c.then(function(w){if(f.status==="pending"){var R=f;R.status="fulfilled",R.value=w}},function(w){if(f.status==="pending"){var R=f;R.status="rejected",R.reason=w}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw c=f.reason,Zu(c),c}throw vl=f,Qu}}function Ku(c){try{var f=c._init;return f(c._payload)}catch(b){throw b!==null&&typeof b=="object"&&typeof b.then=="function"?(vl=b,Qu):b}}var vl=null;function Ju(){if(vl===null)throw Error(r(459));var c=vl;return vl=null,c}function Zu(c){if(c===Qu||c===$n)throw Error(r(483))}var ed=null,td=0;function $h(c){var f=td;return td+=1,ed===null&&(ed=[]),Zp(ed,c,f)}function xo(c,f){f=f.props.ref,c.ref=f!==void 0?f:null}function hf(c,f){throw f.$$typeof===x?Error(r(525)):(c=Object.prototype.toString.call(f),Error(r(31,c==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":c)))}function eg(c){function f(tt,$e){if(c){var lt=tt.deletions;lt===null?(tt.deletions=[$e],tt.flags|=16):lt.push($e)}}function b(tt,$e){if(!c)return null;for(;$e!==null;)f(tt,$e),$e=$e.sibling;return null}function w(tt){for(var $e=new Map;tt!==null;)tt.key!==null?$e.set(tt.key,tt):$e.set(tt.index,tt),tt=tt.sibling;return $e}function R(tt,$e){return tt=ga(tt,$e),tt.index=0,tt.sibling=null,tt}function L(tt,$e,lt){return tt.index=lt,c?(lt=tt.alternate,lt!==null?(lt=lt.index,lt<$e?(tt.flags|=67108866,$e):lt):(tt.flags|=67108866,$e)):(tt.flags|=1048576,$e)}function te(tt){return c&&tt.alternate===null&&(tt.flags|=67108866),tt}function xe(tt,$e,lt,Nt){return $e===null||$e.tag!==6?($e=Hp(lt,tt.mode,Nt),$e.return=tt,$e):($e=R($e,lt),$e.return=tt,$e)}function Oe(tt,$e,lt,Nt){var gn=lt.type;return gn===_?St(tt,$e,lt.props.children,Nt,lt.key):$e!==null&&($e.elementType===gn||typeof gn=="object"&&gn!==null&&gn.$$typeof===P&&Ku(gn)===$e.type)?($e=R($e,lt.props),xo($e,lt),$e.return=tt,$e):($e=fl(lt.type,lt.key,lt.props,null,tt.mode,Nt),xo($e,lt),$e.return=tt,$e)}function ct(tt,$e,lt,Nt){return $e===null||$e.tag!==4||$e.stateNode.containerInfo!==lt.containerInfo||$e.stateNode.implementation!==lt.implementation?($e=Vp(lt,tt.mode,Nt),$e.return=tt,$e):($e=R($e,lt.children||[]),$e.return=tt,$e)}function St(tt,$e,lt,Nt,gn){return $e===null||$e.tag!==7?($e=Gc(lt,tt.mode,Nt,gn),$e.return=tt,$e):($e=R($e,lt),$e.return=tt,$e)}function jt(tt,$e,lt){if(typeof $e=="string"&&$e!==""||typeof $e=="number"||typeof $e=="bigint")return $e=Hp(""+$e,tt.mode,lt),$e.return=tt,$e;if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case y:return lt=fl($e.type,$e.key,$e.props,null,tt.mode,lt),xo(lt,$e),lt.return=tt,lt;case v:return $e=Vp($e,tt.mode,lt),$e.return=tt,$e;case P:return $e=Ku($e),jt(tt,$e,lt)}if(ee($e)||U($e))return $e=Gc($e,tt.mode,lt,null),$e.return=tt,$e;if(typeof $e.then=="function")return jt(tt,$h($e),lt);if($e.$$typeof===E)return jt(tt,ff(tt,$e),lt);hf(tt,$e)}return null}function dt(tt,$e,lt,Nt){var gn=$e!==null?$e.key:null;if(typeof lt=="string"&&lt!==""||typeof lt=="number"||typeof lt=="bigint")return gn!==null?null:xe(tt,$e,""+lt,Nt);if(typeof lt=="object"&&lt!==null){switch(lt.$$typeof){case y:return lt.key===gn?Oe(tt,$e,lt,Nt):null;case v:return lt.key===gn?ct(tt,$e,lt,Nt):null;case P:return lt=Ku(lt),dt(tt,$e,lt,Nt)}if(ee(lt)||U(lt))return gn!==null?null:St(tt,$e,lt,Nt,null);if(typeof lt.then=="function")return dt(tt,$e,$h(lt),Nt);if(lt.$$typeof===E)return dt(tt,$e,ff(tt,lt),Nt);hf(tt,lt)}return null}function gt(tt,$e,lt,Nt,gn){if(typeof Nt=="string"&&Nt!==""||typeof Nt=="number"||typeof Nt=="bigint")return tt=tt.get(lt)||null,xe($e,tt,""+Nt,gn);if(typeof Nt=="object"&&Nt!==null){switch(Nt.$$typeof){case y:return tt=tt.get(Nt.key===null?lt:Nt.key)||null,Oe($e,tt,Nt,gn);case v:return tt=tt.get(Nt.key===null?lt:Nt.key)||null,ct($e,tt,Nt,gn);case P:return Nt=Ku(Nt),gt(tt,$e,lt,Nt,gn)}if(ee(Nt)||U(Nt))return tt=tt.get(lt)||null,St($e,tt,Nt,gn,null);if(typeof Nt.then=="function")return gt(tt,$e,lt,$h(Nt),gn);if(Nt.$$typeof===E)return gt(tt,$e,lt,ff($e,Nt),gn);hf($e,Nt)}return null}function on(tt,$e,lt,Nt){for(var gn=null,Pr=null,un=$e,Kn=$e=0,gr=null;un!==null&&Kn<lt.length;Kn++){un.index>Kn?(gr=un,un=null):gr=un.sibling;var Dr=dt(tt,un,lt[Kn],Nt);if(Dr===null){un===null&&(un=gr);break}c&&un&&Dr.alternate===null&&f(tt,un),$e=L(Dr,$e,Kn),Pr===null?gn=Dr:Pr.sibling=Dr,Pr=Dr,un=gr}if(Kn===lt.length)return b(tt,un),lr&&hl(tt,Kn),gn;if(un===null){for(;Kn<lt.length;Kn++)un=jt(tt,lt[Kn],Nt),un!==null&&($e=L(un,$e,Kn),Pr===null?gn=un:Pr.sibling=un,Pr=un);return lr&&hl(tt,Kn),gn}for(un=w(un);Kn<lt.length;Kn++)gr=gt(un,tt,Kn,lt[Kn],Nt),gr!==null&&(c&&gr.alternate!==null&&un.delete(gr.key===null?Kn:gr.key),$e=L(gr,$e,Kn),Pr===null?gn=gr:Pr.sibling=gr,Pr=gr);
vendor: 5,023 bytes, line 8
8return c&&un.forEach(function(If){return f(tt,If)}),lr&&hl(tt,Kn),gn}function Mn(tt,$e,lt,Nt){if(lt==null)throw Error(r(151));for(var gn=null,Pr=null,un=$e,Kn=$e=0,gr=null,Dr=lt.next();un!==null&&!Dr.done;Kn++,Dr=lt.next()){un.index>Kn?(gr=un,un=null):gr=un.sibling;var If=dt(tt,un,Dr.value,Nt);if(If===null){un===null&&(un=gr);break}c&&un&&If.alternate===null&&f(tt,un),$e=L(If,$e,Kn),Pr===null?gn=If:Pr.sibling=If,Pr=If,un=gr}if(Dr.done)return b(tt,un),lr&&hl(tt,Kn),gn;if(un===null){for(;!Dr.done;Kn++,Dr=lt.next())Dr=jt(tt,Dr.value,Nt),Dr!==null&&($e=L(Dr,$e,Kn),Pr===null?gn=Dr:Pr.sibling=Dr,Pr=Dr);return lr&&hl(tt,Kn),gn}for(un=w(un);!Dr.done;Kn++,Dr=lt.next())Dr=gt(un,tt,Kn,Dr.value,Nt),Dr!==null&&(c&&Dr.alternate!==null&&un.delete(Dr.key===null?Kn:Dr.key),$e=L(Dr,$e,Kn),Pr===null?gn=Dr:Pr.sibling=Dr,Pr=Dr);return c&&un.forEach(function(MH){return f(tt,MH)}),lr&&hl(tt,Kn),gn}function Zr(tt,$e,lt,Nt){if(typeof lt=="object"&&lt!==null&&lt.type===_&&lt.key===null&&(lt=lt.props.children),typeof lt=="object"&&lt!==null){switch(lt.$$typeof){case y:e:{for(var gn=lt.key;$e!==null;){if($e.key===gn){if(gn=lt.type,gn===_){if($e.tag===7){b(tt,$e.sibling),Nt=R($e,lt.props.children),Nt.return=tt,tt=Nt;break e}}else if($e.elementType===gn||typeof gn=="object"&&gn!==null&&gn.$$typeof===P&&Ku(gn)===$e.type){b(tt,$e.sibling),Nt=R($e,lt.props),xo(Nt,lt),Nt.return=tt,tt=Nt;break e}b(tt,$e);break}else f(tt,$e);$e=$e.sibling}lt.type===_?(Nt=Gc(lt.props.children,tt.mode,Nt,lt.key),Nt.return=tt,tt=Nt):(Nt=fl(lt.type,lt.key,lt.props,null,tt.mode,Nt),xo(Nt,lt),Nt.return=tt,tt=Nt)}return te(tt);case v:e:{for(gn=lt.key;$e!==null;){if($e.key===gn)if($e.tag===4&&$e.stateNode.containerInfo===lt.containerInfo&&$e.stateNode.implementation===lt.implementation){b(tt,$e.sibling),Nt=R($e,lt.children||[]),Nt.return=tt,tt=Nt;break e}else{b(tt,$e);break}else f(tt,$e);$e=$e.sibling}Nt=Vp(lt,tt.mode,Nt),Nt.return=tt,tt=Nt}return te(tt);case P:return lt=Ku(lt),Zr(tt,$e,lt,Nt)}if(ee(lt))return on(tt,$e,lt,Nt);if(U(lt)){if(gn=U(lt),typeof gn!="function")throw Error(r(150));return lt=gn.call(lt),Mn(tt,$e,lt,Nt)}if(typeof lt.then=="function")return Zr(tt,$e,$h(lt),Nt);if(lt.$$typeof===E)return Zr(tt,$e,ff(tt,lt),Nt);hf(tt,lt)}return typeof lt=="string"&&lt!==""||typeof lt=="number"||typeof lt=="bigint"?(lt=""+lt,$e!==null&&$e.tag===6?(b(tt,$e.sibling),Nt=R($e,lt),Nt.return=tt,tt=Nt):(b(tt,$e),Nt=Hp(lt,tt.mode,Nt),Nt.return=tt,tt=Nt),te(tt)):b(tt,$e)}return function(tt,$e,lt,Nt){try{td=0;var gn=Zr(tt,$e,lt,Nt);return ed=null,gn}catch(un){if(un===Qu||un===$n)throw un;var Pr=bs(29,un,null,tt.mode);return Pr.lanes=Nt,Pr.return=tt,Pr}}}var tc=eg(!0),tg=eg(!1),ta=!1;function Xh(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function D0(c,f){c=c.updateQueue,f.updateQueue===c&&(f.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,callbacks:null})}function nc(c){return{lane:c,tag:0,payload:null,callback:null,next:null}}function Yc(c,f,b){var w=c.updateQueue;if(w===null)return null;if(w=w.shared,(dn&2)!==0){var R=w.pending;return R===null?f.next=f:(f.next=R.next,R.next=f),w.pending=f,f=po(c),Uc(c,null,b),f}return yi(c,w,f,b),po(c)}function Qc(c,f,b){if(f=f.updateQueue,f!==null&&(f=f.shared,(b&4194048)!==0)){var w=f.lanes;w&=c.pendingLanes,b|=w,f.lanes=b,Et(c,b)}}function pn(c,f){var b=c.updateQueue,w=c.alternate;if(w!==null&&(w=w.updateQueue,b===w)){var R=null,L=null;if(b=b.firstBaseUpdate,b!==null){do{var te={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};L===null?R=L=te:L=L.next=te,b=b.next}while(b!==null);L===null?R=L=f:L=L.next=f}else R=L=f;b={baseState:w.baseState,firstBaseUpdate:R,lastBaseUpdate:L,shared:w.shared,callbacks:w.callbacks},c.updateQueue=b;return}c=b.lastBaseUpdate,c===null?b.firstBaseUpdate=f:c.next=f,b.lastBaseUpdate=f}var k0=!1;function qh(){if(k0){var c=go;if(c!==null)throw c}}function mf(c,f,b,w){k0=!1;var R=c.updateQueue;ta=!1;var L=R.firstBaseUpdate,te=R.lastBaseUpdate,xe=R.shared.pending;if(xe!==null){R.shared.pending=null;var Oe=xe,ct=Oe.next;Oe.next=null,te===null?L=ct:te.next=ct,te=Oe;var St=c.alternate;St!==null&&(St=St.updateQueue,xe=St.lastBaseUpdate,xe!==te&&(xe===null?St.firstBaseUpdate=ct:xe.next=ct,St.lastBaseUpdate=Oe))}if(L!==null){var jt=R.baseState;te=0,St=ct=Oe=null,xe=L;do{var dt=xe.lane&-536870913,gt=dt!==xe.lane;if(gt?(Vn&dt)===dt:(w&dt)===dt){dt!==0&&dt===ec&&(k0=!0),St!==null&&(St=St.next={lane:0,tag:xe.tag,payload:xe.payload,callback:null,next:null});e:{var on=c,Mn=xe;dt=f;var Zr=b;switch(Mn.tag){case 1:if(on=Mn.payload,typeof on=="function"){jt=on.call(Zr,jt,dt);break e}jt=on;break e;case 3:on.flags=on.flags&-65537|128;case 0:if(on=Mn.payload,dt=typeof on=="function"?on.call(Zr,jt,dt):on,dt==null)break e;jt=p({},jt,dt);break e;case 2:ta=!0}}dt=xe.callback,dt!==null&&(c.flags|=64,gt&&(c.flags|=8192),gt=R.callbacks,gt===null?R.callbacks=[dt]:gt.push(dt))}
vendor: 5,558 bytes, line 8
8else gt={lane:dt,tag:xe.tag,payload:xe.payload,callback:xe.callback,next:null},St===null?(ct=St=gt,Oe=jt):St=St.next=gt,te|=dt;if(xe=xe.next,xe===null){if(xe=R.shared.pending,xe===null)break;gt=xe,xe=gt.next,gt.next=null,R.lastBaseUpdate=gt,R.shared.pending=null}}while(!0);St===null&&(Oe=jt),R.baseState=Oe,R.firstBaseUpdate=ct,R.lastBaseUpdate=St,L===null&&(R.shared.lanes=0),Cl|=te,c.lanes=te,c.memoizedState=jt}}function pf(c,f){if(typeof c!="function")throw Error(r(191,c));c.call(f)}function l1(c,f){var b=c.callbacks;if(b!==null)for(c.callbacks=null,c=0;c<b.length;c++)pf(b[c],f)}var gf=F(null),ng=F(0);function c1(c,f){c=Ha,J(ng,c),J(gf,f),Ha=c|f.baseLanes}function I0(){J(ng,Ha),J(gf,gf.current)}function Yh(){Ha=ng.current,O(gf),O(ng)}var ya=F(null),na=null;function rc(c){var f=c.alternate;J(cr,cr.current&1),J(ya,c),na===null&&(f===null||gf.current!==null||f.memoizedState!==null)&&(na=c)}function B0(c){J(cr,cr.current),J(ya,c),na===null&&(na=c)}function u1(c){c.tag===22?(J(cr,cr.current),J(ya,c),na===null&&(na=c)):va()}function va(){J(cr,cr.current),J(ya,ya.current)}function Bs(c){O(ya),na===c&&(na=null),O(cr)}var cr=F(0);function Ua(c){for(var f=c;f!==null;){if(f.tag===13){var b=f.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||OA(b)||FA(b)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var us=0,zn=null,Vr=null,rr=null,bo=!1,xf=!1,nd=!1,rg=0,Qh=0,bf=null,L0=0;function vs(){throw Error(r(321))}function O0(c,f){if(f===null)return!1;for(var b=0;b<f.length&&b<c.length;b++)if(!Zi(c[b],f[b]))return!1;return!0}function sg(c,f,b,w,R,L){return us=L,zn=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,z.H=c===null||c.memoizedState===null?G1:sb,nd=!1,L=b(w,R),nd=!1,xf&&(L=rd(f,b,w,R)),d1(c),L}function d1(c){z.H=yf;var f=Vr!==null&&Vr.next!==null;if(us=0,rr=Vr=zn=null,bo=!1,Qh=0,bf=null,f)throw Error(r(300));c===null||Xs||(c=c.dependencies,c!==null&&Hh(c)&&(Xs=!0))}function rd(c,f,b,w){zn=c;var R=0;do{if(xf&&(bf=null),Qh=0,xf=!1,25<=R)throw Error(r(301));if(R+=1,rr=Vr=null,c.updateQueue!=null){var L=c.updateQueue;L.lastEffect=null,L.events=null,L.stores=null,L.memoCache!=null&&(L.memoCache.index=0)}z.H=yo,L=f(b,w)}while(xf);return L}function sd(){var c=z.H,f=c.useState()[0];return f=typeof f.then=="function"?Kh(f):f,c=c.useState()[0],(Vr!==null?Vr.memoizedState:null)!==c&&(zn.flags|=1024),f}function F0(){var c=rg!==0;return rg=0,c}function U0(c,f,b){f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~b}function z0(c){if(bo){for(c=c.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}bo=!1}us=0,rr=Vr=zn=null,xf=!1,Qh=rg=0,bf=null}function ai(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rr===null?zn.memoizedState=rr=c:rr=rr.next=c,rr}function Ls(){if(Vr===null){var c=zn.alternate;c=c!==null?c.memoizedState:null}else c=Vr.next;var f=rr===null?zn.memoizedState:rr.next;if(f!==null)rr=f,Vr=c;else{if(c===null)throw zn.alternate===null?Error(r(467)):Error(r(310));Vr=c,c={memoizedState:Vr.memoizedState,baseState:Vr.baseState,baseQueue:Vr.baseQueue,queue:Vr.queue,next:null},rr===null?zn.memoizedState=rr=c:rr=rr.next=c}return rr}function ig(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kh(c){var f=Qh;return Qh+=1,bf===null&&(bf=[]),c=Zp(bf,c,f),f=zn,(rr===null?f.memoizedState:rr.next)===null&&(f=f.alternate,z.H=f===null||f.memoizedState===null?G1:sb),c}function Kc(c){if(c!==null&&typeof c=="object"){if(typeof c.then=="function")return Kh(c);if(c.$$typeof===E)return An(c)}throw Error(r(438,String(c)))}function G0(c){var f=null,b=zn.updateQueue;if(b!==null&&(f=b.memoCache),f==null){var w=zn.alternate;w!==null&&(w=w.updateQueue,w!==null&&(w=w.memoCache,w!=null&&(f={data:w.data.map(function(R){return R.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),b===null&&(b=ig(),zn.updateQueue=b),b.memoCache=f,b=f.data[f.index],b===void 0)for(b=f.data[f.index]=Array(c),w=0;w<c;w++)b[w]=k;return f.index++,b}function sc(c,f){return typeof f=="function"?f(c):f}function ag(c){var f=Ls();return H0(f,Vr,c)}function H0(c,f,b){var w=c.queue;if(w===null)throw Error(r(311));w.lastRenderedReducer=b;var R=c.baseQueue,L=w.pending;if(L!==null){if(R!==null){var te=R.next;R.next=L.next,L.next=te}f.baseQueue=R=L,w.pending=null}if(L=c.baseState,R===null)c.memoizedState=L;else{f=R.next;var xe=te=null,Oe=null,ct=f,St=!1;do{var jt=ct.lane&-536870913;if(jt!==ct.lane?(Vn&jt)===jt:(us&jt)===jt){var dt=ct.revertLane;if(dt===0)Oe!==null&&(Oe=Oe.next={lane:0,revertLane:0,gesture:null,action:ct.action,hasEagerState:ct.hasEagerState,eagerState:ct.eagerState,next:null}),jt===ec&&(St=!0);else if((us&dt)===dt){ct=ct.next,dt===ec&&(St=!0);continue}else jt={lane:0,revertLane:ct.revertLane,gesture:null,action:ct.action,hasEagerState:ct.hasEagerState,eagerState:ct.eagerState,next:null},Oe===null?(xe=Oe=jt,te=L):Oe=Oe.next=jt,zn.lanes|=dt,Cl|=dt;jt=ct.action,nd&&b(L,jt),L=ct.hasEagerState?ct.eagerState:b(L,jt)}else dt={lane:jt,revertLane:ct.revertLane,gesture:ct.gesture,action:ct.action,hasEagerState:ct.hasEagerState,eagerState:ct.eagerState,next:null},Oe===null?(xe=Oe=dt,te=L):Oe=Oe.next=dt,zn.lanes|=jt,Cl|=jt;ct=ct.next}
vendor: 3,381 bytes, line 8
8while(ct!==null&&ct!==f);if(Oe===null?te=L:Oe.next=xe,!Zi(L,c.memoizedState)&&(Xs=!0,St&&(b=go,b!==null)))throw b;c.memoizedState=L,c.baseState=te,c.baseQueue=Oe,w.lastRenderedState=L}return R===null&&(w.lanes=0),[c.memoizedState,w.dispatch]}function V0(c){var f=Ls(),b=f.queue;if(b===null)throw Error(r(311));b.lastRenderedReducer=c;var w=b.dispatch,R=b.pending,L=f.memoizedState;if(R!==null){b.pending=null;var te=R=R.next;do L=c(L,te.action),te=te.next;while(te!==R);Zi(L,f.memoizedState)||(Xs=!0),f.memoizedState=L,f.baseQueue===null&&(f.baseState=L),b.lastRenderedState=L}return[L,w]}function f1(c,f,b){var w=zn,R=Ls(),L=lr;if(L){if(b===void 0)throw Error(r(407));b=b()}else b=f();var te=!Zi((Vr||R).memoizedState,b);if(te&&(R.memoizedState=b,Xs=!0),R=R.queue,J0(p1.bind(null,w,R,c),[c]),R.getSnapshot!==f||te||rr!==null&&rr.memoizedState.tag&1){if(w.flags|=2048,Jc(9,{destroy:void 0},m1.bind(null,w,R,b,f),null),kn===null)throw Error(r(349));L||(us&127)!==0||h1(w,f,b)}return b}function h1(c,f,b){c.flags|=16384,c={getSnapshot:f,value:b},f=zn.updateQueue,f===null?(f=ig(),zn.updateQueue=f,f.stores=[c]):(b=f.stores,b===null?f.stores=[c]:b.push(c))}function m1(c,f,b,w){f.value=b,f.getSnapshot=w,g1(f)&&x1(c)}function p1(c,f,b){return b(function(){g1(f)&&x1(c)})}function g1(c){var f=c.getSnapshot;c=c.value;try{var b=f();return!Zi(c,b)}catch{return!0}}function x1(c){var f=ea(c,2);f!==null&&qn(f,c,2)}function W0(c){var f=ai();if(typeof c=="function"){var b=c;if(c=b(),nd){Fe(!0);try{b()}finally{Fe(!1)}}}return f.memoizedState=f.baseState=c,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sc,lastRenderedState:c},f}function $0(c,f,b,w){return c.baseState=b,H0(c,Vr,typeof w=="function"?w:sc)}function SA(c,f,b,w,R){if(ug(c))throw Error(r(485));if(c=f.action,c!==null){var L={payload:R,action:c,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(te){L.listeners.push(te)}};z.T!==null?b(!0):L.isTransition=!1,w(L),b=f.pending,b===null?(L.next=f.pending=L,b1(f,L)):(L.next=b.next,f.pending=b.next=L)}}function b1(c,f){var b=f.action,w=f.payload,R=c.state;if(f.isTransition){var L=z.T,te={};z.T=te;try{var xe=b(R,w),Oe=z.S;Oe!==null&&Oe(te,xe),y1(c,f,xe)}catch(ct){X0(c,f,ct)}finally{L!==null&&te.types!==null&&(L.types=te.types),z.T=L}}else try{L=b(R,w),y1(c,f,L)}catch(ct){X0(c,f,ct)}}function y1(c,f,b){b!==null&&typeof b=="object"&&typeof b.then=="function"?b.then(function(w){v1(c,f,w)},function(w){return X0(c,f,w)}):v1(c,f,b)}function v1(c,f,b){f.status="fulfilled",f.value=b,w1(f),c.state=b,f=c.pending,f!==null&&(b=f.next,b===f?c.pending=null:(b=b.next,f.next=b,b1(c,b)))}function X0(c,f,b){var w=c.pending;if(c.pending=null,w!==null){w=w.next;do f.status="rejected",f.reason=b,w1(f),f=f.next;while(f!==w)}c.action=null}function w1(c){c=c.listeners;for(var f=0;f<c.length;f++)(0,c[f])()}function q0(c,f){return f}function Y0(c,f){if(lr){var b=kn.formState;if(b!==null){e:{var w=zn;if(lr){if(Qr){t:{for(var R=Qr,L=Oa;R.nodeType!==8;){if(!L){R=null;break t}if(R=Tl(R.nextSibling),R===null){R=null;break t}}L=R.data,R=L==="F!"||L==="F"?R:null}if(R){Qr=Tl(R.nextSibling),w=R.data==="F!";break e}}pl(w)}w=!1}w&&(f=b[0])}}return b=ai(),b.memoizedState=b.baseState=f,w={pending:null,lanes:0,dispatch:null,lastRenderedReducer:q0,lastRenderedState:f},b.queue=w,b=F1.bind(null,zn,w),w.dispatch=b,w=W0(!1),L=rb.bind(null,z
vendor: 5,192 bytes, line 8
8n,!1,w.queue),w=ai(),R={state:f,dispatch:null,action:c,pending:null},w.queue=R,b=SA.bind(null,zn,R,L,b),R.dispatch=b,w.memoizedState=c,[f,b,!1]}function S1(c){var f=Ls();return Q0(f,Vr,c)}function Q0(c,f,b){if(f=H0(c,f,q0)[0],c=ag(sc)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var w=Kh(f)}catch(te){throw te===Qu?$n:te}else w=f;f=Ls();var R=f.queue,L=R.dispatch;return b!==f.memoizedState&&(zn.flags|=2048,Jc(9,{destroy:void 0},_1.bind(null,R,b),null)),[w,L,c]}function _1(c,f){c.action=f}function K0(c){var f=Ls(),b=Vr;if(b!==null)return Q0(f,b,c);Ls(),f=f.memoizedState,b=Ls();var w=b.queue.dispatch;return b.memoizedState=c,[f,w,!1]}function Jc(c,f,b,w){return c={tag:c,create:b,deps:w,inst:f,next:null},f=zn.updateQueue,f===null&&(f=ig(),zn.updateQueue=f),b=f.lastEffect,b===null?f.lastEffect=c.next=c:(w=b.next,b.next=c,c.next=w,f.lastEffect=c),c}function og(){return Ls().memoizedState}function lg(c,f,b,w){var R=ai();zn.flags|=c,R.memoizedState=Jc(1|f,{destroy:void 0},b,w===void 0?null:w)}function cg(c,f,b,w){var R=Ls();w=w===void 0?null:w;var L=R.memoizedState.inst;Vr!==null&&w!==null&&O0(w,Vr.memoizedState.deps)?R.memoizedState=Jc(f,L,b,w):(zn.flags|=c,R.memoizedState=Jc(1|f,L,b,w))}function M1(c,f){lg(8390656,8,c,f)}function J0(c,f){cg(2048,8,c,f)}function N1(c){zn.flags|=4;var f=zn.updateQueue;if(f===null)f=ig(),zn.updateQueue=f,f.events=[c];else{var b=f.events;b===null?f.events=[c]:b.push(c)}}function A1(c){var f=Ls().memoizedState;return N1({ref:f,nextImpl:c}),function(){if((dn&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}function C1(c,f){return cg(4,2,c,f)}function E1(c,f){return cg(4,4,c,f)}function j1(c,f){if(typeof f=="function"){c=c();var b=f(c);return function(){typeof b=="function"?b():f(null)}}if(f!=null)return c=c(),f.current=c,function(){f.current=null}}function T1(c,f,b){b=b!=null?b.concat([c]):null,cg(4,4,j1.bind(null,f,c),b)}function Z0(){}function R1(c,f){var b=Ls();f=f===void 0?null:f;var w=b.memoizedState;return f!==null&&O0(f,w[1])?w[0]:(b.memoizedState=[c,f],c)}function P1(c,f){var b=Ls();f=f===void 0?null:f;var w=b.memoizedState;if(f!==null&&O0(f,w[1]))return w[0];if(w=c(),nd){Fe(!0);try{c()}finally{Fe(!1)}}return b.memoizedState=[w,f],w}function eb(c,f,b){return b===void 0||(us&1073741824)!==0&&(Vn&261930)===0?c.memoizedState=f:(c.memoizedState=b,c=er(),zn.lanes|=c,Cl|=c,b)}function D1(c,f,b,w){return Zi(b,f)?b:gf.current!==null?(c=eb(c,b,w),Zi(c,f)||(Xs=!0),c):(us&42)===0||(us&1073741824)!==0&&(Vn&261930)===0?(Xs=!0,c.memoizedState=b):(c=er(),zn.lanes|=c,Cl|=c,f)}function k1(c,f,b,w,R){var L=K.p;K.p=L!==0&&8>L?L:8;var te=z.T,xe={};z.T=xe,rb(c,!1,f,b);try{var Oe=R(),ct=z.S;if(ct!==null&&ct(xe,Oe),Oe!==null&&typeof Oe=="object"&&typeof Oe.then=="function"){var St=R0(Oe,w);Jh(c,f,St,Wa(c))}else Jh(c,f,w,Wa(c))}catch(jt){Jh(c,f,{then:function(){},status:"rejected",reason:jt},Wa())}finally{K.p=L,te!==null&&xe.types!==null&&(te.types=xe.types),z.T=te}}function _A(){}function tb(c,f,b,w){if(c.tag!==5)throw Error(r(476));var R=I1(c).queue;k1(c,R,f,ae,b===null?_A:function(){return B1(c),b(w)})}function I1(c){var f=c.memoizedState;if(f!==null)return f;f={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sc,lastRenderedState:ae},next:null};var b={};return f.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sc,lastRenderedState:b},next:null},c.memoizedState=f,c=c.alternate,c!==null&&(c.memoizedState=f),f}function B1(c){var f=I1(c);f.next===null&&(f=c.alternate.memoizedState),Jh(c,f.next.queue,{},Wa())}function nb(){return An(Mb)}function L1(){return Ls().memoizedState}function O1(){return Ls().memoizedState}function MA(c){for(var f=c.return;f!==null;){switch(f.tag){case 24:case 3:var b=Wa();c=nc(b);var w=Yc(f,c,b);w!==null&&(qn(w,f,b),Qc(w,f,b)),f={cache:E0()},c.payload=f;return}f=f.return}}function NA(c,f,b){var w=Wa();b={lane:w,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},ug(c)?U1(f,b):(b=zp(c,f,b,w),b!==null&&(qn(b,c,w),z1(b,f,w)))}function F1(c,f,b){var w=Wa();Jh(c,f,b,w)}function Jh(c,f,b,w){var R={lane:w,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(ug(c))U1(f,R);else{var L=c.alternate;if(c.lanes===0&&(L===null||L.lanes===0)&&(L=f.lastRenderedReducer,L!==null))try{var te=f.lastRenderedState,xe=L(te,b);if(R.hasEagerState=!0,R.eagerState=xe,Zi(xe,te))return yi(c,f,R,0),kn===null&&zh(),!1}catch{}if(b=zp(c,f,R,w),b!==null)return qn(b,c,w),z1(b,f,w),!0}return!1}function rb(c,f,b,w){if(w={lane:2,revertLane:ht(),gesture:null,action:w,hasEagerState:!1,eagerState:null,next:null},ug(c)){if(f)throw Error(r(479))}else f=zp(c,b,w,2),f!==null&&qn(f,c,2)}function ug(c){var f=c.alternate;return c===zn||f!==null&&f===zn}function U1(c,f){xf=bo=!0;var b=c.pending;b===null?f.next=f:(f.next=b.next,b.next=f),c.pending=f}function z1(c,f,b){if((b&4194048)!==0){var w=f.lanes;w&=c.pendingLanes,b|=w,f.lanes=b,Et(c,b)}}var yf={readContext:An,use:Kc,useCallback:vs,useContext:vs,useEffect:vs,useImperativeHandle:vs,useLayoutEffect:vs,useInsertionEffect:vs,useMemo:vs,useReducer:vs,useRef
vendor: 7,979 bytes, line 8
8:vs,useState:vs,useDebugValue:vs,useDeferredValue:vs,useTransition:vs,useSyncExternalStore:vs,useId:vs,useHostTransitionStatus:vs,useFormState:vs,useActionState:vs,useOptimistic:vs,useMemoCache:vs,useCacheRefresh:vs};yf.useEffectEvent=vs;var G1={readContext:An,use:Kc,useCallback:function(c,f){return ai().memoizedState=[c,f===void 0?null:f],c},useContext:An,useEffect:M1,useImperativeHandle:function(c,f,b){b=b!=null?b.concat([c]):null,lg(4194308,4,j1.bind(null,f,c),b)},useLayoutEffect:function(c,f){return lg(4194308,4,c,f)},useInsertionEffect:function(c,f){lg(4,2,c,f)},useMemo:function(c,f){var b=ai();f=f===void 0?null:f;var w=c();if(nd){Fe(!0);try{c()}finally{Fe(!1)}}return b.memoizedState=[w,f],w},useReducer:function(c,f,b){var w=ai();if(b!==void 0){var R=b(f);if(nd){Fe(!0);try{b(f)}finally{Fe(!1)}}}else R=f;return w.memoizedState=w.baseState=R,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:R},w.queue=c,c=c.dispatch=NA.bind(null,zn,c),[w.memoizedState,c]},useRef:function(c){var f=ai();return c={current:c},f.memoizedState=c},useState:function(c){c=W0(c);var f=c.queue,b=F1.bind(null,zn,f);return f.dispatch=b,[c.memoizedState,b]},useDebugValue:Z0,useDeferredValue:function(c,f){var b=ai();return eb(b,c,f)},useTransition:function(){var c=W0(!1);return c=k1.bind(null,zn,c.queue,!0,!1),ai().memoizedState=c,[!1,c]},useSyncExternalStore:function(c,f,b){var w=zn,R=ai();if(lr){if(b===void 0)throw Error(r(407));b=b()}else{if(b=f(),kn===null)throw Error(r(349));(Vn&127)!==0||h1(w,f,b)}R.memoizedState=b;var L={value:b,getSnapshot:f};return R.queue=L,M1(p1.bind(null,w,L,c),[c]),w.flags|=2048,Jc(9,{destroy:void 0},m1.bind(null,w,L,b,f),null),b},useId:function(){var c=ai(),f=kn.identifierPrefix;if(lr){var b=Fo,w=ys;b=(w&~(1<<32-ie(w)-1)).toString(32)+b,f="_"+f+"R_"+b,b=rg++,0<b&&(f+="H"+b.toString(32)),f+="_"}else b=L0++,f="_"+f+"r_"+b.toString(32)+"_";return c.memoizedState=f},useHostTransitionStatus:nb,useFormState:Y0,useActionState:Y0,useOptimistic:function(c){var f=ai();f.memoizedState=f.baseState=c;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=b,f=rb.bind(null,zn,!0,b),b.dispatch=f,[c,f]},useMemoCache:G0,useCacheRefresh:function(){return ai().memoizedState=MA.bind(null,zn)},useEffectEvent:function(c){var f=ai(),b={impl:c};return f.memoizedState=b,function(){if((dn&2)!==0)throw Error(r(440));return b.impl.apply(void 0,arguments)}}},sb={readContext:An,use:Kc,useCallback:R1,useContext:An,useEffect:J0,useImperativeHandle:T1,useInsertionEffect:C1,useLayoutEffect:E1,useMemo:P1,useReducer:ag,useRef:og,useState:function(){return ag(sc)},useDebugValue:Z0,useDeferredValue:function(c,f){var b=Ls();return D1(b,Vr.memoizedState,c,f)},useTransition:function(){var c=ag(sc)[0],f=Ls().memoizedState;return[typeof c=="boolean"?c:Kh(c),f]},useSyncExternalStore:f1,useId:L1,useHostTransitionStatus:nb,useFormState:S1,useActionState:S1,useOptimistic:function(c,f){var b=Ls();return $0(b,Vr,c,f)},useMemoCache:G0,useCacheRefresh:O1};sb.useEffectEvent=A1;var yo={readContext:An,use:Kc,useCallback:R1,useContext:An,useEffect:J0,useImperativeHandle:T1,useInsertionEffect:C1,useLayoutEffect:E1,useMemo:P1,useReducer:V0,useRef:og,useState:function(){return V0(sc)},useDebugValue:Z0,useDeferredValue:function(c,f){var b=Ls();return Vr===null?eb(b,c,f):D1(b,Vr.memoizedState,c,f)},useTransition:function(){var c=V0(sc)[0],f=Ls().memoizedState;return[typeof c=="boolean"?c:Kh(c),f]},useSyncExternalStore:f1,useId:L1,useHostTransitionStatus:nb,useFormState:K0,useActionState:K0,useOptimistic:function(c,f){var b=Ls();return Vr!==null?$0(b,Vr,c,f):(b.baseState=c,[c,b.queue.dispatch])},useMemoCache:G0,useCacheRefresh:O1};yo.useEffectEvent=A1;function dg(c,f,b,w){f=c.memoizedState,b=b(w,f),b=b==null?f:p({},f,b),c.memoizedState=b,c.lanes===0&&(c.updateQueue.baseState=b)}var Zh={enqueueSetState:function(c,f,b){c=c._reactInternals;var w=Wa(),R=nc(w);R.payload=f,b!=null&&(R.callback=b),f=Yc(c,R,w),f!==null&&(qn(f,c,w),Qc(f,c,w))},enqueueReplaceState:function(c,f,b){c=c._reactInternals;var w=Wa(),R=nc(w);R.tag=1,R.payload=f,b!=null&&(R.callback=b),f=Yc(c,R,w),f!==null&&(qn(f,c,w),Qc(f,c,w))},enqueueForceUpdate:function(c,f){c=c._reactInternals;var b=Wa(),w=nc(b);w.tag=2,f!=null&&(w.callback=f),f=Yc(c,w,b),f!==null&&(qn(f,c,b),Qc(f,c,b))}};function ib(c,f,b,w,R,L,te){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(w,L,te):f.prototype&&f.prototype.isPureReactComponent?!ef(b,w)||!ef(R,L):!0}function ab(c,f,b,w){c=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(b,w),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(b,w),f.state!==c&&Zh.enqueueReplaceState(f,f.state,null)}function Zc(c,f){var b=f;if("ref"in f){b={};for(var w in f)w!=="ref"&&(b[w]=f[w])}if(c=c.defaultProps){b===f&&(b=p({},b));for(var R in c)b[R]===void 0&&(b[R]=c[R])}return b}function H1(c){Uh(c)}function ob(c){console.error(c)}function lb(c){Uh(c)}function fg(c,f){try{var b=c.onUncaughtError;b(f.value,{componentStack:f.stack})}catch(w){setTimeout(function(){throw w})}}function V1(c,f,b){try{var w=c.onCaughtError;w(b.value,{componentStack:b.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(R){setTimeout(function(){throw R})}}function cb(c,f,b){return b=nc(b),b.tag=3,b.payload={element:null},b.callback=function(){fg(c,f)},b}function ub(c){return c=nc(c),c.tag=3,c}function W1(c,f,b,w){var R=b.type.getDerivedStateFromError;if(typeof R=="function"){var L=w.value;c.payload=function(){return R(L)},c.callback=function(){V1(f,b,w)}}var te=b.stateNode;te!==null&&typeof te.componentDidCatch=="function"&&(c.callback=function(){V1(f,b,w),typeof R!="function"&&(Us===null?Us=new Set([this]):Us.add(this));var xe=w.stack;this.componentDidCatch(w.value,{componentStack:xe!==null?xe:""})})}function oi(c,f,b,w,R){if(b.flags|=32768,w!==null&&typeof w=="object"&&typeof w.then=="function"){if(f=b.alternate,f!==null&&yl(f,b,R,!0),b=ya.current,b!==null){switch(b.tag){case 31:case 13:return na===null?Af():b.alternate===null&&ws===0&&(ws=3),b.flags&=-257,b.flags|=65536,b.lanes=R,w===Jp?b.flags|=16384:(f=b.updateQueue,f===null?b.updateQueue=new Set([w]):f.add(w),dm(c,w,R)),!1;case 22:return b.flags|=65536,w===Jp?b.flags|=16384:(f=b.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([w])},b.updateQueue=f):(b=f.retryQueue,b===null?f.retryQueue=new Set([w]):b.add(w)),dm(c,w,R)),!1}throw Error(r(435,b.tag))}return dm(c,w,R),Af(),!1}if(lr)return f=ya.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=R,w!==cf&&(c=Error(r(422),{cause:w}),gl(La(c,b)))):(w!==cf&&(f=Error(r(423),{cause:w}),gl(La(f,b))),c=c.current.alternate,c.flags|=65536,R&=-R,c.lanes|=R,w=La(w,b),R=cb(c.stateNode,w,R),pn(c,R),ws!==4&&(ws=2)),!1;var L=Error(r(520),{cause:w});if(L=La(L,b),fd===null?fd=[L]:fd.push(L),ws!==4&&(ws=2),f===null)return!0;w=La(w,b),b=f;do{switch(b.tag){case 3:return b.flags|=65536,c=R&-R,b.lanes|=c,c=cb(b.stateNode,w,c),pn(b,c),!1;case 1:if(f=b.type,L=b.stateNode,(b.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||L!==null&&typeof L.componentDidCatch=="function"&&(Us===null||!Us.has(L))))return b.flags|=65536,R&=-R,b.lanes|=R,R=ub(R),W1(R,c,b,w),pn(b,R),!1}b=b.return}while(b!==null);return!1}var hg=Error(r(461)),Xs=!1;function vi(c,f,b,w){f.child=c===null?tg(f,null,b,w):tc(f,c.child,b,w)}function db(c,f,b,w,R){b=b.render;var L=f.ref;if("ref"in w){var te={};for(var xe in w)xe!=="ref"&&(te[xe]=w[xe])}else te=w;return Xc(f),w=sg(c,f,b,te,L,R),xe=F0(),c!==null&&!Xs?(U0(c,f,R),Os(c,f,R)):(lr&&xe&&ml(f),f.flags|=1,vi(c,f,w,R),f.child)}function id(c,f,b,w,R){if(c===null){var L=b.type;return typeof L=="function"&&!Gp(L)&&L.defaultProps===void 0&&b.compare===null?(f.tag=15,f.type=L,mg(c,f,L,w,R)):(c=fl(b.type,null,w,f,f.mode,R),c.ref=f.ref,c.return=f,f.child=c)}if(L=c.child,!vg(c,R)){var te=L.memoizedProps;
vendor: 13,406 bytes, line 8
8if(b=b.compare,b=b!==null?b:ef,b(te,w)&&c.ref===f.ref)return Os(c,f,R)}return f.flags|=1,c=ga(L,w),c.ref=f.ref,c.return=f,f.child=c}function mg(c,f,b,w,R){if(c!==null){var L=c.memoizedProps;if(ef(L,w)&&c.ref===f.ref)if(Xs=!1,f.pendingProps=w=L,vg(c,R))(c.flags&131072)!==0&&(Xs=!0);else return f.lanes=c.lanes,Os(c,f,R)}return vf(c,f,b,w,R)}function ad(c,f,b,w){var R=w.children,L=c!==null?c.memoizedState:null;if(c===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),w.mode==="hidden"){if((f.flags&128)!==0){if(L=L!==null?L.baseLanes|b:b,c!==null){for(w=f.child=c.child,R=0;w!==null;)R=R|w.lanes|w.childLanes,w=w.sibling;w=R&~L}else w=0,f.child=null;return wa(c,f,L,b,w)}if((b&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},c!==null&&Vh(f,L!==null?L.cachePool:null),L!==null?c1(f,L):I0(),u1(f);else return w=f.lanes=536870912,wa(c,f,L!==null?L.baseLanes|b:b,b,w)}else L!==null?(Vh(f,L.cachePool),c1(f,L),va(),f.memoizedState=null):(c!==null&&Vh(f,null),I0(),va());return vi(c,f,R,b),f.child}function wl(c,f){return c!==null&&c.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function wa(c,f,b,w,R){var L=Kp();return L=L===null?null:{parent:$s._currentValue,pool:L},f.memoizedState={baseLanes:b,cachePool:L},c!==null&&Vh(f,null),I0(),u1(f),c!==null&&yl(c,f,w,!0),f.childLanes=R,null}function pg(c,f){return f=yg({mode:f.mode,children:f.children},c.mode),f.ref=c.ref,c.child=f,f.return=c,f}function $1(c,f,b){return tc(f,c.child,null,b),c=pg(f,f.pendingProps),c.flags|=2,Bs(f),f.memoizedState=null,c}function gg(c,f,b){var w=f.pendingProps,R=(f.flags&128)!==0;if(f.flags&=-129,c===null){if(lr){if(w.mode==="hidden")return c=pg(f,w),f.lanes=536870912,wl(null,c);if(B0(f),(c=Qr)?(c=hP(c,Oa),c=c!==null&&c.data==="&"?c:null,c!==null&&(f.memoizedState={dehydrated:c,treeContext:Kl!==null?{id:ys,overflow:Fo}:null,retryLane:536870912,hydrationErrors:null},b=af(c),b.return=f,f.child=b,Es=f,Qr=null)):c=null,c===null)throw pl(f);return f.lanes=536870912,null}return pg(f,w)}var L=c.memoizedState;if(L!==null){var te=L.dehydrated;if(B0(f),R)if(f.flags&256)f.flags&=-257,f=$1(c,f,b);else if(f.memoizedState!==null)f.child=c.child,f.flags|=128,f=null;else throw Error(r(558));else if(Xs||yl(c,f,b,!1),R=(b&c.childLanes)!==0,Xs||R){if(w=kn,w!==null&&(te=Wt(w,b),te!==0&&te!==L.retryLane))throw L.retryLane=te,ea(c,te),qn(w,c,te),hg;Af(),f=$1(c,f,b)}else c=L.treeContext,Qr=Tl(te.nextSibling),Es=f,lr=!0,Jl=null,Oa=!1,c!==null&&$p(f,c),f=pg(f,w),f.flags|=4096;return f}return c=ga(c.child,{mode:w.mode,children:w.children}),c.ref=f.ref,f.child=c,c.return=f,c}function od(c,f){var b=f.ref;if(b===null)c!==null&&c.ref!==null&&(f.flags|=4194816);else{if(typeof b!="function"&&typeof b!="object")throw Error(r(284));(c===null||c.ref!==b)&&(f.flags|=4194816)}}function vf(c,f,b,w,R){return Xc(f),b=sg(c,f,b,w,void 0,R),w=F0(),c!==null&&!Xs?(U0(c,f,R),Os(c,f,R)):(lr&&w&&ml(f),f.flags|=1,vi(c,f,b,R),f.child)}function em(c,f,b,w,R,L){return Xc(f),f.updateQueue=null,b=rd(f,w,b,R),d1(c),w=F0(),c!==null&&!Xs?(U0(c,f,L),Os(c,f,L)):(lr&&w&&ml(f),f.flags|=1,vi(c,f,b,L),f.child)}function xg(c,f,b,w,R){if(Xc(f),f.stateNode===null){var L=zc,te=b.contextType;typeof te=="object"&&te!==null&&(L=An(te)),L=new b(w,L),f.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,L.updater=Zh,f.stateNode=L,L._reactInternals=f,L=f.stateNode,L.props=w,L.state=f.memoizedState,L.refs={},Xh(f),te=b.contextType,L.context=typeof te=="object"&&te!==null?An(te):zc,L.state=f.memoizedState,te=b.getDerivedStateFromProps,typeof te=="function"&&(dg(f,b,te,w),L.state=f.memoizedState),typeof b.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(te=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),te!==L.state&&Zh.enqueueReplaceState(L,L.state,null),mf(f,w,L,R),qh(),L.state=f.memoizedState),typeof L.componentDidMount=="function"&&(f.flags|=4194308),w=!0}else if(c===null){L=f.stateNode;var xe=f.memoizedProps,Oe=Zc(b,xe);L.props=Oe;var ct=L.context,St=b.contextType;te=zc,typeof St=="object"&&St!==null&&(te=An(St));var jt=b.getDerivedStateFromProps;St=typeof jt=="function"||typeof L.getSnapshotBeforeUpdate=="function",xe=f.pendingProps!==xe,St||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(xe||ct!==te)&&ab(f,L,w,te),ta=!1;var dt=f.memoizedState;L.state=dt,mf(f,w,L,R),qh(),ct=f.memoizedState,xe||dt!==ct||ta?(typeof jt=="function"&&(dg(f,b,jt,w),ct=f.memoizedState),(Oe=ta||ib(f,b,Oe,w,dt,ct,te))?(St||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount()),typeof L.componentDidMount=="function"&&(f.flags|=4194308)):(typeof L.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=w,f.memoizedState=ct),L.props=w,L.state=ct,L.context=te,w=Oe):(typeof L.componentDidMount=="function"&&(f.flags|=4194308),w=!1)}else{L=f.stateNode,D0(c,f),te=f.memoizedProps,St=Zc(b,te),L.props=St,jt=f.pendingProps,dt=L.context,ct=b.contextType,Oe=zc,typeof ct=="object"&&ct!==null&&(Oe=An(ct)),xe=b.getDerivedStateFromProps,(ct=typeof xe=="function"||typeof L.getSnapshotBeforeUpdate=="function")||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(te!==jt||dt!==Oe)&&ab(f,L,w,Oe),ta=!1,dt=f.memoizedState,L.state=dt,mf(f,w,L,R),qh();var gt=f.memoizedState;te!==jt||dt!==gt||ta||c!==null&&c.dependencies!==null&&Hh(c.dependencies)?(typeof xe=="function"&&(dg(f,b,xe,w),gt=f.memoizedState),(St=ta||ib(f,b,St,w,dt,gt,Oe)||c!==null&&c.dependencies!==null&&Hh(c.dependencies))?(ct||typeof L.UNSAFE_componentWillUpdate!="function"&&typeof L.componentWillUpdate!="function"||(typeof L.componentWillUpdate=="function"&&L.componentWillUpdate(w,gt,Oe),typeof L.UNSAFE_componentWillUpdate=="function"&&L.UNSAFE_componentWillUpdate(w,gt,Oe)),typeof L.componentDidUpdate=="function"&&(f.flags|=4),typeof L.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof L.componentDidUpdate!="function"||te===c.memoizedProps&&dt===c.memoizedState||(f.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||te===c.memoizedProps&&dt===c.memoizedState||(f.flags|=1024),f.memoizedProps=w,f.memoizedState=gt),L.props=w,L.state=gt,L.context=Oe,w=St):(typeof L.componentDidUpdate!="function"||te===c.memoizedProps&&dt===c.memoizedState||(f.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||te===c.memoizedProps&&dt===c.memoizedState||(f.flags|=1024),w=!1)}return L=w,od(c,f),w=(f.flags&128)!==0,L||w?(L=f.stateNode,b=w&&typeof b.getDerivedStateFromError!="function"?null:L.render(),f.flags|=1,c!==null&&w?(f.child=tc(f,c.child,null,R),f.child=tc(f,null,b,R)):vi(c,f,b,R),f.memoizedState=L.state,c=f.child):c=Os(c,f,R),c}function X1(c,f,b,w){return Wc(),f.flags|=256,vi(c,f,b,w),f.child}var fb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vi(c){return{baseLanes:c,cachePool:P0()}}function bg(c,f,b){return c=c!==null?c.childLanes&~b:0,f&&(c|=ia),c}function q1(c,f,b){var w=f.pendingProps,R=!1,L=(f.flags&128)!==0,te;if((te=L)||(te=c!==null&&c.memoizedState===null?!1:(cr.current&2)!==0),te&&(R=!0,f.flags&=-129),te=(f.flags&32)!==0,f.flags&=-33,c===null){if(lr){if(R?rc(f):va(),(c=Qr)?(c=hP(c,Oa),c=c!==null&&c.data!=="&"?c:null,c!==null&&(f.memoizedState={dehydrated:c,treeContext:Kl!==null?{id:ys,overflow:Fo}:null,retryLane:536870912,hydrationErrors:null},b=af(c),b.return=f,f.child=b,Es=f,Qr=null)):c=null,c===null)throw pl(f);return FA(c)?f.lanes=32:f.lanes=536870912,null}var xe=w.children;return w=w.fallback,R?(va(),R=f.mode,xe=yg({mode:"hidden",children:xe},R),w=Gc(w,R,b,null),xe.return=f,w.return=f,xe.sibling=w,f.child=xe,w=f.child,w.memoizedState=Vi(b),w.childLanes=bg(c,te,b),f.memoizedState=fb,wl(null,w)):(rc(f),tm(f,xe))}var Oe=c.memoizedState;if(Oe!==null&&(xe=Oe.dehydrated,xe!==null)){if(L)f.flags&256?(rc(f),f.flags&=-257,f=hb(c,f,b)):f.memoizedState!==null?(va(),f.child=c.child,f.flags|=128,f=null):(va(),xe=w.fallback,R=f.mode,w=yg({mode:"visible",children:w.children},R),xe=Gc(xe,R,b,null),xe.flags|=2,w.return=f,xe.return=f,w.sibling=xe,f.child=w,tc(f,c.child,null,b),w=f.child,w.memoizedState=Vi(b),w.childLanes=bg(c,te,b),f.memoizedState=fb,f=wl(null,w));else if(rc(f),FA(xe)){if(te=xe.nextSibling&&xe.nextSibling.dataset,te)var ct=te.dgst;te=ct,w=Error(r(419)),w.stack="",w.digest=te,gl({value:w,source:null,stack:null}),f=hb(c,f,b)}else if(Xs||yl(c,f,b,!1),te=(b&c.childLanes)!==0,Xs||te){if(te=kn,te!==null&&(w=Wt(te,b),w!==0&&w!==Oe.retryLane))throw Oe.retryLane=w,ea(c,w),qn(te,c,w),hg;OA(xe)||Af(),f=hb(c,f,b)}else OA(xe)?(f.flags|=192,f.child=c.child,f=null):(c=Oe.treeContext,Qr=Tl(xe.nextSibling),Es=f,lr=!0,Jl=null,Oa=!1,c!==null&&$p(f,c),f=tm(f,w.children),f.flags|=4096);return f}return R?(va(),xe=w.fallback,R=f.mode,Oe=c.child,ct=Oe.sibling,w=ga(Oe,{mode:"hidden",children:w.children}),w.subtreeFlags=Oe.subtreeFlags&65011712,ct!==null?xe=ga(ct,xe):(xe=Gc(xe,R,b,null),xe.flags|=2),xe.return=f,w.return=f,w.sibling=xe,f.child=w,wl(null,w),w=f.child,xe=c.child.memoizedState,xe===null?xe=Vi(b):(R=xe.cachePool,R!==null?(Oe=$s._currentValue,R=R.parent!==Oe?{parent:Oe,pool:Oe}:R):R=P0(),xe={baseLanes:xe.baseLanes|b,cachePool:R}),w.memoizedState=xe,w.childLanes=bg(c,te,b),f.memoizedState=fb,wl(c.child,w)):(rc(f),b=c.child,c=b.sibling,b=ga(b,{mode:"visible",children:w.children}),b.return=f,b.sibling=null,c!==null&&(te=f.deletions,te===null?(f.deletions=[c],f.flags|=16):te.push(c)),f.child=b,f.memoizedState=null,b)}function tm(c,f){return f=yg({mode:"visible",children:f},c.mode),f.return=c,c.child=f}function yg(c,f){return c=bs(22,c,null,f),c.lanes=0,c}function hb(c,f,b){return tc(f,c.child,null,b),c=tm(f,f.pendingProps.children),c.flags|=2,f.memoizedState=null,c}function Y1(c,f,b){c.lanes|=f;var w=c.alternate;w!==null&&(w.lanes|=f),qp(c.return,f,b)}function ld(c,f,b,w,R,L){var te=c.memoizedState;te===null?c.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:w,tail:b,tailMode:R,treeForkCount:L}:(te.isBackwards=f,te.rendering=null,te.renderingStartTime=0,te.last=w,te.tail=b,te.tailMode=R,te.treeForkCount=L)}function Sa(c,f,b){var w=f.pendingProps,R=w.revealOrder,L=w.tail;w=w.children;var te=cr.current,xe=(te&2)!==0;if(xe?(te=te&1|2,f.flags|=128):te&=1,J(cr,te),vi(c,f,w,b),w=lr?lf:0,!xe&&c!==null&&(c.flags&128)!==0)e:for(c=f.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&Y1(c,b,f);else if(c.tag===19)Y1(c,b,f);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===f)break e;for(;c.sibling===null;){if(c.return===null||c.return===f)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}switch(R){case"forwards":for(b=f.child,R=null;b!==null;)c=b.alternate,c!==null&&Ua(c)===null&&(R=b),b=b.sibling;b=R,b===null?(R=f.child,f.child=null):(R=b.sibling,b.sibling=null),ld(f,!1,R,b,L,w);break;case"backwards":case"unstable_legacy-backwards":for(b=null,R=f.child,f.child=null;R!==null;){if(c=R.alternate,c!==null&&Ua(c)===null){f.child=R;break}c=R.sibling,R.sibling=b,b=R,R=c}ld(f,!0,b,null,L,w);break;case"together":ld(f,!1,null,null,void 0,w);break;default:f.memoizedState=null}return f.child}function Os(c,f,b){if(c!==null&&(f.dependencies=c.dependencies),Cl|=f.lanes,(b&f.childLanes)===0)if(c!==null){if(yl(c,f,b,!1),(b&f.childLanes)===0)return null}else return null;if(c!==null&&f.child!==c.child)throw Error(r(153));if(f.child!==null){for(c=f.child,b=ga(c,c.pendingProps),f.child=b,b.return=f;c.sibling!==null;)c=c.sibling,b=b.sibling=ga(c,c.pendingProps),b.return=f;b.sibling=null}return f.child}function vg(c,f){return(c.lanes&f)!==0?!0:(c=c.dependencies,!!(c!==null&&Hh(c)))}function AA(c,f,b){switch(f.tag){case 3:se(f,f.stateNode.containerInfo),Zl(f,$s,c.memoizedState.cache),Wc();break;case 27:case 5:ze(f);break;case 4:se(f,f.stateNode.containerInfo);break;case 10:Zl(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,B0(f),null;break;case 13:var w=f.memoizedState;if(w!==null)return w.dehydrated!==null?(rc(f),f.flags|=128,null):(b&f.child.childLanes)!==0?q1(c,f,b):(rc(f),c=Os(c,f,b),c!==null?c.sibling:null);rc(f);break;case 19:var R=(c.flags&128)!==0;if(w=(b&f.childLanes)!==0,w||(yl(c,f,b,!1),w=(b&f.childLanes)!==0),R){if(w)return Sa(c,f,b);f.flags|=128}if(R=f.memoizedState,R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),J(cr,cr.current),w)break;return null;case 22:return f.lanes=0,ad(c,f,b,f.pendingProps);case 24:Zl(f,$s,c.memoizedState.cache)}return Os(c,f,b)}function wg(c,f,b){if(c!==null)if(c.memoizedProps!==f.pendingProps)Xs=!0;else{if(!vg(c,b)&&(f.flags&128)===0)return Xs=!1,AA(c,f,b);Xs=(c.flags&131072)!==0}else Xs=!1,lr&&(f.flags&1048576)!==0&&n1(f,lf,f.index);switch(f.lanes=0,f.tag){case 16:e:{var w=f.pendingProps;if(c=Ku(f.elementType),f.type=c,typeof c=="function")Gp(c)?(w=Zc(c,w),f.tag=1,f=xg(null,f,c,w,b)):(f.tag=0,f=vf(null,f,c,w,b));else{if(c!=null){var R=c.$$typeof;if(R===C){f.tag=11,f=db(null,f,c,w,b);break e}else if(R===B){f.tag=14,f=id(null,f,c,w,b);break e}}
vendor: 4,683 bytes, line 8
8throw f=X(c)||c,Error(r(306,f,""))}}return f;case 0:return vf(c,f,f.type,f.pendingProps,b);case 1:return w=f.type,R=Zc(w,f.pendingProps),xg(c,f,w,R,b);case 3:e:{if(se(f,f.stateNode.containerInfo),c===null)throw Error(r(387));w=f.pendingProps;var L=f.memoizedState;R=L.element,D0(c,f),mf(f,w,null,b);var te=f.memoizedState;if(w=te.cache,Zl(f,$s,w),w!==L.cache&&Yp(f,[$s],b,!0),qh(),w=te.element,L.isDehydrated)if(L={element:w,isDehydrated:!1,cache:te.cache},f.updateQueue.baseState=L,f.memoizedState=L,f.flags&256){f=X1(c,f,w,b);break e}else if(w!==R){R=La(Error(r(424)),f),gl(R),f=X1(c,f,w,b);break e}else for(c=f.stateNode.containerInfo,c.nodeType===9?c=c.body:c=c.nodeName==="HTML"?c.ownerDocument.body:c,Qr=Tl(c.firstChild),Es=f,lr=!0,Jl=null,Oa=!0,b=tg(f,null,w,b),f.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(Wc(),w===R){f=Os(c,f,b);break e}vi(c,f,w,b)}f=f.child}return f;case 26:return od(c,f),c===null?(b=yP(f.type,null,f.pendingProps,null))?f.memoizedState=b:lr||(b=f.type,c=f.pendingProps,w=Z1(ne.current).createElement(b),w[Wn]=f,w[jr]=c,oa(w,b,c),or(w),f.stateNode=w):f.memoizedState=yP(f.type,c.memoizedProps,f.pendingProps,c.memoizedState),null;case 27:return ze(f),c===null&&lr&&(w=f.stateNode=gP(f.type,f.pendingProps,ne.current),Es=f,Oa=!0,R=Qr,Tf(f.type)?(UA=R,Qr=Tl(w.firstChild)):Qr=R),vi(c,f,f.pendingProps.children,b),od(c,f),c===null&&(f.flags|=4194304),f.child;case 5:return c===null&&lr&&((R=w=Qr)&&(w=eH(w,f.type,f.pendingProps,Oa),w!==null?(f.stateNode=w,Es=f,Qr=Tl(w.firstChild),Oa=!1,R=!0):R=!1),R||pl(f)),ze(f),R=f.type,L=f.pendingProps,te=c!==null?c.memoizedProps:null,w=L.children,IA(R,L)?w=null:te!==null&&IA(R,te)&&(f.flags|=32),f.memoizedState!==null&&(R=sg(c,f,sd,null,null,b),Mb._currentValue=R),od(c,f),vi(c,f,w,b),f.child;case 6:return c===null&&lr&&((c=b=Qr)&&(b=tH(b,f.pendingProps,Oa),b!==null?(f.stateNode=b,Es=f,Qr=null,c=!0):c=!1),c||pl(f)),null;case 13:return q1(c,f,b);case 4:return se(f,f.stateNode.containerInfo),w=f.pendingProps,c===null?f.child=tc(f,null,w,b):vi(c,f,w,b),f.child;case 11:return db(c,f,f.type,f.pendingProps,b);case 7:return vi(c,f,f.pendingProps,b),f.child;case 8:return vi(c,f,f.pendingProps.children,b),f.child;case 12:return vi(c,f,f.pendingProps.children,b),f.child;case 10:return w=f.pendingProps,Zl(f,f.type,w.value),vi(c,f,w.children,b),f.child;case 9:return R=f.type._context,w=f.pendingProps.children,Xc(f),R=An(R),w=w(R),f.flags|=1,vi(c,f,w,b),f.child;case 14:return id(c,f,f.type,f.pendingProps,b);case 15:return mg(c,f,f.type,f.pendingProps,b);case 19:return Sa(c,f,b);case 31:return gg(c,f,b);case 22:return ad(c,f,b,f.pendingProps);case 24:return Xc(f),w=An($s),c===null?(R=Kp(),R===null&&(R=kn,L=E0(),R.pooledCache=L,L.refCount++,L!==null&&(R.pooledCacheLanes|=b),R=L),f.memoizedState={parent:w,cache:R},Xh(f),Zl(f,$s,R)):((c.lanes&b)!==0&&(D0(c,f),mf(f,null,null,b),qh()),R=c.memoizedState,L=f.memoizedState,R.parent!==w?(R={parent:w,cache:w},f.memoizedState=R,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=R),Zl(f,$s,w)):(w=L.cache,Zl(f,$s,w),w!==R.cache&&Yp(f,[$s],b,!0))),vi(c,f,f.pendingProps.children,b),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function Sl(c){c.flags|=4}function nm(c,f,b,w,R){if((f=(c.mode&32)!==0)&&(f=!1),f){if(c.flags|=16777216,(R&335544128)===R)if(c.stateNode.complete)c.flags|=8192;else if(_s())c.flags|=8192;else throw vl=Jp,Wh}else c.flags&=-16777217}function mb(c,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)c.flags&=-16777217;else if(c.flags|=16777216,!MP(f))if(_s())c.flags|=8192;else throw vl=Jp,Wh}function ic(c,f){f!==null&&(c.flags|=4),c.flags&16384&&(f=c.tag!==22?Qe():536870912,c.lanes|=f,ns|=f)}function _l(c,f){if(!lr)switch(c.tailMode){case"hidden":f=c.tail;for(var b=null;f!==null;)f.alternate!==null&&(b=f),f=f.sibling;b===null?c.tail=null:b.sibling=null;break;case"collapsed":b=c.tail;for(var w=null;b!==null;)b.alternate!==null&&(w=b),b=b.sibling;w===null?f||c.tail===null?c.tail=null:c.tail.sibling=null:w.sibling=null}}function Wr(c){var f=c.alternate!==null&&c.alternate.child===c.child,b=0,w=0;if(f)for(var R=c.child;R!==null;)b|=R.lanes|R.childLanes,w|=R.subtreeFlags&65011712,w|=R.flags&65011712,R.return=c,R=R.sibling;else for(R=c.child;R!==null;)b|=R.lanes|R.childLanes,w|=R.subtreeFlags,w|=R.flags,R.return=c,R=R.sibling;return c.subtreeFlags|=w,c.childLanes=b,f}function rm(c,f,b){var w=f.pendingProps;switch(Wp(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wr(f),null;case 1:return Wr(f),null;case 3:return b=f.stateNode,w=null,c!==null&&(w=c.memoizedState.cache),f.memoizedState.cache!==w&&(f.flags|=2048),bl($s),me(),b.pendingContext&&(b.context=b.pen
vendor: 6,997 bytes, line 8
8dingContext,b.pendingContext=null),(c===null||c.child===null)&&(uf(f)?Sl(f):c===null||c.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,Xp())),Wr(f),null;case 26:var R=f.type,L=f.memoizedState;return c===null?(Sl(f),L!==null?(Wr(f),mb(f,L)):(Wr(f),nm(f,R,null,w,b))):L?L!==c.memoizedState?(Sl(f),Wr(f),mb(f,L)):(Wr(f),f.flags&=-16777217):(c=c.memoizedProps,c!==w&&Sl(f),Wr(f),nm(f,R,c,w,b)),null;case 27:if(Be(f),b=ne.current,R=f.type,c!==null&&f.stateNode!=null)c.memoizedProps!==w&&Sl(f);else{if(!w){if(f.stateNode===null)throw Error(r(166));return Wr(f),null}c=q.current,uf(f)?r1(f):(c=gP(R,w,b),f.stateNode=c,Sl(f))}return Wr(f),null;case 5:if(Be(f),R=f.type,c!==null&&f.stateNode!=null)c.memoizedProps!==w&&Sl(f);else{if(!w){if(f.stateNode===null)throw Error(r(166));return Wr(f),null}if(L=q.current,uf(f))r1(f);else{var te=Z1(ne.current);switch(L){case 1:L=te.createElementNS("http://www.w3.org/2000/svg",R);break;case 2:L=te.createElementNS("http://www.w3.org/1998/Math/MathML",R);break;default:switch(R){case"svg":L=te.createElementNS("http://www.w3.org/2000/svg",R);break;case"math":L=te.createElementNS("http://www.w3.org/1998/Math/MathML",R);break;case"script":L=te.createElement("div"),L.innerHTML="<script><\/script>",L=L.removeChild(L.firstChild);break;case"select":L=typeof w.is=="string"?te.createElement("select",{is:w.is}):te.createElement("select"),w.multiple?L.multiple=!0:w.size&&(L.size=w.size);break;default:L=typeof w.is=="string"?te.createElement(R,{is:w.is}):te.createElement(R)}}L[Wn]=f,L[jr]=w;e:for(te=f.child;te!==null;){if(te.tag===5||te.tag===6)L.appendChild(te.stateNode);else if(te.tag!==4&&te.tag!==27&&te.child!==null){te.child.return=te,te=te.child;continue}if(te===f)break e;for(;te.sibling===null;){if(te.return===null||te.return===f)break e;te=te.return}te.sibling.return=te.return,te=te.sibling}f.stateNode=L;e:switch(oa(L,R,w),R){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}w&&Sl(f)}}return Wr(f),nm(f,f.type,c===null?null:c.memoizedProps,f.pendingProps,b),null;case 6:if(c&&f.stateNode!=null)c.memoizedProps!==w&&Sl(f);else{if(typeof w!="string"&&f.stateNode===null)throw Error(r(166));if(c=ne.current,uf(f)){if(c=f.stateNode,b=f.memoizedProps,w=null,R=Es,R!==null)switch(R.tag){case 27:case 5:w=R.memoizedProps}c[Wn]=f,c=!!(c.nodeValue===b||w!==null&&w.suppressHydrationWarning===!0||iP(c.nodeValue,b)),c||pl(f,!0)}else c=Z1(c).createTextNode(w),c[Wn]=f,f.stateNode=c}return Wr(f),null;case 31:if(b=f.memoizedState,c===null||c.memoizedState!==null){if(w=uf(f),b!==null){if(c===null){if(!w)throw Error(r(318));if(c=f.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(557));c[Wn]=f}else Wc(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Wr(f),c=!1}else b=Xp(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=b),c=!0;if(!c)return f.flags&256?(Bs(f),f):(Bs(f),null);if((f.flags&128)!==0)throw Error(r(558))}return Wr(f),null;case 13:if(w=f.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(R=uf(f),w!==null&&w.dehydrated!==null){if(c===null){if(!R)throw Error(r(318));if(R=f.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(r(317));R[Wn]=f}else Wc(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Wr(f),R=!1}else R=Xp(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=R),R=!0;if(!R)return f.flags&256?(Bs(f),f):(Bs(f),null)}return Bs(f),(f.flags&128)!==0?(f.lanes=b,f):(b=w!==null,c=c!==null&&c.memoizedState!==null,b&&(w=f.child,R=null,w.alternate!==null&&w.alternate.memoizedState!==null&&w.alternate.memoizedState.cachePool!==null&&(R=w.alternate.memoizedState.cachePool.pool),L=null,w.memoizedState!==null&&w.memoizedState.cachePool!==null&&(L=w.memoizedState.cachePool.pool),L!==R&&(w.flags|=2048)),b!==c&&b&&(f.child.flags|=8192),ic(f,f.updateQueue),Wr(f),null);case 4:return me(),c===null&&TA(f.stateNode.containerInfo),Wr(f),null;case 10:return bl(f.type),Wr(f),null;case 19:if(O(cr),w=f.memoizedState,w===null)return Wr(f),null;if(R=(f.flags&128)!==0,L=w.rendering,L===null)if(R)_l(w,!1);else{if(ws!==0||c!==null&&(c.flags&128)!==0)for(c=f.child;c!==null;){if(L=Ua(c),L!==null){for(f.flags|=128,_l(w,!1),c=L.updateQueue,f.updateQueue=c,ic(f,c),f.subtreeFlags=0,c=b,b=f.child;b!==null;)sf(b,c),b=b.sibling;return J(cr,cr.current&1|2),lr&&hl(f,w.treeForkCount),f.child}c=c.sibling}w.tail!==null&&mt()>Fs&&(f.flags|=128,R=!0,_l(w,!1),f.lanes=4194304)}else{if(!R)if(c=Ua(L),c!==null){if(f.flags|=128,R=!0,c=c.updateQueue,f.updateQueue=c,ic(f,c),_l(w,!0),w.tail===null&&w.tailMode==="hidden"&&!L.alternate&&!lr)return Wr(f),null}else 2*mt()-w.renderingStartTime>Fs&&b!==536870912&&(f.flags|=128,R=!0,_l(w,!1),f.lanes=4194304);w.isBackwards?(L.sibling=f.child,f.child=L):(c=w.last,c!==null?c.sibling=L:f.child=L,w.last=L)}return w.tail!==null?(c=w.tail,w.rendering=c,w.tail=c.sibling,w.renderingStartTime=mt(),c.sibling=null,b=cr.current,J(cr,R?b&1|2:b&1),lr&&hl(f,w.treeForkCount),c):(Wr(f),null);case 22:case 23:return Bs(f),Yh(),w=f.memoizedState!==null,c!==null?c.memoizedState!==null!==w&&(f.flags|=8192):w&&(f.flags|=8192),w?(b&536870912)!==0&&(f.flags&128)===0&&(Wr(f),f.subtreeFlags&6&&(f.flags|=8192)):Wr(f),b=f.updateQueue,b!==null&&ic(f,b.retryQueue),b=null,c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),w=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(w=f.memoizedState.cachePool.pool),w!==b&&(f.flags|=2048),c!==null&&O(qc),null;case 24:return b=null,c!==null&&(b=c.memoizedState.cache),f.memoizedState.cache!==b&&(f.flags|=2048),bl($s),Wr(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function vo(c,f){switch(Wp(f),f.tag){case 1:return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return bl($s),me(),c=f.flags,(c&65536)!==0&&(c&128)===0?(f.flags=c&-65537|128,f):null;case 26:case 27:case 5:return Be(f),null;case 31:if(f.memoizedState!==null){if(Bs(f),f.alternate===null)throw Error(r(340));Wc()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 13:if(Bs(f),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(r(340));Wc()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return O(cr),null;case 4:return me(),null;case 10:return bl(f.type),null;case 22:case 23:return Bs(f),Yh(),c!==null&&O(qc),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 24:return bl($s),null;case 25:return null;default:return null}}function za(c,f){switch(Wp(f),f.tag){case 3:bl($s),me();break;case 26:case 27:case 5:Be(f);break;case 4:me();break;case 31:f.memoizedState!==null&&Bs(f);break;case 13:Bs(f);break;case 19:O(cr);break;case 10:bl(f.type);break;case 22:case 23:Bs(f),Yh(),c!==null&&O(qc);break;case 24:bl($s)}}function wo(c,f){try{var b=f.updateQueue,w=b!==null?b.lastEffect:null;if(w!==null){var R=w.next;b=R;do{if((b.tag&c)===c){w=void 0;var L=b.create,te=b.inst;w=L(),te.destroy=w}b=b.next}
vendor: 21,379 bytes, line 8
8while(b!==R)}}catch(xe){yr(f,f.return,xe)}}function Ri(c,f,b){try{var w=f.updateQueue,R=w!==null?w.lastEffect:null;if(R!==null){var L=R.next;w=L;do{if((w.tag&c)===c){var te=w.inst,xe=te.destroy;if(xe!==void 0){te.destroy=void 0,R=f;var Oe=b,ct=xe;try{ct()}catch(St){yr(R,Oe,St)}}}w=w.next}while(w!==L)}}catch(St){yr(f,f.return,St)}}function Uo(c){var f=c.updateQueue;if(f!==null){var b=c.stateNode;try{l1(f,b)}catch(w){yr(c,c.return,w)}}}function wi(c,f,b){b.props=Zc(c.type,c.memoizedProps),b.state=c.memoizedState;try{b.componentWillUnmount()}catch(w){yr(c,f,w)}}function ac(c,f){try{var b=c.ref;if(b!==null){switch(c.tag){case 26:case 27:case 5:var w=c.stateNode;break;case 30:w=c.stateNode;break;default:w=c.stateNode}typeof b=="function"?c.refCleanup=b(w):b.current=w}}catch(R){yr(c,f,R)}}function Pi(c,f){var b=c.ref,w=c.refCleanup;if(b!==null)if(typeof w=="function")try{w()}catch(R){yr(c,f,R)}finally{c.refCleanup=null,c=c.alternate,c!=null&&(c.refCleanup=null)}else if(typeof b=="function")try{b(null)}catch(R){yr(c,f,R)}else b.current=null}function sm(c){var f=c.type,b=c.memoizedProps,w=c.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":b.autoFocus&&w.focus();break e;case"img":b.src?w.src=b.src:b.srcSet&&(w.srcset=b.srcSet)}}catch(R){yr(c,c.return,R)}}function li(c,f,b){try{var w=c.stateNode;qG(w,c.type,b,f),w[jr]=f}catch(R){yr(c,c.return,R)}}function ds(c){return c.tag===5||c.tag===3||c.tag===26||c.tag===27&&Tf(c.type)||c.tag===4}function sr(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||ds(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.tag===27&&Tf(c.type)||c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function Ml(c,f,b){var w=c.tag;if(w===5||w===6)c=c.stateNode,f?(b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b).insertBefore(c,f):(f=b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b,f.appendChild(c),b=b._reactRootContainer,b!=null||f.onclick!==null||(f.onclick=ts));else if(w!==4&&(w===27&&Tf(c.type)&&(b=c.stateNode,f=null),c=c.child,c!==null))for(Ml(c,f,b),c=c.sibling;c!==null;)Ml(c,f,b),c=c.sibling}function ra(c,f,b){var w=c.tag;if(w===5||w===6)c=c.stateNode,f?b.insertBefore(c,f):b.appendChild(c);else if(w!==4&&(w===27&&Tf(c.type)&&(b=c.stateNode),c=c.child,c!==null))for(ra(c,f,b),c=c.sibling;c!==null;)ra(c,f,b),c=c.sibling}function Sg(c){var f=c.stateNode,b=c.memoizedProps;try{for(var w=c.type,R=f.attributes;R.length;)f.removeAttributeNode(R[0]);oa(f,w,b),f[Wn]=c,f[jr]=b}catch(L){yr(c,c.return,L)}}var So=!1,Kr=!1,zo=!1,Q1=typeof WeakSet=="function"?WeakSet:Set,Si=null;function CA(c,f){if(c=c.containerInfo,DA=aw,c=Jv(c),_0(c)){if("selectionStart"in c)var b={start:c.selectionStart,end:c.selectionEnd};else e:{b=(b=c.ownerDocument)&&b.defaultView||window;var w=b.getSelection&&b.getSelection();if(w&&w.rangeCount!==0){b=w.anchorNode;var R=w.anchorOffset,L=w.focusNode;w=w.focusOffset;try{b.nodeType,L.nodeType}catch{b=null;break e}var te=0,xe=-1,Oe=-1,ct=0,St=0,jt=c,dt=null;t:for(;;){for(var gt;jt!==b||R!==0&&jt.nodeType!==3||(xe=te+R),jt!==L||w!==0&&jt.nodeType!==3||(Oe=te+w),jt.nodeType===3&&(te+=jt.nodeValue.length),(gt=jt.firstChild)!==null;)dt=jt,jt=gt;for(;;){if(jt===c)break t;if(dt===b&&++ct===R&&(xe=te),dt===L&&++St===w&&(Oe=te),(gt=jt.nextSibling)!==null)break;jt=dt,dt=jt.parentNode}jt=gt}b=xe===-1||Oe===-1?null:{start:xe,end:Oe}}else b=null}b=b||{start:0,end:0}}else b=null;for(kA={focusedElem:c,selectionRange:b},aw=!1,Si=f;Si!==null;)if(f=Si,c=f.child,(f.subtreeFlags&1028)!==0&&c!==null)c.return=f,Si=c;else for(;Si!==null;){switch(f=Si,L=f.alternate,c=f.flags,f.tag){case 0:if((c&4)!==0&&(c=f.updateQueue,c=c!==null?c.events:null,c!==null))for(b=0;b<c.length;b++)R=c[b],R.ref.impl=R.nextImpl;break;case 11:case 15:break;case 1:if((c&1024)!==0&&L!==null){c=void 0,b=f,R=L.memoizedProps,L=L.memoizedState,w=b.stateNode;try{var on=Zc(b.type,R);c=w.getSnapshotBeforeUpdate(on,L),w.__reactInternalSnapshotBeforeUpdate=c}catch(Mn){yr(b,b.return,Mn)}}break;case 3:if((c&1024)!==0){if(c=f.stateNode.containerInfo,b=c.nodeType,b===9)LA(c);else if(b===1)switch(c.nodeName){case"HEAD":case"HTML":case"BODY":LA(c);break;default:c.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((c&1024)!==0)throw Error(r(163))}if(c=f.sibling,c!==null){c.return=f.return,Si=c;break}Si=f.return}}function fs(c,f,b){var w=b.flags;switch(b.tag){case 0:case 11:case 15:No(c,b),w&4&&wo(5,b);break;case 1:if(No(c,b),w&4)if(c=b.stateNode,f===null)try{c.componentDidMount()}catch(te){yr(b,b.return,te)}else{var R=Zc(b.type,f.memoizedProps);f=f.memoizedState;try{c.componentDidUpdate(R,f,c.__reactInternalSnapshotBeforeUpdate)}catch(te){yr(b,b.return,te)}}w&64&&Uo(b),w&512&&ac(b,b.return);break;case 3:if(No(c,b),w&64&&(c=b.updateQueue,c!==null)){if(f=null,b.child!==null)switch(b.child.tag){case 27:case 5:f=b.child.stateNode;break;case 1:f=b.child.stateNode}try{l1(c,f)}catch(te){yr(b,b.return,te)}}break;case 27:f===null&&w&4&&Sg(b);case 26:case 5:No(c,b),f===null&&w&4&&sm(b),w&512&&ac(b,b.return);break;case 12:No(c,b);break;case 31:No(c,b),w&4&&eu(c,b);break;case 13:No(c,b),w&4&&wf(c,b),w&64&&(c=b.memoizedState,c!==null&&(c=c.dehydrated,c!==null&&(b=N.bind(null,b),nH(c,b))));break;case 22:if(w=b.memoizedState!==null||So,!w){f=f!==null&&f.memoizedState!==null||Kr,R=So;var L=Kr;So=w,(Kr=f)&&!L?sa(c,b,(b.subtreeFlags&8772)!==0):No(c,b),So=R,Kr=L}break;case 30:break;default:No(c,b)}}function im(c){var f=c.alternate;f!==null&&(c.alternate=null,im(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&ps(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}var Fr=null,Wi=!1;function _o(c,f,b){for(b=b.child;b!==null;)_g(c,f,b),b=b.sibling}function _g(c,f,b){if(Me&&typeof Me.onCommitFiberUnmount=="function")try{Me.onCommitFiberUnmount(ce,b)}catch{}switch(b.tag){case 26:Kr||Pi(b,f),_o(c,f,b),b.memoizedState?b.memoizedState.count--:b.stateNode&&(b=b.stateNode,b.parentNode.removeChild(b));break;case 27:Kr||Pi(b,f);var w=Fr,R=Wi;Tf(b.type)&&(Fr=b.stateNode,Wi=!1),_o(c,f,b),wb(b.stateNode),Fr=w,Wi=R;break;case 5:Kr||Pi(b,f);case 6:if(w=Fr,R=Wi,Fr=null,_o(c,f,b),Fr=w,Wi=R,Fr!==null)if(Wi)try{(Fr.nodeType===9?Fr.body:Fr.nodeName==="HTML"?Fr.ownerDocument.body:Fr).removeChild(b.stateNode)}catch(L){yr(b,f,L)}else try{Fr.removeChild(b.stateNode)}catch(L){yr(b,f,L)}break;case 18:Fr!==null&&(Wi?(c=Fr,dP(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,b.stateNode),Rg(c)):dP(Fr,b.stateNode));break;case 4:w=Fr,R=Wi,Fr=b.stateNode.containerInfo,Wi=!0,_o(c,f,b),Fr=w,Wi=R;break;case 0:case 11:case 14:case 15:Ri(2,b,f),Kr||Ri(4,b,f),_o(c,f,b);break;case 1:Kr||(Pi(b,f),w=b.stateNode,typeof w.componentWillUnmount=="function"&&wi(b,f,w)),_o(c,f,b);break;case 21:_o(c,f,b);break;case 22:Kr=(w=Kr)||b.memoizedState!==null,_o(c,f,b),Kr=w;break;default:_o(c,f,b)}}function eu(c,f){if(f.memoizedState===null&&(c=f.alternate,c!==null&&(c=c.memoizedState,c!==null))){c=c.dehydrated;try{Rg(c)}catch(b){yr(f,f.return,b)}}}function wf(c,f){if(f.memoizedState===null&&(c=f.alternate,c!==null&&(c=c.memoizedState,c!==null&&(c=c.dehydrated,c!==null))))try{Rg(c)}catch(b){yr(f,f.return,b)}}function pb(c){switch(c.tag){case 31:case 13:case 19:var f=c.stateNode;return f===null&&(f=c.stateNode=new Q1),f;case 22:return c=c.stateNode,f=c._retryCache,f===null&&(f=c._retryCache=new Q1),f;default:throw Error(r(435,c.tag))}}function oc(c,f){var b=pb(c);f.forEach(function(w){if(!b.has(w)){b.add(w);var R=j.bind(null,c,w);w.then(R,R)}})}function ci(c,f){var b=f.deletions;if(b!==null)for(var w=0;w<b.length;w++){var R=b[w],L=c,te=f,xe=te;e:for(;xe!==null;){switch(xe.tag){case 27:if(Tf(xe.type)){Fr=xe.stateNode,Wi=!1;break e}break;case 5:Fr=xe.stateNode,Wi=!1;break e;case 3:case 4:Fr=xe.stateNode.containerInfo,Wi=!0;break e}xe=xe.return}if(Fr===null)throw Error(r(160));_g(L,te,R),Fr=null,Wi=!1,L=R.alternate,L!==null&&(L.return=null),R.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)tu(f,c),f=f.sibling}var Mo=null;function tu(c,f){var b=c.alternate,w=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:ci(f,c),ui(c),w&4&&(Ri(3,c,c.return),wo(3,c),Ri(5,c,c.return));break;case 1:ci(f,c),ui(c),w&512&&(Kr||b===null||Pi(b,b.return)),w&64&&So&&(c=c.updateQueue,c!==null&&(w=c.callbacks,w!==null&&(b=c.shared.hiddenCallbacks,c.shared.hiddenCallbacks=b===null?w:b.concat(w))));break;case 26:var R=Mo;if(ci(f,c),ui(c),w&512&&(Kr||b===null||Pi(b,b.return)),w&4){var L=b!==null?b.memoizedState:null;if(w=c.memoizedState,b===null)if(w===null)if(c.stateNode===null){e:{w=c.type,b=c.memoizedProps,R=R.ownerDocument||R;t:switch(w){case"title":L=R.getElementsByTagName("title")[0],(!L||L[Xr]||L[Wn]||L.namespaceURI==="http://www.w3.org/2000/svg"||L.hasAttribute("itemprop"))&&(L=R.createElement(w),R.head.insertBefore(L,R.querySelector("head > title"))),oa(L,w,b),L[Wn]=c,or(L),w=L;break e;case"link":var te=SP("link","href",R).get(w+(b.href||""));if(te){for(var xe=0;xe<te.length;xe++)if(L=te[xe],L.getAttribute("href")===(b.href==null||b.href===""?null:b.href)&&L.getAttribute("rel")===(b.rel==null?null:b.rel)&&L.getAttribute("title")===(b.title==null?null:b.title)&&L.getAttribute("crossorigin")===(b.crossOrigin==null?null:b.crossOrigin)){te.splice(xe,1);break t}}L=R.createElement(w),oa(L,w,b),R.head.appendChild(L);break;case"meta":if(te=SP("meta","content",R).get(w+(b.content||""))){for(xe=0;xe<te.length;xe++)if(L=te[xe],L.getAttribute("content")===(b.content==null?null:""+b.content)&&L.getAttribute("name")===(b.name==null?null:b.name)&&L.getAttribute("property")===(b.property==null?null:b.property)&&L.getAttribute("http-equiv")===(b.httpEquiv==null?null:b.httpEquiv)&&L.getAttribute("charset")===(b.charSet==null?null:b.charSet)){te.splice(xe,1);break t}}L=R.createElement(w),oa(L,w,b),R.head.appendChild(L);break;default:throw Error(r(468,w))}L[Wn]=c,or(L),w=L}c.stateNode=w}else _P(R,c.type,c.stateNode);else c.stateNode=wP(R,w,c.memoizedProps);else L!==w?(L===null?b.stateNode!==null&&(b=b.stateNode,b.parentNode.removeChild(b)):L.count--,w===null?_P(R,c.type,c.stateNode):wP(R,w,c.memoizedProps)):w===null&&c.stateNode!==null&&li(c,c.memoizedProps,b.memoizedProps)}break;case 27:ci(f,c),ui(c),w&512&&(Kr||b===null||Pi(b,b.return)),b!==null&&w&4&&li(c,c.memoizedProps,b.memoizedProps);break;case 5:if(ci(f,c),ui(c),w&512&&(Kr||b===null||Pi(b,b.return)),c.flags&32){R=c.stateNode;try{As(R,"")}catch(on){yr(c,c.return,on)}}w&4&&c.stateNode!=null&&(R=c.memoizedProps,li(c,R,b!==null?b.memoizedProps:R)),w&1024&&(zo=!0);break;case 6:if(ci(f,c),ui(c),w&4){if(c.stateNode===null)throw Error(r(162));w=c.memoizedProps,b=c.stateNode;try{b.nodeValue=w}catch(on){yr(c,c.return,on)}}break;case 3:if(nw=null,R=Mo,Mo=ew(f.containerInfo),ci(f,c),Mo=R,ui(c),w&4&&b!==null&&b.memoizedState.isDehydrated)try{Rg(f.containerInfo)}catch(on){yr(c,c.return,on)}zo&&(zo=!1,Mg(c));break;case 4:w=Mo,Mo=ew(c.stateNode.containerInfo),ci(f,c),ui(c),Mo=w;break;case 12:ci(f,c),ui(c);break;case 31:ci(f,c),ui(c),w&4&&(w=c.updateQueue,w!==null&&(c.updateQueue=null,oc(c,w)));break;case 13:ci(f,c),ui(c),c.child.flags&8192&&c.memoizedState!==null!=(b!==null&&b.memoizedState!==null)&&(Sf=mt()),w&4&&(w=c.updateQueue,w!==null&&(c.updateQueue=null,oc(c,w)));break;case 22:R=c.memoizedState!==null;var Oe=b!==null&&b.memoizedState!==null,ct=So,St=Kr;if(So=ct||R,Kr=St||Oe,ci(f,c),Kr=St,So=ct,ui(c),w&8192)e:for(f=c.stateNode,f._visibility=R?f._visibility&-2:f._visibility|1,R&&(b===null||Oe||So||Kr||Nl(c)),b=null,f=c;;){if(f.tag===5||f.tag===26){if(b===null){Oe=b=f;try{if(L=Oe.stateNode,R)te=L.style,typeof te.setProperty=="function"?te.setProperty("display","none","important"):te.display="none";else{xe=Oe.stateNode;var jt=Oe.memoizedProps.style,dt=jt!=null&&jt.hasOwnProperty("display")?jt.display:null;xe.style.display=dt==null||typeof dt=="boolean"?"":(""+dt).trim()}}catch(on){yr(Oe,Oe.return,on)}}}else if(f.tag===6){if(b===null){Oe=f;try{Oe.stateNode.nodeValue=R?"":Oe.memoizedProps}catch(on){yr(Oe,Oe.return,on)}}}else if(f.tag===18){if(b===null){Oe=f;try{var gt=Oe.stateNode;R?fP(gt,!0):fP(Oe.stateNode,!1)}catch(on){yr(Oe,Oe.return,on)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===c)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break e;for(;f.sibling===null;){if(f.return===null||f.return===c)break e;b===f&&(b=null),f=f.return}b===f&&(b=null),f.sibling.return=f.return,f=f.sibling}w&4&&(w=c.updateQueue,w!==null&&(b=w.retryQueue,b!==null&&(w.retryQueue=null,oc(c,b))));break;case 19:ci(f,c),ui(c),w&4&&(w=c.updateQueue,w!==null&&(c.updateQueue=null,oc(c,w)));break;case 30:break;case 21:break;default:ci(f,c),ui(c)}}function ui(c){var f=c.flags;if(f&2){try{for(var b,w=c.return;w!==null;){if(ds(w)){b=w;break}w=w.return}if(b==null)throw Error(r(160));switch(b.tag){case 27:var R=b.stateNode,L=sr(c);ra(c,L,R);break;case 5:var te=b.stateNode;b.flags&32&&(As(te,""),b.flags&=-33);var xe=sr(c);ra(c,xe,te);break;case 3:case 4:var Oe=b.stateNode.containerInfo,ct=sr(c);Ml(c,ct,Oe);break;default:throw Error(r(161))}}catch(St){yr(c,c.return,St)}c.flags&=-3}f&4096&&(c.flags&=-4097)}function Mg(c){if(c.subtreeFlags&1024)for(c=c.child;c!==null;){var f=c;Mg(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),c=c.sibling}}function No(c,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)fs(c,f.alternate,f),f=f.sibling}function Nl(c){for(c=c.child;c!==null;){var f=c;switch(f.tag){case 0:case 11:case 14:case 15:Ri(4,f,f.return),Nl(f);break;case 1:Pi(f,f.return);var b=f.stateNode;typeof b.componentWillUnmount=="function"&&wi(f,f.return,b),Nl(f);break;case 27:wb(f.stateNode);case 26:case 5:Pi(f,f.return),Nl(f);break;case 22:f.memoizedState===null&&Nl(f);break;case 30:Nl(f);break;default:Nl(f)}c=c.sibling}}function sa(c,f,b){for(b=b&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var w=f.alternate,R=c,L=f,te=L.flags;switch(L.tag){case 0:case 11:case 15:sa(R,L,b),wo(4,L);break;case 1:if(sa(R,L,b),w=L,R=w.stateNode,typeof R.componentDidMount=="function")try{R.componentDidMount()}catch(ct){yr(w,w.return,ct)}if(w=L,R=w.updateQueue,R!==null){var xe=w.stateNode;try{var Oe=R.shared.hiddenCallbacks;if(Oe!==null)for(R.shared.hiddenCallbacks=null,R=0;R<Oe.length;R++)pf(Oe[R],xe)}catch(ct){yr(w,w.return,ct)}}b&&te&64&&Uo(L),ac(L,L.return);break;case 27:Sg(L);case 26:case 5:sa(R,L,b),b&&w===null&&te&4&&sm(L),ac(L,L.return);break;case 12:sa(R,L,b);break;case 31:sa(R,L,b),b&&te&4&&eu(R,L);break;case 13:sa(R,L,b),b&&te&4&&wf(R,L);break;case 22:L.memoizedState===null&&sa(R,L,b),ac(L,L.return);break;case 30:break;default:sa(R,L,b)}f=f.sibling}}function nu(c,f){var b=null;c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),c=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(c=f.memoizedState.cachePool.pool),c!==b&&(c!=null&&c.refCount++,b!=null&&Yu(b))}function cd(c,f){c=null,f.alternate!==null&&(c=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==c&&(f.refCount++,c!=null&&Yu(c))}function Di(c,f,b,w){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)gb(c,f,b,w),f=f.sibling}function gb(c,f,b,w){var R=f.flags;switch(f.tag){case 0:case 11:case 15:Di(c,f,b,w),R&2048&&wo(9,f);break;case 1:Di(c,f,b,w);break;case 3:Di(c,f,b,w),R&2048&&(c=null,f.alternate!==null&&(c=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==c&&(f.refCount++,c!=null&&Yu(c)));break;case 12:if(R&2048){Di(c,f,b,w),c=f.stateNode;try{var L=f.memoizedProps,te=L.id,xe=L.onPostCommit;typeof xe=="function"&&xe(te,f.alternate===null?"mount":"update",c.passiveEffectDuration,-0)}catch(Oe){yr(f,f.return,Oe)}}else Di(c,f,b,w);break;case 31:Di(c,f,b,w);break;case 13:Di(c,f,b,w);break;case 23:break;case 22:L=f.stateNode,te=f.alternate,f.memoizedState!==null?L._visibility&2?Di(c,f,b,w):Al(c,f):L._visibility&2?Di(c,f,b,w):(L._visibility|=2,ki(c,f,b,w,(f.subtreeFlags&10256)!==0||!1)),R&2048&&nu(te,f);break;case 24:Di(c,f,b,w),R&2048&&cd(f.alternate,f);break;default:Di(c,f,b,w)}}function ki(c,f,b,w,R){for(R=R&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var L=c,te=f,xe=b,Oe=w,ct=te.flags;switch(te.tag){case 0:case 11:case 15:ki(L,te,xe,Oe,R),wo(8,te);break;case 23:break;case 22:var St=te.stateNode;te.memoizedState!==null?St._visibility&2?ki(L,te,xe,Oe,R):Al(L,te):(St._visibility|=2,ki(L,te,xe,Oe,R)),R&&ct&2048&&nu(te.alternate,te);break;case 24:ki(L,te,xe,Oe,R),R&&ct&2048&&cd(te.alternate,te);break;default:ki(L,te,xe,Oe,R)}f=f.sibling}}function Al(c,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var b=c,w=f,R=w.flags;switch(w.tag){case 22:Al(b,w),R&2048&&nu(w.alternate,w);break;case 24:Al(b,w),R&2048&&cd(w.alternate,w);break;default:Al(b,w)}f=f.sibling}}var ud=8192;function Ga(c,f,b){if(c.subtreeFlags&ud)for(c=c.child;c!==null;)Ng(c,f,b),c=c.sibling}function Ng(c,f,b){switch(c.tag){case 26:Ga(c,f,b),c.flags&ud&&c.memoizedState!==null&&mH(b,Mo,c.memoizedState,c.memoizedProps);break;case 5:Ga(c,f,b);break;case 3:case 4:var w=Mo;Mo=ew(c.stateNode.containerInfo),Ga(c,f,b),Mo=w;break;case 22:c.memoizedState===null&&(w=c.alternate,w!==null&&w.memoizedState!==null?(w=ud,ud=16777216,Ga(c,f,b),ud=w):Ga(c,f,b));break;default:Ga(c,f,b)}}function dd(c){var f=c.alternate;if(f!==null&&(c=f.child,c!==null)){f.child=null;do f=c.sibling,c.sibling=null,c=f;while(c!==null)}}function ru(c){var f=c.deletions;if((c.flags&16)!==0){if(f!==null)for(var b=0;b<f.length;b++){var w=f[b];Si=w,js(w,c)}dd(c)}if(c.subtreeFlags&10256)for(c=c.child;c!==null;)_a(c),c=c.sibling}function _a(c){switch(c.tag){case 0:case 11:case 15:ru(c),c.flags&2048&&Ri(9,c,c.return);break;case 3:ru(c);break;case 12:ru(c);break;case 22:var f=c.stateNode;c.memoizedState!==null&&f._visibility&2&&(c.return===null||c.return.tag!==13)?(f._visibility&=-3,Ma(c)):ru(c);break;default:ru(c)}}function Ma(c){var f=c.deletions;if((c.flags&16)!==0){if(f!==null)for(var b=0;b<f.length;b++){var w=f[b];Si=w,js(w,c)}dd(c)}for(c=c.child;c!==null;){switch(f=c,f.tag){case 0:case 11:case 15:Ri(8,f,f.return),Ma(f);break;case 22:b=f.stateNode,b._visibility&2&&(b._visibility&=-3,Ma(f));break;default:Ma(f)}c=c.sibling}}function js(c,f){for(;Si!==null;){var b=Si;switch(b.tag){case 0:case 11:case 15:Ri(8,b,f);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var w=b.memoizedState.cachePool.pool;w!=null&&w.refCount++}break;case 24:Yu(b.memoizedState.cache)}if(w=b.child,w!==null)w.return=b,Si=w;else e:for(b=c;Si!==null;){w=Si;var R=w.sibling,L=w.return;if(im(w),w===b){Si=null;break e}if(R!==null){R.return=L,Si=R;break e}Si=L}}}var lc={getCacheForType:function(c){var f=An($s),b=f.data.get(c);return b===void 0&&(b=c(),f.data.set(c,b)),b},cacheSignal:function(){return An($s).controller.signal}},Gn=typeof WeakMap=="function"?WeakMap:Map,dn=0,kn=null,Xn=null,Vn=0,dr=0,$i=null,Ao=!1,Go=!1,xb=!1,Ha=0,ws=0,Cl=0,su=0,am=0,ia=0,ns=0,fd=null,Ts=null,Rs=!1,Sf=0,bb=0,Fs=1/0,Ss=null,Us=null,Ur=0,Va=null,_f=null,Co=0,Mf=0,Nf=null,om=null,iu=0,hd=null;function Wa(){return(dn&2)!==0&&Vn!==0?Vn&-Vn:z.T!==null?ht():Lr()}function er(){if(ia===0)if((Vn&536870912)===0||lr){var c=Ke;Ke<<=1,(Ke&3932160)===0&&(Ke=262144),ia=c}else ia=536870912;return c=ya.current,c!==null&&(c.flags|=32),ia}function qn(c,f,b){(c===kn&&(dr===2||dr===9)||c.cancelPendingCommit!==null)&&(ou(c,0),qs(c,Vn,ia,!1)),ue(c,b),((dn&2)===0||c!==kn)&&(c===kn&&((dn&2)===0&&(su|=b),ws===4&&qs(c,Vn,ia,!1)),Dt(c))}function tr(c,f,b){if((dn&6)!==0)throw Error(r(327));var w=!b&&(f&127)===0&&(f&c.expiredLanes)===0||st(c,f),R=w?lm(c,f):aa(c,f,!0),L=w;do{if(R===0){Go&&!w&&qs(c,f,0,!1);break}else{if(b=c.current.alternate,L&&!zr(b)){R=aa(c,f,!1),L=!1;continue}if(R===2){if(L=f,c.errorRecoveryDisabledLanes&L)var te=0;else te=c.pendingLanes&-536870913,te=te!==0?te:te&536870912?536870912:0;if(te!==0){f=te;e:{var xe=c;R=fd;var Oe=xe.current.memoizedState.isDehydrated;if(Oe&&(ou(xe,te).flags|=256),te=aa(xe,te,!1),te!==2){if(xb&&!Oe){xe.errorRecoveryDisabledLanes|=L,su|=L,R=4;break e}L=Ts,Ts=R,L!==null&&(Ts===null?Ts=L:Ts.push.apply(Ts,L))}R=te}if(L=!1,R!==2)continue}}if(R===1){ou(c,0),qs(c,f,0,!0);break}e:{switch(w=c,L=R,L){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:qs(w,f,ia,!Ao);break e;case 2:Ts=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(R=Sf+300-mt(),10<R)){if(qs(w,f,ia,!Ao),Te(w,0,!0)!==0)break e;Co=f,w.timeoutHandle=cP(ir.bind(null,w,b,Ts,Ss,Rs,f,ia,su,ns,Ao,L,"Throttled",-0,0),R);break e}ir(w,b,Ts,Ss,Rs,f,ia,su,ns,Ao,L,null,-0,0)}}break}while(!0);Dt(c)}function ir(c,f,b,w,R,L,te,xe,Oe,ct,St,jt,dt,gt){if(c.timeoutHandle=-1,jt=f.subtreeFlags,jt&8192||(jt&16785408)===16785408){jt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ts},Ng(f,L,jt);var on=(L&62914560)===L?Sf-mt():(L&4194048)===L?bb-mt():0;if(on=pH(jt,on),on!==null){Co=L,c.cancelPendingCommit=on(uc.bind(null,c,f,L,b,w,R,te,xe,Oe,St,jt,null,dt,gt)),qs(c,L,te,!ct);return}}uc(c,f,L,b,w,R,te,xe,Oe)}function zr(c){for(var f=c;;){var b=f.tag;if((b===0||b===11||b===15)&&f.flags&16384&&(b=f.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var w=0;w<b.length;w++){var R=b[w],L=R.getSnapshot;R=R.value;
vendor: 12,571 bytes, line 8
8try{if(!Zi(L(),R))return!1}catch{return!1}}if(b=f.child,f.subtreeFlags&16384&&b!==null)b.return=f,f=b;else{if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function qs(c,f,b,w){f&=~am,f&=~su,c.suspendedLanes|=f,c.pingedLanes&=~f,w&&(c.warmLanes|=f),w=c.expirationTimes;for(var R=f;0<R;){var L=31-ie(R),te=1<<L;w[L]=-1,R&=~te}b!==0&&it(c,b,f)}function Ho(){return(dn&6)===0?(Kt(0),!1):!0}function au(){if(Xn!==null){if(dr===0)var c=Xn.return;else c=Xn,xl=$c=null,z0(c),ed=null,td=0,c=Xn;for(;c!==null;)za(c.alternate,c),c=c.return;Xn=null}}function ou(c,f){var b=c.timeoutHandle;b!==-1&&(c.timeoutHandle=-1,KG(b)),b=c.cancelPendingCommit,b!==null&&(c.cancelPendingCommit=null,b()),Co=0,au(),kn=c,Xn=b=ga(c.current,null),Vn=f,dr=0,$i=null,Ao=!1,Go=st(c,f),xb=!1,ns=ia=am=su=Cl=ws=0,Ts=fd=null,Rs=!1,(f&8)!==0&&(f|=f&32);var w=c.entangledLanes;if(w!==0)for(c=c.entanglements,w&=f;0<w;){var R=31-ie(w),L=1<<R;f|=c[R],w&=~L}return Ha=f,zh(),b}function El(c,f){zn=null,z.H=yf,f===Qu||f===$n?(f=Ju(),dr=3):f===Wh?(f=Ju(),dr=4):dr=f===hg?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,$i=f,Xn===null&&(ws=1,fg(c,La(f,c.current)))}function _s(){var c=ya.current;return c===null?!0:(Vn&4194048)===Vn?na===null:(Vn&62914560)===Vn||(Vn&536870912)!==0?c===na:!1}function cc(){var c=z.H;return z.H=yf,c===null?yf:c}function lu(){var c=z.A;return z.A=lc,c}function Af(){ws=4,Ao||(Vn&4194048)!==Vn&&ya.current!==null||(Go=!0),(Cl&134217727)===0&&(su&134217727)===0||kn===null||qs(kn,Vn,ia,!1)}function aa(c,f,b){var w=dn;dn|=2;var R=cc(),L=lu();(kn!==c||Vn!==f)&&(Ss=null,ou(c,f)),f=!1;var te=ws;e:do try{if(dr!==0&&Xn!==null){var xe=Xn,Oe=$i;switch(dr){case 8:au(),te=6;break e;case 3:case 2:case 9:case 6:ya.current===null&&(f=!0);var ct=dr;if(dr=0,$i=null,md(c,xe,Oe,ct),b&&Go){te=0;break e}break;default:ct=dr,dr=0,$i=null,md(c,xe,Oe,ct)}}Cf(),te=ws;break}catch(St){El(c,St)}while(!0);return f&&c.shellSuspendCounter++,xl=$c=null,dn=w,z.H=R,z.A=L,Xn===null&&(kn=null,Vn=0,zh()),te}function Cf(){for(;Xn!==null;)Ag(Xn)}function lm(c,f){var b=dn;dn|=2;var w=cc(),R=lu();kn!==c||Vn!==f?(Ss=null,Fs=mt()+500,ou(c,f)):Go=st(c,f);e:do try{if(dr!==0&&Xn!==null){f=Xn;var L=$i;t:switch(dr){case 1:dr=0,$i=null,md(c,f,L,1);break;case 2:case 9:if(ba(L)){dr=0,$i=null,cm(f);break}f=function(){dr!==2&&dr!==9||kn!==c||(dr=7),Dt(c)},L.then(f,f);break e;case 3:dr=7;break e;case 4:dr=5;break e;case 7:ba(L)?(dr=0,$i=null,cm(f)):(dr=0,$i=null,md(c,f,L,7));break;case 5:var te=null;switch(Xn.tag){case 26:te=Xn.memoizedState;case 5:case 27:var xe=Xn;if(te?MP(te):xe.stateNode.complete){dr=0,$i=null;var Oe=xe.sibling;if(Oe!==null)Xn=Oe;else{var ct=xe.return;ct!==null?(Xn=ct,cu(ct)):Xn=null}break t}}dr=0,$i=null,md(c,f,L,5);break;case 6:dr=0,$i=null,md(c,f,L,6);break;case 8:au(),ws=6;break e;default:throw Error(r(462))}}Na();break}catch(St){El(c,St)}while(!0);return xl=$c=null,z.H=w,z.A=R,dn=b,Xn!==null?0:(kn=null,Vn=0,zh(),ws)}function Na(){for(;Xn!==null&&!ot();)Ag(Xn)}function Ag(c){var f=wg(c.alternate,c,Ha);c.memoizedProps=c.pendingProps,f===null?cu(c):Xn=f}function cm(c){var f=c,b=f.alternate;switch(f.tag){case 15:case 0:f=em(b,f,f.pendingProps,f.type,void 0,Vn);break;case 11:f=em(b,f,f.pendingProps,f.type.render,f.ref,Vn);break;case 5:z0(f);default:za(b,f),f=Xn=sf(f,Ha),f=wg(b,f,Ha)}c.memoizedProps=c.pendingProps,f===null?cu(c):Xn=f}function md(c,f,b,w){xl=$c=null,z0(f),ed=null,td=0;var R=f.return;try{if(oi(c,R,f,b,Vn)){ws=1,fg(c,La(b,c.current)),Xn=null;return}}catch(L){if(R!==null)throw Xn=R,L;ws=1,fg(c,La(b,c.current)),Xn=null;return}f.flags&32768?(lr||w===1?c=!0:Go||(Vn&536870912)!==0?c=!1:(Ao=c=!0,(w===2||w===9||w===3||w===6)&&(w=ya.current,w!==null&&w.tag===13&&(w.flags|=16384))),um(f,c)):cu(f)}function cu(c){var f=c;do{if((f.flags&32768)!==0){um(f,Ao);return}c=f.return;var b=rm(f.alternate,f,Ha);if(b!==null){Xn=b;return}if(f=f.sibling,f!==null){Xn=f;return}Xn=f=c}while(f!==null);ws===0&&(ws=5)}function um(c,f){do{var b=vo(c.alternate,c);if(b!==null){b.flags&=32767,Xn=b;return}if(b=c.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!f&&(c=c.sibling,c!==null)){Xn=c;return}Xn=c=b}while(c!==null);ws=6,Xn=null}function uc(c,f,b,w,R,L,te,xe,Oe){c.cancelPendingCommit=null;do Ef();while(Ur!==0);if((dn&6)!==0)throw Error(r(327));if(f!==null){if(f===c.current)throw Error(r(177));if(L=f.lanes|f.childLanes,L|=bi,Je(c,b,L,te,xe,Oe),c===kn&&(Xn=kn=null,Vn=0),_f=f,Va=c,Co=b,Mf=L,Nf=R,om=w,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(c.callbackNode=null,c.callbackPriority=0,H(je,function(){return Cg(),null})):(c.callbackNode=null,c.callbackPriority=0),w=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||w){w=z.T,z.T=null,R=K.p,K.p=2,te=dn,dn|=4;try{CA(c,f,b)}finally{dn=te,K.p=R,z.T=w}}Ur=1,Ys(),dc(),pd()}}function Ys(){if(Ur===1){Ur=0;var c=Va,f=_f,b=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||b){b=z.T,z.T=null;var w=K.p;K.p=2;var R=dn;dn|=4;try{tu(f,c);var L=kA,te=Jv(c.containerInfo),xe=L.focusedElem,Oe=L.selectionRange;if(te!==xe&&xe&&xe.ownerDocument&&Yr(xe.ownerDocument.documentElement,xe)){if(Oe!==null&&_0(xe)){var ct=Oe.start,St=Oe.end;if(St===void 0&&(St=ct),"selectionStart"in xe)xe.selectionStart=ct,xe.selectionEnd=Math.min(St,xe.value.length);else{var jt=xe.ownerDocument||document,dt=jt&&jt.defaultView||window;if(dt.getSelection){var gt=dt.getSelection(),on=xe.textContent.length,Mn=Math.min(Oe.start,on),Zr=Oe.end===void 0?Mn:Math.min(Oe.end,on);!gt.extend&&Mn>Zr&&(te=Zr,Zr=Mn,Mn=te);var tt=tf(xe,Mn),$e=tf(xe,Zr);if(tt&&$e&&(gt.rangeCount!==1||gt.anchorNode!==tt.node||gt.anchorOffset!==tt.offset||gt.focusNode!==$e.node||gt.focusOffset!==$e.offset)){var lt=jt.createRange();lt.setStart(tt.node,tt.offset),gt.removeAllRanges(),Mn>Zr?(gt.addRange(lt),gt.extend($e.node,$e.offset)):(lt.setEnd($e.node,$e.offset),gt.addRange(lt))}}}}for(jt=[],gt=xe;gt=gt.parentNode;)gt.nodeType===1&&jt.push({element:gt,left:gt.scrollLeft,top:gt.scrollTop});for(typeof xe.focus=="function"&&xe.focus(),xe=0;xe<jt.length;xe++){var Nt=jt[xe];Nt.element.scrollLeft=Nt.left,Nt.element.scrollTop=Nt.top}}aw=!!DA,kA=DA=null}finally{dn=R,K.p=w,z.T=b}}c.current=f,Ur=2}}function dc(){if(Ur===2){Ur=0;var c=Va,f=_f,b=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||b){b=z.T,z.T=null;var w=K.p;K.p=2;var R=dn;dn|=4;try{fs(c,f.alternate,f)}finally{dn=R,K.p=w,z.T=b}}Ur=3}}function pd(){if(Ur===4||Ur===3){Ur=0,ve();var c=Va,f=_f,b=Co,w=om;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Ur=5:(Ur=0,_f=Va=null,jl(c,c.pendingLanes));var R=c.pendingLanes;if(R===0&&(Us=null),Sn(b),f=f.stateNode,Me&&typeof Me.onCommitFiberRoot=="function")try{Me.onCommitFiberRoot(ce,f,void 0,(f.current.flags&128)===128)}catch{}if(w!==null){f=z.T,R=K.p,K.p=2,z.T=null;try{for(var L=c.onRecoverableError,te=0;te<w.length;te++){var xe=w[te];L(xe.value,{componentStack:xe.stack})}}finally{z.T=f,K.p=R}}(Co&3)!==0&&Ef(),Dt(c),R=c.pendingLanes,(b&261930)!==0&&(R&42)!==0?c===hd?iu++:(iu=0,hd=c):iu=0,Kt(0)}}function jl(c,f){(c.pooledCacheLanes&=f)===0&&(f=c.pooledCache,f!=null&&(c.pooledCache=null,Yu(f)))}function Ef(){return Ys(),dc(),pd(),Cg()}function Cg(){if(Ur!==5)return!1;var c=Va,f=Mf;Mf=0;var b=Sn(Co),w=z.T,R=K.p;try{K.p=32>b?32:b,z.T=null,b=Nf,Nf=null;var L=Va,te=Co;if(Ur=0,_f=Va=null,Co=0,(dn&6)!==0)throw Error(r(331));var xe=dn;if(dn|=4,_a(L.current),gb(L,L.current,te,b),dn=xe,Kt(0,!1),Me&&typeof Me.onPostCommitFiberRoot=="function")try{Me.onPostCommitFiberRoot(ce,L)}catch{}return!0}finally{K.p=R,z.T=w,jl(c,f)}}function yb(c,f,b){f=La(b,f),f=cb(c.stateNode,f,2),c=Yc(c,f,2),c!==null&&(ue(c,2),Dt(c))}function yr(c,f,b){if(c.tag===3)yb(c,c,b);else for(;f!==null;){if(f.tag===3){yb(f,c,b);break}else if(f.tag===1){var w=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(Us===null||!Us.has(w))){c=La(b,c),b=ub(2),w=Yc(f,b,2),w!==null&&(W1(b,w,f,c),ue(w,2),Dt(w));break}}f=f.return}}function dm(c,f,b){var w=c.pingCache;if(w===null){w=c.pingCache=new Gn;var R=new Set;w.set(f,R)}else R=w.get(f),R===void 0&&(R=new Set,w.set(f,R));R.has(b)||(xb=!0,R.add(b),c=m.bind(null,c,f,b),f.then(c,c))}function m(c,f,b){var w=c.pingCache;w!==null&&w.delete(f),c.pingedLanes|=c.suspendedLanes&b,c.warmLanes&=~b,kn===c&&(Vn&b)===b&&(ws===4||ws===3&&(Vn&62914560)===Vn&&300>mt()-Sf?(dn&2)===0&&ou(c,0):am|=b,ns===Vn&&(ns=0)),Dt(c)}function g(c,f){f===0&&(f=Qe()),c=ea(c,f),c!==null&&(ue(c,f),Dt(c))}function N(c){var f=c.memoizedState,b=0;f!==null&&(b=f.retryLane),g(c,b)}function j(c,f){var b=0;switch(c.tag){case 31:case 13:var w=c.stateNode,R=c.memoizedState;R!==null&&(b=R.retryLane);break;case 19:w=c.stateNode;break;case 22:w=c.stateNode._retryCache;break;default:throw Error(r(314))}w!==null&&w.delete(f),g(c,b)}function H(c,f){return qe(c,f)}var W=null,fe=null,Ue=!1,pt=!1,Tt=!1,Lt=0;function Dt(c){c!==fe&&c.next===null&&(fe===null?W=fe=c:fe=fe.next=c),pt=!0,Ue||(Ue=!0,nt())}function Kt(c,f){if(!Tt&&pt){Tt=!0;do for(var b=!1,w=W;w!==null;){if(c!==0){var R=w.pendingLanes;if(R===0)var L=0;else{var te=w.suspendedLanes,xe=w.pingedLanes;L=(1<<31-ie(42|c)+1)-1,L&=R&~(te&~xe),L=L&201326741?L&201326741|1:L?L|2:0}L!==0&&(b=!0,ut(w,L))}else L=Vn,L=Te(w,w===kn?L:0,w.cancelPendingCommit!==null||w.timeoutHandle!==-1),(L&3)===0||st(w,L)||(b=!0,ut(w,L));w=w.next}while(b);Tt=!1}}function On(){zs()}function zs(){pt=Ue=!1;var c=0;Lt!==0&&QG()&&(c=Lt);for(var f=mt(),b=null,w=W;w!==null;){var R=w.next,L=jf(w,f);L===0?(w.next=null,b===null?W=R:b.next=R,R===null&&(fe=b)):(b=w,(c!==0||(L&3)!==0)&&(pt=!0)),w=R}Ur!==0&&Ur!==5||Kt(c),Lt!==0&&(Lt=0)}function jf(c,f){for(var b=c.suspendedLanes,w=c.pingedLanes,R=c.expirationTimes,L=c.pendingLanes&-62914561;0<L;){var te=31-ie(L),xe=1<<te,Oe=R[te];Oe===-1?((xe&b)===0||(xe&w)!==0)&&(R[te]=et(xe,f)):Oe<=f&&(c.expiredLanes|=xe),L&=~xe}if(f=kn,b=Vn,b=Te(c,c===f?b:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),w=c.callbackNode,b===0||c===f&&(dr===2||dr===9)||c.cancelPendingCommit!==null)return w!==null&&w!==null&&Ge(w),c.callbackNode=null,c.callbackPriority=0;if((b&3)===0||st(c,b)){if(f=b&-b,f===c.callbackPriority)return f;switch(w!==null&&Ge(w),Sn(b)){case 2:case 8:b=Y;break;case 32:b=je;break;case 268435456:b=Ve;break;default:b=je}return w=uu.bind(null,c),b=qe(b,w),c.callbackPriority=f,c.callbackNode=b,f}return w!==null&&w!==null&&Ge(w),c.callbackPriority=2,c.callbackNode=null,2}function uu(c,f){if(Ur!==0&&Ur!==5)return c.callbackNode=null,c.callbackPriority=0,null;var b=c.callbackNode;if(Ef()&&c.callbackNode!==b)return null;var w=Vn;return w=Te(c,c===kn?w:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),w===0?null:(tr(c,w,f),jf(c,mt()),c.callbackNode!=null&&c.callbackNode===b?uu.bind(null,c):null)}function ut(c,f){if(Ef())return null;tr(c,f,!0)}function nt(){JG(function(){(dn&6)!==0?qe(ge,On):zs()})}function ht(){if(Lt===0){var c=ec;c===0&&(c=pe,pe<<=1,(pe&261888)===0&&(pe=256)),Lt=c}return Lt}function Bt(c){return c==null||typeof c=="symbol"||typeof c=="boolean"?null:typeof c=="function"?c:Cs(""+c)}function xn(c,f){var b=f.ownerDocument.createElement("input");return b.name=f.name,b.value=f.value,c.id&&b.setAttribute("form",c.id),f.parentNode.insertBefore(b,f),c=new FormData(c),b.parentNode.removeChild(b),c}function Ms(c,f,b,w,R){if(f==="submit"&&b&&b.stateNode===R){var L=Bt((R[jr]||null).action),te=w.submitter;te&&(f=(f=te[jr]||null)?Bt(f.formAction):te.getAttribute("formAction"),f!==null&&(L=f,te=null));var xe=new ql("action","action",null,w,R);c.push({event:xe,listeners:[{instance:null,listener:function(){if(w.defaultPrevented){if(Lt!==0){var Oe=te?xn(R,te):new FormData(R);tb(b,{pending:!0,data:Oe,method:R.method,action:L},null,Oe)}}else typeof L=="function"&&(xe.preventDefault(),Oe=te?xn(R,te):new FormData(R),tb(b,{pending:!0,data:Oe,method:R.method,action:L},L,Oe))},currentTarget:R}]})}}for(var vn=0;vn<Fh.length;vn++){var pr=Fh[vn],_i=pr.toLowerCase(),Sr=pr[0].toUpperCase()+pr.slice(1);ho(_i,"on"+Sr)}ho(Up,"onAnimationEnd"),ho(Oh,"onAnimationIteration"),ho(N0,"onAnimationStart"),ho("dblclick","onDoubleClick"),ho("focusin","onFocus"),ho("focusout","onBlur"),ho(e1,"onTransitionRun"),ho(yA,"onTransitionStart"),ho(t1,"onTransitionCancel"),ho(A0,"onTransitionEnd"),rt("onMouseEnter",["mouseout","mouseover"]),rt("onMouseLeave",["mouseout","mouseover"]),rt("onPointerEnter",["pointerout","pointerover"]),rt("onPointerLeave",["pointerout","pointerover"]),He("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),He("onSelect","focusout contextmenu dragend focu
8sin keydown keyup mousedown mouseup selectionchange".split(" ")),He("onBeforeInput",["compositionend","keypress","textInput","paste"]),He("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),He("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),He("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),EA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Eo));function tP(c,f){f=(f&4)!==0;for(var b=0;b<c.length;b++){var w=c[b],R=w.event;w=w.listeners;e:{var L=void 0;if(f)for(var te=w.length-1;0<=te;te--){var xe=w[te],Oe=xe.instance,ct=xe.currentTarget;if(xe=xe.listener,Oe!==L&&R.isPropagationStopped())break e;L=xe,R.currentTarget=ct;try{L(R)}catch(St){Uh(St)}R.currentTarget=null,L=Oe}else for(te=0;te<w.length;te++){if(xe=w[te],Oe=xe.instance,ct=xe.currentTarget,xe=xe.listener,Oe!==L&&R.isPropagationStopped())break e;L=xe,R.currentTarget=ct;try{L(R)}catch(St){Uh(St)}R.currentTarget=null,L=Oe}}}}function fr(c,f){var b=f[Tr];b===void 0&&(b=f[Tr]=new Set);var w=c+"__bubble";b.has(w)||(nP(f,c,2,!1),b.add(w))}function jA(c,f,b){var w=0;f&&(w|=4),nP(b,c,w,f)}var K1="_reactListening"+Math.random().toString(36).slice(2);function TA(c){if(!c[K1]){c[K1]=!0,ks.forEach(function(b){b!=="selectionchange"&&(EA.has(b)||jA(b,!1,c),jA(b,!0,c))});var f=c.nodeType===9?c:c.ownerDocument;f===null||f[K1]||(f[K1]=!0,jA("selectionchange",!1,f))}}function nP(c,f,b,w){switch(RP(f)){case 2:var R=bH;break;case 8:R=yH;break;default:R=WA}b=R.bind(null,f,b,c),R=void 0,!It||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(R=!0),w?R!==void 0?c.addEventListener(f,b,{capture:!0,passive:R}):c.addEventListener(f,b,!0):R!==void 0?c.addEventListener(f,b,{passive:R}):c.addEventListener(f,b,!1)}function RA(c,f,b,w,R){var L=w;if((f&1)===0&&(f&2)===0&&w!==null)e:for(;;){if(w===null)return;var te=w.tag;if(te===3||te===4){var xe=w.stateNode.containerInfo;if(xe===R)break;if(te===4)for(te=w.return;te!==null;){var Oe=te.tag;if((Oe===3||Oe===4)&&te.stateNode.containerInfo===R)return;te=te.return}for(;xe!==null;){if(te=xi(xe),te===null)return;if(Oe=te.tag,Oe===5||Oe===6||Oe===26||Oe===27){w=L=te;continue e}xe=xe.parentNode}}w=w.return}Is(function(){var ct=L,St=Bo(b),jt=[];e:{var dt=fo.get(c);if(dt!==void 0){var gt=ql,on=c;switch(c){case"keypress":if(kc(b)===0)break e;case"keydown":case"keyup":gt=Vu;break;case"focusin":on="focus",gt=Kd;break;case"focusout":on="blur",gt=Kd;break;case"beforeblur":case"afterblur":gt=Kd;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":gt=Ph;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":gt=Hu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":gt=Uv;break;case Up:case Oh:case N0:gt=Ba;break;case A0:gt=bA;break;case"scroll":case"scrollend":gt=Bc;break;case"wheel":gt=Gv;break;case"copy":case"cut":case"paste":gt=Oo;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":gt=d0;break;case"toggle":case"beforetoggle":gt=Vv}var Mn=(f&4)!==0,Zr=!Mn&&(c==="scroll"||c==="scrollend"),tt=Mn?dt!==null?dt+"Capture":null:dt;Mn=[];for(var $e=ct,lt;$e!==null;){var Nt=$e;if(lt=Nt.stateNode,Nt=Nt.tag,Nt!==5&&Nt!==26&&Nt!==27||lt===null||tt===null||(Nt=lo($e,tt),Nt!=null&&Mn.push(vb($e,Nt,lt))),Zr)break;$e=$e.return}0<Mn.length&&(dt=new gt(dt,on,null,b,St),jt.push({event:dt,listeners:Mn}))}}if((f&7)===0){e:{if(dt=c==="mouseover"||c==="pointerover",gt=c==="mouseout"||c==="pointerout",dt&&b!==pa&&(on=b.relatedTarget||b.fromElement)&&(xi(on)||on[es]))break e;if((gt||dt)&&(dt=St.window===St?St:(dt=St.ownerDocument)?dt.defaultView||dt.parentWindow:window,gt?(on=b.relatedTarget||b.toElement,gt=ct,on=on?xi(on):null,on!==null&&(Zr=a(on),Mn=on.tag,on!==Zr||Mn!==5&&Mn!==27&&Mn!==6)&&(on=null)):(gt=null,on=ct),gt!==on)){if(Mn=Ph,Nt="onMouseLeave",tt="onMouseEnter",$e="mou
8se",(c==="pointerout"||c==="pointerover")&&(Mn=d0,Nt="onPointerLeave",tt="onPointerEnter",$e="pointer"),Zr=gt==null?dt:Vs(gt),lt=on==null?dt:Vs(on),dt=new Mn(Nt,$e+"leave",gt,b,St),dt.target=Zr,dt.relatedTarget=lt,Nt=null,xi(St)===ct&&(Mn=new Mn(tt,$e+"enter",on,b,St),Mn.target=lt,Mn.relatedTarget=Zr,Nt=Mn),Zr=Nt,gt&&on)t:{for(Mn=WG,tt=gt,$e=on,lt=0,Nt=tt;Nt;Nt=Mn(Nt))lt++;Nt=0;for(var gn=$e;gn;gn=Mn(gn))Nt++;for(;0<lt-Nt;)tt=Mn(tt),lt--;for(;0<Nt-lt;)$e=Mn($e),Nt--;for(;lt--;){if(tt===$e||$e!==null&&tt===$e.alternate){Mn=tt;break t}tt=Mn(tt),$e=Mn($e)}Mn=null}else Mn=null;gt!==null&&rP(jt,dt,gt,Mn,!1),on!==null&&Zr!==null&&rP(jt,Zr,on,Mn,!0)}}e:{if(dt=ct?Vs(ct):window,gt=dt.nodeName&&dt.nodeName.toLowerCase(),gt==="select"||gt==="input"&&dt.type==="file")var Pr=b0;else if(x0(dt))if(cl)Pr=Kv;else{Pr=w0;var un=Yv}else gt=dt.nodeName,!gt||gt.toLowerCase()!=="input"||dt.type!=="checkbox"&&dt.type!=="radio"?ct&&In(ct.elementType)&&(Pr=b0):Pr=Qv;if(Pr&&(Pr=Pr(c,ct))){Op(jt,Pr,b,St);break e}un&&un(c,dt,ct),c==="focusout"&&ct&&dt.type==="number"&&ct.memoizedProps.value!=null&&mn(dt,"number",dt.value)}switch(un=ct?Vs(ct):window,c){case"focusin":(x0(un)||un.contentEditable==="true")&&(ul=un,dl=ct,nf=null);break;case"focusout":nf=dl=ul=null;break;case"mousedown":Fp=!0;break;case"contextmenu":case"mouseup":case"dragend":Fp=!1,rf(jt,b,St);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":rf(jt,b,St)}var Kn;if(Wu)e:{switch(c){case"compositionstart":var gr="onCompositionStart";break e;case"compositionend":gr="onCompositionEnd";break e;case"compositionupdate":gr="onCompositionUpdate";break e}gr=void 0}else $u?Lp(c,b)&&(gr="onCompositionEnd"):c==="keydown"&&b.keyCode===229&&(gr="onCompositionStart");gr&&(h0&&b.locale!=="ko"&&($u||gr!=="onCompositionStart"?gr==="onCompositionEnd"&&$u&&(Kn=Hr()):(ln=St,Un="value"in ln?ln.value:ln.textContent,$u=!0)),un=J1(ct,gr),0<un.length&&(gr=new Pp(gr,c,null,b,St),jt.push({event:gr,listeners:un}),Kn?gr.data=Kn:(Kn=m0(b),Kn!==null&&(gr.data=Kn)))),(Kn=Bp?Xv(c,b):p0(c,b))&&(gr=J1(ct,"onBeforeInput"),0<gr.length&&(un=new Pp("onBeforeInput","beforeinput",null,b,St),jt.push({event:un,listeners:gr}),un.data=Kn)),Ms(jt,c,ct,b,St)}tP(jt,f)})}function vb(c,f,b){return{instance:c,listener:f,currentTarget:b}}function J1(c,f){for(var b=f+"Capture",w=[];c!==null;){var R=c,L=R.stateNode;if(R=R.tag,R!==5&&R!==26&&R!==27||L===null||(R=lo(c,b),R!=null&&w.unshift(vb(c,R,L)),R=lo(c,f),R!=null&&w.push(vb(c,R,L))),c.tag===3)return w;c=c.return}return[]}function WG(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5&&c.tag!==27);return c||null}function rP(c,f,b,w,R){for(var L=f._reactName,te=[];b!==null&&b!==w;){var xe=b,Oe=xe.alternate,ct=xe.stateNode;if(xe=xe.tag,Oe!==null&&Oe===w)break;xe!==5&&xe!==26&&xe!==27||ct===null||(Oe=ct,R?(ct=lo(b,L),ct!=null&&te.unshift(vb(b,ct,Oe))):R||(ct=lo(b,L),ct!=null&&te.push(vb(b,ct,Oe)))),b=b.return}te.length!==0&&c.push({event:f,listeners:te})}var $G=/\r\n?/g,XG=/\u0000|\uFFFD/g;function sP(c){return(typeof c=="string"?c:""+c).replace($G,`
9`).replace(XG,"")}function iP(c,f){return f=sP(f),sP(c)===f}function Jr(c,f,b,w,R,L){switch(b){case"children":typeof w=="string"?f==="body"||f==="textarea"&&w===""||As(c,w):(typeof w=="number"||typeof w=="bigint")&&f!=="body"&&As(c,""+w);break;case"className":_t(c,"class",w);break;case"tabIndex":_t(c,"tabindex",w);break;case"dir":case"role":case"viewBox":case"width":case"height":_t(c,b,w);break;case"style":Dn(c,w,L);break;case"data":if(f!=="object"){_t(c,"data",w);break}case"src":case"href":if(w===""&&(f!=="a"||b!=="href")){c.removeAttribute(b);break}if(w==null||typeof w=="function"||typeof w=="symbol"||typeof w=="boolean"){c.removeAttribute(b);break}w=Cs(""+w),c.setAttribute(b,w);break;case"action":case"formAction":if(typeof w=="function"){c.setAttribute(b,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof L=="function"&&(b==="formAction"?(f!=="input"&&Jr(c,f,"name",R.name,R,null),Jr(c,f,"formEncType",R.formEncType,R,null),Jr(c,f,"formMethod",R.formMethod,R,null),Jr(c,f,"formTarget",R.formTarget,R,null)):(Jr(c,f,"encType",R.encType,R,null),Jr(c,f,"method",R.method,R,null),Jr(c,f,"target",R.target,R,null)));if(w==null||typeof w=="symbol"||typeof w=="boolean"){c.removeAttribute(b);break}w=Cs(""+w),c.setAttribute(b,w);break;case"onClick":w!=null&&(c.onclick=ts);break;case"onScroll":w!=null&&fr("scroll",c);break;case"onScrollEnd":w!=null&&fr("scrollend",c);break;case"dangerouslySetInnerHTML":if(w!=null){if(typeof w!="object"||!("__html"in w))throw Error(r(61));if(b=w.__html,b!=null){if(R.children!=null)throw Error(r(60));c.innerHTML=b}}break;case"multiple":c.multiple=w&&typeof w!="function"&&typeof w!="symbol";break;case"muted":c.muted=w&&typeof w!="function"&&typeof w!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(w==null||typeof w=="function"||typeof w=="boolean"||typeof w=="symbol"){c.removeAttribute("xlink:href");break}b=Cs(""+w),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":w!=null&&typeof w!="function"&&typeof w!="symbol"?c.setAttribute(b,""+w):c.removeAttribute(b);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
9ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":w&&typeof w!="function"&&typeof w!="symbol"?c.setAttribute(b,""):c.removeAttribute(b);break;case"capture":case"download":w===!0?c.setAttribute(b,""):w!==!1&&w!=null&&typeof w!="function"&&typeof w!="symbol"?c.setAttribute(b,w):c.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":w!=null&&typeof w!="function"&&typeof w!="symbol"&&!isNaN(w)&&1<=w?c.setAttribute(b,w):c.removeAttribute(b);break;case"rowSpan":case"start":w==null||typeof w=="function"||typeof w=="symbol"||isNaN(w)?c.removeAttribute(b):c.setAttribute(b,w);break;case"popover":fr("beforetoggle",c),fr("toggle",c),Pt(c,"popover",w);break;case"xlinkActuate":kt(c,"http://www.w3.org/1999/xlink","xlink:actuate",w);break;case"xlinkArcrole":kt(c,"http://www.w3.org/1999/xlink","xlink:arcrole",w);break;case"xlinkRole":kt(c,"http://www.w3.org/1999/xlink","xlink:role",w);break;case"xlinkShow":kt(c,"http://www.w3.org/1999/xlink","xlink:show",w);break;case"xlinkTitle":kt(c,"http://www.w3.org/1999/xlink","xlink:title",w);break;case"xlinkType":kt(c,"http://www.w3.org/1999/xlink","xlink:type",w);break;case"xmlBase":kt(c,"http://www.w3.org/XML/1998/namespace","xml:base",w);break;case"xmlLang":kt(c,"http://www.w3.org/XML/1998/namespace","xml:lang",w);break;case"xmlSpace":kt(c,"http://www.w3.org/XML/1998/namespace","xml:space",w);break;case"is":Pt(c,"is",w);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=xs.get(b)||b,Pt(c,b,w))}}function PA(c,f,b,w,R,L){switch(b){case"style":Dn(c,w,L);break;case"dangerouslySetInnerHTML":if(w!=null){if(typeof w!="object"||!("__html"in w))throw Error(r(61));if(b=w.__html,b!=null){if(R.children!=null)throw Error(r(60));c.innerHTML=b}}break;case"children":typeof w=="string"?As(c,w):(typeof w=="number"||typeof w=="bigint")&&As(c,""+w);break;case"onScroll":w!=null&&fr("scroll",c);break;case"onScrollEnd":w!=null&&fr("scrollend",c);break;case"onClick":w!=null&&(c.onclick=ts);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!de.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(R=b.endsWith("Capture"),f=b.slice(2,R?b.length-7:void 0),L=c[jr]||null,L=L!=null?L[b]:null,typeof L=="function"&&c.removeEventListener(f,L,R),typeof w=="function")){typeof L!="function"&&L!==null&&(b in c?c[b]=null:c.hasAttribute(b)&&c.removeAttribute(b)),c.addEventListener(f,w,R);break e}b in c?c[b]=w:w===!0?c.setAttribute(b,""):Pt(c,b,w)}}}function oa(c,f,b){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":fr("error",c),fr("load",c);var w=!1,R=!1,L;for(L in b)if(b.hasOwnProperty(L)){var te=b[L];if(te!=null)switch(L){case"src":w=!0;break;case"srcSet":R=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:Jr(c,f,L,te,b,null)}}R&&Jr(c,f,"srcSet",b.srcSet,b,null),w&&Jr(c,f,"src",b.src,b,null);return;case"input":fr("invalid",c);var xe=L=te=R=null,Oe=null,ct=null;for(w in b)if(b.hasOwnProperty(w)){var St=b[w];if(St!=null)switch(w){case"name":R=St;break;case"type":te=St;break;case"checked":Oe=St;break;case"defaultChecked":ct=St;break;case"value":L=St;break;case"defaultValue":xe=St;break;case"children":case"dangerouslySetInnerHTML":if(St!=null)throw Error(r(137,f));break;default:Jr(c,f,w,St,b,null)}}Rr(c,L,xe,Oe,ct,te,R,!1);return;case"select":fr("invalid",c),w=te=L=null;for(R in b)if(b.hasOwnProperty(R)&&(xe=b[R],xe!=null))switch(R){case"value":L=xe;break;case"defaultValue":te=xe;break;case"multiple":w=xe;default:Jr(c,f,R,xe,b,null)}f=L,b=te,c.multiple=!!w,f!=null?Or(c,!!w,f,!1):b!=null&&Or(c,!!w,b,!0);return;case"textarea":fr("invalid",c),L=R=w=null;for(te in b)if(b.hasOwnProperty(te)&&(xe=b[te],xe!=null))switch(te){case"value":w=xe;break;case"defaultValue":R=xe;break;case"children":L=xe;break;case"dangerouslySetInnerHTML":if(xe!=null)throw Error(r(91));break;default:Jr(c,f,te,xe,b,null)}gs(c,w,R,L);return;case"option":for(Oe in b)b.hasOwnProperty(Oe)&&(w=b[Oe],w!=null)&&(Oe==="selected"?c.selected=w&&typeof w!="function"&&typeof w!="symbol":Jr(c,f,Oe,w,b,null));return;case"dialog":fr("beforetoggle",c),fr("toggle",c),fr("cancel",c),fr("close",c);break;case"iframe":case"object":fr("load",c);break;case"video":case"audio":for(w=0;w<Eo.length;w++)fr(Eo[w],c);break;case"image":fr("error",c),fr("load",c);break;case"details":fr("toggle",c);break;case"embed":case"source":case"link":fr("error",c),fr("load",c);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ct in b)if(b.hasOwnProperty(ct)&&(w=b[ct],w!=null))switch(ct){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));
vendor: 8,256 bytes, line 9
9default:Jr(c,f,ct,w,b,null)}return;default:if(In(f)){for(St in b)b.hasOwnProperty(St)&&(w=b[St],w!==void 0&&PA(c,f,St,w,b,void 0));return}}for(xe in b)b.hasOwnProperty(xe)&&(w=b[xe],w!=null&&Jr(c,f,xe,w,b,null))}function qG(c,f,b,w){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var R=null,L=null,te=null,xe=null,Oe=null,ct=null,St=null;for(gt in b){var jt=b[gt];if(b.hasOwnProperty(gt)&&jt!=null)switch(gt){case"checked":break;case"value":break;case"defaultValue":Oe=jt;default:w.hasOwnProperty(gt)||Jr(c,f,gt,null,w,jt)}}for(var dt in w){var gt=w[dt];if(jt=b[dt],w.hasOwnProperty(dt)&&(gt!=null||jt!=null))switch(dt){case"type":L=gt;break;case"name":R=gt;break;case"checked":ct=gt;break;case"defaultChecked":St=gt;break;case"value":te=gt;break;case"defaultValue":xe=gt;break;case"children":case"dangerouslySetInnerHTML":if(gt!=null)throw Error(r(137,f));break;default:gt!==jt&&Jr(c,f,dt,gt,w,jt)}}Gt(c,te,xe,Oe,ct,St,L,R);return;case"select":gt=te=xe=dt=null;for(L in b)if(Oe=b[L],b.hasOwnProperty(L)&&Oe!=null)switch(L){case"value":break;case"multiple":gt=Oe;default:w.hasOwnProperty(L)||Jr(c,f,L,null,w,Oe)}for(R in w)if(L=w[R],Oe=b[R],w.hasOwnProperty(R)&&(L!=null||Oe!=null))switch(R){case"value":dt=L;break;case"defaultValue":xe=L;break;case"multiple":te=L;default:L!==Oe&&Jr(c,f,R,L,w,Oe)}f=xe,b=te,w=gt,dt!=null?Or(c,!!b,dt,!1):!!w!=!!b&&(f!=null?Or(c,!!b,f,!0):Or(c,!!b,b?[]:"",!1));return;case"textarea":gt=dt=null;for(xe in b)if(R=b[xe],b.hasOwnProperty(xe)&&R!=null&&!w.hasOwnProperty(xe))switch(xe){case"value":break;case"children":break;default:Jr(c,f,xe,null,w,R)}for(te in w)if(R=w[te],L=b[te],w.hasOwnProperty(te)&&(R!=null||L!=null))switch(te){case"value":dt=R;break;case"defaultValue":gt=R;break;case"children":break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(r(91));break;default:R!==L&&Jr(c,f,te,R,w,L)}os(c,dt,gt);return;case"option":for(var on in b)dt=b[on],b.hasOwnProperty(on)&&dt!=null&&!w.hasOwnProperty(on)&&(on==="selected"?c.selected=!1:Jr(c,f,on,null,w,dt));for(Oe in w)dt=w[Oe],gt=b[Oe],w.hasOwnProperty(Oe)&&dt!==gt&&(dt!=null||gt!=null)&&(Oe==="selected"?c.selected=dt&&typeof dt!="function"&&typeof dt!="symbol":Jr(c,f,Oe,dt,w,gt));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Mn in b)dt=b[Mn],b.hasOwnProperty(Mn)&&dt!=null&&!w.hasOwnProperty(Mn)&&Jr(c,f,Mn,null,w,dt);for(ct in w)if(dt=w[ct],gt=b[ct],w.hasOwnProperty(ct)&&dt!==gt&&(dt!=null||gt!=null))switch(ct){case"children":case"dangerouslySetInnerHTML":if(dt!=null)throw Error(r(137,f));break;default:Jr(c,f,ct,dt,w,gt)}return;default:if(In(f)){for(var Zr in b)dt=b[Zr],b.hasOwnProperty(Zr)&&dt!==void 0&&!w.hasOwnProperty(Zr)&&PA(c,f,Zr,void 0,w,dt);for(St in w)dt=w[St],gt=b[St],!w.hasOwnProperty(St)||dt===gt||dt===void 0&&gt===void 0||PA(c,f,St,dt,w,gt);return}}for(var tt in b)dt=b[tt],b.hasOwnProperty(tt)&&dt!=null&&!w.hasOwnProperty(tt)&&Jr(c,f,tt,null,w,dt);for(jt in w)dt=w[jt],gt=b[jt],!w.hasOwnProperty(jt)||dt===gt||dt==null&&gt==null||Jr(c,f,jt,dt,w,gt)}function aP(c){switch(c){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function YG(){if(typeof performance.getEntriesByType=="function"){for(var c=0,f=0,b=performance.getEntriesByType("resource"),w=0;w<b.length;w++){var R=b[w],L=R.transferSize,te=R.initiatorType,xe=R.duration;if(L&&xe&&aP(te)){for(te=0,xe=R.responseEnd,w+=1;w<b.length;w++){var Oe=b[w],ct=Oe.startTime;if(ct>xe)break;var St=Oe.transferSize,jt=Oe.initiatorType;St&&aP(jt)&&(Oe=Oe.responseEnd,te+=St*(Oe<xe?1:(xe-ct)/(Oe-ct)))}if(--w,f+=8*(L+te)/(R.duration/1e3),c++,10<c)break}}if(0<c)return f/c/1e6}return navigator.connection&&(c=navigator.connection.downlink,typeof c=="number")?c:5}var DA=null,kA=null;function Z1(c){return c.nodeType===9?c:c.ownerDocument}function oP(c){switch(c){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lP(c,f){if(c===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return c===1&&f==="foreignObject"?0:c}function IA(c,f){return c==="textarea"||c==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var BA=null;function QG(){var c=window.event;return c&&c.type==="popstate"?c===BA?!1:(BA=c,!0):(BA=null,!1)}var cP=typeof setTimeout=="function"?setTimeout:void 0,KG=typeof clearTimeout=="function"?clearTimeout:void 0,uP=typeof Promise=="function"?Promise:void 0,JG=typeof queueMicrotask=="function"?queueMicrotask:typeof uP<"u"?function(c){return uP.resolve(null).then(c).catch(ZG)}:cP;function ZG(c){setTimeout(function(){throw c})}function Tf(c){return c==="head"}function dP(c,f){var b=f,w=0;do{var R=b.nextSibling;if(c.removeChild(b),R&&R.nodeType===8)if(b=R.data,b==="/$"||b==="/&"){if(w===0){c.removeChild(R),Rg(f);return}w--}else if(b==="$"||b==="$?"||b==="$~"||b==="$!"||b==="&")w++;else if(b==="html")wb(c.ownerDocument.documentElement);else if(b==="head"){b=c.ownerDocument.head,wb(b);for(var L=b.firstChild;L;){var te=L.nextSibling,xe=L.nodeName;L[Xr]||xe==="SCRIPT"||xe==="STYLE"||xe==="LINK"&&L.rel.toLowerCase()==="stylesheet"||b.removeChild(L),L=te}}else b==="body"&&wb(c.ownerDocument.body);b=R}while(b);Rg(f)}function fP(c,f){var b=c;c=0;do{var w=b.nextSibling;if(b.nodeType===1?f?(b._stashedDisplay=b.style.display,b.style.display="none"):(b.style.display=b._stashedDisplay||"",b.getAttribute("style")===""&&b.removeAttribute("style")):b.nodeType===3&&(f?(b._stashedText=b.nodeValue,b.nodeValue=""):b.nodeValue=b._stashedText||""),w&&w.nodeType===8)if(b=w.data,b==="/$"){if(c===0)break;c--}else b!=="$"&&b!=="$?"&&b!=="$~"&&b!=="$!"||c++;b=w}while(b)}function LA(c){var f=c.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var b=f;switch(f=f.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":LA(b),ps(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}c.removeChild(b)}}function eH(c,f,b,w){for(;c.nodeType===1;){var R=b;if(c.nodeName.toLowerCase()!==f.toLowerCase()){if(!w&&(c.nodeName!=="INPUT"||c.type!=="hidden"))break}else if(w){if(!c[Xr])switch(f){case"meta":if(!c.hasAttribute("itemprop"))break;return c;case"link":if(L=c.getAttribute("rel"),L==="stylesheet"&&c.hasAttribute("data-precedence"))break;if(L!==R.rel||c.getAttribute("href")!==(R.href==null||R.href===""?null:R.href)||c.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin)||c.getAttribute("title")!==(R.title==null?null:R.title))break;return c;case"style":if(c.hasAttribute("data-precedence"))break;return c;case"script":if(L=c.getAttribute("src"),(L!==(R.src==null?null:R.src)||c.getAttribute("type")!==(R.type==null?null:R.type)||c.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin))&&L&&c.hasAttribute("async")&&!c.hasAttribute("itemprop"))break;return c;default:return c}}else if(f==="input"&&c.type==="hidden"){var L=R.name==null?null:""+R.name;if(R.type==="hidden"&&c.getAttribute("name")===L)return c}else return c;if(c=Tl(c.nextSibling),c===null)break}return null}function tH(c,f,b){if(f==="")return null;for(;c.nodeType!==3;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!b||(c=Tl(c.nextSibling),c===null))return null;return c}function hP(c,f){for(;c.nodeType!==8;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!f||(c=Tl(c.nextSibling),c===null))return null;return c}function OA(c){return c.data==="$?"||c.data==="$~"}function FA(c){return c.data==="$!"||c.data==="$?"&&c.ownerDocument.readyState!=="loading"}function nH(c,f){var b=c.ownerDocument;if(c.data==="$~")c._reactRetry=f;else if(c.data!=="$?"||b.readyState!=="loading")f();else{var w=function(){f(),b.removeEventListener("DOMContentLoaded",w)};b.addEventListener("DOMContentLoaded",w),c._reactRetry=w}}function Tl(c){for(;c!=null;c=c.nextSibling){var f=c.nodeType;if(f===1||f===3)break;if(f===8){if(f=c.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;
vendor: 5,096 bytes, line 9
9if(f==="/$"||f==="/&")return null}}return c}var UA=null;function mP(c){c=c.nextSibling;for(var f=0;c;){if(c.nodeType===8){var b=c.data;if(b==="/$"||b==="/&"){if(f===0)return Tl(c.nextSibling);f--}else b!=="$"&&b!=="$!"&&b!=="$?"&&b!=="$~"&&b!=="&"||f++}c=c.nextSibling}return null}function pP(c){c=c.previousSibling;for(var f=0;c;){if(c.nodeType===8){var b=c.data;if(b==="$"||b==="$!"||b==="$?"||b==="$~"||b==="&"){if(f===0)return c;f--}else b!=="/$"&&b!=="/&"||f++}c=c.previousSibling}return null}function gP(c,f,b){switch(f=Z1(b),c){case"html":if(c=f.documentElement,!c)throw Error(r(452));return c;case"head":if(c=f.head,!c)throw Error(r(453));return c;case"body":if(c=f.body,!c)throw Error(r(454));return c;default:throw Error(r(451))}}function wb(c){for(var f=c.attributes;f.length;)c.removeAttributeNode(f[0]);ps(c)}var Rl=new Map,xP=new Set;function ew(c){return typeof c.getRootNode=="function"?c.getRootNode():c.nodeType===9?c:c.ownerDocument}var gd=K.d;K.d={f:rH,r:sH,D:iH,C:aH,L:oH,m:lH,X:uH,S:cH,M:dH};function rH(){var c=gd.f(),f=Ho();return c||f}function sH(c){var f=Ds(c);f!==null&&f.tag===5&&f.type==="form"?B1(f):gd.r(c)}var Eg=typeof document>"u"?null:document;function bP(c,f,b){var w=Eg;if(w&&typeof f=="string"&&f){var R=_n(f);R='link[rel="'+c+'"][href="'+R+'"]',typeof b=="string"&&(R+='[crossorigin="'+b+'"]'),xP.has(R)||(xP.add(R),c={rel:c,crossOrigin:b,href:f},w.querySelector(R)===null&&(f=w.createElement("link"),oa(f,"link",c),or(f),w.head.appendChild(f)))}}function iH(c){gd.D(c),bP("dns-prefetch",c,null)}function aH(c,f){gd.C(c,f),bP("preconnect",c,f)}function oH(c,f,b){gd.L(c,f,b);var w=Eg;if(w&&c&&f){var R='link[rel="preload"][as="'+_n(f)+'"]';f==="image"&&b&&b.imageSrcSet?(R+='[imagesrcset="'+_n(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(R+='[imagesizes="'+_n(b.imageSizes)+'"]')):R+='[href="'+_n(c)+'"]';var L=R;switch(f){case"style":L=jg(c);break;case"script":L=Tg(c)}Rl.has(L)||(c=p({rel:"preload",href:f==="image"&&b&&b.imageSrcSet?void 0:c,as:f},b),Rl.set(L,c),w.querySelector(R)!==null||f==="style"&&w.querySelector(Sb(L))||f==="script"&&w.querySelector(_b(L))||(f=w.createElement("link"),oa(f,"link",c),or(f),w.head.appendChild(f)))}}function lH(c,f){gd.m(c,f);var b=Eg;if(b&&c){var w=f&&typeof f.as=="string"?f.as:"script",R='link[rel="modulepreload"][as="'+_n(w)+'"][href="'+_n(c)+'"]',L=R;switch(w){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":L=Tg(c)}if(!Rl.has(L)&&(c=p({rel:"modulepreload",href:c},f),Rl.set(L,c),b.querySelector(R)===null)){switch(w){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(_b(L)))return}w=b.createElement("link"),oa(w,"link",c),or(w),b.head.appendChild(w)}}}function cH(c,f,b){gd.S(c,f,b);var w=Eg;if(w&&c){var R=Yt(w).hoistableStyles,L=jg(c);f=f||"default";var te=R.get(L);if(!te){var xe={loading:0,preload:null};if(te=w.querySelector(Sb(L)))xe.loading=5;else{c=p({rel:"stylesheet",href:c,"data-precedence":f},b),(b=Rl.get(L))&&zA(c,b);var Oe=te=w.createElement("link");or(Oe),oa(Oe,"link",c),Oe._p=new Promise(function(ct,St){Oe.onload=ct,Oe.onerror=St}),Oe.addEventListener("load",function(){xe.loading|=1}),Oe.addEventListener("error",function(){xe.loading|=2}),xe.loading|=4,tw(te,f,w)}te={type:"stylesheet",instance:te,count:1,state:xe},R.set(L,te)}}}function uH(c,f){gd.X(c,f);var b=Eg;if(b&&c){var w=Yt(b).hoistableScripts,R=Tg(c),L=w.get(R);L||(L=b.querySelector(_b(R)),L||(c=p({src:c,async:!0},f),(f=Rl.get(R))&&GA(c,f),L=b.createElement("script"),or(L),oa(L,"link",c),b.head.appendChild(L)),L={type:"script",instance:L,count:1,state:null},w.set(R,L))}}function dH(c,f){gd.M(c,f);var b=Eg;if(b&&c){var w=Yt(b).hoistableScripts,R=Tg(c),L=w.get(R);L||(L=b.querySelector(_b(R)),L||(c=p({src:c,async:!0,type:"module"},f),(f=Rl.get(R))&&GA(c,f),L=b.createElement("script"),or(L),oa(L,"link",c),b.head.appendChild(L)),L={type:"script",instance:L,count:1,state:null},w.set(R,L))}}function yP(c,f,b,w){var R=(R=ne.current)?ew(R):null;if(!R)throw Error(r(446));switch(c){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(f=jg(b.href),b=Yt(R).hoistableStyles,w=b.get(f),w||(w={type:"style",instance:null,count:0,state:null},b.set(f,w)),w):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){c=jg(b.href);var L=Yt(R).hoistableStyles,te=L.get(c);if(te||(R=R.ownerDocument||R,te={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},L.set(c,te),(L=R.querySelector(Sb(c)))&&!L._p&&(te.instance=L,te.state.loading=5),Rl.has(c)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},Rl.set(c,b),L||fH(R,c,b,te.state))),f&&w===null)throw Error(r(528,""));return te}if(f&&w!==null)throw Error(r(529,""));return null;case"script":return f=b.async,b=b.src,typeof b=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?
vendor: 5,798 bytes, line 9
9(f=Tg(b),b=Yt(R).hoistableScripts,w=b.get(f),w||(w={type:"script",instance:null,count:0,state:null},b.set(f,w)),w):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,c))}}function jg(c){return'href="'+_n(c)+'"'}function Sb(c){return'link[rel="stylesheet"]['+c+"]"}function vP(c){return p({},c,{"data-precedence":c.precedence,precedence:null})}function fH(c,f,b,w){c.querySelector('link[rel="preload"][as="style"]['+f+"]")?w.loading=1:(f=c.createElement("link"),w.preload=f,f.addEventListener("load",function(){return w.loading|=1}),f.addEventListener("error",function(){return w.loading|=2}),oa(f,"link",b),or(f),c.head.appendChild(f))}function Tg(c){return'[src="'+_n(c)+'"]'}function _b(c){return"script[async]"+c}function wP(c,f,b){if(f.count++,f.instance===null)switch(f.type){case"style":var w=c.querySelector('style[data-href~="'+_n(b.href)+'"]');if(w)return f.instance=w,or(w),w;var R=p({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return w=(c.ownerDocument||c).createElement("style"),or(w),oa(w,"style",R),tw(w,b.precedence,c),f.instance=w;case"stylesheet":R=jg(b.href);var L=c.querySelector(Sb(R));if(L)return f.state.loading|=4,f.instance=L,or(L),L;w=vP(b),(R=Rl.get(R))&&zA(w,R),L=(c.ownerDocument||c).createElement("link"),or(L);var te=L;return te._p=new Promise(function(xe,Oe){te.onload=xe,te.onerror=Oe}),oa(L,"link",w),f.state.loading|=4,tw(L,b.precedence,c),f.instance=L;case"script":return L=Tg(b.src),(R=c.querySelector(_b(L)))?(f.instance=R,or(R),R):(w=b,(R=Rl.get(L))&&(w=p({},b),GA(w,R)),c=c.ownerDocument||c,R=c.createElement("script"),or(R),oa(R,"link",w),c.head.appendChild(R),f.instance=R);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(w=f.instance,f.state.loading|=4,tw(w,b.precedence,c));return f.instance}function tw(c,f,b){for(var w=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),R=w.length?w[w.length-1]:null,L=R,te=0;te<w.length;te++){var xe=w[te];if(xe.dataset.precedence===f)L=xe;else if(L!==R)break}L?L.parentNode.insertBefore(c,L.nextSibling):(f=b.nodeType===9?b.head:b,f.insertBefore(c,f.firstChild))}function zA(c,f){c.crossOrigin==null&&(c.crossOrigin=f.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=f.referrerPolicy),c.title==null&&(c.title=f.title)}function GA(c,f){c.crossOrigin==null&&(c.crossOrigin=f.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=f.referrerPolicy),c.integrity==null&&(c.integrity=f.integrity)}var nw=null;function SP(c,f,b){if(nw===null){var w=new Map,R=nw=new Map;R.set(b,w)}else R=nw,w=R.get(b),w||(w=new Map,R.set(b,w));if(w.has(c))return w;for(w.set(c,null),b=b.getElementsByTagName(c),R=0;R<b.length;R++){var L=b[R];if(!(L[Xr]||L[Wn]||c==="link"&&L.getAttribute("rel")==="stylesheet")&&L.namespaceURI!=="http://www.w3.org/2000/svg"){var te=L.getAttribute(f)||"";te=c+te;var xe=w.get(te);xe?xe.push(L):w.set(te,[L])}}return w}function _P(c,f,b){c=c.ownerDocument||c,c.head.insertBefore(b,f==="title"?c.querySelector("head > title"):null)}function hH(c,f,b){if(b===1||f.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;return f.rel==="stylesheet"?(c=f.disabled,typeof f.precedence=="string"&&c==null):!0;case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function MP(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function mH(c,f,b,w){if(b.type==="stylesheet"&&(typeof w.media!="string"||matchMedia(w.media).matches!==!1)&&(b.state.loading&4)===0){if(b.instance===null){var R=jg(w.href),L=f.querySelector(Sb(R));if(L){f=L._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(c.count++,c=rw.bind(c),f.then(c,c)),b.state.loading|=4,b.instance=L,or(L);return}L=f.ownerDocument||f,w=vP(w),(R=Rl.get(R))&&zA(w,R),L=L.createElement("link"),or(L);var te=L;te._p=new Promise(function(xe,Oe){te.onload=xe,te.onerror=Oe}),oa(L,"link",w),b.instance=L}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(b,f),(f=b.state.preload)&&(b.state.loading&3)===0&&(c.count++,b=rw.bind(c),f.addEventListener("load",b),f.addEventListener("error",b))}}var HA=0;function pH(c,f){return c.stylesheets&&c.count===0&&iw(c,c.stylesheets),0<c.count||0<c.imgCount?function(b){var w=setTimeout(function(){if(c.stylesheets&&iw(c,c.stylesheets),c.unsuspend){var L=c.unsuspend;c.unsuspend=null,L()}},6e4+f);0<c.imgBytes&&HA===0&&(HA=62500*YG());var R=setTimeout(function(){if(c.waitingForImages=!1,c.count===0&&(c.stylesheets&&iw(c,c.stylesheets),c.unsuspend)){var L=c.unsuspend;c.unsuspend=null,L()}},(c.imgBytes>HA?50:800)+f);return c.unsuspend=b,function(){c.unsuspend=null,clearTimeout(w),clearTimeout(R)}}:null}function rw(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)iw(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var sw=null;function iw(c,f){c.stylesheets=null,c.unsuspend!==null&&(c.count++,sw=new Map,f.forEach(gH,c),sw=null,rw.call(c))}function gH(c,f){if(!(f.state.loading&4)){var b=sw.get(c);if(b)var w=b.get(null);else{b=new Map,sw.set(c,b);for(var R=c.querySelectorAll("link[data-precedence],style[data-precedence]"),L=0;L<R.length;L++){var te=R[L];(te.nodeName==="LINK"||te.getAttribute("media")!=="not all")&&(b.set(te.dataset.precedence,te),w=te)}w&&b.set(null,w)}R=f.instance,te=R.getAttribute("data-precedence"),L=b.get(te)||w,L===w&&b.set(null,R),b.set(te,R),this.count++,w=rw.bind(this),R.addEventListener("load",
vendor: 9,395 bytes, line 9
9w),R.addEventListener("error",w),L?L.parentNode.insertBefore(R,L.nextSibling):(c=c.nodeType===9?c.head:c,c.insertBefore(R,c.firstChild)),f.state.loading|=4}}var Mb={$$typeof:E,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function xH(c,f,b,w,R,L,te,xe,Oe){this.tag=1,this.containerInfo=c,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mt(0),this.hiddenUpdates=Mt(null),this.identifierPrefix=w,this.onUncaughtError=R,this.onCaughtError=L,this.onRecoverableError=te,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Oe,this.incompleteTransitions=new Map}function NP(c,f,b,w,R,L,te,xe,Oe,ct,St,jt){return c=new xH(c,f,b,te,Oe,ct,St,jt,xe),f=1,L===!0&&(f|=24),L=bs(3,null,null,f),c.current=L,L.stateNode=c,f=E0(),f.refCount++,c.pooledCache=f,f.refCount++,L.memoizedState={element:w,isDehydrated:b,cache:f},Xh(L),c}function AP(c){return c?(c=zc,c):zc}function CP(c,f,b,w,R,L){R=AP(R),w.context===null?w.context=R:w.pendingContext=R,w=nc(f),w.payload={element:b},L=L===void 0?null:L,L!==null&&(w.callback=L),b=Yc(c,w,f),b!==null&&(qn(b,c,f),Qc(b,c,f))}function EP(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var b=c.retryLane;c.retryLane=b!==0&&b<f?b:f}}function VA(c,f){EP(c,f),(c=c.alternate)&&EP(c,f)}function jP(c){if(c.tag===13||c.tag===31){var f=ea(c,67108864);f!==null&&qn(f,c,67108864),VA(c,67108864)}}function TP(c){if(c.tag===13||c.tag===31){var f=Wa();f=an(f);var b=ea(c,f);b!==null&&qn(b,c,f),VA(c,f)}}var aw=!0;function bH(c,f,b,w){var R=z.T;z.T=null;var L=K.p;try{K.p=2,WA(c,f,b,w)}finally{K.p=L,z.T=R}}function yH(c,f,b,w){var R=z.T;z.T=null;var L=K.p;try{K.p=8,WA(c,f,b,w)}finally{K.p=L,z.T=R}}function WA(c,f,b,w){if(aw){var R=$A(w);if(R===null)RA(c,f,w,ow,b),PP(c,w);else if(wH(R,c,f,b,w))w.stopPropagation();else if(PP(c,w),f&4&&-1<vH.indexOf(c)){for(;R!==null;){var L=Ds(R);if(L!==null)switch(L.tag){case 3:if(L=L.stateNode,L.current.memoizedState.isDehydrated){var te=Ye(L.pendingLanes);if(te!==0){var xe=L;for(xe.pendingLanes|=2,xe.entangledLanes|=2;te;){var Oe=1<<31-ie(te);xe.entanglements[1]|=Oe,te&=~Oe}Dt(L),(dn&6)===0&&(Fs=mt()+500,Kt(0))}}break;case 31:case 13:xe=ea(L,2),xe!==null&&qn(xe,L,2),Ho(),VA(L,2)}if(L=$A(w),L===null&&RA(c,f,w,ow,b),L===R)break;R=L}R!==null&&w.stopPropagation()}else RA(c,f,w,null,b)}}function $A(c){return c=Bo(c),XA(c)}var ow=null;function XA(c){if(ow=null,c=xi(c),c!==null){var f=a(c);if(f===null)c=null;else{var b=f.tag;if(b===13){if(c=o(f),c!==null)return c;c=null}else if(b===31){if(c=l(f),c!==null)return c;c=null}else if(b===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;c=null}else f!==c&&(c=null)}}return ow=c,null}function RP(c){switch(c){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(xt()){case ge:return 2;case Y:return 8;case je:case Ie:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var qA=!1,Rf=null,Pf=null,Df=null,Nb=new Map,Ab=new Map,kf=[],vH="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function PP(c,f){switch(c){case"focusin":case"focusout":Rf=null;break;case"dragenter":case"dragleave":Pf=null;break;case"mouseover":case"mouseout":Df=null;break;case"pointerover":case"pointerout":Nb.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ab.delete(f.pointerId)}}function Cb(c,f,b,w,R,L){return c===null||c.nativeEvent!==L?(c={blockedOn:f,domEventName:b,eventSystemFlags:w,nativeEvent:L,targetContainers:[R]},f!==null&&(f=Ds(f),f!==null&&jP(f)),c):(c.eventSystemFlags|=w,f=c.targetContainers,R!==null&&f.indexOf(R)===-1&&f.push(R),c)}function wH(c,f,b,w,R){switch(f){case"focusin":return Rf=Cb(Rf,c,f,b,w,R),!0;case"dragenter":return Pf=Cb(Pf,c,f,b,w,R),!0;case"mouseover":return Df=Cb(Df,c,f,b,w,R),!0;case"pointerover":var L=R.pointerId;return Nb.set(L,Cb(Nb.get(L)||null,c,f,b,w,R)),!0;case"gotpointercapture":return L=R.pointerId,Ab.set(L,Cb(Ab.get(L)||null,c,f,b,w,R)),!0}return!1}function DP(c){var f=xi(c.target);if(f!==null){var b=a(f);if(b!==null){if(f=b.tag,f===13){if(f=o(b),f!==null){c.blockedOn=f,Gr(c.priority,function(){TP(b)});return}}else if(f===31){if(f=l(b),f!==null){c.blockedOn=f,Gr(c.priority,function(){TP(b)});return}}else if(f===3&&b.stateNode.current.memoizedState.isDehydrated){c.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}c.blockedOn=null}function lw(c){if(c.blockedOn!==null)return!1;for(var f=c.targetContainers;0<f.length;){var b=$A(c.nativeEvent);if(b===null){b=c.nativeEvent;var w=new b.constructor(b.type,b);pa=w,b.target.dispatchEvent(w),pa=null}else return f=Ds(b),f!==null&&jP(f),c.blockedOn=b,!1;f.shift()}return!0}function kP(c,f,b){lw(c)&&b.delete(f)}function SH(){qA=!1,Rf!==null&&lw(Rf)&&(Rf=null),Pf!==null&&lw(Pf)&&(Pf=null),Df!==null&&lw(Df)&&(Df=null),Nb.forEach(kP),Ab.forEach(kP)}function cw(c,f){c.blockedOn===f&&(c.blockedOn=null,qA||(qA=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,SH)))}var uw=null;function IP(c){uw!==c&&(uw=c,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){uw===c&&(uw=null);for(var f=0;f<c.length;f+=3){var b=c[f],w=c[f+1],R=c[f+2];if(typeof w!="function"){if(XA(w||b)===null)continue;break}var L=Ds(b);L!==null&&(c.splice(f,3),f-=3,tb(L,{pending:!0,data:R,method:b.method,action:w},w,R))}}))}function Rg(c){function f(Oe){return cw(Oe,c)}Rf!==null&&cw(Rf,c),Pf!==null&&cw(Pf,c),Df!==null&&cw(Df,c),Nb.forEach(f),Ab.forEach(f);for(var b=0;b<kf.length;b++){var w=kf[b];w.blockedOn===c&&(w.blockedOn=null)}for(;0<kf.length&&(b=kf[0],b.blockedOn===null);)DP(b),b.blockedOn===null&&kf.shift();if(b=(c.ownerDocument||c).$$reactFormReplay,b!=null)for(w=0;w<b.length;w+=3){var R=b[w],L=b[w+1],te=R[jr]||null;if(typeof L=="function")te||IP(b);else if(te){var xe=null;if(L&&L.hasAttribute("formAction")){if(R=L,te=L[jr]||null)xe=te.formAction;else if(XA(R)!==null)continue}else xe=te.action;typeof xe=="function"?b[w+1]=xe:(b.splice(w,3),w-=3),IP(b)}}}function BP(){function c(L){L.canIntercept&&L.info==="react-transition"&&L.intercept({handler:function(){return new Promise(function(te){return R=te})},focusReset:"manual",scroll:"manual"})}function f(){R!==null&&(R(),R=null),w||setTimeout(b,20)}function b(){if(!w&&!navigation.transition){var L=navigation.currentEntry;L&&L.url!=null&&navigation.navigate(L.url,{state:L.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var w=!1,R=null;return navigation.addEventListener("navigate",c),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(b,100),function(){w=!0,navigation.removeEventListener("navigate",c),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),R!==null&&(R(),R=null)}}}function YA(c){this._internalRoot=c}dw.prototype.render=YA.prototype.render=function(c){var f=this._internalRoot;if(f===null)throw Error(r(409));var b=f.current,w=Wa();CP(b,w,c,f,null,null)},dw.prototype.unmount=YA.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var f=c.containerInfo;CP(c.current,2,null,c,null,null),Ho(),f[es]=null}};function dw(c){this._internalRoot=c}dw.prototype.unstable_scheduleHydration=function(c){if(c){var f=Lr();c={blockedOn:null,target:c,priority:f};for(var b=0;b<kf.length&&f!==0&&f<kf[b].priority;b++);kf.splice(b,0,c),b===0&&DP(c)}};var LP=e.version;if(LP!=="19.2.8")throw Error(r(527,LP,"19.2.8"));K.findDOMNode=function(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(r(188)):(c=Object.keys(c).join(","),Error(r(268,c)));return c=d(f),c=c!==null?h(c):null,c=c===null?null:c.stateNode,c};var _H={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.8"};
9if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fw=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fw.isDisabled&&fw.supportsFiber)try{ce=fw.inject(_H),Me=fw}catch{}}return Tb.createRoot=function(c,f){if(!s(c))throw Error(r(299));var b=!1,w="",R=H1,L=ob,te=lb;return f!=null&&(f.unstable_strictMode===!0&&(b=!0),f.identifierPrefix!==void 0&&(w=f.identifierPrefix),f.onUncaughtError!==void 0&&(R=f.onUncaughtError),f.onCaughtError!==void 0&&(L=f.onCaughtError),f.onRecoverableError!==void 0&&(te=f.onRecoverableError)),f=NP(c,1,!1,null,null,b,w,null,R,L,te,BP),c[es]=f.current,TA(c),new YA(f)},Tb.hydrateRoot=function(c,f,b){if(!s(c))throw Error(r(299));var w=!1,R="",L=H1,te=ob,xe=lb,Oe=null;return b!=null&&(b.unstable_strictMode===!0&&(w=!0),b.identifierPrefix!==void 0&&(R=b.identifierPrefix),b.onUncaughtError!==void 0&&(L=b.onUncaughtError),b.onCaughtError!==void 0&&(te=b.onCaughtError),b.onRecoverableError!==void 0&&(xe=b.onRecoverableError),b.formState!==void 0&&(Oe=b.formState)),f=NP(c,1,!0,f,b??null,w,R,Oe,L,te,xe,BP),f.context=AP(null),b=f.current,w=Wa(),w=an(w),R=nc(w),R.callback=null,Yc(b,R,w),b=w,f.current.lanes=b,ue(f,b),Dt(f),c[es]=f.current,TA(c),new dw(f)},Tb.version="19.2.8",Tb}var hD;function F7(){if(hD)return rC.exports;hD=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),rC.exports=O7(),rC.exports}var U7=F7(),z7=(function(){function n(){this.keyToValue=new Map,this.valueToKey=new Map}return n.prototype.set=function(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)},n.prototype.getByKey=function(e){return this.keyToValue.get(e)},n.prototype.getByValue=function(e){return this.valueToKey.get(e)},n.prototype.clear=function(){this.keyToValue.clear(),this.valueToKey.clear()},n})(),DL=(function(){function n(e){this.generateIdentifier=e,this.kv=new z7}return n.prototype.register=function(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))},n.prototype.clear=function(){this.kv.clear()},n.prototype.getIdentifier=function(e){return this.kv.getByValue(e)},n.prototype.getValue=function(e){return this.kv.getByKey(e)},n}
9)(),G7=(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),H7=(function(n){G7(e,n);function e(){var t=n.call(this,function(r){return r.name})||this;return t.classToAllowedProps=new Map,t}return e.prototype.register=function(t,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(t,r.allowProps),n.prototype.register.call(this,t,r.identifier)):n.prototype.register.call(this,t,r)},e.prototype.getAllowedProps=function(t){return this.classToAllowedProps.get(t)},e})(DL),V7=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return a};function W7(n){if("values"in Object)return Object.values(n);var e=[];for(var t in n)n.hasOwnProperty(t)&&e.push(n[t]);return e}function $7(n,e){var t=W7(n);if("find"in t)return t.find(e);for(var r=t,s=0;s<r.length;s++){var a=r[s];if(e(a))return a}}function Ex(n,e){Object.entries(n).forEach(function(t){var r=V7(t,2),s=r[0],a=r[1];return e(a,s)})}function GS(n,e){return n.indexOf(e)!==-1}function mD(n,e){for(var t=0;t<n.length;t++){var r=n[t];if(e(r))return r}}var X7=(function(){function n(){this.transfomers={}}return n.prototype.register=function(e){this.transfomers[e.name]=e},n.prototype.findApplicable=function(e){return $7(this.transfomers,function(t){return t.isApplicable(e)}
9)},n.prototype.findByName=function(e){return this.transfomers[e]},n})(),q7=function(n){return Object.prototype.toString.call(n).slice(8,-1)},kL=function(n){return typeof n>"u"},Y7=function(n){return n===null},Ry=function(n){return typeof n!="object"||n===null||n===Object.prototype?!1:Object.getPrototypeOf(n)===null?!0:Object.getPrototypeOf(n)===Object.prototype},bj=function(n){return Ry(n)&&Object.keys(n).length===0},ch=function(n){return Array.isArray(n)},Q7=function(n){return typeof n=="string"},K7=function(n){return typeof n=="number"&&!isNaN(n)},J7=function(n){return typeof n=="boolean"},Z7=function(n){return n instanceof RegExp},Py=function(n){return n instanceof Map},Dy=function(n){return n instanceof Set},IL=function(n){return q7(n)==="Symbol"},eW=function(n){return n instanceof Date&&!isNaN(n.valueOf())},tW=function(n){return n instanceof Error},pD=function(n){return typeof n=="number"&&isNaN(n)},nW=function(n){return J7(n)||Y7(n)||kL(n)||K7(n)||Q7(n)||IL(n)},rW=function(n){return typeof n=="bigint"},sW=function(n){return n===1/0||n===-1/0},iW=function(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)},aW=function(n){return n instanceof URL},BL=function(n){return n.replace(/\./g,"\\.")},oC=function(n){return n.map(String).map(BL).join(".")},cy=function(n){for(var e=[],t="",r=0;r<n.length;r++){var s=n.charAt(r),a=s==="\\"&&n.charAt(r+1)===".";if(a){t+=".",r++;continue}var o=s===".";if(o){e.push(t),t="";continue}t+=s}var l=t;return e.push(l),e},yj=function(){return yj=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},yj.apply(this,arguments)},vj=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return a},wj=function(n,e){for(var t=0,r=e.length,s=n.length;t<r;t++,s++)n[s]=e[t];return n};function du(n,e,t,r){return{isApplicable:n,annotation:e,transform:t,untransform:r}}var LL=[du(kL,"undefined",function(){return null},function(){}),du(rW,"bigint",function(n){return n.toString()},function(n){return typeof BigInt<"u"?BigInt(n):(console.error("Please add a BigInt polyfill."),n)}),du(eW,"Date",function(n){return n.toISOString()},function(n){return new Date(n)}),du(tW,"Error",function(n,e){var t={name:n.name,message:n.message};return e.allowedErrorProps.forEach(function(r){t[r]=n[r]}),t},function(n,e){var t=new Error(n.message);return t.name=n.name,t.stack=n.stack,e.allowedErrorProps.forEach(function(r){t[r]=n[r]}),t}),du(Z7,"regexp",function(n){return""+n},function(n){var e=n.slice(1,n.lastIndexOf("/")),t=n.slice(n.lastIndexOf("/")+1);return new RegExp(e,t)}),du(Dy,"set",function(n){return wj([],vj(n.values()))},function(n){return new Set(n)}),du(Py,"map",function(n){return wj([],vj(n.entries()))},function(n){return new Map(n)}),du(function(n){return pD(n)||sW(n)},"number",function(n){return pD(n)?"NaN":n>0?"Infinity":"-Infinity"},Number),du(function(n){return n===0&&1/n===-1/0},"number",function(){return"-0"},Number),du(aW,"URL",function(n){return n.toString()},function(n){return new URL(n)})];function HM(n,e,t,r){return{isApplicable:n,annotation:e,transform:t,untransform:r}}var OL=HM(function(n,e){if(IL(n)){var t=!!e.symbolRegistry.getIdentifier(n);return t}return!1},function(n,e){var t=e.symbolRegistry.getIdentifier(n);return["symbol",t]},function(n){return n.description},function(n,e,t){var r=t.symbolRegistry.getValue(e[1]);if(!r)throw new Error("Trying to deserialize unknown symbol");return r}),oW=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce(function(n,e){return n[e.name]=e,n},{}),FL=HM(iW,function(n){return["typed-array",n.constructor.name]},function(n){return wj([],vj(n))},function(n,e){var t=oW[e[1]];if(!t)throw new Error("Trying to deserialize unknown typed array");return new t(n)});function UL(n,e){if(n?.constructor){var t=!!e.classRegistry.getIdentifier(n.constructor);return t}return!1}var zL=HM(UL,function(n,e){var t=e.classRegistry.getIdentifier(n.constructor);return["class",t]},function(n,e){var t=e.classRegistry.getAllowedProps(n.constructor);if(!t)return yj({},n);var r={};return t.forEach(function(s){r[s]=n[s]}),r},function(n,e,t){var r=t.classRegistry.getValue(e[1]);
9if(!r)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),n)}),GL=HM(function(n,e){return!!e.customTransformerRegistry.findApplicable(n)},function(n,e){var t=e.customTransformerRegistry.findApplicable(n);return["custom",t.name]},function(n,e){var t=e.customTransformerRegistry.findApplicable(n);return t.serialize(n)},function(n,e,t){var r=t.customTransformerRegistry.findByName(e[1]);if(!r)throw new Error("Trying to deserialize unknown custom value");return r.deserialize(n)}),lW=[zL,OL,GL,FL],gD=function(n,e){var t=mD(lW,function(s){return s.isApplicable(n,e)});if(t)return{value:t.transform(n,e),type:t.annotation(n,e)};var r=mD(LL,function(s){return s.isApplicable(n,e)});if(r)return{value:r.transform(n,e),type:r.annotation}},HL={};LL.forEach(function(n){HL[n.annotation]=n});var cW=function(n,e,t){if(ch(e))switch(e[0]){case"symbol":return OL.untransform(n,e,t);case"class":return zL.untransform(n,e,t);case"custom":return GL.untransform(n,e,t);case"typed-array":return FL.untransform(n,e,t);default:throw new Error("Unknown transformation: "+e)}else{var r=HL[e];if(!r)throw new Error("Unknown transformation: "+e);return r.untransform(n,t)}},mx=function(n,e){for(var t=n.keys();e>0;)t.next(),e--;return t.next().value};function VL(n){if(GS(n,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(GS(n,"prototype"))throw new Error("prototype is not allowed as a property");if(GS(n,"constructor"))throw new Error("constructor is not allowed as a property")}var uW=function(n,e){VL(e);for(var t=0;t<e.length;t++){var r=e[t];if(Dy(n))n=mx(n,+r);else if(Py(n)){var s=+r,a=+e[++t]==0?"key":"value",o=mx(n,s);switch(a){case"key":n=o;break;case"value":n=n.get(o);break}}else n=n[r]}return n},Sj=function(n,e,t){if(VL(e),e.length===0)return t(n);for(var r=n,s=0;s<e.length-1;s++){var a=e[s];if(ch(r)){var o=+a;r=r[o]}else if(Ry(r))r=r[a];else if(Dy(r)){var l=+a;r=mx(r,l)}else if(Py(r)){var u=s===e.length-2;if(u)break;var l=+a,d=+e[++s]==0?"key":"value",h=mx(r,l);switch(d){case"key":r=h;break;case"value":r=r.get(h);break}}}var p=e[e.length-1];if(ch(r)?r[+p]=t(r[+p]):Ry(r)&&(r[p]=t(r[p])),Dy(r)){var x=mx(r,+p),y=t(x);x!==y&&(r.delete(x),r.add(y))}if(Py(r)){var l=+e[e.length-2],v=mx(r,l),d=+p==0?"key":"value";switch(d){case"key":{var _=t(v);r.set(_,r.get(v)),_!==v&&r.delete(v);break}case"value":{r.set(v,t(r.get(v)));break}}}return n},Ed=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return a},th=function(n,e){for(var t=0,r=e.length,s=n.length;t<r;t++,s++)n[s]=e[t];return n};function _j(n,e,t){if(t===void 0&&(t=[]),!!n){if(!ch(n)){Ex(n,function(o,l){return _j(o,e,th(th([],Ed(t)),Ed(cy(l))))});return}var r=Ed(n,2),s=r[0],a=r[1];a&&Ex(a,function(o,l){_j(o,e,th(th([],Ed(t)),Ed(cy(l))))}),e(s,t)}}function dW(n,e,t){return _j(e,function(r,s){n=Sj(n,s,function(a){return cW(a,r,t)})}),n}function fW(n,e){function t(o,l){var u=uW(n,cy(l));o.map(cy).forEach(function(d){n=Sj(n,d,function(){return u})})}if(ch(e)){var r=Ed(e,2),s=r[0],a=r[1];s.forEach(function(o){n=Sj(n,cy(o),function(){return n})}),a&&Ex(a,t)}else Ex(e,t);return n}var hW=function(n,e){return Ry(n)||ch(n)||Py(n)||Dy(n)||UL(n,e)};function mW(n,e,t){var r=t.get(n);r?r.push(e):t.set(n,[e])}function pW(n,e){var t={},r=void 0;return n.forEach(function(s){if(!(s.length<=1)){e||(s=s.map(function(u){return u.map(String)}).sort(function(u,d){return u.length-d.length}));var a=Ed(s),o=a[0],l=a.slice(1);o.length===0?r=l.map(oC):t[oC(o)]=l.map(oC)}}),r?bj(t)?[r]:[r,t]:bj(t)?void 0:t}var WL=function(n,e,t,r,s,a,o){var l;s===void 0&&(s=[]),a===void 0&&(a=[]),o===void 0&&(o=new Map);var u=nW(n);if(!u){mW(n,s,e);var d=o.get(n);if(d)return r?{transformedValue:null}:d}if(!hW(n,t)){var h=gD(n,t),p=h?{transformedValue:h.value,annotations:[h.type]}:{transformedValue:n};return u||o.set(n,p),p}if(GS(a,n))return{transformedValue:null};var x=gD(n,t),y=(l=x?.value)!==null&&l!==void 0?l:n,v=ch(y)?[]:{},_={};Ex(y,function(S,A){var E=WL(S,e,t,r,th(th([],Ed(s)),[A]),th(th([],Ed(a)),[n]),o);v[A]=E.transformedValue,ch(E.annotations)?_[A]=E.annotations:Ry(E.annotations)&&Ex(E.annotations,function(C,I){_[BL(A)+"."+I]=C})});var M=bj(_)?{transformedValue:v,annotations:x?[x.type]:void 0}:{transformedValue:v,annotations:x?[x.type,_]:_};return u||o.set(n,M),M};function $L(n){return Object.prototype.toString.call(n).slice(8,-1)}function xD(n){return $L(n)==="Array"}function gW(n){if($L(n)!=="Object")return!1;const e=Object.getPrototypeOf(n);return!!e&&e.constructor===Object&&e===Object.prototype}function xW(n,e,t,r,s){const a={}.propertyIsEnumerable.call(r,e)?"enumerable":"nonenumerable";a==="enumerable"&&(n[e]=t),s&&a==="nonenumerable"&&Object.defineProperty(n,e,{value:t,enumerable:!1,writable:!0,configurable:!0})}function Mj(n,e={}){if(xD(n))return n.map(s=>Mj(s,e));if(!gW(n))return n;const t=Object.getOwnPropertyNames(n),r=Object.getOwnPropertySymbols(n);return[...t,...r].reduce((s,a)=>
9{if(xD(e.props)&&!e.props.includes(a))return s;const o=n[a],l=Mj(o,e);return xW(s,a,l,n,e.nonenumerable),s},{})}var Im=function(){return Im=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},Im.apply(this,arguments)},bW=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return a},yW=function(n,e){for(var t=0,r=e.length,s=n.length;t<r;t++,s++)n[s]=e[t];return n},Wd=(function(){function n(e){var t=e===void 0?{}:e,r=t.dedupe,s=r===void 0?!1:r;this.classRegistry=new H7,this.symbolRegistry=new DL(function(a){var o;return(o=a.description)!==null&&o!==void 0?o:""}),this.customTransformerRegistry=new X7,this.allowedErrorProps=[],this.dedupe=s}return n.prototype.serialize=function(e){var t=new Map,r=WL(e,t,this,this.dedupe),s={json:r.transformedValue};r.annotations&&(s.meta=Im(Im({},s.meta),{values:r.annotations}));var a=pW(t,this.dedupe);return a&&(s.meta=Im(Im({},s.meta),{referentialEqualities:a})),s},n.prototype.deserialize=function(e){var t=e.json,r=e.meta,s=Mj(t);return r?.values&&(s=dW(s,r.values,this)),r?.referentialEqualities&&(s=fW(s,r.referentialEqualities)),s},n.prototype.stringify=function(e){return JSON.stringify(this.serialize(e))},n.prototype.parse=function(e){return this.deserialize(JSON.parse(e))},n.prototype.registerClass=function(e,t){this.classRegistry.register(e,t)},n.prototype.registerSymbol=function(e,t){this.symbolRegistry.register(e,t)},n.prototype.registerCustom=function(e,t){this.customTransformerRegistry.register(Im({name:t},e))},n.prototype.allowErrorProps=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];(e=this.allowedErrorProps).push.apply(e,yW([],bW(t)))},n.defaultInstance=new n,n.serialize=n.defaultInstance.serialize.bind(n.defaultInstance),n.deserialize=n.defaultInstance.deserialize.bind(n.defaultInstance),n.stringify=n.defaultInstance.stringify.bind(n.defaultInstance),n.parse=n.defaultInstance.parse.bind(n.defaultInstance),n.registerClass=n.defaultInstance.registerClass.bind(n.defaultInstance),n.registerSymbol=n.defaultInstance.registerSymbol.bind(n.defaultInstance),n.registerCustom=n.defaultInstance.registerCustom.bind(n.defaultInstance),n.allowErrorProps=n.defaultInstance.allowErrorProps.bind(n.defaultInstance),n})();Wd.serialize;Wd.deserialize;Wd.stringify;Wd.parse;Wd.registerClass;Wd.registerCustom;Wd.registerSymbol;Wd.allowErrorProps;var vW=(n,e,t,r,s,a,o,l)=>{let u=document.documentElement,d=["light","dark"];function h(y){(Array.isArray(n)?n:[n]).forEach(v=>{let _=v==="class",M=_&&a?s.map(S=>a[S]||S):s;_?(u.classList.remove(...M),u.classList.add(a&&a[y]?a[y]:y)):u.setAttribute(v,y)}),p(y)}function p(y){l&&d.includes(y)&&(u.style.colorScheme=y)}function x(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)h(r);else try{let y=localStorage.getItem(e)||t,v=o&&y==="system"?x():y;h(v)}catch{}},wW=T.createContext(void 0),SW={setTheme:n=>{},themes:[]},_W=()=>{var n;return(n=T.useContext(wW))!=null?n:SW};T.memo(({forcedTheme:n,storageKey:e,attribute:t,enableSystem:r,enableColorScheme:s,defaultTheme:a,value:o,themes:l,nonce:u,scriptProps:d})=>{let h=JSON.stringify([t,e,a,n,l,o,r,s]).slice(1,-1);return T.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${vW.toString()})(${h}
9)`}})});var Yx=PL();const MW=LM(Yx);function NW(n){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",e.appendChild(t),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n))}const AW=n=>{switch(n){case"success":return jW;case"info":return RW;case"warning":return TW;case"error":return PW;default:return null}},CW=Array(12).fill(0),EW=({visible:n,className:e})=>Ft.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":n},Ft.createElement("div",{className:"sonner-spinner"},CW.map((t,r)=>Ft.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),jW=Ft.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ft.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),TW=Ft.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ft.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),RW=Ft.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ft.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),PW=Ft.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ft.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),DW=Ft.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Ft.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ft.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kW=()=>{const[n,e]=Ft.useState(document.hidden);return Ft.useEffect(()=>{const t=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),n};let IW=1;const BW=100,bD=n=>{var e;return typeof n?.id=="number"||(n==null||(e=n.id)==null?void 0:e.length)>0?n.id:IW++};class LW{constructor(){this.subscribe=e=>
9(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{const t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-BW;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{const{message:t,...r}=e,s=bD(e),a=this.pendingDismissals.get(s);a!==void 0&&(cancelAnimationFrame(a),this.pendingDismissals.delete(s),this.dismissedToasts.delete(s));const o=this.dismissedToasts.has(s),l=e.dismissible===void 0?!0:e.dismissible;return o&&(this.dismissedToasts.delete(s),this.toasts=this.toasts.filter(d=>d.id!==s)),(o?void 0:this.toasts.find(d=>d.id===s))?this.toasts=this.toasts.map(d=>d.id===s?(this.publish({...d,...e,id:s,title:t}),{...d,...e,id:s,dismissible:l,title:t}):d):this.addToast({title:t,...r,dismissible:l,id:s}),s},this.dismiss=e=>
9{if(e==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);const t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(r=>r({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let a=r!==void 0,o;const l=s.then(async d=>{if(o=["resolve",d],Ft.isValidElement(d))a=!1,this.create({id:r,type:"default",message:d});else if(FW(d)&&!d.ok){a=!1;const p=typeof t.error=="function"?await t.error(`HTTP error! status: ${d.status}`):t.error,x=typeof t.description=="function"?await t.description(`HTTP error! status: ${d.status}`):t.description,v=typeof p=="object"&&!Ft.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:x,...v})}else if(d instanceof Error){a=!1;const p=typeof t.error=="function"?await t.error(d):t.error,x=typeof t.description=="function"?await t.description(d):t.description,v=typeof p=="object"&&!Ft.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:x,...v})}else if(t.success!==void 0){a=!1;const p=typeof t.success=="function"?await t.success(d):t.success,x=typeof t.description=="function"?await t.description(d):t.description,v=typeof p=="object"&&!Ft.isValidElement(p)?p:{message:p};this.create({id:r,type:"success",description:x,...v})}}).catch(async d=>{if(o=["reject",d],t.error!==void 0){a=!1;const h=typeof t.error=="function"?await t.error(d):t.error,p=typeof t.description=="function"?await t.description(d):t.description,y=typeof h=="object"&&!Ft.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:p,...y})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),t.finally==null||t.finally.call(t)}),u=()=>new Promise((d,h)=>l.then(()=>o[0]==="reject"?h(o[1]):d(o[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(e,t)=>{const r=bD(t);return this.create({...t,jsx:e(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const Ro=new LW,OW=(n,e)=>Ro.message(n,e),FW=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",UW=OW,zW=()=>Ro.toasts,GW=()=>Ro.getActiveToasts(),_e=Object.assign(UW,{success:Ro.success,info:Ro.info,warning:Ro.warning,error:Ro.error,custom:Ro.custom,message:Ro.message,promise:Ro.promise,dismiss:Ro.dismiss,loading:Ro.loading},{getHistory:zW,getToasts:GW});NW
vendor: 14,921 bytes, line 9
9("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
vendor: 2,562 bytes, line 9
9function xw(n){return n.label!==void 0}const HW=3,VW="24px",WW="16px",yD=4e3,$W=356,XW=14,qW=45,YW=200;function fu(...n){return n.filter(Boolean).join(" ")}function QW(n){const[e,t]=n.split("-"),r=[];return e&&r.push(e),t&&r.push(t),r}const KW=n=>{var e,t,r,s,a,o,l,u,d;const{invert:h,toast:p,unstyled:x,interacting:y,setHeights:v,visibleToasts:_,heights:M,index:S,toasts:A,expanded:E,removeToast:C,defaultRichColors:I,closeButton:D,style:B,cancelButtonStyle:P,actionButtonStyle:G,className:k="",descriptionClassName:V="",duration:U,position:$,gap:X,expandByDefault:ee,classNames:z,icons:K,closeButtonAriaLabel:ae="Close toast"}=n,[oe,re]=Ft.useState(null),[F,O]=Ft.useState(null),[J,q]=Ft.useState(!1),[Q,ne]=Ft.useState(!1),[Z,se]=Ft.useState(!1),[me,ze]=Ft.useState(!1),[Be,ye]=Ft.useState(!1),[Le,Ce]=Ft.useState(0),[Re,De]=Ft.useState(0),he=Ft.useRef(p.duration||U||yD),le=Ft.useRef(null),Xe=Ft.useRef(null),qe=S===0,Ge=S+1<=_,ot=p.type,ve=ot??"default",mt=p.dismissible!==!1,xt=p.className||"",ge=p.descriptionClassName||"",Y=Ft.useMemo(()=>M.findIndex(et=>et.toastId===p.id)||0,[M,p.id]),je=Ft.useMemo(()=>{var et;return(et=p.closeButton)!=null?et:D},[p.closeButton,D]),Ie=Ft.useMemo(()=>p.duration||U||yD,[p.duration,U]),Ve=Ft.useRef(0),ft=Ft.useRef(0),vt=Ft.useRef(0),ce=Ft.useRef(null),[Me,Fe]=$.split("-"),ie=Ft.useMemo(()=>M.reduce((et,Qe,Mt)=>Mt>=Y?et:et+Qe.height,0),[M,Y]),Se=kW(),Ae=Ft.useMemo(()=>{var et;return(et=n.swipeDirections)!=null?et:QW($)},[n.swipeDirections,$]),at=p.invert||h,pe=ot==="loading";ft.current=Ft.useMemo(()=>Y*X+ie,[Y,ie]),Ft.useEffect(()=>{he.current=Ie},[Ie]),Ft.useEffect(()=>{q(!0)},[]),Ft.useEffect(()=>{const et=Xe.current;if(et){const Qe=et.getBoundingClientRect().height;return De(Qe),v(Mt=>[{toastId:p.id,height:Qe,position:p.position},...Mt]),()=>v(Mt=>Mt.filter(ue=>ue.toastId!==p.id))}},[v,p.id]),Ft.useLayoutEffect(()=>{if(!J)return;const et=Xe.current,Qe=et.style.height;et.style.height="auto";const Mt=et.getBoundingClientRect().height;et.style.height=Qe,De(Mt),v(ue=>ue.find(it=>it.toastId===p.id)?ue.map(it=>it.toastId===p.id?{...it,height:Mt}:it):[{toastId:p.id,height:Mt,position:p.position},...ue])},[J,p.title,p.description,v,p.id,p.jsx,p.action,p.cancel]);const Ke=Ft.useCallback(()=>{ne(!0),Ce(ft.current),v(et=>et.filter(Qe=>Qe.toastId!==p.id)),setTimeout(()=>{C(p)},YW)},[p,C,v,ft]);Ft.useEffect(()=>{if(p.promise&&ot==="loading"||p.duration===1/0||p.type==="loading")return;let et;return E||y||Se?(()=>{if(vt.current<Ve.current){const ue=new Date().getTime()-Ve.current;he.current=he.current-ue}
vendor: 6,545 bytes, line 9
9vt.current=new Date().getTime()})():he.current!==1/0&&(Ve.current=new Date().getTime(),et=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Ke()},he.current)),()=>clearTimeout(et)},[E,y,p,ot,Se,Ke]),Ft.useEffect(()=>{p.delete&&(Ke(),p.onDismiss==null||p.onDismiss.call(p,p))},[Ke,p.delete]);function Ne(){var et;if(K?.loading){var Qe;return Ft.createElement("div",{className:fu(z?.loader,p==null||(Qe=p.classNames)==null?void 0:Qe.loader,"sonner-loader"),"data-visible":ot==="loading"},K.loading)}return Ft.createElement(EW,{className:fu(z?.loader,p==null||(et=p.classNames)==null?void 0:et.loader),visible:ot==="loading"})}const Ye=p.icon||K?.[ot]||AW(ot);var Te,st;return Ft.createElement("li",{tabIndex:0,ref:Xe,className:fu(k,xt,z?.toast,p==null||(e=p.classNames)==null?void 0:e.toast,z?.[ve],p==null||(t=p.classNames)==null?void 0:t[ve]),"data-sonner-toast":"","data-rich-colors":(Te=p.richColors)!=null?Te:I,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":J,"data-promise":!!p.promise,"data-swiped":Be,"data-removed":Q,"data-visible":Ge,"data-y-position":Me,"data-x-position":Fe,"data-index":S,"data-front":qe,"data-swiping":Z,"data-dismissible":mt,"data-type":ot,"data-invert":at,"data-swipe-out":me,"data-swipe-direction":F,"data-expanded":!!(E||ee&&J),"data-testid":p.testId,style:{"--index":S,"--toasts-before":S,"--z-index":A.length-S,"--offset":`${Q?Le:ft.current}px`,"--initial-height":ee?"auto":`${Re}px`,...B,...p.style},onDragEnd:()=>{se(!1),re(null),ce.current=null},onPointerDown:et=>{et.button!==2&&(pe||!mt||(le.current=new Date,Ce(ft.current),et.target.setPointerCapture(et.pointerId),et.target.tagName!=="BUTTON"&&(se(!0),ce.current={x:et.clientX,y:et.clientY})))},onPointerUp:()=>{var et,Qe,Mt;if(me||!mt)return;ce.current=null;const ue=Number(((et=Xe.current)==null?void 0:et.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Je=Number(((Qe=Xe.current)==null?void 0:Qe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),it=new Date().getTime()-((Mt=le.current)==null?void 0:Mt.getTime()),Et=oe==="x"?ue:Je,Wt=Math.abs(Et)/it;if((oe==="x"?Ae.includes(ue>0?"right":"left"):Ae.includes(Je>0?"bottom":"top"))&&(Math.abs(Et)>=qW||Wt>.11)){Ce(ft.current),p.onDismiss==null||p.onDismiss.call(p,p),O(oe==="x"?ue>0?"right":"left":Je>0?"down":"up"),Ke(),ze(!0);return}else{var Sn,Lr;(Sn=Xe.current)==null||Sn.style.setProperty("--swipe-amount-x","0px"),(Lr=Xe.current)==null||Lr.style.setProperty("--swipe-amount-y","0px")}ye(!1),se(!1),re(null)},onPointerMove:et=>{var Qe,Mt,ue;if(!ce.current||!mt||((Qe=window.getSelection())==null?void 0:Qe.toString().length)>0)return;const it=et.clientY-ce.current.y,Et=et.clientX-ce.current.x;!oe&&(Math.abs(Et)>1||Math.abs(it)>1)&&re(Math.abs(Et)>Math.abs(it)?"x":"y");let Wt={x:0,y:0};const an=Sn=>1/(1.5+Math.abs(Sn)/20);if(oe==="y"){if(Ae.includes("top")||Ae.includes("bottom"))if(Ae.includes("top")&&it<0||Ae.includes("bottom")&&it>0)Wt.y=it;else{const Sn=it*an(it);Wt.y=Math.abs(Sn)<Math.abs(it)?Sn:it}}else if(oe==="x"&&(Ae.includes("left")||Ae.includes("right")))if(Ae.includes("left")&&Et<0||Ae.includes("right")&&Et>0)Wt.x=Et;else{const Sn=Et*an(Et);Wt.x=Math.abs(Sn)<Math.abs(Et)?Sn:Et}(Math.abs(Wt.x)>0||Math.abs(Wt.y)>0)&&ye(!0),(Mt=Xe.current)==null||Mt.style.setProperty("--swipe-amount-x",`${Wt.x}px`),(ue=Xe.current)==null||ue.style.setProperty("--swipe-amount-y",`${Wt.y}px`)}},je&&!p.jsx&&ot!=="loading"?Ft.createElement("button",{"aria-label":ae,"data-disabled":pe,"data-close-button":!0,onClick:pe||!mt?()=>{}:()=>{Ke(),p.onDismiss==null||p.onDismiss.call(p,p)},className:fu(z?.closeButton,p==null||(r=p.classNames)==null?void 0:r.closeButton)},(st=K?.close)!=null?st:DW):null,(ot||p.icon||p.promise)&&p.icon!==null&&(K?.[ot]!==null||p.icon)?Ft.createElement("div",{"data-icon":"",className:fu(z?.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},ot==="loading"?p.icon||Ne():p.promise?Ne():null,ot!=="loading"?Ye:null):null,Ft.createElement("div",{"data-content":"",className:fu(z?.content,p==null||(a=p.classNames)==null?void 0:a.content)},Ft.createElement("div",{"data-title":"",className:fu(z?.title,p==null||(o=p.classNames)==null?void 0:o.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Ft.createElement("div",{"data-description":"",className:fu(V,ge,z?.description,p==null||(l=p.classNames)==null?void 0:l.description)},typeof p.description=="function"?p.description():p.description):null),Ft.isValidElement(p.cancel)?p.cancel:p.cancel&&xw(p.cancel)?Ft.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||P,onClick:et=>{xw(p.cancel)&&mt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,et),Ke())},className:fu(z?.cancelButton,p==null||(u=p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,Ft.isValidElement(p.action)?p.action:p.action&&xw(p.action)?Ft.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||G,onClick:et=>{xw(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,et),!et.defaultPrevented&&Ke())},className:fu(z?.actionButton,p==null||(d=p.classNames)==null?void 0:d.actionButton)},p.action.label):null)};function vD(){if(typeof window>"u"||typeof document>"u")return"ltr";const n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}function JW(n,e){const t={};return[n,e].forEach((r,s)=>{const a=s===1,o=a?"--mobile-offset":"--offset",l=a?WW:VW;function u(d){["top","right","bottom","left"].forEach(h=>{t[`${o}-${h}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?t[`${o}-${d}`]=l:t[`${o}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):u(l)}),t}const ZW=Ft.forwardRef(function(e,t){const{id:r,invert:s,position:a="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:u,className:d,offset:h,mobileOffset:p,theme:x="light",richColors:y,duration:v,style:_,visibleToasts:M=HW,toastOptions:S,dir:A=vD(),gap:E=XW,icons:C,customAriaLabel:I,containerAriaLabel:D="Notifications"}=e,[B,P]=Ft.useState([]),G=Ft.useMemo(()=>r?B.filter(q=>q.toasterId===r):B.filter(q=>!q.toasterId),[B,r]),k=Ft.useMemo(()=>Array.from(new Set([a].concat(G.filter(q=>q.position).map(q=>q.position)))),[G,a]),[V,U]=Ft.useState([]),[$,X]=Ft.useState(!1),[ee,z]=Ft.useState(!1),[K,ae]=Ft.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
9k":"light"),oe=Ft.useRef(null),re=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=Ft.useRef(null),O=Ft.useRef(!1),J=Ft.useCallback(q=>{P(Q=>{var ne;return(ne=Q.find(Z=>Z.id===q.id))!=null&&ne.delete||Ro.dismiss(q.id),Q.filter(({id:Z})=>Z!==q.id)})},[]);return Ft.useEffect(()=>Ro.subscribe(q=>{if(q.dismiss){requestAnimationFrame(()=>{P(Q=>Q.map(ne=>ne.id===q.id?{...ne,delete:!0}:ne))});return}setTimeout(()=>{MW.flushSync(()=>{P(Q=>{const ne=Q.findIndex(Z=>Z.id===q.id);return ne!==-1?[...Q.slice(0,ne),{...Q[ne],...q},...Q.slice(ne+1)]:[q,...Q]})})})}),[]),Ft.useEffect(()=>{if(x!=="system"){ae(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ae("dark"):ae("light")),typeof window>"u")return;const q=window.matchMedia("(prefers-color-scheme: dark)");try{q.addEventListener("change",({matches:Q})=>{ae(Q?"dark":"light")})}catch{q.addListener(({matches:ne})=>{try{ae(ne?"dark":"light")}catch(Z){console.error(Z)}})}},[x]),Ft.useEffect(()=>{B.length<=1&&X(!1)},[B]),Ft.useEffect(()=>{const q=Q=>{var ne;if(o.length>0&&o.every(me=>Q[me]||Q.code===me)){var se;X(!0),(se=oe.current)==null||se.focus()}Q.code==="Escape"&&(document.activeElement===oe.current||(ne=oe.current)!=null&&ne.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[o]),Ft.useEffect(()=>{if(oe.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,O.current=!1)}},[oe.current]),Ft.createElement("section",{ref:t,"aria-label":I??`${D} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},k.map((q,Q)=>{var ne;const[Z,se]=q.split("-");return G.length?Ft.createElement("ol",{key:q,dir:A==="auto"?vD():A,tabIndex:-1,ref:oe,className:d,"data-sonner-toaster":!0,"data-sonner-theme":K,"data-y-position":Z,"data-x-position":se,style:{"--front-toast-height":`${((ne=V[0])==null?void 0:ne.height)||0}px`,"--width":`${$W}px`,"--gap":`${E}px`,..._,...JW(h,p)},onBlur:me=>{O.current&&!me.currentTarget.contains(me.relatedTarget)&&(O.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:me=>{me.target instanceof HTMLElement&&me.target.dataset.dismissible==="false"||O.current||(O.current=!0,F.current=me.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{ee||X(!1)},onDragEnd:()=>X(!1),onPointerDown:me=>{me.target instanceof HTMLElement&&me.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},G.filter(me=>!me.position&&Q===0||me.position===q).map((me,ze)=>{var Be,ye;return Ft.createElement(KW,{key:me.id,icons:C,index:ze,toast:me,defaultRichColors:y,duration:(Be=S?.duration)!=null?Be:v,className:S?.className,descriptionClassName:S?.descriptionClassName,invert:s,visibleToasts:M,closeButton:(ye
9=S?.closeButton)!=null?ye:u,interacting:ee,position:q,style:S?.style,unstyled:S?.unstyled,classNames:S?.classNames,cancelButtonStyle:S?.cancelButtonStyle,actionButtonStyle:S?.actionButtonStyle,closeButtonAriaLabel:S?.closeButtonAriaLabel,removeToast:J,toasts:G.filter(Le=>Le.position==me.position),heights:V.filter(Le=>Le.position==me.position),setHeights:U,expandByDefault:l,gap:E,expanded:$,swipeDirections:e.swipeDirections})})):null}))}),e$=({...n})=>{const{theme:e="system"}=_W();return i.jsx(ZW,{theme:e,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...n})};var t$=Object.defineProperty,Qx=(n,e)=>t$(n,"name",{value:e,configurable:!0}),XL=!!(typeof window<"u"&&window.document&&window.document.createElement);function Jn(n,e,{checkForDefaultPrevented:t=!0}={}){return Qx(function(s){if(n?.(s),t===!1||!s||!s.defaultPrevented)return e?.(s)},"handleEvent")}Qx(Jn,"composeEventHandlers");function n$(n){if(!XL)throw new Error("Cannot access window outside of the DOM");return n?.ownerDocument?.defaultView??window}Qx(n$,"getOwnerWindow");function Nj(n){if(!XL)throw new Error("Cannot access document outside of the DOM");return n?.ownerDocument??document}Qx(Nj,"getOwnerDocument");function qL(n,e=!1){const{activeElement:t}=Nj(n);if(!t?.nodeName)return null;if(YL(t)&&t.contentDocument)return qL(t.contentDocument.body,e);if(e){const r=t.getAttribute("aria-activedescendant");if(r){const s=Nj(t).getElementById(r);if(s)return s}}return t}Qx(qL,"getActiveElement");function YL(n){return n.tagName==="IFRAME"}Qx(YL,"isFrame");var r$=Object.defineProperty,b2=(n,e)=>r$(n,"name",{value:e,configurable:!0});function Aj(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}b2(Aj,"setRef");function QL(...n){return e=>{let t=!1;const r=n.map(s=>{const a=Aj(s,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():Aj(n[s],null)}}}}b2(QL,"composeRefs");function xr(...n){return T.useCallback(QL(...n),n)}b2(xr,"useComposedRefs");var s$=Object.defineProperty,Bl=(n,e)=>s$(n,"name",{value:e,configurable:!0});function i$(n,e){const t=T.createContext(e);t.displayName=n+"Context";const r=Bl(a=>{const{children:o,...l}=a,u=T.useMemo(()=>l,Object.values(l));return i.jsx(t.Provider,{value:u,children:o})},"Provider");r.displayName=n+"Provider";function s(a,o={}){const{optional:l=!1}=o,u=T.useContext(t);if(u)return u;if(e!==void 0)return e;if(!l)throw new Error(`\`${a}\` must be used within \`${n}\``)}return Bl(s,"useContext"),[r,s]}Bl(i$,"createContext");function zu(n,e=[]){let t=[];function r(a,o){const l=T.createContext(o);l.displayName=a+"Context";const u=t.length;t=[...t,o];const d=Bl(p=>{const{scope:x,children:y,...v}=p,_=x?.[n]?.[u]||l,M=T.useMemo(()=>v,Object.values(v));return i.jsx(_.Provider,{value:M,children:y})},"Provider");d.displayName=a+"Provider";function h(p,x,y={}){const{optional:v=!1}=y,_=x?.[n]?.[u]||l,M=T.useContext(_);if(M)return M;if(o!==void 0)return o;if(!v)throw new Error(`\`${p}\` must be used within \`${a}\``)}return Bl(h,"useContext"),[d,h]}Bl(r,"createContext");const s=Bl(()=>{const a=t.map(o=>T.createContext(o));return Bl(function(l){const u=l?.[n]||a;return T.useMemo(()=>({[`__scope${n}`]:{...l,[n]:u}}),[l,u])},"useScope")},"createScope");return s.scopeName=n,[r,KL(s,...e)]}Bl(zu,"createContextScope");function KL(...n){const e=n[0];if(n.length===1)return e;const t=Bl(()=>{const r=n.map(s=>({useScope:s(),scopeName:s.scopeName}));return Bl(function(a){const o=r.reduce((l,{useScope:u,scopeName:d})=>{const p=u(a)[`__scope${d}`];return{...l,...p}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return t.scopeName=e.scopeName,t}Bl(KL,"composeContextScopes");var a$=Object.defineProperty,Ec=(n,e)=>a$(n,"name",{value:e,configurable:!0});function Fd(n){const e=T.forwardRef((t,r)=>{let{children:s,...a}=t,o=null,l=!1;const u=[];Cj(s)&&typeof bw=="function"&&(s=bw(s._payload)),T.Children.forEach(s,x=>{if(rO(x)){l=!0;const y=x;let v="child"in y.props?y.props.child:y.props.children;Cj(v)&&typeof bw=="function"&&(v=bw(v._payload)),o=o$(y,v),u.push(o?.props?.children)}else u.push(x)}),o?o=T.cloneElement(o,void 0,u):!l&&T.Children.count(s)===1&&T.isValidElement(s)&&(o=s);const d=o?nO(o):void 0,h=xr(r,d);if(!o){if(s||s===0)throw new Error(l?u$(n):c$(n));return s}const p=tO(a,o.props??{});return o.type!==T.Fragment&&(p.ref=r?h:d),T.cloneElement(o,p)});return e.displayName=`${n}.Slot`,e}Ec(Fd,"createSlot");var JL=Fd("Slot"),ZL=Symbol.for("radix.slottable");function eO(n){const e=Ec(t=>"child"in t?t.children(t.child):t.children,"Slottable");return e.displayName=`${n}.Slottable`,e.__radixId=ZL,e}Ec(eO,"createSlottable");var o$=Ec((n,e)=>{if("child"in n.props){const t=n.props.child;return T.isValidElement(t)?T.cloneElement(t,void 0,n.props.children(t.props.children)):null}return T.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function tO(n,e){const t={...e};for(const r in e){const s=n[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?t[r]=(...l)=>{const u=a(...l);return s(...l),u}:s&&(t[r]=s):r==="style"?t[r]={...s,...a}
9:r==="className"&&(t[r]=[s,a].filter(Boolean).join(" "))}return{...n,...t}}Ec(tO,"mergeProps");function nO(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}Ec(nO,"getElementRef");function rO(n){return T.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===ZL}Ec(rO,"isSlottable");var l$=Symbol.for("react.lazy");function Cj(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===l$&&"_payload"in n&&sO(n._payload)}Ec(Cj,"isLazyComponent");function sO(n){return typeof n=="object"&&n!==null&&"then"in n}Ec(sO,"isPromiseLike");var c$=Ec(n=>`${n} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),u$=Ec(n=>`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),bw=_h[" use ".trim().toString()],d$=Object.defineProperty,f$=(n,e)=>d$(n,"name",{value:e,configurable:!0}),h$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Br=h$.reduce((n,e)=>{const t=Fd(`Primitive.${e}`),r=T.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function iO(n,e){n&&Yx.flushSync(()=>n.dispatchEvent(e))}f$(iO,"dispatchDiscreteCustomEvent");var m$=Object.defineProperty,p$=(n,e)=>m$(n,"name",{value:e,configurable:!0});function Pu(n){const e=T.useRef(n);return T.useEffect(()=>{e.current=n}),T.useMemo(()=>((...t)=>e.current?.(...t)),[])}p$(Pu,"useCallbackRef");var g$=Object.defineProperty,Yi=(n,e)=>g$(n,"name",{value:e,configurable:!0}),Ej="dismissableLayer.update",x$="dismissableLayer.pointerDownOutside",b$="dismissableLayer.focusOutside",wD,aO=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),y2=T.forwardRef(Yi(function(e,t){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,p=T.useContext(aO),[x,y]=T.useState(null),v=x?.ownerDocument??globalThis?.document,[,_]=T.useState({}),M=xr(t,y),S=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=A?S.indexOf(A):-1,C=x?S.indexOf(x):-1,I=p.layersWithOutsidePointerEventsDisabled.size>0,D=C>=E,B=T.useRef(!1),P=lO(U=>{o?.(U),u?.(U),U.defaultPrevented||d?.()},{ownerDocument:v,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:B,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:T.useCallback(U=>{if(!(U instanceof Node))return!1;const $=[...p.branches].some(X=>X.contains(U));return D&&!$},[p.branches,D])}),G=cO(U=>{if(s&&B.current)return;const $=U.target;[...p.branches].some(ee=>ee.contains($))||(l?.(U),u?.(U),U.defaultPrevented||d?.())},v),k=x?C===S.length-1:!1,V=Pu(U=>{U.key==="Escape"&&(a?.(U),!U.defaultPrevented&&d&&(U.preventDefault(),d()))});return T.useEffect(()=>{if(k)return v.addEventListener("keydown",V,{capture:!0}),()=>v.removeEventListener("keydown",V,{capture:!0})},[v,k,V]),T.useEffect(()=>{if(x)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(wD=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),jj(),()=>{r&&(p.layersWithOutsidePointerEventsDisabled.delete(x),p.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=wD))}},[x,v,r,p]),T.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),jj())},[x,p]),T.useEffect(()=>{const U=Yi(()=>_({}),"handleUpdate");return document.addEventListener(Ej,U),()=>document.removeEventListener(Ej,U)},[]),i.jsx(Br.div,{...h,ref:M,style:{pointerEvents:I?D?"auto":"none":void 0,...e.style},onFocusCapture:Jn(e.onFocusCapture,G.onFocusCapture),onBlurCapture:Jn(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:Jn(e.onPointerDownCapture,P.onPointerDownCapture)})},"DismissableLayer"));function oO(){const n=T.useContext(aO),[e,t]=T.useState(null);return T.useEffect(()=>{if(e)return n.dismissableSurfaces.add(e),()=>
9{n.dismissableSurfaces.delete(e)}},[e,n.dismissableSurfaces]),t}Yi(oO,"useDismissableLayerSurface");var y$=Yi(()=>!0,"IS_TRUE");function lO(n,e){const{ownerDocument:t=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=y$}=e,l=Pu(n),u=T.useRef(!1),d=T.useRef(!1),h=T.useRef(new Map),p=T.useRef(()=>{});return T.useEffect(()=>{function x(){d.current=!1,s.current=!1,h.current.clear()}Yi(x,"resetOutsideInteraction");function y(){return Array.from(h.current.values()).some(Boolean)}Yi(y,"isOutsideInteractionIntercepted");function v(E){if(!d.current)return;const C=E.target;C instanceof Node&&[...a].some(D=>D.contains(C))||h.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{d.current&&p.current()},0)}Yi(v,"handleInteractionCapture");function _(E){d.current&&h.current.set(E.type,!1)}Yi(_,"handleInteractionBubble");const M=Yi(E=>{if(E.target&&!u.current){let C=function(){t.removeEventListener("click",p.current);const D=y();x(),D||v2(x$,l,I,{discrete:!0})};if(Yi(C,"handleAndDispatchPointerDownOutsideEvent"),!o(E.target)){t.removeEventListener("click",p.current),x(),u.current=!1;return}const I={originalEvent:E};d.current=!0,s.current=r&&E.button===0,h.current.clear(),!r||E.button!==0?C():(t.removeEventListener("click",p.current),p.current=C,t.addEventListener("click",p.current,{once:!0}))}else t.removeEventListener("click",p.current),x();u.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of S)t.addEventListener(E,v,!0),t.addEventListener(E,_);const A=window.setTimeout(()=>{t.addEventListener("pointerdown",M)},0);return()=>{window.clearTimeout(A),t.removeEventListener("pointerdown",M),t.removeEventListener("click",p.current);for(const E of S)t.removeEventListener(E,v,!0),t.removeEventListener(E,_)}},[t,l,r,s,a,o]),{onPointerDownCapture:Yi(()=>u.current=!0,"onPointerDownCapture")}}Yi(lO,"usePointerDownOutside");function cO(n,e=globalThis?.document){const t=Pu(n),r=T.useRef(!1);return T.useEffect(()=>{const s=Yi(a=>{a.target&&!r.current&&v2(b$,t,{originalEvent:a},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,t]),{onFocusCapture:Yi(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Yi(()=>r.current=!1,"onBlurCapture")}}Yi(cO,"useFocusOutside");function jj(){const n=new CustomEvent(Ej);document.dispatchEvent(n)}Yi(jj,"dispatchUpdate");function v2(n,e,t,{discrete:r}){const s=t.originalEvent.target,a=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&s.addEventListener(n,e,{once:!0}),r?iO(s,a):s.dispatchEvent(a)}Yi(v2,"handleAndDispatchCustomEvent");var fi=globalThis?.document?T.useLayoutEffect:()=>{},v$=Object.defineProperty,w$=(n,e)=>v$(n,"name",{value:e,configurable:!0}),S$=_h[" useId ".trim().toString()]||(()=>{}),_$=0;function Ym(n){const[e,t]=T.useState(S$());return fi(()=>{n||t(r=>r??String(_$++))},[n]),n||(e?`radix-${e}`:"")}w$(Ym,"useId");const M$=["top","right","bottom","left"],uh=Math.min,kd=Math.max,g_=Math.round,yw=Math.floor,Id=n=>({x:n,y:n}),N$={left:"right",right:"left",bottom:"top",top:"bottom"};function uO(n,e,t){return kd(n,uh(e,t))}function Ud(n,e){return typeof n=="function"?n(e):n}function dh(n){return n.split("-")[0]}function Kx(n){return n.split("-")[1]}function w2(n){return n==="x"?"y":"x"}function S2(n){return n==="y"?"height":"width"}function Au(n){const e=n[0];return e==="t"||e==="b"?"y":"x"}function _2(n){return w2(Au(n))}function A$(n,e,t){t===void 0&&(t=!1);const r=Kx(n),s=_2(n),a=S2(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=x_(o)),[o,x_(o)]}function C$(n){const e=x_(n);return[Tj(n),e,Tj(e)]}function Tj(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const SD=["left","right"],_D=["right","left"],E$=["top","bottom"],j$=["bottom","top"];function T$(n,e,t){switch(n){case"top":case"bottom":return t?e?_D:SD:e?SD:_D;case"left":case"right":return e?E$:j$;default:return[]}}function R$(n,e,t,r){const s=Kx(n);let a=T$(dh(n),t==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(Tj)))),a}function x_(n){const e=dh(n);return N$[e]+n.slice(e.length)}function P$(n){var e,t,r,s;return{top:(e=n.top)!=null?e:0,right:(t=n.right)!=null?t:0,bottom:(r=n.bottom)!=null?r:0,left:(s=n.left)!=null?s:0}}function dO(n){return typeof n!="number"?P$(n):{top:n,right:n,bottom:n,left:n}}function b_(n){const{x:e,y:t,width:r,height:s}=n;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function MD(n,e,t){let{reference:r,floating:s}=n;const a=Au(e),o=_2(e),l=S2(o),u=dh(e),d=a==="y",h=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,x=r[l]/2-s[l]/2;let y;switch(u){case"top":y={x:h,y:r.y-s.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}const v=Kx(e);return v&&(y[o]+=x*(v==="end"?1:-1)*(t&&d?-1:1)),y}async function D$(n,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:l,strategy:u}=n,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:x=!1,padding:y=0}=Ud(e,n),v=dO(y),M=l[x?p==="floating"?"reference":"floating":p],S=b_(await a.getClippingRect
vendor: 4,718 bytes, line 9
9({element:(t=await(a.isElement==null?void 0:a.isElement(M)))==null||t?M:M.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:d,rootBoundary:h,strategy:u})),A=p==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),C=await(a.isElement==null?void 0:a.isElement(E))&&await(a.getScale==null?void 0:a.getScale(E))||{x:1,y:1},I=b_(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:A,offsetParent:E,strategy:u}):A);return{top:(S.top-I.top+v.top)/C.y,bottom:(I.bottom-S.bottom+v.bottom)/C.y,left:(S.left-I.left+v.left)/C.x,right:(I.right-S.right+v.right)/C.x}}const k$=50,I$=async(n,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=t,l=o.detectOverflow?o:{...o,detectOverflow:D$},u=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:n,floating:e,strategy:s}),{x:h,y:p}=MD(d,r,u),x=r,y=0;const v={};for(let _=0;_<a.length;_++){const M=a[_];if(!M)continue;const{name:S,fn:A}=M,{x:E,y:C,data:I,reset:D}=await A({x:h,y:p,initialPlacement:r,placement:x,strategy:s,middlewareData:v,rects:d,platform:l,elements:{reference:n,floating:e}});h=E??h,p=C??p,v[S]={...v[S],...I},D&&y<k$&&(y++,typeof D=="object"&&(D.placement&&(x=D.placement),D.rects&&(d=D.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:s}):D.rects),{x:h,y:p}=MD(d,x,u)),_=-1)}return{x:h,y:p,placement:x,strategy:s,middlewareData:v}},B$=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:s,rects:a,platform:o,elements:l,middlewareData:u}=e,{element:d,padding:h=0}=Ud(n,e)||{};if(d==null)return{};const p=dO(h),x={x:t,y:r},y=_2(s),v=S2(y),_=await o.getDimensions(d),M=y==="y",S=M?"top":"left",A=M?"bottom":"right",E=M?"clientHeight":"clientWidth",C=a.reference[v]+a.reference[y]-x[y]-a.floating[v],I=x[y]-a.reference[y],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let B=D?D[E]:0;(!B||!await(o.isElement==null?void 0:o.isElement(D)))&&(B=l.floating[E]||a.floating[v]);const P=C/2-I/2,G=B/2-_[v]/2-1,k=uh(p[S],G),V=uh(p[A],G),U=B-_[v]-V,$=B/2-_[v]/2+P,X=uO(k,$,U),ee=!u.arrow&&Kx(s)!=null&&$!==X&&a.reference[v]/2-($<k?k:V)-_[v]/2<0,z=ee?$<k?$-k:$-U:0;return{[y]:x[y]+z,data:{[y]:X,centerOffset:$-X-z,...ee&&{alignmentOffset:z}},reset:ee}}}),L$=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:u,elements:d}=e,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:_=!0,...M}=Ud(n,e);if((t=a.arrow)!=null&&t.alignmentOffset)return{};const S=dh(s),A=Au(l),E=dh(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(d.floating)),I=x||(E||!_?[x_(l)]:C$(l)),D=v!=="none";!x&&D&&I.push(...R$(l,_,v,C));const B=[l,...I],P=await u.detectOverflow(e,M),G=[];let k=((r=a.flip)==null?void 0:r.overflows)||[];if(h&&G.push(P[S]),p){const X=A$(s,o,C);G.push(P[X[0]],P[X[1]])}if(k=[...k,{placement:s,overflows:G}],!G.every(X=>X<=0)){var V,U;const X=(((V=a.flip)==null?void 0:V.index)||0)+1,ee=B[X];if(ee&&(!(p==="alignment"?A!==Au(ee):!1)||k.every(ae=>Au(ae.placement)===A?ae.overflows[0]>0:!0)))return{data:{index:X,overflows:k},reset:{placement:ee}};let z=(U=k.filter(K=>K.overflows[0]<=0).sort((K,ae)=>K.overflows[1]-ae.overflows[1])[0])==null?void 0:U.placement;if(!z)switch(y){case"bestFit":{var $;const K=($=k.filter(ae=>{if(D){const oe=Au(ae.placement);return oe===A||oe==="y"}return!0}).map(ae=>[ae.placement,ae.overflows.filter(oe=>oe>0).reduce((oe,re)=>oe+re,0)]).sort((ae,oe)=>ae[1]-oe[1])[0])==null?void 0:$[0];K&&(z=K);break}case"initialPlacement":z=l;break}if(s!==z)return{reset:{placement:z}}}return{}}}};function ND(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function AD(n){return M$.some(e=>n[e]>=0)}const O$=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:r}=e,{strategy:s="referenceHidden",...a}=Ud(n,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),l=ND(o,t.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:AD(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),l=ND(o,t.floating);return{data:{escapedOffsets:l,escaped:AD(l)}}}default:return{}}}}},fO=new Set(["left","top"]);async function F$(n,e){const{placement:t,platform:r,elements:s}=n,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=dh(t),l=Kx(t),u=Au(t)==="y",d=fO.has(o)?-1:1,h=a&&u?-1:1,p=Ud(e,n
9);let{mainAxis:x,crossAxis:y,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof v=="number"&&(y=l==="end"?v*-1:v),u?{x:y*h,y:x*d}:{x:x*d,y:y*h}}const U$=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:s,y:a,placement:o,middlewareData:l}=e,u=await F$(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:a+u.y,data:{...u,placement:o}}}}},z$=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:s,platform:a}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:A=>{let{x:E,y:C}=A;return{x:E,y:C}}},...d}=Ud(n,e),h={x:t,y:r},p=await a.detectOverflow(e,d),x=Au(s),y=w2(x);let v=h[y],_=h[x];const M=(A,E)=>uO(E+p[A==="y"?"top":"left"],E,E-p[A==="y"?"bottom":"right"]);o&&(v=M(y,v)),l&&(_=M(x,_));const S=u.fn({...e,[y]:v,[x]:_});return{...S,data:{x:S.x-t,y:S.y-r,enabled:{[y]:o,[x]:l}}}}}},G$=function(n){return n===void 0&&(n={}),{options:n,fn(e){var t,r;const{x:s,y:a,placement:o,rects:l,middlewareData:u}=e,{offset:d=0,mainAxis:h=!0,crossAxis:p=!0}=Ud(n,e),x={x:s,y:a},y=Au(o),v=w2(y);let _=x[v],M=x[y];const S=Ud(d,e),A=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(t=S.mainAxis)!=null?t:0,crossAxis:(r=S.crossAxis)!=null?r:0};if(h){const I=v==="y"?"height":"width",D=l.reference[v]-l.floating[I]+A.mainAxis,B=l.reference[v]+l.reference[I]-A.mainAxis;_<D?_=D:_>B&&(_=B)}if(p){var E,C;const I=v==="y"?"width":"height",D=fO.has(dh(o)),B=l.reference[y]-l.floating[I]+(D&&((E=u.offset)==null?void 0:E[y])||0)+(D?0:A.crossAxis),P=l.reference[y]+l.reference[I]+(D?0:((C=u.offset)==null?void 0:C[y])||0)-(D?A.crossAxis:0);M<B?M=B:M>P&&(M=P)}return{[v]:_,[y]:M}}}},H$=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:s,elements:a}=e,{apply:o=()=>{},...l}=Ud(n,e),u=await s.detectOverflow(e,l),d=dh(t),h=Kx(t),p=Au(t)==="y",{width:x,height:y}=r.floating;let v,_;d==="top"||d==="bottom"?(v=d,_=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(_=d,v=h==="end"?"top":"bottom");const M=y-u.top-u.bottom,S=x-u.left-u.right,A=uh(y-u[v],M),E=uh(x-u[_],S),C=e.middlewareData.shift,I=!C;let D=A,B=E;C!=null&&C.enabled.x&&(B=S),C!=null&&C.enabled.y&&(D=M),I&&!h&&(p?B=x-2*kd(u.left,u.right):D=y-2*kd(u.top,u.bottom)),await o({...e,availableWidth:B,availableHeight:D});const P=await s.getDimensions(a.floating);return x!==P.width||y!==P.height?{reset:{rects:!0}}:{}}}};function VM(){return typeof window<"u"}function Jx(n){return hO(n)?(n.nodeName||"").toLowerCase():"#document"}function Io(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function $d(n){var e;return(e=(hO(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function hO(n){return VM()?n instanceof Node||n instanceof Io(n).Node:!1}function Du(n){return VM()?n instanceof Element||n instanceof Io(n).Element:!1}function Nh(n){return VM()?n instanceof HTMLElement||n instanceof Io(n).HTMLElement:!1}function CD(n){return!VM()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Io(n).ShadowRoot}function WM(n){const{overflow:e,overflowX:t,overflowY:r,display:s}=ku(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&s!=="inline"&&s!=="contents"}function V$(n){return/^(table|td|th)$/.test(Jx(n))}function $M(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const W$=/transform|translate|scale|rotate|perspective|filter/,$$=/paint|layout|strict|content/,fm=n=>!!n&&n!=="none";let lC;function M2(n){const e=Du(n)?ku(n):n;return fm(e.transform)||fm(e.translate)||fm(e.scale)||fm(e.rotate)||fm(e.perspective)||!N2()&&(fm(e.backdropFilter)||fm(e.filter))||W$.test(e.willChange||"")||$$.test(e.contain||"")}function X$(n){let e=op(n);for(;Nh(e)&&!ky(e);){if(M2(e))return e;if($M(e))return null;e=op(e)}return null}function N2(){return lC==null&&(lC=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),lC}function ky(n){return/^(html|body|#document)$/.test(Jx(n))}function ku(n){return Io(n).getComputedStyle(n)}function XM(n){return Du(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function op(n){if(Jx(n)==="html")return n;const e=n.assignedSlot||n.parentNode||CD(n)&&n.host||$d(n);return CD(e)?e.host:e}function mO(n){const e=op(n);return ky(e)?(n.ownerDocument||n).body:Nh(e)&&WM(e)?e:mO(e)}function Iy(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=mO(n),a=s===((r=n.ownerDocument)==null?void 0:r.body),o=Io(s);if(a){const l=Rj(o);
9return e.concat(o,o.visualViewport||[],WM(s)?s:[],l&&t?Iy(l):[])}else return e.concat(s,Iy(s,[],t))}function Rj(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function pO(n){const e=ku(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Nh(n),a=s?n.offsetWidth:t,o=s?n.offsetHeight:r,l=g_(t)!==a||g_(r)!==o;return l&&(t=a,r=o),{width:t,height:r,$:l}}function A2(n){return Du(n)?n:n.contextElement}function vx(n){const e=A2(n);if(!Nh(e))return Id(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:a}=pO(e);let o=(a?g_(t.width):t.width)/r,l=(a?g_(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const q$=Id(0);function gO(n){const e=Io(n);return!N2()||!e.visualViewport?q$:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Y$(n,e,t){return e===void 0&&(e=!1),!!t&&e&&t===Io(n)}function lp(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),a=A2(n);let o=Id(1);e&&(r?Du(r)&&(o=vx(r)):o=vx(n));const l=Y$(a,t,r)?gO(a):Id(0);let u=(s.left+l.x)/o.x,d=(s.top+l.y)/o.y,h=s.width/o.x,p=s.height/o.y;if(a&&r){const x=Io(a),y=Du(r)?Io(r):r;let v=x,_=Rj(v);for(;_&&y!==v;){const M=vx(_),S=_.getBoundingClientRect(),A=ku(_),E=S.left+(_.clientLeft+parseFloat(A.paddingLeft))*M.x,C=S.top+(_.clientTop+parseFloat(A.paddingTop))*M.y;u*=M.x,d*=M.y,h*=M.x,p*=M.y,u+=E,d+=C,v=Io(_),_=Rj(v)}}return b_({width:h,height:p,x:u,y:d})}function qM(n,e){const t=XM(n).scrollLeft;return e?e.left+t:lp($d(n)).left+t}function xO(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-qM(n,t),s=t.top+e.scrollTop;return{x:r,y:s}}function Q$(n){let{elements:e,rect:t,offsetParent:r,strategy:s}=n;const a=s==="fixed",o=$d(r),l=e?$M(e.floating):!1;if(r===o||l&&a)return t;let u={scrollLeft:0,scrollTop:0},d=Id(1);const h=Id(0),p=Nh(r);if((p||!a)&&((Jx(r)!=="body"||WM(o))&&(u=XM(r)),p)){const y=lp(r);d=vx(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const x=o&&!p&&!a?xO(o,u):Id(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-u.scrollLeft*d.x+h.x+x.x,y:t.y*d.y-u.scrollTop*d.y+h.y+x.y}}function K$(n){return n.getClientRects?Array.from(n.getClientRects()):[]}function J$(n){const e=XM(n),t=n.ownerDocument.body,r=kd(n.scrollWidth,n.clientWidth,t.scrollWidth,t.clientWidth),s=kd(n.scrollHeight,n.clientHeight,t.scrollHeight,t.clientHeight);let a=-e.scrollLeft+qM(n);const o=-e.scrollTop;return ku(t).direction==="rtl"&&(a+=kd(n.clientWidth,t.clientWidth)-r),{width:r,height:s,x:a,y:o}}const Z$=25;function eX(n,e,t){t===void 0&&(t="viewport");const r=t==="layoutViewport",s=Io(n),a=$d(n),o=s.visualViewport;let l=a.clientWidth,u=a.clientHeight,d=0,h=0;if(o){const x=!N2()||e==="fixed";r?x||(d=-o.offsetLeft,h=-o.offsetTop):(l=o.width,u=o.height,x&&(d=o.offsetLeft,h=o.offsetTop))}if(qM(a)<=0){const x=a.ownerDocument,y=x.body,v=getComputedStyle(y),_=x.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,M=Math.abs(a.clientWidth-y.clientWidth-_),S=getComputedStyle(a).scrollbarGutter==="stable both-edges"?M/2:M;S<=Z$&&(l-=S)}return{width:l,height:u,x:d,y:h}}function tX(n,e){const t=lp(n,!0,e==="fixed"),r=t.top+n.clientTop,s=t.left+n.clientLeft,a=vx(n),o=n.clientWidth*a.x,l=n.clientHeight*a.y,u=s*a.x,d=r*a.y;return{width:o,height:l,x:u,y:d}}function ED(n,e,t){let r;if(e==="viewport"||e==="layoutViewport")r=eX(n,t,e);else if(e==="document")r=J$($d(n));else if(Du(e))r=tX(e,t);else{const s=gO(n);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return b_(r)}function nX(n,e){const t=e.get(n);if(t)return t;let r=Iy(n,[],!1).filter(l=>Du(l)&&Jx(l)!=="body"),s=null;const a=ku(n).position==="fixed";let o=a?op(n):n;for(;Du(o)&&!ky(o);){const l=ku(o),u=M2(o),d=s?s.position:a?"fixed":"";!u&&(d==="fixed"||d==="absolute"&&l.position==="static")?r=r.filter(p=>p!==o):s=l,o=op(o)}return e.set(n,r),r}function rX(n){let{element:e,boundary:t,rootBoundary:r,strategy:s}=n;const o=[...t==="clippingAncestors"?$M(e)?[]:nX(e,this._c):[].concat(t),r],l=ED(e,o[0],s);let u=l.top,d=l.right,h=l.bottom,p=l.left;for(let x=1;x<o.length;x++){const y=ED(e,o[x],s);u=kd(y.top,u),d=uh(y.right,d),h=uh(y.bottom,h),p=kd(y.left,p)}return{width:d-p,height:h-u,x:p,y:u}}function sX(n){const{width:e,height:t}=pO(n);return{width:e,height:t}}function iX(n,e,t){const r=Nh(e),s=$d(e),a=t==="fixed",o=lp(n,!0,a,e);let l={scrollLeft:0,scrollTop:0};const u=Id(0);
9if((r||!a)&&((Jx(e)!=="body"||WM(s))&&(l=XM(e)),r)){const x=lp(e,!0,a,e);u.x=x.x+e.clientLeft,u.y=x.y+e.clientTop}!r&&s&&(u.x=qM(s));const d=s&&!r&&!a?xO(s,l):Id(0),h=o.left+l.scrollLeft-u.x-d.x,p=o.top+l.scrollTop-u.y-d.y;return{x:h,y:p,width:o.width,height:o.height}}function cC(n){return ku(n).position==="static"}function jD(n,e){if(!Nh(n)||ku(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return $d(n)===t&&(t=t.ownerDocument.body),t}function bO(n,e){const t=Io(n);if($M(n))return t;if(!Nh(n)){let s=op(n);for(;s&&!ky(s);){if(Du(s)&&!cC(s))return s;s=op(s)}return t}let r=jD(n,e);for(;r&&V$(r)&&cC(r);)r=jD(r,e);return r&&ky(r)&&cC(r)&&!M2(r)?t:r||X$(n)||t}const aX=async function(n){const e=this.getOffsetParent||bO,t=this.getDimensions,r=await t(n.floating);return{reference:iX(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function oX(n){return ku(n).direction==="rtl"}const lX={convertOffsetParentRelativeRectToViewportRelativeRect:Q$,getDocumentElement:$d,getClippingRect:rX,getOffsetParent:bO,getElementRects:aX,getClientRects:K$,getDimensions:sX,getScale:vx,isElement:Du,isRTL:oX};function yO(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function cX(n,e,t){let r=null,s;const a=$d(n);function o(){var h;clearTimeout(s),(h=r)==null||h.disconnect(),r=null}function l(h,p){h===void 0&&(h=!1),p===void 0&&(p=1),o();const x=n.getBoundingClientRect(),{left:y,top:v,width:_,height:M}=x;if(h||e(),!_||!M)return;const S=yw(v),A=yw(a.clientWidth-(y+_)),E=yw(a.clientHeight-(v+M)),C=yw(y),D={rootMargin:-S+"px "+-A+"px "+-E+"px "+-C+"px",threshold:kd(0,uh(1,p))||1};let B=!0;function P(G){const k=G[0].intersectionRatio;if(!yO(x,n.getBoundingClientRect()))return l();if(k!==p){if(!B)return l();k?l(!1,k):s=setTimeout(()=>{l(!1,1e-7)},1e3)}B=!1}try{r=new IntersectionObserver(P,{...D,root:a.ownerDocument})}catch{r=new IntersectionObserver(P,D)}r.observe(n)}const u=Io(n),d=()=>l(t);return u.addEventListener("resize",d),l(!0),()=>{u.removeEventListener("resize",d),o()}}function uX(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=A2(n),h=s||a?[...d?Iy(d):[],...e?Iy(e):[]]:[];h.forEach(S=>{s&&S.addEventListener("scroll",t),a&&S.addEventListener("resize",t)});const p=d&&l?cX(d,t,a):null;let x=-1,y=null;o&&(y=new ResizeObserver(S=>{let[A]=S;A&&A.target===d&&y&&e&&(y.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),t()}),d&&!u&&y.observe(d),e&&y.observe(e));let v,_=u?lp(n):null;u&&M();function M(){const S=lp(n);_&&!yO(_,S)&&t(),_=S,v=requestAnimationFrame(M)}return t(),()=>{var S;h.forEach(A=>{s&&A.removeEventListener("scroll",t),a&&A.removeEventListener("resize",t)}),p?.(),(S=y)==null||S.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const dX=U$,fX=z$,hX=L$,mX=H$,pX=O$,TD=B$,gX=G$,xX=(n,e,t)=>{const r=new Map,s=t??{},a={...lX,...s.platform,_c:r};return I$(n,e,{...s,platform:a})};var bX=typeof document<"u",yX=function(){},HS=bX?T.useLayoutEffect:yX;function y_(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,s;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!y_(n[r],e[r]))return!1;return!0}if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=t;r--!==0;){const a=s[r];if(!(a==="_owner"&&n.$$typeof)&&!y_(n[a],e[a]))return!1}return!0}return n!==n&&e!==e}function vO(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function RD(n,e){const t=vO(n);return Math.round(e*t)/t}function uC(n){const e=T.useRef(n);return HS(()=>{e.current=n}),e}function vX(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:u,open:d}=n,[h,p]=T.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[x,y]=T.useState(r);y_(x,r)||y(r);const[v,_]=T.useState(null),[M,S]=T.useState(null),A=T.useCallback(ae=>{ae!==D.current&&(D.current=ae,_(ae))},[]),E=T.useCallback(ae=>{ae!==B.current&&(B.current=ae,S(ae))},[]),C=a||v,I=o||M,D=T.useRef(null),B=T.useRef(null),P=T.useRef(h),G=u!=null,k=uC(u),V=uC(s),U=uC(d),$=T.useCallback(()=>
9{if(!D.current||!B.current)return;const ae={placement:e,strategy:t,middleware:x};V.current&&(ae.platform=V.current),xX(D.current,B.current,ae).then(oe=>{const re={...oe,isPositioned:U.current!==!1};X.current&&!y_(P.current,re)&&(P.current=re,Yx.flushSync(()=>{p(re)}))})},[x,e,t,V,U]);HS(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,p(ae=>({...ae,isPositioned:!1})))},[d]);const X=T.useRef(!1);HS(()=>(X.current=!0,()=>{X.current=!1}),[]),HS(()=>{if(C&&(D.current=C),I&&(B.current=I),C&&I){if(k.current)return k.current(C,I,$);$()}},[C,I,$,k,G]);const ee=T.useMemo(()=>({reference:D,floating:B,setReference:A,setFloating:E}),[A,E]),z=T.useMemo(()=>({reference:C,floating:I}),[C,I]),K=T.useMemo(()=>{const ae={position:t,left:0,top:0};if(!z.floating)return ae;const oe=RD(z.floating,h.x),re=RD(z.floating,h.y);return l?{...ae,transform:"translate("+oe+"px, "+re+"px)",...vO(z.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:oe,top:re}},[t,l,z.floating,h.x,h.y]);return T.useMemo(()=>({...h,update:$,refs:ee,elements:z,floatingStyles:K}),[h,$,ee,z,K])}const wX=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:s}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?TD({element:r.current,padding:s}).fn(t):{}:r?TD({element:r,padding:s}).fn(t):{}}}},SX=(n,e)=>{const t=dX(n);return{name:t.name,fn:t.fn,options:[n,e]}},_X=(n,e)=>{const t=fX(n);return{name:t.name,fn:t.fn,options:[n,e]}},MX=(n,e)=>({fn:gX(n).fn,options:[n,e]}),NX=(n,e)=>{const t=hX(n);return{name:t.name,fn:t.fn,options:[n,e]}},AX=(n,e)=>{const t=mX(n);return{name:t.name,fn:t.fn,options:[n,e]}},CX=(n,e)=>{const t=pX(n);return{name:t.name,fn:t.fn,options:[n,e]}},EX=(n,e)=>{const t=wX(n);return{name:t.name,fn:t.fn,options:[n,e]}};var jX=Object.defineProperty,TX=(n,e)=>jX(n,"name",{value:e,configurable:!0}),RX=T.forwardRef(TX(function(e,t){const{children:r,width:s=10,height:a=5,...o}=e;return i.jsx(Br.svg,{...o,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),PX=RX,DX=Object.defineProperty,kX=(n,e)=>DX(n,"name",{value:e,configurable:!0});function YM(n){const[e,t]=T.useState(void 0);return fi(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,l;if("borderBoxSize"in a){const u=a.borderBoxSize,d=Array.isArray(u)?u[0]:u;o=d.inlineSize,l=d.blockSize}else o=n.offsetWidth,l=n.offsetHeight;t({width:o,height:l})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}kX(YM,"useSize");var IX=Object.defineProperty,Bd=(n,e)=>IX(n,"name",{value:e,configurable:!0}),wO="Popper",[SO,QM]=zu(wO),[BX,_O]=SO(wO),LX=Bd(n=>{const{__scopePopper:e,children:t}=n,[r,s]=T.useState(null),[a,o]=T.useState(void 0);return i.jsx(BX,{scope:e,anchor:r,onAnchorChange:s,placementState:a,setPlacementState:o,children:t})},"Popper"),OX="PopperAnchor",FX=T.forwardRef(Bd(function(e,t){const{__scopePopper:r,virtualRef:s,...a}=e,o=_O(OX,r),l=T.useRef(null),u=o.onAnchorChange,d=T.useCallback(_=>{l.current=_,_&&u(_)},[u]),h=xr(t,d),p=T.useRef(null);T.useEffect(()=>{if(!s)return;const _=p.current;p.current=s.current,_!==p.current&&u(p.current)});const x=o.placementState&&KM(o.placementState),y=x?.[0],v=x?.[1];return s?null:i.jsx(Br.div,{"data-radix-popper-side":y,"data-radix-popper-align":v,...a,ref:h})},"PopperAnchor")),MO="PopperContent",[UX,zX]=SO(MO),GX=T.forwardRef(Bd(function(e,t){const{__scopePopper:r,side:s="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:v="optimized",onPlaced:_,...M}=e,S=_O(MO,r),[A,E]=T.useState(null),C=xr(t,E),[I,D]=T.useState(null),B=YM(I),P=B?.width??0,G=B?.height??0,k=s+(o!=="center"?"-"+o:""),V=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(h)?h:[h],$=U.length>0,X={padding:V,boundary:U.filter(NO),altBoundary:$},{refs:ee,floatingStyles:z,placement:K,isPositioned:ae,middlewareData:oe}=vX({strategy:"fixed",placement:k,whileElementsMounted:Bd((...me)=>uX(...me,{animationFrame:v==="always"}
9),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[SX({mainAxis:a+G,alignmentAxis:l}),d&&_X({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?MX():void 0,...X}),d&&NX({...X}),AX({...X,apply:Bd(({elements:me,rects:ze,availableWidth:Be,availableHeight:ye})=>{const{width:Le,height:Ce}=ze.reference,Re=me.floating.style;Re.setProperty("--radix-popper-available-width",`${Be}px`),Re.setProperty("--radix-popper-available-height",`${ye}px`),Re.setProperty("--radix-popper-anchor-width",`${Le}px`),Re.setProperty("--radix-popper-anchor-height",`${Ce}px`)},"apply")}),I&&EX({element:I,padding:u}),$X({arrowWidth:P,arrowHeight:G}),y&&CX({strategy:"referenceHidden",...X,boundary:$?X.boundary:void 0})]}),re=S.setPlacementState;fi(()=>(re(K),()=>{re(void 0)}),[K,re]);const[F,O]=KM(K),J=Pu(_);fi(()=>{ae&&J?.()},[ae,J]);const q=oe.arrow?.x,Q=oe.arrow?.y,ne=oe.arrow?.centerOffset!==0,[Z,se]=T.useState();return fi(()=>{A&&se(window.getComputedStyle(A).zIndex)},[A]),i.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:ae?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(" "),...oe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(UX,{scope:r,placedSide:F,placedAlign:O,onArrowChange:D,arrowX:q,arrowY:Q,shouldHideArrow:ne,children:i.jsx(Br.div,{"data-side":F,"data-align":O,...M,ref:C,style:{...M.style,animation:ae?M.style?.animation:"none"}})})})},"PopperContent")),HX="PopperArrow",VX={top:"bottom",right:"left",bottom:"top",left:"right"},WX=T.forwardRef(Bd(function(e,t){const{__scopePopper:r,...s}=e,a=zX(HX,r),o=VX[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(PX,{...s,ref:t,style:{...s.style,display:"block"}})})},"PopperArrow"));function NO(n){return n!==null}Bd(NO,"isNotNull");var $X=Bd(n=>({name:"transformOrigin",options:n,fn(e){const{placement:t,rects:r,middlewareData:s}=e,o=s.arrow?.centerOffset!==0,l=o?0:n.arrowWidth,u=o?0:n.arrowHeight,[d,h]=KM(t),p={start:"0%",center:"50%",end:"100%"}[h],x=(s.arrow?.x??0)+l/2,y=(s.arrow?.y??0)+u/2;let v="",_="";return d==="bottom"?(v=o?p:`${x}px`,_=`${-u}px`):d==="top"?(v=o?p:`${x}px`,_=`${r.floating.height+u}px`):d==="right"?(v=`${-u}px`,_=o?p:`${y}px`):d==="left"&&(v=`${r.floating.width+u}px`,_=o?p:`${y}px`),{data:{x:v,y:_}}}}),"transformOrigin");function KM(n){const[e,t="center"]=n.split("-");return[e,t]}Bd(KM,"getSideAndAlignFromPlacement");var AO=LX,CO=FX,EO=GX,XX=WX,qX=Object.defineProperty,YX=(n,e)=>qX(n,"name",{value:e,configurable:!0}),C2=T.forwardRef(YX(function(e,t){const{container:r,...s}=e,[a,o]=T.useState(!1);fi(()=>o(!0),[]);const l=r||a&&globalThis?.document?.body;return l?Yx.createPortal(i.jsx(Br.div,{...s,ref:t}),l):null},"Portal")),QX=Object.defineProperty,zd=(n,e)=>QX(n,"name",{value:e,configurable:!0});function jO(n,e){return T.useReducer((t,r)=>e[t][r]??t,n)}zd(jO,"useStateMachine");var Zx=zd(n=>{const{present:e,children:t}=n,r=TO(e),s=typeof t=="function"?t({present:r.isPresent}):T.Children.only(t),a=RO(r.ref,PO(s));return typeof t=="function"||r.isPresent?T.cloneElement(s,{ref:a}):null},"Presence");function TO(n){const[e,t]=T.useState(),r=T.useRef(null),s=T.useRef(n),a=T.useRef("none"),o=T.useRef(void 0),l=n?"mounted":"unmounted",[u,d]=jO(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{u==="mounted"?(a.current=o.current??dx(r.current),o.current=void 0):a.current="none"},[u]),fi(()=>{const h=r.current,p=s.current;if(p!==n){const y=a.current,v=dx(h);n?(o.current=v,d("MOUNT")):v==="none"||h?.display==="none"?d("UNMOUNT"):d(p&&y!==v?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,d]),fi(()=>
9{if(e){let h;const p=e.ownerDocument.defaultView??window,x=zd(v=>{const M=dx(r.current).includes(CSS.escape(v.animationName));if(v.target===e&&M&&(d("ANIMATION_END"),!s.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",h=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},"handleAnimationEnd"),y=zd(v=>{v.target===e&&(a.current=dx(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",x),e.addEventListener("animationend",x),()=>{p.clearTimeout(h),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",x),e.removeEventListener("animationend",x)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:T.useCallback(h=>{if(h){const p=getComputedStyle(h);r.current=p,o.current=dx(p)}else r.current=null;t(h)},[])}}zd(TO,"usePresence");function Pj(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}zd(Pj,"setRef");function RO(...n){const e=T.useRef(n);return e.current=n,T.useCallback(t=>{const r=e.current;let s=!1;const a=r.map(o=>{const l=Pj(o,t);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let o=0;o<a.length;o++){const l=a[o];typeof l=="function"?l():Pj(r[o],null)}}},[])}zd(RO,"useStableComposedRefs");function dx(n){return n?.animationName||"none"}zd(dx,"getAnimationName");function PO(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}zd(PO,"getElementRef");var KX=Object.defineProperty,JX=(n,e)=>KX(n,"name",{value:e,configurable:!0}),PD=_h[" useEffectEvent ".trim().toString()],DD=_h[" useInsertionEffect ".trim().toString()];function DO(n){if(typeof PD=="function")return PD(n);const e=T.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof DD=="function"?DD(()=>{e.current=n}):fi(()=>{e.current=n}),T.useMemo(()=>((...t)=>e.current?.(...t)),[])}JX(DO,"useEffectEvent");var ZX=Object.defineProperty,hv=(n,e)=>ZX(n,"name",{value:e,configurable:!0}),eq=_h[" useInsertionEffect ".trim().toString()]||fi;function cp({prop:n,defaultProp:e,onChange:t=hv(()=>{},"onChange"),caller:r}){const[s,a,o]=kO({defaultProp:e,onChange:t}),l=n!==void 0,u=l?n:s,d=T.useCallback(h=>{if(l){const p=IO(h)?h(n):h;p!==n&&o.current?.(p)}else a(h)},[l,n,a,o]);return[u,d]}hv(cp,"useControllableState");function kO({defaultProp:n,onChange:e}){const[t,r]=T.useState(n),s=T.useRef(t),a=T.useRef(e);return eq(()=>{a.current=e},[e]),T.useEffect(()=>{s.current!==t&&(a.current?.(t),s.current=t)},[t,s]),[t,r,a]}hv(kO,"useUncontrolledState");function IO(n){return typeof n=="function"}hv(IO,"isFunction");var kD=Symbol("RADIX:SYNC_STATE");function tq(n,e,t,r){const{prop:s,defaultProp:a,onChange:o,caller:l}=e,u=s!==void 0,d=DO(o),h=[{...t,state:a}];r&&h.push(r);const[p,x]=T.useReducer((M,S)=>{if(S.type===kD)return{...M,state:S.state};const A=n(M,S);return u&&!Object.is(A.state,M.state)&&d(A.state),A},...h),y=p.state,v=T.useRef(y);T.useEffect(()=>{v.current!==y&&(v.current=y,u||d(y))},[y,v,u]);const _=T.useMemo(()=>s!==void 0?{...p,state:s}:p,[p,s]);return T.useEffect(()=>{u&&!Object.is(s,p.state)&&x({type:kD,state:s})},[s,p.state,u]),[_,x]}hv(tq,"useControllableStateReducer");var nq=Object.defineProperty,rq=(n,e)=>nq(n,"name",{value:e,configurable:!0}),BO=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),sq=T.forwardRef(rq(function(e,t){return i.jsx(Br.span,{...e,ref:t,style:{...BO,...e.style}})},"VisuallyHidden")),iq=sq,aq=Object.defineProperty,Li=(n,e)=>aq(n,"name",{value:e,configurable:!0}),[E2,dbe]=zu("Tooltip",[QM]),JM=QM(),oq="TooltipProvider",lq=700,Dj="tooltip.open",[cq,j2]=E2(oq),uq=Li(n=>{const{__scopeTooltip:e,delayDuration:t=lq,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:a}=n,o=T.useRef(!0),l=T.useRef(!1),u=T.useRef(0);return T.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),i.jsx(cq,{scope:e,isOpenDelayedRef:o,delayDuration:t,onOpen:T.useCallback(()=>{r<=0||(window.clearTimeout(u.current),o.current=!1)},[r]),onClose:T.useCallback(()=>{r<=0||(window.clearTimeout(u.current),u.current=window.setTimeout(()=>
9o.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:T.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:a})},"TooltipProvider"),kj="Tooltip",[dq,mv]=E2(kj),fq=Li(n=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:s,onOpenChange:a,disableHoverableContent:o,delayDuration:l}=n,u=j2(kj,n.__scopeTooltip),d=JM(e),[h,p]=T.useState(null),[x,y]=T.useState(void 0),v=Ym(),_=T.useRef(0),M=o??u.disableHoverableContent,S=l??u.delayDuration,A=T.useRef(!1),[E,C]=cp({prop:r,defaultProp:s??!1,onChange:Li(k=>{k?(u.onOpen(),document.dispatchEvent(new CustomEvent(Dj))):u.onClose(),a?.(k)},"onChange"),caller:kj}),I=T.useMemo(()=>E?A.current?"delayed-open":"instant-open":"closed",[E]),D=T.useCallback(()=>{window.clearTimeout(_.current),_.current=0,A.current=!1,C(!0)},[C]),B=T.useCallback(()=>{window.clearTimeout(_.current),_.current=0,C(!1)},[C]),P=T.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{A.current=!0,C(!0),_.current=0},S)},[S,C]);T.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]);const G=x??v;return i.jsx(AO,{...d,children:i.jsx(dq,{scope:e,contentId:G,setContentId:y,open:E,stateAttribute:I,trigger:h,onTriggerChange:p,onTriggerEnter:T.useCallback(()=>{u.isOpenDelayedRef.current?P():D()},[u.isOpenDelayedRef,P,D]),onTriggerLeave:T.useCallback(()=>{M?B():(window.clearTimeout(_.current),_.current=0)},[B,M]),onOpen:D,onClose:B,disableHoverableContent:M,children:t})})},"Tooltip"),ID="TooltipTrigger",hq=T.forwardRef(Li(function(e,t){const{__scopeTooltip:r,...s}=e,a=mv(ID,r),o=j2(ID,r),l=JM(r),u=T.useRef(null),d=xr(t,u,a.onTriggerChange),h=T.useRef(!1),p=T.useRef(!1),x=T.useCallback(()=>h.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),i.jsx(CO,{asChild:!0,...l,children:i.jsx(Br.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:d,onPointerMove:Jn(e.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),p.current=!0)}),onPointerLeave:Jn(e.onPointerLeave,()=>{a.onTriggerLeave(),p.current=!1}),onPointerDown:Jn(e.onPointerDown,()=>{a.open&&a.onClose(),h.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:Jn(e.onFocus,()=>{h.current||a.onOpen()}),onBlur:Jn(e.onBlur,a.onClose),onClick:Jn(e.onClick,a.onClose)})})},"TooltipTrigger")),LO="TooltipPortal",[mq,pq]=E2(LO,{forceMount:void 0}),gq=Li(n=>{const{__scopeTooltip:e,forceMount:t,children:r,container:s}=n,a=mv(LO,e);return i.jsx(mq,{scope:e,forceMount:t,children:i.jsx(Zx,{present:t||a.open,children:i.jsx(C2,{asChild:!0,container:s,children:r})})})},"TooltipPortal"),By="TooltipContent",xq=T.forwardRef(Li(function(e,t){const r=pq(By,e.__scopeTooltip),{forceMount:s=r.forceMount,side:a="top",...o}=e,l=mv(By,e.__scopeTooltip);return i.jsx(Zx,{present:s||l.open,children:l.disableHoverableContent?i.jsx(OO,{side:a,...o,ref:t}):i.jsx(bq,{side:a,...o,ref:t})})},"TooltipContent")),bq=T.forwardRef(Li(function(e,t){const r=mv(By,e.__scopeTooltip),s=j2(By,e.__scopeTooltip),a=T.useRef(null),o=xr(t,a),[l,u]=T.useState(null),{trigger:d,onClose:h}=r,p=a.current,{onPointerInTransitChange:x}=s,y=T.useCallback(()=>{u(null),x(!1)},[x]),v=T.useCallback((_,M)=>{const S=_.currentTarget,A={x:_.clientX,y:_.clientY},E=FO(A,S.getBoundingClientRect()),C=UO(A,E),I=zO(M.getBoundingClientRect()),D=HO([...C,...I]);u(D),x(!0)},[x]);return T.useEffect(()=>()=>y(),[y]),T.useEffect(()=>{if(d&&p){const _=Li(S=>v(S,p),"handleTriggerLeave"),M=Li(S=>v(S,d),"handleContentLeave");return d.addEventListener("pointerleave",_),p.addEventListener("pointerleave",M),()=>{d.removeEventListener("pointerleave",_),p.removeEventListener("pointerleave",M)}}},[d,p,v,y]),T.useEffect(()=>{if(l){const _=Li(M=>{const S=M.target,A={x:M.clientX,y:M.clientY},E=d?.contains(S)||p?.contains(S),C=!GO(A,l);E?y():C&&(y(),h())},"handleTrackPointerGrace");return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[d,p,l,h,y]),i.jsx(OO,{...e,ref:o})},"TooltipContentHoverable")),yq=eO("TooltipContent"),OO=T.forwardRef(Li(function(e,t){const{__scopeTooltip:r,children:s,"aria-label":a,id:o,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=mv(By,r),p=JM(r),{onClose:x}=h;T.useEffect(()=>
9(document.addEventListener(Dj,x),()=>document.removeEventListener(Dj,x)),[x]),T.useEffect(()=>{if(h.trigger){const v=Li(_=>{_.target instanceof Node&&_.target.contains(h.trigger)&&x()},"handleScroll");return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[h.trigger,x]);const{setContentId:y}=h;return fi(()=>(y(o),()=>{y(void 0)}),[o,y]),i.jsx(y2,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:i.jsxs(EO,{"data-state":h.stateAttribute,role:a?void 0:"tooltip",id:a?void 0:h.contentId,...p,...d,ref:t,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(yq,{children:s}),a?i.jsx(iq,{id:h.contentId,role:"tooltip",children:a}):null]})})},"TooltipContentImpl")),vq=T.forwardRef(Li(function(e,t){const{__scopeTooltip:r,...s}=e,a=JM(r);return i.jsx(XX,{...a,...s,ref:t})},"TooltipArrow"));function FO(n,e){const t=Math.abs(e.top-n.y),r=Math.abs(e.bottom-n.y),s=Math.abs(e.right-n.x),a=Math.abs(e.left-n.x);switch(Math.min(t,r,s,a)){case a:return"left";case s:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Li(FO,"getExitSideFromRect");function UO(n,e,t=5){const r=[];switch(e){case"top":r.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":r.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":r.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":r.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return r}Li(UO,"getPaddedExitPoints");function zO(n){const{top:e,right:t,bottom:r,left:s}=n;return[{x:s,y:e},{x:t,y:e},{x:t,y:r},{x:s,y:r}]}Li(zO,"getPointsFromRect");function GO(n,e){const{x:t,y:r}=n;let s=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){const l=e[a],u=e[o],d=l.x,h=l.y,p=u.x,x=u.y;h>r!=x>r&&t<(p-d)*(r-h)/(x-h)+d&&(s=!s)}return s}Li(GO,"isPointInPolygon");function HO(n){const e=n.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),VO(e)}Li(HO,"getHull");function VO(n){if(n.length<=1)return n.slice();const e=[];for(let r=0;r<n.length;r++){const s=n[r];for(;e.length>=2;){const a=e[e.length-1],o=e[e.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const t=[];for(let r=n.length-1;r>=0;r--){const s=n[r];for(;t.length>=2;){const a=t[t.length-1],o=t[t.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}Li(VO,"getHullPresorted");var wq=uq,Sq=fq,_q=hq,Mq=gq,Nq=xq,Aq=vq;function WO(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=WO(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function $O(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=WO(n))&&(r&&(r+=" "),r+=e);return r}const Cq=(n,e)=>{const t=new Array(n.length+e.length);for(let r=0;r<n.length;r++)t[r]=n[r];for(let r=0;r<e.length;r++)t[n.length+r]=e[r];return t},Eq=(n,e)=>({classGroupId:n,validator:e}),XO=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),v_="-",BD=[],jq="arbitrary..",Tq=n=>{const e=Pq(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Rq(o);const l=o.split(v_),u=l[0]===""&&l.length>1?1:0;return qO(l,u,e)},getConflictingClassGroupIds:(o,l)=>{if(l){const u=r[o],d=t[o];return u?d?Cq(d,u):u:d||BD}return t[o]||BD}}},qO=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const s=n[e],a=t.nextPart.get(s);if(a){const d=qO(n,e+1,a);if(d)return d}const o=t.validators;if(o===null)return;const l=e===0?n.join(v_):n.slice(e).join(v_),u=o.length;for(let d=0;d<u;d++){const h=o[d];if(h.validator(l))return h.classGroupId}},Rq=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),r=e.slice(0,t);return r?jq+r:void 0})(),Pq=n=>{const{theme:e,classGroups:t}=n;return Dq(t,e)},Dq=(n,e)=>{const t=XO();for(const r in n){const s=n[r];T2(s,t,r,e)}return t},T2=(n,e,t,r)=>{const s=n.length;for(let a=0;a<s;a++){const o=n[a];kq(o,e,t,r)}}
vendor: 4,895 bytes, line 9
9,kq=(n,e,t,r)=>{if(typeof n=="string"){Iq(n,e,t);return}if(typeof n=="function"){Bq(n,e,t,r);return}Lq(n,e,t,r)},Iq=(n,e,t)=>{const r=n===""?e:YO(e,n);r.classGroupId=t},Bq=(n,e,t,r)=>{if(Oq(n)){T2(n(r),e,t,r);return}e.validators===null&&(e.validators=[]),e.validators.push(Eq(t,n))},Lq=(n,e,t,r)=>{const s=Object.entries(n),a=s.length;for(let o=0;o<a;o++){const[l,u]=s[o];T2(u,YO(e,l),t,r)}},YO=(n,e)=>{let t=n;const r=e.split(v_),s=r.length;for(let a=0;a<s;a++){const o=r[a];let l=t.nextPart.get(o);l||(l=XO(),t.nextPart.set(o,l)),t=l}return t},Oq=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,Fq=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),r=Object.create(null);const s=(a,o)=>{t[a]=o,e++,e>n&&(e=0,r=t,t=Object.create(null))};return{get(a){let o=t[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in t?t[a]=o:s(a,o)}}},Ij="!",LD=":",Uq=[],OD=(n,e,t,r,s)=>({modifiers:n,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:r,isExternal:s}),zq=n=>{const{prefix:e,experimentalParseClassName:t}=n;let r=s=>{const a=[];let o=0,l=0,u=0,d;const h=s.length;for(let _=0;_<h;_++){const M=s[_];if(o===0&&l===0){if(M===LD){a.push(s.slice(u,_)),u=_+1;continue}if(M==="/"){d=_;continue}}M==="["?o++:M==="]"?o--:M==="("?l++:M===")"&&l--}const p=a.length===0?s:s.slice(u);let x=p,y=!1;p.endsWith(Ij)?(x=p.slice(0,-1),y=!0):p.startsWith(Ij)&&(x=p.slice(1),y=!0);const v=d&&d>u?d-u:void 0;return OD(a,y,x,v)};if(e){const s=e+LD,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):OD(Uq,!1,o,void 0,!0)}if(t){const s=r;r=a=>t({className:a,parseClassName:s})}return r},Gq=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((t,r)=>{e.set(t,1e6+r)}),t=>{const r=[];let s=[];for(let a=0;a<t.length;a++){const o=t[a],l=o[0]==="[",u=e.has(o);l||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},Hq=n=>({cache:Fq(n.cacheSize),parseClassName:zq(n),sortModifiers:Gq(n),postfixLookupClassGroupIds:Vq(n),...Tq(n)}),Vq=n=>{const e=Object.create(null),t=n.postfixLookupClassGroups;if(t)for(let r=0;r<t.length;r++)e[t[r]]=!0;return e},Wq=/\s+/,$q=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a,postfixLookupClassGroupIds:o}=e,l=[],u=n.trim().split(Wq);let d="";for(let h=u.length-1;h>=0;h-=1){const p=u[h],{isExternal:x,modifiers:y,hasImportantModifier:v,baseClassName:_,maybePostfixModifierPosition:M}=t(p);if(x){d=p+(d.length>0?" "+d:d);continue}let S=!!M,A;if(S){const B=_.substring(0,M);A=r(B);const P=A&&o[A]?r(_):void 0;P&&P!==A&&(A=P,S=!1)}else A=r(_);if(!A){if(!S){d=p+(d.length>0?" "+d:d);continue}if(A=r(_),!A){d=p+(d.length>0?" "+d:d);continue}S=!1}const E=y.length===0?"":y.length===1?y[0]:a(y).join(":"),C=v?E+Ij:E,I=C+A;if(l.indexOf(I)>-1)continue;l.push(I);const D=s(A,S);for(let B=0;B<D.length;++B){const P=D[B];l.push(C+P)}d=p+(d.length>0?" "+d:d)}return d},Xq=(...n)=>{let e=0,t,r,s="";for(;e<n.length;)(t=n[e++])&&(r=QO(t))&&(s&&(s+=" "),s+=r);return s},QO=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=QO(n[r]))&&(t&&(t+=" "),t+=e);return t},qq=(n,...e)=>{let t,r,s,a;const o=u=>{const d=e.reduce((h,p)=>p(h),n());return t=Hq(d),r=t.cache.get,s=t.cache.set,a=l,l(u)},l=u=>{const d=r(u);if(d)return d;const h=$q(u,t);return s(u,h),h};return a=o,(...u)=>a(Xq(...u))},Yq=[],Ii=n=>{const e=t=>t[n]||Yq;return e.isThemeGetter=!0,e},KO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,JO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Qq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Kq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Zq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,eY=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tY=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bf=n=>Qq.test(n),ar=n=>!!n&&!Number.isNaN(Number(n)),hu=n=>!!n&&Number.isInteger(Number(n)),dC=n=>n.endsWith("%")&&ar(n.slice(0,-1)),xd=n=>Kq.test(n),ZO=()=>!0,nY=n=>Jq.test(n)&&!Zq.test(n),R2=()=>!1,rY=n=>eY.test(n),sY=n=>tY.test(n),iY=n=>!rn(n)&&!sn(n),aY=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),oY=n=>Ah(n,nF,R2),rn=n=>KO.test(n),hm=n=>Ah(n,rF,nY),FD=n=>Ah(n,pY,ar),lY=n=>Ah(n,iF,ZO),cY=n=>Ah(n,sF,R2),UD=n=>Ah(n,eF,R2),uY=n=>Ah(n,tF,sY),vw=n=>Ah(n,aF,rY),sn=n=>JO.test(n),Rb=n=>Mp(n,rF),dY=n=>Mp(n,sF),zD=n=>Mp(n,eF),fY=n=>Mp(n,nF),hY=n=>Mp(n,tF),ww=n=>Mp(n,aF,!0),mY=n=>Mp(n,iF,!0),Ah=(n,e,t)=>{const r=KO.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},Mp=(n,e,t=!1)=>{const r=JO.exec(n);return r?r[1]?e(r[1]):t:!1},eF=n=>n==="position"||n==="percentage",tF=n=>n==="image"||n==="url",nF=n=>n==="length"||n==="size"||n==="bg-size",rF=n=>
vendor: 8,847 bytes, line 9
9n==="length",pY=n=>n==="number",sF=n=>n==="family-name",iF=n=>n==="number"||n==="weight",aF=n=>n==="shadow",gY=()=>{const n=Ii("color"),e=Ii("font"),t=Ii("text"),r=Ii("font-weight"),s=Ii("tracking"),a=Ii("leading"),o=Ii("breakpoint"),l=Ii("container"),u=Ii("spacing"),d=Ii("radius"),h=Ii("shadow"),p=Ii("inset-shadow"),x=Ii("text-shadow"),y=Ii("drop-shadow"),v=Ii("blur"),_=Ii("perspective"),M=Ii("aspect"),S=Ii("ease"),A=Ii("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...C(),sn,rn],D=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],P=()=>[sn,rn,u],G=()=>[Bf,"full","auto",...P()],k=()=>[hu,"none","subgrid",sn,rn],V=()=>["auto",{span:["full",hu,sn,rn]},hu,sn,rn],U=()=>[hu,"auto",sn,rn],$=()=>["auto","min","max","fr",sn,rn],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...P()],K=()=>[Bf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],ae=()=>[Bf,"screen","full","dvw","lvw","svw","min","max","fit",...P()],oe=()=>[Bf,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],re=()=>[n,sn,rn],F=()=>[...C(),zD,UD,{position:[sn,rn]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",fY,oY,{size:[sn,rn]}],q=()=>[dC,Rb,hm],Q=()=>["","none","full",d,sn,rn],ne=()=>["",ar,Rb,hm],Z=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[ar,dC,zD,UD],ze=()=>["","none",v,sn,rn],Be=()=>["none",ar,sn,rn],ye=()=>["none",ar,sn,rn],Le=()=>[ar,sn,rn],Ce=()=>[Bf,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xd],breakpoint:[xd],color:[ZO],container:[xd],"drop-shadow":[xd],ease:["in","out","in-out"],font:[iY],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xd],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xd],shadow:[xd],spacing:["px",ar],text:[xd],"text-shadow":[xd],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bf,rn,sn,M]}],container:["container"],"container-type":[{"@container":["","normal","size",sn,rn]}],"container-named":[aY],columns:[{columns:[ar,rn,sn,l]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{"inset-s":G(),start:G()}],end:[{"inset-e":G(),end:G()}],"inset-bs":[{"inset-bs":G()}],"inset-be":[{"inset-be":G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[hu,"auto",sn,rn]}],basis:[{basis:[Bf,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ar,Bf,"auto","initial","none",rn]}],grow:[{grow:["",ar,sn,rn]}],shrink:[{shrink:["",ar,sn,rn]}],order:[{order:[hu,"first","last","none",sn,rn]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...ae()]}],"min-inline-size":[{"min-inline":["auto",...ae()]}],"max-inline-size":[{"max-inline":["none",...ae()]}],"block-size":[{block:["auto",...oe()]}],"min-block-size":[{"min-block":["auto",...oe()]}],"max-block-size":[{"max-block":["none",...oe()]}],w:[{w:[l,"screen",...K()]}],"min-w":[{"min-w":[l,"screen","none",...K()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",t,Rb,hm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,mY,lY]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dC,rn]}],"font-family":[{font:[dY,cY,e]}],"font-features":[{"font-features":[rn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,sn,rn]}],"line-clamp":[{"line-clamp":[ar,"none",sn,FD]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",sn,rn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",sn,rn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:re()}],"text-color":[{text:re()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[ar,"from-font","auto",sn,hm]}],"text-decoration-color":[{decoration:re()}],"underline-offset":[{"underline-offset":[ar,"auto",sn,rn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"tab-size":[{tab:[hu,sn,rn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",sn,rn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",sn,rn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hu,sn,rn],radial:["",sn,rn],conic:[hu,sn,rn]},hY,uY]}],"bg-color":[{bg:re()}],"gradient-from-pos":[{from:q()}
vendor: 7,450 bytes, line 9
9],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:re()}],"gradient-via":[{via:re()}],"gradient-to":[{to:re()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:re()}],"border-color-x":[{"border-x":re()}],"border-color-y":[{"border-y":re()}],"border-color-s":[{"border-s":re()}],"border-color-e":[{"border-e":re()}],"border-color-bs":[{"border-bs":re()}],"border-color-be":[{"border-be":re()}],"border-color-t":[{"border-t":re()}],"border-color-r":[{"border-r":re()}],"border-color-b":[{"border-b":re()}],"border-color-l":[{"border-l":re()}],"divide-color":[{divide:re()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ar,sn,rn]}],"outline-w":[{outline:["",ar,Rb,hm]}],"outline-color":[{outline:re()}],shadow:[{shadow:["","none",h,ww,vw]}],"shadow-color":[{shadow:re()}],"inset-shadow":[{"inset-shadow":["none",p,ww,vw]}],"inset-shadow-color":[{"inset-shadow":re()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:re()}],"ring-offset-w":[{"ring-offset":[ar,hm]}],"ring-offset-color":[{"ring-offset":re()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":re()}],"text-shadow":[{"text-shadow":["none",x,ww,vw]}],"text-shadow-color":[{"text-shadow":re()}],opacity:[{opacity:[ar,sn,rn]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ar]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":re()}],"mask-image-linear-to-color":[{"mask-linear-to":re()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":re()}],"mask-image-t-to-color":[{"mask-t-to":re()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":re()}],"mask-image-r-to-color":[{"mask-r-to":re()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":re()}],"mask-image-b-to-color":[{"mask-b-to":re()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":re()}],"mask-image-l-to-color":[{"mask-l-to":re()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":re()}],"mask-image-x-to-color":[{"mask-x-to":re()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":re()}],"mask-image-y-to-color":[{"mask-y-to":re()}],"mask-image-radial":[{"mask-radial":[sn,rn]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":re()}],"mask-image-radial-to-color":[{"mask-radial-to":re()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[ar]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":re()}],"mask-image-conic-to-color":[{"mask-conic-to":re()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",sn,rn]}],filter:[{filter:["","none",sn,rn]}],blur:[{blur:ze()}],brightness:[{brightness:[ar,sn,rn]}],contrast:[{contrast:[ar,sn,rn]}],"drop-shadow":[{"drop-shadow":["","none",y,ww,vw]}],"drop-shadow-color":[{"drop-shadow":re()}],grayscale:[{grayscale:["",ar,sn,rn]}],"hue-rotate":[{"hue-rotate":[ar,sn,rn]}],invert:[{invert:["",ar,sn,rn]}],saturate:[{saturate:[ar,sn,rn]}],sepia:[{sepia:["",ar,sn,rn]}],"backdrop-filter":[{"backdrop-filter":["","none",sn,rn]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[ar,sn,rn]}],"backdrop-contrast":[{"backdrop-contrast":[ar,sn,rn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ar,sn,rn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ar,sn,rn]}],"backdrop-invert":[{"backdrop-invert":["",ar,sn,rn]}],"backdrop-opacity":[{"backdrop-opacity":[ar,sn,rn]}],"backdrop-saturate":[{"backdrop-saturate":[ar,sn,rn]}],"backdrop-sepia":[{"backdrop-sepia":["",ar,sn,rn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",sn,rn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ar,"initial",sn,rn]}],ease:[{ease:["linear","initial",S,sn,rn]}],delay:[{delay:[ar,sn,rn]}],animate:[{animate:["none",A,sn,rn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,sn,rn]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[sn,rn,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],zoom:[{zoom:[hu,sn,rn]}],accent:[{accent:re()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:re()}
vendor: 5,749 bytes, line 9
9],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",sn,rn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":re()}],"scrollbar-track-color":[{"scrollbar-track":re()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",sn,rn]}],fill:[{fill:["none",...re()]}],"stroke-w":[{stroke:[ar,Rb,hm,FD]}],stroke:[{stroke:["none",...re()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},xY=qq(gY);function br(...n){return xY($O(n))}function ZM({delayDuration:n=0,...e}){return i.jsx(wq,{"data-slot":"tooltip-provider",delayDuration:n,...e})}function bc({...n}){return i.jsx(ZM,{children:i.jsx(Sq,{"data-slot":"tooltip",...n})})}function yc({...n}){return i.jsx(_q,{"data-slot":"tooltip-trigger",...n})}function vc({className:n,sideOffset:e=0,children:t,...r}){return i.jsx(Mq,{children:i.jsxs(Nq,{"data-slot":"tooltip-content",sideOffset:e,className:br("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
9de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",n),...r,children:[t,i.jsx(Aq,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const GD=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,HD=$O,oF=(n,e)=>t=>{var r;if(e?.variants==null)return HD(n,t?.class,t?.className);const{variants:s,defaultVariants:a}=e,o=Object.keys(s).map(d=>{const h=t?.[d],p=a?.[d];if(h===null)return null;const x=GD(h)||GD(p);return s[d][x]}),l=t&&Object.entries(t).reduce((d,h)=>{let[p,x]=h;return x===void 0||(d[p]=x),d},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:p,className:x,...y}=h;return Object.entries(y).every(v=>{let[_,M]=v;return Array.isArray(M)?M.includes({...a,...l}[_]):{...a,...l}[_]===M})?[...d,p,x]:d},[]);return HD(n,o,u,t?.class,t?.className)},P2=oF("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-transparent shadow-xs hover:bg-accent dark:bg-transparent dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ke({className:n,variant:e,size:t,asChild:r=!1,...s}){const a=r?JL:"button";return i.jsx(a,{"data-slot":"button",className:br(P2({variant:e,size:t,className:n})),...s})}function bn({className:n,...e}){return i.jsx("div",{"data-slot":"card",className:br("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function bY({className:n,...e}){return i.jsx("div",{"data-slot":"card-content",className:br("px-6",n),...e})}const yY=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lF=(...n)=>n.filter((e,t,r)=>!!e&&r.indexOf(e)===t).join(" ");var vY={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const wY=T.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...l},u)=>T.createElement("svg",{ref:u,...vY,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:lF("lucide",s),...l},[...o.map(([d,h])=>T.createElement(d,h)),...Array.isArray(a)?a:[a]]));const yt=(n,e)=>{const t=T.forwardRef(({className:r,...s},a)=>T.createElement(wY,{ref:a,iconNode:e,className:lF(`lucide-${yY(n)}`,r),...s}));return t.displayName=`${n}`,t};const SY=yt("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const _Y=yt("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const MY=yt("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const cF=yt("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);const NY=yt("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const VD=yt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Ly=yt("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);const D2=yt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const uF=yt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);const AY=yt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const CY=yt("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);const EY=yt("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);const jY=yt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const Bj=yt("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);const TY=yt("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);const fh=yt("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}
9],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);const Lj=yt("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);const w_=yt("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const S_=yt("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);const jx=yt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const dF=yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Qm=yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const WD=yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const RY=yt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const PY=yt("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const DY=yt("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);const kY=yt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const IY=yt("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);const BY=yt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const $D=yt("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const uy=yt("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);const VS=yt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const fF=yt("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);const k2=yt("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);const Oj=yt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const LY=yt("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);const Fj=yt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const jc=yt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Vl=yt("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);const Uj=yt("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);const zj=yt("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);const OY=yt("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);const FY=yt("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const Ki=yt("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const WS=yt("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);const UY=yt("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);const eN=yt("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const __=yt("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const XD=yt("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);const zY=yt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const hF=yt("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);const Gj=yt("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}
9]]);const mF=yt("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);const GY=yt("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);const tN=yt("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const HY=yt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const VY=yt("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const Hj=yt("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);const dy=yt("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);const nN=yt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);const qD=yt("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);const YD=yt("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const WY=yt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const $Y=yt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const XY=yt("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const rN=yt("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);const I2=yt("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);const qY=yt("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);const B2=yt("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const YY=yt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);const Cu=yt("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const QY=yt("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const KY=yt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const Vj=yt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const QD=yt("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.5
979 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);const JY=yt("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);const ZY=yt("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);const ma=yt("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const eQ=yt("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);const KD=yt("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);const pF=yt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);const tQ=yt("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);const hh=yt("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const sN=yt("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);const nQ=yt("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);const L2=yt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const Nn=yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const nl=yt("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);const JD=yt("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);const ZD=yt("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);const rQ=yt("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);const sQ=yt("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);const gF=yt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const iQ=yt("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}
9],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);const Km=yt("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const Sw=yt("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);const si=yt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const ek=yt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const aQ=yt("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);const oQ=yt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const tk=yt("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const xF=yt("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const lQ=yt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const cQ=yt("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);const uQ=yt("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);const nk=yt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const dQ=yt("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const M_=yt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const Wj=yt("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);const iN=yt("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);const $j=yt("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const bF=yt("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);const Ar=yt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
9],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const yF=yt("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);const aN=yt("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);const up=yt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const O2=yt("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);const vF=yt("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);const F2=yt("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const fQ=yt("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);const hQ=yt("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const mQ=yt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const _c=yt("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);const N_=yt("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);const Jb=yt("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);const wF=yt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const Mr=yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const pQ=yt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function gQ(n,e){if(n instanceof RegExp)return{keys:!1,pattern:n};var t,r,s,a,o=[],l="",u=n.split("/");for(u[0]||u.shift();s=u.shift();)t=s[0],t==="*"?(o.push(t),l+=s[1]==="?"?"(?:/(.*))?":"/(.*)"):t===":"?(r=s.indexOf("?",1),a=s.indexOf(".",1),o.push(s.substring(1,~r?r:~a?a:s.length)),l+=~r&&!~a?"(?:/([^/]+?))?":"/([^/]+?)",~a&&(l+=(~r?"?":"")+"\\"+s.substring(a))):l+="/"+s;return{keys:o,pattern:new RegExp("^"+l+(e?"(?=$|/)":"/?$"),"i")}}var fC={exports:{}},hC={};var rk;function xQ(){if(rk)return hC;rk=1;var n=lv();function e(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,s=n.useEffect,a=n.useLayoutEffect,o=n.useDebugValue;function l(p,x){var y=x(),v=r({inst:{value:y,getSnapshot:x}}),_=v[0].inst,M=v[1];return a(function(){_.value=y,_.getSnapshot=x,u(_)&&M({inst:_})},[p,y,x]),s(function(){return u(_)&&M({inst:_}),p(function(){u(_)&&M({inst:_})})},[p]),o(y),y}function u(p){var x=p.getSnapshot;p=p.value;try{var y=x();return!t(p,y)}catch{return!0}}function d(p,x){return x()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return hC.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:h,hC}var sk;function SF(){return sk||(sk=1,fC.exports=xQ()),fC.exports}var bQ=SF();const yQ=_h.useInsertionEffect,vQ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wQ=vQ?T.useLayoutEffect:T.useEffect,SQ=yQ||wQ,_F=n=>{const e=T.useRef([n,(...t)=>e[0](...t)]).current;return SQ(()=>{e[0]=n}),e[1]},_Q="popstate",U2="pushState",z2="replaceState",MQ="hashchange",ik=[_Q,U2,z2,MQ],NQ=n=>{for(const e of ik)addEventListener(e,n);return()=>{for(const e of ik)removeEventListener(e,n)}},MF=(n,e)=>bQ.useSyncExternalStore(NQ,n,e),ak=()=>location.search,AQ=({ssrSearch:n}={})=>MF(ak,n!=null?()=>n:ak),ok=()=>location.pathname,CQ=({ssrPath:n}={})=>MF(ok,n!=null?()=>n:ok),EQ=(n,{replace:e=!1,state:t=null}={})=>history[e?z2:U2](t,"",n),jQ=(n={})=>[CQ(n),EQ],lk=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[lk]>"u"){for(const n of[U2,z2]){const e=history[n];history[n]=function(){const t=e.apply(this,arguments),r=new Event(n);return r.arguments=arguments,dispatchEvent(r),t}}Object.defineProperty(window,lk,{value:!0})}const TQ=(n,e)=>e.toLowerCase().indexOf(n.toLowerCase())?"~"+e:e.slice(n.length)||"/",NF=(n="")=>
9n==="/"?"":n,RQ=(n,e)=>n[0]==="~"?n.slice(1):NF(e)+n,PQ=(n="",e)=>TQ(ck(NF(n)),ck(e)),ck=n=>{try{return decodeURI(n)}catch{return n}},AF={hook:jQ,searchHook:AQ,parser:gQ,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:n=>n,aroundNav:(n,e,t)=>n(e,t)},CF=T.createContext(AF),e0=()=>T.useContext(CF),EF={},jF=T.createContext(EF),DQ=()=>T.useContext(jF),oN=n=>{const[e,t]=n.hook(n);return[PQ(n.base,e),_F((r,s)=>n.aroundNav(t,RQ(r,n.base),s))]},pv=()=>oN(e0()),G2=(n,e,t,r)=>{const{pattern:s,keys:a}=e instanceof RegExp?{keys:!1,pattern:e}:n(e||"*",r),o=s.exec(t)||[],[l,...u]=o;return l!==void 0?[!0,(()=>{const d=a!==!1?Object.fromEntries(a.map((p,x)=>[p,u[x]])):o.groups;let h={...u};return d&&Object.assign(h,d),h})(),...r?[l]:[]]:[!1,null]},TF=n=>G2(e0().parser,n,pv()[0]),kQ=({children:n,...e})=>{const t=e0(),r=e.hook?AF:t;let s=r;const[a,o=e.ssrSearch??""]=e.ssrPath?.split("?")??[];a&&(e.ssrSearch=o,e.ssrPath=a),e.hrefs=e.hrefs??e.hook?.hrefs,e.searchHook=e.searchHook??e.hook?.searchHook;let l=T.useRef({}),u=l.current,d=u;for(let h in r){const p=h==="base"?r[h]+(e[h]??""):e[h]??r[h];u===d&&p!==d[h]&&(l.current=d={...d}),d[h]=p,(p!==r[h]||p!==s[h])&&(s=d)}return T.createElement(CF.Provider,{value:s,children:n})},uk=({children:n,component:e},t)=>e?T.createElement(e,{params:t}):typeof n=="function"?n(t):n,IQ=n=>{let e=T.useRef(EF);const t=e.current;return e.current=Object.keys(n).length!==Object.keys(t).length||Object.entries(n).some(([r,s])=>s!==t[r])?n:t},Lf=({path:n,nest:e,match:t,...r})=>{const s=e0(),[a]=oN(s),[o,l,u]=t??G2(s.parser,n,a,e),d=IQ({...DQ(),...l});if(!o)return null;const h=u?T.createElement(kQ,{base:u},uk(r,d)):uk(r,d);return T.createElement(jF.Provider,{value:d,children:h})};T.forwardRef((n,e)=>{const t=e0(),[r,s]=oN(t),{to:a="",href:o=a,onClick:l,asChild:u,children:d,className:h,replace:p,state:x,transition:y,...v}=n,_=_F(S=>{S.ctrlKey||S.metaKey||S.altKey||S.shiftKey||S.button!==0||(l?.(S),S.defaultPrevented||(S.preventDefault(),s(o,n)))}),M=t.hrefs(o[0]==="~"?o.slice(1):t.base+o,t);return u&&T.isValidElement(d)?T.cloneElement(d,{onClick:_,href:M}):T.createElement("a",{...v,onClick:_,href:M,className:h?.call?h(r===o):h,children:d,ref:e})});const RF=n=>Array.isArray(n)?n.flatMap(e=>RF(e&&e.type===T.Fragment?e.props.children:e)):[n],BQ=({children:n,location:e})=>{const t=e0(),[r]=oN(t);for(const s of RF(n)){let a=0;if(T.isValidElement(s)&&(a=G2(t.parser,s.props.path,e||r,s.props.nest))[0])return T.cloneElement(s,{match:a})}return null};function dk(){const[,n]=pv(),e=()=>{n("/")};return i.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-slate-50 to-slate-100",children:i.jsx(bn,{className:"w-full max-w-lg mx-4 shadow-lg border-0 bg-white/80 backdrop-blur-sm",children:i.jsxs(bY,{className:"pt-8 pb-8 text-center",children:[i.jsx("div",{className:"flex justify-center mb-6",children:i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-0 bg-red-100 rounded-full animate-pulse"}),i.jsx(PY,{className:"relative h-16 w-16 text-red-500"})]})}),i.jsx("h1",{className:"text-4xl font-bold text-slate-900 mb-2",children:"404"}),i.jsx("h2",{className:"text-xl font-semibold text-slate-700 mb-4",children:"Page Not Found"}),i.jsxs("p",{className:"text-slate-600 mb-8 leading-relaxed",children:["Sorry, the page you are looking for doesn't exist.",i.jsx("br",{}),"It may have been moved or deleted."]}),i.jsx("div",{id:"not-found-button-group",className:"flex flex-col sm:flex-row gap-3 justify-center",children:i.jsxs(ke,{onClick:e,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2.5 rounded-lg transition-all duration-200 shadow-md hover:shadow-lg",children:[i.jsx(GY,{className:"w-4 h-4 mr-2"}),"Go Home"]})})]})})})}let LQ=class extends T.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?i.jsx("div",{className:"flex items-center justify-center min-h-screen p-8 bg-background",children:i.jsxs("div",{className:"flex flex-col items-center w-full max-w-2xl p-8",children:[i.jsx(up,{size:48,className:"text-destructive mb-6 flex-shrink-0"}),i.jsx("h2",{className:"text-xl mb-4",children:"An unexpected error occurred."}),i.jsx("div",{className:"p-4 w-full rounded bg-muted overflow-auto mb-6",children:i.jsx("pre",{className:"text-sm text-muted-foreground whitespace-break-spaces",children:this.state.error?.stack})}),i.jsxs("button",{onClick:()=>window.location.reload(),className:br("flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground","hover:opacity-90 cursor-pointer"),children:[i.jsx(gF,{size:16}),"Reload Page"]})]})}):this.props.children}};const PF=T.createContext(void 0);function OQ({children:n,defaultTheme:e="light",switchable:t=!1}){const[r,s]=T.useState(()=>t&&localStorage.getItem("theme")||e);T.useEffect(()=>{const o=document.documentElement;
9r==="dark"?(o.classList.add("dark"),o.classList.remove("light")):(o.classList.remove("dark"),o.classList.add("light")),t&&localStorage.setItem("theme",r)},[r,t]);const a=t?()=>{s(o=>o==="light"?"dark":"light")}:void 0;return i.jsx(PF.Provider,{value:{theme:r,toggleTheme:a,switchable:t},children:n})}function DF(){const n=T.useContext(PF);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}var FQ=Object.defineProperty,no=(n,e)=>FQ(n,"name",{value:e,configurable:!0}),mC="focusScope.autoFocusOnMount",pC="focusScope.autoFocusOnUnmount",fk={bubbles:!1,cancelable:!0},kF=T.forwardRef(no(function(e,t){const{loop:r=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[u,d]=T.useState(null),h=Pu(a),p=Pu(o),x=T.useRef(null),y=xr(t,d),v=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(s){let M=function(C){if(v.paused||!u)return;const I=C.target;u.contains(I)?x.current=I:Nd(x.current,{select:!0})},S=function(C){if(v.paused||!u)return;const I=C.relatedTarget;I!==null&&(u.contains(I)||Nd(x.current,{select:!0}))},A=function(C){if(document.activeElement===document.body)for(const D of C)D.removedNodes.length>0&&Nd(u)};no(M,"handleFocusIn"),no(S,"handleFocusOut"),no(A,"handleMutations"),document.addEventListener("focusin",M),document.addEventListener("focusout",S);const E=new MutationObserver(A);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",M),document.removeEventListener("focusout",S),E.disconnect()}}},[s,u,v.paused]),T.useEffect(()=>{if(u){hk.add(v);const M=document.activeElement;if(!u.contains(M)){const A=new CustomEvent(mC,fk);u.addEventListener(mC,h),u.dispatchEvent(A),A.defaultPrevented||(IF(UF(H2(u)),{select:!0}),document.activeElement===M&&Nd(u))}return()=>{u.removeEventListener(mC,h),setTimeout(()=>{const A=new CustomEvent(pC,fk);u.addEventListener(pC,p),u.dispatchEvent(A),A.defaultPrevented||Nd(M??document.body,{select:!0}),u.removeEventListener(pC,p),hk.remove(v)},0)}}},[u,h,p,v]);const _=T.useCallback(M=>{if(!r&&!s||v.paused)return;const S=M.key==="Tab"&&!M.altKey&&!M.ctrlKey&&!M.metaKey,A=document.activeElement;if(S&&A){const E=M.currentTarget,[C,I]=BF(E);C&&I?!M.shiftKey&&A===I?(M.preventDefault(),r&&Nd(C,{select:!0})):M.shiftKey&&A===C&&(M.preventDefault(),r&&Nd(I,{select:!0})):A===E&&M.preventDefault()}},[r,s,v.paused]);return i.jsx(Br.div,{tabIndex:-1,...l,ref:y,onKeyDown:_})},"FocusScope"));function IF(n,{select:e=!1}={}){const t=document.activeElement;for(const r of n)if(Nd(r,{select:e}),document.activeElement!==t)return}no(IF,"focusFirst");function BF(n){const e=H2(n),t=Xj(e,n),r=Xj(e.reverse(),n);return[t,r]}no(BF,"getTabbableEdges");function H2(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:no(r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;t.nextNode();)e.push(t.currentNode);return e}no(H2,"getTabbableCandidates");function Xj(n,e){const t=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of n)if(!(t?!r.checkVisibility({checkVisibilityCSS:!0}):LF(r,{upTo:e})))return r}no(Xj,"findVisible");function LF(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}no(LF,"isHidden");function OF(n){return n instanceof HTMLInputElement&&"select"in n}no(OF,"isSelectableInput");function Nd(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&OF(n)&&e&&n.select()}}no(Nd,"focus");var hk=FF();function FF(){let n=[];return{add(e){const t=n[0];e!==t&&t?.pause(),n=qj(n,e),n.unshift(e)},remove(e){n=qj(n,e),n[0]?.resume()}}}no(FF,"createFocusScopesStack");function qj(n,e){const t=[...n],r=t.indexOf(e);return r!==-1&&t.splice(r,1),t}no(qj,"arrayRemove");function UF(n){return n.filter(e=>e.tagName!=="A")}no(UF,"removeLinks");var UQ=Object.defineProperty,V2=(n,e)=>UQ(n,"name",{value:e,configurable:!0}),_w=0,Dg=null;function zQ(n){return lN(),n.children}V2(zQ,"FocusGuards");function lN(){T.useEffect(()=>{Dg||(Dg={start:Yj(),end:Yj()});const{start:n,end:e}=Dg;return document.body.firstElementChild!==n&&document.body.insertAdjacentElement("afterbegin",n),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),_w++,()=>{_w===1&&(Dg?.start.remove(),Dg?.end.remove(),Dg=null),_w=Math.max(0,_w-1)}},[])}V2(lN,"useFocusGuards");function Yj(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}V2(Yj,"createFocusGuard");var Mu=function(){return Mu=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Mu.apply(this,arguments)};function zF(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function GQ(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,a;r<s;
vendor: 4,973 bytes, lines 9-24
9r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return n.concat(a||Array.prototype.slice.call(e))}var $S="right-scroll-bar-position",XS="width-before-scroll-bar",HQ="with-scroll-bars-hidden",VQ="--removed-body-scroll-bar-size";function gC(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function WQ(n,e){var t=T.useState(function(){return{value:n,callback:e,facade:{get current(){return t.value},set current(r){var s=t.value;s!==r&&(t.value=r,t.callback(r,s))}}}})[0];return t.callback=e,t.facade}var $Q=typeof window<"u"?T.useLayoutEffect:T.useEffect,mk=new WeakMap;function XQ(n,e){var t=WQ(null,function(r){return n.forEach(function(s){return gC(s,r)})});return $Q(function(){var r=mk.get(t);if(r){var s=new Set(r),a=new Set(n),o=t.current;s.forEach(function(l){a.has(l)||gC(l,null)}),a.forEach(function(l){s.has(l)||gC(l,o)})}mk.set(t,n)},[n]),t}function qQ(n){return n}function YQ(n,e){e===void 0&&(e=qQ);var t=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:n},useMedium:function(a){var o=e(a,r);return t.push(o),function(){t=t.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(r=!0;t.length;){var o=t;t=[],o.forEach(a)}t={push:function(l){return a(l)},filter:function(){return t}}},assignMedium:function(a){r=!0;var o=[];if(t.length){var l=t;t=[],l.forEach(a),o=t}var u=function(){var h=o;o=[],h.forEach(a)},d=function(){return Promise.resolve().then(u)};d(),t={push:function(h){o.push(h),d()},filter:function(h){return o=o.filter(h),t}}}};return s}function QQ(n){n===void 0&&(n={});var e=YQ(null);return e.options=Mu({async:!0,ssr:!1},n),e}var GF=function(n){var e=n.sideCar,t=zF(n,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return T.createElement(r,Mu({},t))};GF.isSideCarExport=!0;function KQ(n,e){return n.useMedium(e),GF}var HF=QQ(),xC=function(){},cN=T.forwardRef(function(n,e){var t=T.useRef(null),r=T.useState({onScrollCapture:xC,onWheelCapture:xC,onTouchMoveCapture:xC}),s=r[0],a=r[1],o=n.forwardProps,l=n.children,u=n.className,d=n.removeScrollBar,h=n.enabled,p=n.shards,x=n.sideCar,y=n.noRelative,v=n.noIsolation,_=n.inert,M=n.allowPinchZoom,S=n.as,A=S===void 0?"div":S,E=n.gapMode,C=zF(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=x,D=XQ([t,e]),B=Mu(Mu({},C),s);return T.createElement(T.Fragment,null,h&&T.createElement(I,{sideCar:HF,removeScrollBar:d,shards:p,noRelative:y,noIsolation:v,inert:_,setCallbacks:a,allowPinchZoom:!!M,lockRef:t,gapMode:E}),o?T.cloneElement(T.Children.only(l),Mu(Mu({},B),{ref:D})):T.createElement(A,Mu({},B,{className:u,ref:D}),l))});cN.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cN.classNames={fullWidth:XS,zeroRight:$S};var JQ=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ZQ(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var e=JQ();return e&&n.setAttribute("nonce",e),n}function eK(n,e){n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}function tK(n){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(n)}var nK=function(){var n=0,e=null;return{add:function(t){n==0&&(e=ZQ())&&(eK(e,t),tK(e)),n++},remove:function(){n--,!n&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},rK=function(){var n=nK();return function(e,t){T.useEffect(function(){return n.add(e),function(){n.remove()}},[e&&t])}},VF=function(){var n=rK(),e=function(t){var r=t.styles,s=t.dynamic;return n(r,s),null};return e},sK={left:0,top:0,right:0,gap:0},bC=function(n){return parseInt(n||"",10)||0},iK=function(n){var e=window.getComputedStyle(document.body),t=e[n==="padding"?"paddingLeft":"marginLeft"],r=e[n==="padding"?"paddingTop":"marginTop"],s=e[n==="padding"?"paddingRight":"marginRight"];return[bC(t),bC(r),bC(s)]},aK=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return sK;var e=iK(n),t=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-t+e[2]-e[0])}},oK=VF(),wx="data-scroll-locked",lK=function(n,e,t,r){var s=n.left,a=n.top,o=n.right,l=n.gap;return t===void 0&&(t="margin"),`
10  .`.concat(HQ,` {
11   overflow: hidden `).concat(r,`;
12   padding-right: `).concat(l,"px ").concat(r,`;
13  }
14  body[`).concat(wx,`] {
15    overflow: hidden `).concat(r,`;
16    overscroll-behavior: contain;
17    `).concat([e&&"position: relative ".concat(r,";"),t==="margin"&&`
18    padding-left: `.concat(s,`px;
19    padding-top: `).concat(a,`px;
20    padding-right: `).concat(o,`px;
21    margin-left:0;
22    margin-top:0;
23    margin-right: `).concat(l,"px ").concat(r,`;
24    `),t==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
24")].filter(Boolean).join(""),`
25  }
26  
27  .`).concat($S,` {
28    right: `).concat(l,"px ").concat(r,`;
29  }
30  
31  .`).concat(XS,` {
32    margin-right: `).concat(l,"px ").concat(r,`;
33  }
34  
35  .`).concat($S," .").concat($S,` {
36    right: 0 `).concat(r,`;
37  }
38  
39  .`).concat(XS," .").concat(XS,` {
40    margin-right: 0 `).concat(r,`;
41  }
42  
43  body[`).concat(wx,`] {
44    `).concat(VQ,": ").concat(l,`px;
45  }
46`)},pk=function(){var n=parseInt(document.body.getAttribute(wx)||"0",10);return isFinite(n)?n:0},cK=function(){T.useEffect(function(){return document.body.setAttribute(wx,(pk()+1).toString()),function(){var n=pk()-1;n<=0?document.body.removeAttribute(wx):document.body.setAttribute(wx,n.toString())}},[])},uK=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,s=r===void 0?"margin":r;cK();var a=T.useMemo(function(){return aK(s)},[s]);return T.createElement(oK,{styles:lK(a,!e,s,t?"":"!important")})},Qj=!1;if(typeof window<"u")try{var Mw=Object.defineProperty({},"passive",{get:function(){return Qj=!0,!0}});window.addEventListener("test",Mw,Mw),window.removeEventListener("test",Mw,Mw)}catch{Qj=!1}var kg=Qj?{passive:!1}:!1,dK=function(n){return n.tagName==="TEXTAREA"},WF=function(n,e){if(!(n instanceof Element))return!1;var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!dK(n)&&t[e]==="visible")},fK=function(n){return WF(n,"overflowY")},hK=function(n){return WF(n,"overflowX")},gk=function(n,e){var t=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=$F(n,r);if(s){var a=XF(n,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==t.body);return!1},mK=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},pK=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},$F=function(n,e){return n==="v"?fK(e):hK(e)},XF=function(n,e){return n==="v"?mK(e):pK(e)},gK=function(n,e){return n==="h"&&e==="rtl"?-1:1},xK=function(n,e,t,r,s){var a=gK(n,window.getComputedStyle(e).direction),o=a*r,l=t.target,u=e.contains(l),d=!1,h=o>0,p=0,x=0;do{if(!l)break;var y=XF(n,l),v=y[0],_=y[1],M=y[2],S=_-M-a*v;(v||S)&&$F(n,l)&&(p+=S,x+=v);var A=l.parentNode;l=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!u&&l!==document.body||u&&(e.contains(l)||e===l));return(h&&Math.abs(p)<1||!h&&Math.abs(x)<1)&&(d=!0),d},Nw=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},xk=function(n){return[n.deltaX,n.deltaY]},bk=function(n){return n&&"current"in n?n.current:n},bK=function(n,e){return n[0]===e[0]&&n[1]===e[1]},yK=function(n){return`
47  .block-interactivity-`.concat(n,` {pointer-events: none;}
48  .allow-interactivity-`).concat(n,` {pointer-events: all;}
49`)},vK=0,Ig=[];function wK(n){var e=T.useRef([]),t=T.useRef([0,0]),r=T.useRef(),s=T.useState(vK++)[0],a=T.useState(VF)[0],o=T.useRef(n);T.useEffect(function(){o.current=n},[n]),T.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(s));var _=GQ([n.lockRef.current],(n.shards||[]).map(bk),!0).filter(Boolean);return _.forEach(function(M){return M.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),_.forEach(function(M){return M.classList.remove("allow-interactivity-".concat(s))})}}},[n.inert,n.lockRef.current,n.shards]);var l=T.useCallback(function(_,M){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var S=Nw(_),A=t.current,E="deltaX"in _?_.deltaX:A[0]-S[0],C="deltaY"in _?_.deltaY:A[1]-S[1],I,D=_.target,B=Math.abs(E)>Math.abs(C)?"h":"v";if("touches"in _&&B==="h"&&D.type==="range")return!1;var P=window.getSelection(),G=P&&P.anchorNode,k=G?G===D||G.contains(D):!1;if(k)return!1;var V=gk(B,D);if(!V)return!0;if(V?I=B:(I=B==="v"?"h":"v",V=gk(B,D)),!V)return!1;if(!r.current&&"changedTouches"in _&&(E||C)&&(r.current=I),!I)return!0;var U=r.current||I;return xK(U,M,_,U==="h"?E:C)},[]),u=T.useCallback(function(_){var M=_;if(!(!Ig.length||Ig[Ig.length-1]!==a)){var S="deltaY"in M?xk(M):Nw(M),A=e.current.filter(function(I){return I.name===M.type&&(I.target===M.target||M.target===I.shadowParent)&&bK(I.delta,S)})[0];if(A&&A.should){M.cancelable&&M.preventDefault();return}
49if(!A){var E=(o.current.shards||[]).map(bk).filter(Boolean).filter(function(I){return I.contains(M.target)}),C=E.length>0?l(M,E[0]):!o.current.noIsolation;C&&M.cancelable&&M.preventDefault()}}},[]),d=T.useCallback(function(_,M,S,A){var E={name:_,delta:M,target:S,should:A,shadowParent:SK(S)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(C){return C!==E})},1)},[]),h=T.useCallback(function(_){t.current=Nw(_),r.current=void 0},[]),p=T.useCallback(function(_){d(_.type,xk(_),_.target,l(_,n.lockRef.current))},[]),x=T.useCallback(function(_){d(_.type,Nw(_),_.target,l(_,n.lockRef.current))},[]);T.useEffect(function(){return Ig.push(a),n.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:x}),document.addEventListener("wheel",u,kg),document.addEventListener("touchmove",u,kg),document.addEventListener("touchstart",h,kg),function(){Ig=Ig.filter(function(_){return _!==a}),document.removeEventListener("wheel",u,kg),document.removeEventListener("touchmove",u,kg),document.removeEventListener("touchstart",h,kg)}},[]);var y=n.removeScrollBar,v=n.inert;return T.createElement(T.Fragment,null,v?T.createElement(a,{styles:yK(s)}):null,y?T.createElement(uK,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function SK(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const _K=KQ(HF,wK);var W2=T.forwardRef(function(n,e){return T.createElement(cN,Mu({},n,{ref:e,sideCar:_K}))});W2.classNames=cN.classNames;var MK=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Bg=new WeakMap,Aw=new WeakMap,Cw={},yC=0,qF=function(n){return n&&(n.host||qF(n.parentNode))},NK=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=qF(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},AK=function(n,e,t,r){var s=NK(e,Array.isArray(n)?n:[n]);Cw[t]||(Cw[t]=new WeakMap);var a=Cw[t],o=[],l=new Set,u=new Set(s),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};s.forEach(d);var h=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(x){if(l.has(x))h(x);else try{var y=x.getAttribute(r),v=y!==null&&y!=="false",_=(Bg.get(x)||0)+1,M=(a.get(x)||0)+1;Bg.set(x,_),a.set(x,M),o.push(x),_===1&&v&&Aw.set(x,!0),M===1&&x.setAttribute(t,"true"),v||x.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return h(e),l.clear(),yC++,function(){o.forEach(function(p){var x=Bg.get(p)-1,y=a.get(p)-1;Bg.set(p,x),a.set(p,y),x||(Aw.has(p)||p.removeAttribute(r),Aw.delete(p)),y||p.removeAttribute(t)}),yC--,yC||(Bg=new WeakMap,Bg=new WeakMap,Aw=new WeakMap,Cw={})}},YF=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),s=MK(n);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),AK(r,s,t,"aria-hidden")):function(){return null}},CK=Object.defineProperty,sl=(n,e)=>CK(n,"name",{value:e,configurable:!0}),$2="Dialog",[QF,KF]=zu($2),[EK,Tc]=QF($2),JF=sl(n=>{const{__scopeDialog:e,children:t,open:r,defaultOpen:s,onOpenChange:a,modal:o=!0}=n,l=T.useRef(null),u=T.useRef(null),[d,h]=cp({prop:r,defaultProp:s??!1,onChange:a,caller:$2}),[p,x]=T.useState(0),[y,v]=T.useState(0);return i.jsx(EK,{scope:e,triggerRef:l,contentRef:u,contentId:Ym(),titleId:Ym(),descriptionId:Ym(),titlePresent:p>0,descriptionPresent:y>0,setTitleCount:x,setDescriptionCount:v,open:d,onOpenChange:h,onOpenToggle:T.useCallback(()=>h(_=>!_),[h]),modal:o,children:t})},"Dialog"),jK="DialogTrigger",TK=T.forwardRef(sl(function(e,t){const{__scopeDialog:r,...s}=e,a=Tc(jK,r),o=xr(t,a.triggerRef);return i.jsx(Br.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":uN(a.open),...s,ref:o,onClick:Jn(e.onClick,a.onOpenToggle)})},"DialogTrigger")),ZF="DialogPortal",[RK,eU]=QF(ZF,{forceMount:void 0}),tU=sl(n=>{const{__scopeDialog:e,forceMount:t,children:r,container:s}=n,a=Tc(ZF,e);return i.jsx(RK,{scope:e,forceMount:t,children:T.Children.map(r,o=>i.jsx(Zx,{present:t||a.open,children:i.jsx(C2,{asChild:!0,container:s,children:o})}))})},"DialogPortal"),Kj="DialogOverlay",nU=T.forwardRef(sl(function(e,t){const r=eU(Kj,e.__scopeDialog),{forceMount:s=r.forceMount,...a}=e,o=Tc(Kj,e.__scopeDialog);return o.modal?i.jsx(Zx,{present:s||o.open,children:i.jsx(DK,{...a,ref:t})}):null},"DialogOverlay")),PK=Fd("DialogOverlay.RemoveScroll"),DK=T.forwardRef(sl(function(e,t){const{__scopeDialog:r,...s}=e,a=Tc(Kj,r),o=oO(),l=xr(t,o);return i.jsx(W2,{as:PK,allowPinchZoom:!0,shards:[a.contentRef],children:i.jsx(Br.div,{"data-state":uN(a.open),...s,ref:l,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),Oy="DialogContent",rU=T.forwardRef(sl(function(e,t){const r=eU(Oy,e.__scopeDialog),{forceMount:s=r.forceMount,...a}=e,o=Tc(Oy,e.__scopeDialog);return i.jsx(Zx,{present:s||o.open,children:o.modal?i.jsx(kK,{...a,ref:t}):i.jsx(IK,{...a,ref:t})})},"DialogContent")),kK=T.forwardRef(sl(function(e,t){const r=Tc(Oy,e.__scopeDialog),s=T.useRef(null),a=xr(t,r.contentRef,s);return T.useEffect(()=>{const o=s.current;if(o)return YF(o)},[]),i.jsx(sU,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Jn(e.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Jn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&o.preventDefault()}),onFocusOutside:Jn(e.onFocusOutside,o=>o.preventDefault())})},"DialogContentModal")),IK=T.forwardRef(sl(function(e,t){const r=Tc(Oy,e.__scopeDialog),s=T.useRef(!1),a=T.useRef(!1);return i.jsx(sU,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(s.current||r.triggerRef.current?.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;r.triggerRef.current?.contains(l)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})},"DialogContentNonModal")),sU=T.forwardRef(sl(function(e,t){const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=e,u=Tc(Oy,r);return lN(),i.jsx(i.Fragment,{children:i.jsx(kF,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:i.jsx(y2,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionPresent?u.descriptionId:void 0,"aria-labelledby":u.titlePresent?u.titleId:void 0,"data-state":uN(u.open),...l,ref:t,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})},"DialogContentImpl")),BK="DialogTitle",iU=T.forwardRef(sl(function(e,t){const{__scopeDialog:r,...s}=e,a=Tc(BK,r),{setTitleCount:o}=a;return fi(()=>(o(l=>l+1),()=>o(l=>l-1)),[o]),i.jsx(Br.h2,{id:a.titleId,...s,ref:t})},"DialogTitle")),LK="DialogDescription",aU=T.forwardRef(sl(function(e,t){const{__scopeDialog:r,...s}=e,a=Tc(LK,r),{setDescriptionCount:o}=a;return fi(()=>(o(l=>l+1),()=>o(l=>l-1)),[o]),i.jsx(Br.p,{id:a.descriptionId,...s,ref:t})},"DialogDescription")),OK="DialogClose",X2=T.forwardRef(sl(function(e,t){const{__scopeDialog:r,...s}=e,a=Tc(OK,r);return i.jsx(Br.button,{type:"button",...s,ref:t,onClick:Jn(e.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function uN(n){return n?"open":"closed"}sl(uN,"getState");const oU=T.createContext({isComposing:()=>!1,setComposing:()=>{},justEndedComposing:()=>!1,markCompositionEnd:()=>{}}),q2=()=>T.useContext(oU);function Qa({...n}){const e=T.useRef(!1),t=T.useRef(!1),r=T.useRef(null),s=T.useMemo(()=>({isComposing:()=>e.current,setComposing:a=>{e.current=a},justEndedComposing:()=>t.current,markCompositionEnd:()=>{t.current=!0,r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{t.current=!1},150)}}),[]);return i.jsx(oU.Provider,{value:s,children:i.jsx(JF,{"data-slot":"dialog",...n})})}function FK({...n}){return i.jsx(tU,{"data-slot":"dialog-portal",...n})}function lU({className:n,...e}){return i.jsx(nU,{"data-slot":"dialog-overlay",className:br("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...e})}lU.displayName="DialogOverlay";function Ka({className:n,children:e,showCloseButton:t=!0,onEscapeKeyDown:r,...s}){const{isComposing:a}=q2(),o=T.useCallback(l=>{if(l.isComposing||a()){l.preventDefault();return}r?.(l)},[a,r]);return i.jsxs(FK,{"data-slot":"dialog-portal",children:[i.jsx(lU,{}),i.jsxs(rU,{"data-slot":"dialog-content",className:br("!bg-white !text-slate-900 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 roun
49ded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",n),onEscapeKeyDown:o,...s,children:[e,t&&i.jsxs(X2,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i.jsx(Mr,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ja({className:n,...e}){return i.jsx("div",{"data-slot":"dialog-header",className:br("flex flex-col gap-2 text-center sm:text-left",n),...e})}function Qf({className:n,...e}){return i.jsx("div",{"data-slot":"dialog-footer",className:br("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...e})}function Za({className:n,...e}){return i.jsx(iU,{"data-slot":"dialog-title",className:br("text-lg leading-none font-semibold",n),...e})}function UK({className:n,...e}){return i.jsx(aU,{"data-slot":"dialog-description",className:br("text-muted-foreground text-sm",n),...e})}function Ew(n){const e=T.useRef(n);e.current=n;const t=T.useRef(null);return t.current||(t.current=function(...r){return e.current.apply(this,r)}),t.current}function cU(n={}){const{onKeyDown:e,onCompositionStart:t,onCompositionEnd:r}=n,s=T.useRef(!1),a=T.useRef(null),o=T.useRef(null),l=Ew(p=>{a.current&&(clearTimeout(a.current),a.current=null),o.current&&(clearTimeout(o.current),o.current=null),s.current=!0,t?.(p)}),u=Ew(p=>{a.current=setTimeout(()=>{o.current=setTimeout(()=>{s.current=!1})}),r?.(p)}),d=Ew(p=>{if(s.current&&(p.key==="Escape"||p.key==="Enter"&&!p.shiftKey)){p.stopPropagation();return}e?.(p)}),h=Ew(()=>s.current);return{onCompositionStart:l,onCompositionEnd:u,onKeyDown:d,isComposing:h}}function Ee({className:n,type:e,onKeyDown:t,onCompositionStart:r,onCompositionEnd:s,...a}){const o=q2(),{onCompositionStart:l,onCompositionEnd:u,onKeyDown:d}=cU({onKeyDown:h=>{const p=h.nativeEvent.isComposing||o.justEndedComposing();h.key==="Enter"&&p||t?.(h)},onCompositionStart:h=>{o.setComposing(!0),r?.(h)},onCompositionEnd:h=>{o.markCompositionEnd(),setTimeout(()=>{o.setComposing(!1)},100),s?.(h)}});return i.jsx("input",{type:e,"data-slot":"input",className:br("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",n),onCompositionStart:l,onCompositionEnd:u,onKeyDown:d,...a})}function zK(){window.location.href="/admin"}function GK(n){const{redirectOnUnauthenticated:e=!1,redirectPath:t}={},r=Pe.useUtils(),s=Pe.auth.me.useQuery(void 0,{retry:!1,refetchOnWindowFocus:!1}),a=Pe.auth.logout.useMutation({onSuccess:()=>{r.auth.me.setData(void 0,null)}}),o=T.useCallback(async()=>{try{await a.mutateAsync()}catch(u){if(u instanceof Ty&&u.data?.code==="UNAUTHORIZED")return;throw u}finally{try{sessionStorage.removeItem("manus-cookie")}catch{}r.auth.me.setData(void 0,null),await r.auth.me.invalidate()}},[a,r]),l=T.useMemo(()=>({user:s.data??null,loading:s.isLoading||a.isPending,error:s.error??a.error??null,isAuthenticated:!!s.data}),[s.data,s.error,s.isLoading,a.error,a.isPending]);return T.useEffect(()=>{e&&(s.isLoading||a.isPending||l.user||typeof window>"u"||t&&window.location.pathname===t||(t?window.location.href=t:zK()))},[e,t,a.isPending,s.isLoading,l.user]),{...l,refresh:()=>s.refetch(),logout:o}}const HK=["dashboard","price-quotations","official-invoices","packing-lists","purchase-requests","purchase-quotations","purchase-invoices","raw-materials","material-categories","inventory-adjustments","material-movements","production-orders","factory-planner","factory-cad-modeling","receipt-vouchers","payment-vouchers","cash-boxes","clients","products","product-categories","employees","reports","settings","public-home","quote-requests","sales-invoices"];function VK(n){const e=n.includes("?")?n.slice(n.indexOf("?")):"",t=new 
49URLSearchParams(e).get("tab");return HK.includes(t)?t:"dashboard"}const vC=768;function WK(){const[n,e]=T.useState(void 0);return T.useEffect(()=>{const t=window.matchMedia(`(max-width: ${vC-1}px)`),r=()=>{e(window.innerWidth<vC)};return t.addEventListener("change",r),e(window.innerWidth<vC),()=>t.removeEventListener("change",r)},[]),!!n}const $K=oF("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ul({className:n,variant:e,asChild:t=!1,...r}){const s=t?JL:"span";return i.jsx(s,{"data-slot":"badge",className:br($K({variant:e}),n),...r})}function yk({onNavigate:n}){const{data:e,isLoading:t}=Pe.dashboard.stats.useQuery(),r=[{label:"إجمالي الآلات",value:e?.totalMachines||0,icon:Vl,color:"from-primary to-primary/70"},{label:"العملاء",value:e?.totalClients||0,icon:_c,color:"from-pink-500 to-pink-700"},{label:"المواد الأولية",value:e?.totalMaterials||0,icon:ma,color:"from-amber-500 to-amber-600"},{label:"فواتير المشتريات",value:e?.totalPurchaseInvoices||0,icon:uQ,color:"from-violet-500 to-violet-700"},{label:"طلبات الأسعار",value:e?.totalQuoteRequests||0,icon:Cu,color:"from-indigo-500 to-indigo-700"},{label:"الآلات المتاحة",value:e?.totalAvailableMachines||0,icon:KY,color:"from-emerald-500 to-emerald-600"}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"لوحة المعلومات"}),i.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"نظرة عامة على نظام الإنتاج والمبيعات"})]}),t?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:Array.from({length:6}).map((s,a)=>i.jsxs(bn,{className:"bg-card border-border p-4 animate-pulse",children:[i.jsx("div",{className:"h-4 bg-muted rounded w-24 mb-3"}),i.jsx("div",{className:"h-8 bg-muted rounded w-16"})]},a))}):i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:r.map((s,a)=>i.jsxs(bn,{className:"bg-card border-border p-4 hover:border-primary/30 transition-all duration-300 cursor-default",style:{animationDelay:`${a*50}ms`},children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:s.label}),i.jsx("div",{className:`w-9 h-9 rounded-xl bg-gradient-to-br ${s.color} flex items-center justify-center`,children:i.jsx(s.icon,{className:"w-4 h-4 text-white"})})]}),i.jsx("div",{className:"text-xl font-bold text-foreground",children:s.value})]},a))}),i.jsxs("div",{className:"mt-6 grid grid-cols-1 lg:grid-cols-2 gap-4",children:[i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:"آخر طلبات الأسعار"}),i.jsxs("button",{onClick:()=>n?.("quote-requests"),className:"text-xs text-primary hover:text-primary/80 flex items-center gap-1 transition-colors",children:["عرض الكل ",i.jsx(VD,{className:"w-3 h-3"})]})]}),i.jsx("div",{className:"space-y-2",children:e?.recentQuoteRequests&&e.recentQuoteRequests.length>0?e.recentQuoteRequests.map(s=>i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Cu,{className:"w-4 h-4 text-indigo-500"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-foreground",children:s.customerName||s.name}),i.jsx("p",{className:"text-xs text-muted-foreground",children:s.productName||"منتج عام"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ul,{variant:"outline",className:"text-[10px] border-indigo-500/50 text-indigo-400",children:s.status==="new"?"جديد":"تم الرد"}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(s.createdAt).toLocaleDateString("ar-SA")})]})]},s.id)):i.jsx("p",{className:"text-muted-foreground text-sm text-center py-4",children:"لا توجد طلبات بعد"})})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground mb-4",children:"ملخص مالي"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:"الرصيد النقدي"}),i.jsxs("span",{className:"text-emerald-500 font-bold",children:[e?.totalCash?.toLocaleStr
49ing()||0," $"]})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:"إجمالي العملاء"}),i.jsx("span",{className:"text-primary font-bold",children:e?.totalClients||0})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:"إجمالي المواد الخام"}),i.jsx("span",{className:"text-amber-500 font-bold",children:e?.totalMaterials||0})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:"إجمالي الآلات"}),i.jsx("span",{className:"text-primary font-bold",children:e?.totalMachines||0})]})]})]})]}),e?.lowStockItems&&e.lowStockItems.length>0&&i.jsx("div",{className:"mt-6",children:i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(up,{className:"w-5 h-5 text-red-500"}),i.jsx("h3",{className:"text-lg font-bold text-foreground",children:"تنبيهات المخزون المنخفض"}),i.jsxs(Ul,{className:"bg-red-500/15 text-red-500 border-red-500/30 text-[10px]",children:[e.lowStockItems.length," مادة"]}),e.lowStockCritical?i.jsxs(Ul,{className:"bg-red-500 text-white text-[10px]",children:[e.lowStockCritical," حرجة"]}):null]}),i.jsxs("button",{onClick:()=>n?.("raw-materials"),className:"text-xs text-primary hover:text-primary/80 flex items-center gap-1 transition-colors",children:["عرض المخزون ",i.jsx(VD,{className:"w-3 h-3"})]})]}),i.jsx("div",{className:"space-y-2",children:e.lowStockItems.map(s=>{const a=s.minReorderLevel>0?s.stockQuantity/s.minReorderLevel*100:100,o=a<=30;return i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx(ma,{className:`w-4 h-4 ${o?"text-red-500":"text-amber-500"}`}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:"text-sm text-foreground truncate",children:s.name}),i.jsxs("span",{className:`text-xs font-bold ${o?"text-red-500":"text-amber-500"}`,children:[s.stockQuantity," / ",s.minReorderLevel," ",s.unit]})]}),i.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full rounded-full ${o?"bg-red-500":"bg-amber-500"}`,style:{width:`${Math.min(a,100)}%`}})})]})]},s.id)})})]})}),i.jsx("div",{className:"mt-6",children:i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground mb-4",children:"آخر النشاطات"}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx(_c,{className:"w-4 h-4 text-primary"}),i.jsxs("span",{className:"text-muted-foreground text-sm",children:[e?.totalClients||0," عميل"]})]}),i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx(Ki,{className:"w-4 h-4 text-emerald-500"}),i.jsxs("span",{className:"text-muted-foreground text-sm",children:[e?.totalInvoices||0," فاتورة"]})]}),i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx(up,{className:"w-4 h-4 text-red-500"}),i.jsxs("span",{className:"text-muted-foreground text-sm",children:[e?.pendingOrders||0," أمر معلق"]})]}),i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[i.jsx(ma,{className:"w-4 h-4 text-orange-500"}),i.jsxs("span",{className:"text-muted-foreground text-sm",children:[e?.lowStockCount||0," مادة منخفضة"]})]})]})]})})]})}const XK="modulepreload",qK=function(n){return"/"+n},vk={},A_=function(e,t,r){let s=Promise.resolve();if(t&&t.length>0){let u=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");s=u(t.map(d=>{if(d=qK(d),d in vk)return;vk[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":XK,h||(x.as="script"),x.crossOrigin="",x.href=d,l&&x.setAttribute("nonce",l),document.head.appendChild(x),h)return new Promise((y,v)=>{x.addEventListener("load",y),x.addEventListener("error",()=>
49v(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&a(l.reason);return e().catch(a)})};function ni({className:n,onKeyDown:e,onCompositionStart:t,onCompositionEnd:r,...s}){const a=q2(),{onCompositionStart:o,onCompositionEnd:l,onKeyDown:u}=cU({onKeyDown:d=>{const h=d.nativeEvent.isComposing||a.justEndedComposing();d.key==="Enter"&&!d.shiftKey&&h||e?.(d)},onCompositionStart:d=>{a.setComposing(!0),t?.(d)},onCompositionEnd:d=>{a.markCompositionEnd(),setTimeout(()=>{a.setComposing(!1)},100),r?.(d)}});return i.jsx("textarea",{"data-slot":"textarea",className:br("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),onCompositionStart:o,onCompositionEnd:l,onKeyDown:u,...s})}var YK=Object.defineProperty,mh=(n,e)=>YK(n,"name",{value:e,configurable:!0}),Y2="Switch",[QK,hbe]=zu(Y2),[KK,Q2]=QK(Y2);function uU(n){const{__scopeSwitch:e,checked:t,children:r,defaultChecked:s,disabled:a,form:o,name:l,onCheckedChange:u,required:d,value:h="on",internal_do_not_use_render:p}=n,[x,y]=cp({prop:t,defaultProp:s??!1,onChange:u,caller:Y2}),[v,_]=T.useState(null),[M,S]=T.useState(null),A=T.useRef(!1),[E,C]=T.useReducer(B=>B+1,0),I=v?!!o||!!v.closest("form"):!0,D={checked:x,setChecked:y,disabled:a,control:v,setControl:_,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:A,userInteractionCount:E,onUserInteraction:C,required:d,defaultChecked:s,isFormControl:I,bubbleInput:M,setBubbleInput:S};return i.jsx(KK,{scope:e,...D,children:dU(p)?p(D):r})}mh(uU,"SwitchProvider");var JK="SwitchTrigger",ZK=T.forwardRef(mh(function({__scopeSwitch:e,onClick:t,...r},s){const{control:a,form:o,value:l,disabled:u,checked:d,required:h,setControl:p,setChecked:x,hasConsumerStoppedPropagationRef:y,onUserInteraction:v,isFormControl:_,bubbleInput:M}=Q2(JK,e),S=xr(s,p),A=T.useRef(d);return T.useEffect(()=>{const E=o?a?.ownerDocument.getElementById(o):a?.form;if(E instanceof HTMLFormElement){const C=mh(()=>x(A.current),"reset");return E.addEventListener("reset",C),()=>E.removeEventListener("reset",C)}},[a,o,x]),i.jsx(Br.button,{type:"button",role:"switch","aria-checked":d,"aria-required":h,"data-state":K2(d),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:S,onClick:Jn(t,E=>{v(),x(C=>!C),M&&_&&(y.current=E.isPropagationStopped(),y.current||E.stopPropagation())})})},"SwitchTrigger")),eJ=T.forwardRef(mh(function(e,t){const{__scopeSwitch:r,name:s,checked:a,defaultChecked:o,required:l,disabled:u,value:d,onCheckedChange:h,form:p,...x}=e;return i.jsx(uU,{__scopeSwitch:r,checked:a,defaultChecked:o,disabled:u,required:l,onCheckedChange:h,name:s,form:p,value:d,internal_do_not_use_render:({isFormControl:y})=>i.jsxs(i.Fragment,{children:[i.jsx(ZK,{...x,ref:t,__scopeSwitch:r}),y&&i.jsx(sJ,{__scopeSwitch:r})]})})},"Switch")),tJ="SwitchThumb",nJ=T.forwardRef(mh(function(e,t){const{__scopeSwitch:r,...s}=e,a=Q2(tJ,r);return i.jsx(Br.span,{"data-state":K2(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})},"SwitchThumb")),rJ="SwitchBubbleInput",sJ=T.forwardRef(mh(function({__scopeSwitch:e,onClick:t,...r},s){const{control:a,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:u,defaultChecked:d,required:h,disabled:p,name:x,value:y,form:v,bubbleInput:_,setBubbleInput:M}=Q2(rJ,e),S=xr(s,M),A=YM(a),E=T.useRef(!1),C=T.useRef(u),I=T.useRef(l);T.useEffect(()=>{const B=_;if(!B)return;const P=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(P,"checked").set,V=l!==I.current;I.current=l;const U=C.current!==u;C.current=u;const $=!(V&&o.current);if(U&&k){E.current=!V;const X=new Event("click",{bubbles:$});k.call(B,u),B.dispatchEvent(X),E.current=!1}},[_,u,o,l]);const D=T.useRef(u);return i.jsx(Br.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??D.current,required:h,disabled:p,name:x,value:y,form:v,...r,tabIndex:-1,ref:S,onClick:Jn(t,B=>{E.current&&B.stopPropagation()}),style:{...r.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})}
49,"SwitchBubbleInput"));function dU(n){return typeof n=="function"}mh(dU,"isFunction");function K2(n){return n?"checked":"unchecked"}mh(K2,"getState");function Yo({className:n,...e}){return i.jsx(eJ,{"data-slot":"switch",className:br("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:i.jsx(nJ,{"data-slot":"switch-thumb",className:br("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var iJ=Object.defineProperty,aJ=(n,e)=>iJ(n,"name",{value:e,configurable:!0});function Fy(n,[e,t]){return Math.min(t,Math.max(e,n))}aJ(Fy,"clamp");var oJ=Object.defineProperty,Qi=(n,e)=>oJ(n,"name",{value:e,configurable:!0});function J2(n){const e=n+"CollectionProvider",[t,r]=zu(e),[s,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=Qi(_=>{const{scope:M,children:S}=_,A=T.useRef(null),E=T.useRef(new Map).current;return i.jsx(s,{scope:M,itemMap:E,collectionRef:A,children:S})},"CollectionProvider");o.displayName=e;const l=n+"CollectionSlot",u=Fd(l),d=T.forwardRef((_,M)=>{const{scope:S,children:A}=_,E=a(l,S),C=xr(M,E.collectionRef);return i.jsx(u,{ref:C,children:A})});d.displayName=l;const h=n+"CollectionItemSlot",p="data-radix-collection-item",x=Fd(h),y=T.forwardRef((_,M)=>{const{scope:S,children:A,...E}=_,C=T.useRef(null),I=xr(M,C),D=a(h,S);return T.useEffect(()=>(D.itemMap.set(C,{ref:C,...E}),()=>{D.itemMap.delete(C)})),i.jsx(x,{[p]:"",ref:I,children:A})});y.displayName=h;function v(_){const M=a(n+"CollectionConsumer",_);return T.useCallback(()=>{const A=M.collectionRef.current;if(!A)return[];const E=Array.from(A.querySelectorAll(`[${p}]`));return Array.from(M.itemMap.values()).sort((D,B)=>E.indexOf(D.ref.current)-E.indexOf(B.ref.current))},[M.collectionRef,M.itemMap])}return Qi(v,"useCollection"),[{Provider:o,Slot:d,ItemSlot:y},v,r]}Qi(J2,"createCollection");var wk=new WeakMap,Ni,Xo,wC=(Xo=class extends Map{constructor(t){super(t);UP(this,Ni);QA(this,Ni,[...super.keys()]),wk.set(this,!0)}set(t,r){return wk.get(this)&&(this.has(t)?Aa(this,Ni)[Aa(this,Ni).indexOf(t)]=t:Aa(this,Ni).push(t)),super.set(t,r),this}insert(t,r,s){const a=this.has(r),o=Aa(this,Ni).length,l=Z2(t);let u=l>=0?l:o+l;const d=u<0||u>=o?-1:u;if(d===this.size||a&&d===this.size-1||d===-1)return this.set(r,s),this;const h=this.size+(a?0:1);l<0&&u++;const p=[...Aa(this,Ni)];let x,y=!1;for(let v=u;v<h;v++)if(u===v){let _=p[v];p[v]===r&&(_=p[v+1]),a&&this.delete(r),x=this.get(_),this.set(r,s)}else{!y&&p[v-1]===r&&(y=!0);const _=p[y?v:v-1],M=x;x=this.get(_),this.delete(_),this.set(_,M)}return this}with(t,r,s){const a=new Xo(this);return a.insert(t,r,s),a}before(t){const r=Aa(this,Ni).indexOf(t)-1;if(!(r<0))return this.entryAt(r)}setBefore(t,r,s){const a=Aa(this,Ni).indexOf(t);return a===-1?this:this.insert(a,r,s)}after(t){let r=Aa(this,Ni).indexOf(t);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(t,r,s){const a=Aa(this,Ni).indexOf(t);return a===-1?this:this.insert(a+1,r,s)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return QA(this,Ni,[]),super.clear()}delete(t){const r=super.delete(t);return r&&Aa(this,Ni).splice(Aa(this,Ni).indexOf(t),1),r}deleteAt(t){const r=this.keyAt(t);return r!==void 0?this.delete(r):!1}at(t){const r=qS(Aa(this,Ni),t);if(r!==void 0)return this.get(r)}entryAt(t){const r=qS(Aa(this,Ni),t);if(r!==void 0)return[r,this.get(r)]}indexOf(t){return Aa(this,Ni).indexOf(t)}keyAt(t){return qS(Aa(this,Ni),t)}from(t,r){const s=this.indexOf(t);if(s===-1)return;let a=s+r;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.at(a)}keyFrom(t,r){const s=this.indexOf(t);if(s===-1)return;let a=s+r;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.keyAt(a)}find(t,r){let s=0;for(const a of this){if(Reflect.apply(t,r,[a,s,this]))return a;s++}}findIndex(t,r){let s=0;for(const a of this){if(Reflect.apply(t,r,[a,s,this]))return s;s++}return-1}filter(t,r){const s=[];let a=0;for(const o of this)Reflect.apply(t,r,[o,a,this])&&s.push(o),a++;return new Xo(s)}map(t,r){const s=[];let a=0;for(const o of this)s.push([o[0],Reflect.apply(t,r,[o,a,this])]),a++;return new Xo(s)}reduce(...t){const[r,s]=t;let a=0,o=s??this.at(0);for(const l of this)a===0&&t.length===1?o=l:o=Reflect.apply(r,this,[o,l,a,this]),a++;return o}reduceRight(...t){const[r,s]=t;let a=s??this.at(-1);for(let o=this.size-1;o>=0;o--){const l=this.at(o);o===this.size-1&&t.length===1?a=l:a=Reflect.apply(r,this,[a,l,o,this])}return a}toSorted(t){const r=[...this.entries()].sort(t);return new Xo(r)}toReversed(){const t=new Xo;for(let r=this.size-1;r>=0;r--){const s=this.keyAt(r),a=this.get(s);t.set(s,a)}return t}toSpliced(...t){const r=[...this.entries()];return r.splice(...t),new Xo(r)}slice(t,r){const s=new Xo;let a=this.size-1;if(t===void 0)return s;t<0&&(t=t+this.size),r!==void 0&&r>0&&(a=r-1);for(let o=t;o<=a;o++){const l=this.keyAt(o),u=this.get(l);s.set(l,u)}return s}every(t,r){let s=0;for(const a of this){if(!Reflect.apply(t,r,[a,s,this]))return!1;s++}return!0}some(t,r){let s=0;for(const a of this){if(Reflect.apply(t,r,[a,s,this]))return!0;s++}return!1}},Ni=new WeakMap,Qi(Xo,"OrderedDict"),Xo);function qS(n,e){if("at"in Array.prototype)return Array.prototype.at.call(n,e);const t=fU(n,e);return t===-1?void 0:n[t]}Qi(qS,"at");function fU(n,e){const t=n.length,r=Z2(e),s=r>=0?r:t+r;return s<0||s>=t?-1:s}Qi(fU,"toSafeIndex");function Z2(n){return n!==n||n===0?0:Math.trunc(n)}Qi(Z2,"toSafeInteger");function lJ(n){const e=n+"CollectionProvider",[t,r]=zu(e),[s,a]=t(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new wC,setItemMap:Qi(()=>{},"setItemMap")}),o=Qi(({state:E,...C})=>E?i.jsx(u,{...C,state:E}):i.jsx(l,{...C}),"CollectionProvider");o.displayName=e;const l=Qi(E=>{const C=M();return i.jsx(u,{...E,state:C})},"CollectionInit");l.displayName=e+"Init";const u=Qi(E=>{const{scope:C,children:I,state:D}=E,B=T.useRef(null),[P,G]=T.useState(null),k=xr(B,G),[V,U]=D;return T.useEffect(()=>{if(!P)return;const $=pU(()=>{});return $.observe(P,{childList:!0,subtree:!0}),()=>{$.disconnect()}},[P]),i.jsx(s,{scope:C,itemMap:V,setItemMap:U,collectionRef:k,collectionRefObject:B,collectionElement:P,children:I})},"CollectionProviderImpl");u.displayName=e+"Impl";const d=n+"CollectionSlot",h=Fd(d),p=T.forwardRef((E,C)=>{const{scope:I,children:D}=E,B=a(d,I),P=xr(C,B.collectionRef);return i.jsx(h,{ref:P,children:D})});p.displayName=d;const x=n+"CollectionItemSlot",y="data-radix-collection-item",v=Fd(x),_=T.forwardRef((E,C)=>{const{scope:I,children:D,...B}=E,P=T.useRef(null),[G,k]=T.useState(null),V=xr(C,P,k),U=a(x,I),{setItemMap:$}=U,X=T.useRef(B);hU(X.current,B)||(X.current=B);const ee=X.current;return T.useEffect(()=>{const z=ee;return $(K=>G?K.has(G)?K.set(G,{...z,element:G}
49).toSorted(Jj):(K.set(G,{...z,element:G}),K.toSorted(Jj)):K),()=>{$(K=>!G||!K.has(G)?K:(K.delete(G),new wC(K)))}},[G,ee,$]),i.jsx(v,{[y]:"",ref:V,children:D})});_.displayName=x;function M(){return T.useState(new wC)}Qi(M,"useInitCollection");function S(E){const{itemMap:C}=a(n+"CollectionConsumer",E);return C}return Qi(S,"useCollection"),[{Provider:o,Slot:p,ItemSlot:_},{createCollectionScope:r,useCollection:S,useInitCollection:M}]}Qi(lJ,"createCollection");function hU(n,e){if(n===e)return!0;if(typeof n!="object"||typeof e!="object"||n==null||e==null)return!1;const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const s of t)if(!Object.prototype.hasOwnProperty.call(e,s)||n[s]!==e[s])return!1;return!0}Qi(hU,"shallowEqual");function mU(n,e){return!!(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)}Qi(mU,"isElementPreceding");function Jj(n,e){return!n[1].element||!e[1].element?0:mU(n[1].element,e[1].element)?-1:1}Qi(Jj,"sortByDocumentPosition");function pU(n){return new MutationObserver(t=>{for(const r of t)if(r.type==="childList"){n();return}})}Qi(pU,"getChildListObserver");var cJ=Object.defineProperty,uJ=(n,e)=>cJ(n,"name",{value:e,configurable:!0}),dJ=T.createContext(void 0);function e3(n){const e=T.useContext(dJ);return n||e||"ltr"}uJ(e3,"useDirection");var fJ=Object.defineProperty,hJ=(n,e)=>fJ(n,"name",{value:e,configurable:!0});function t3(n){const e=T.useRef({value:n,previous:n});return T.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}hJ(t3,"usePrevious");var mJ=Object.defineProperty,Cr=(n,e)=>mJ(n,"name",{value:e,configurable:!0}),pJ=[" ","Enter","ArrowUp","ArrowDown"],gJ=[" ","Enter"],Tx="Select",[dN,fN,xJ]=J2(Tx),[Np,mbe]=zu(Tx,[xJ,QM]),n3=QM(),[bJ,Ch]=Np(Tx),[yJ,vJ]=Np(Tx);function gU(n){const{__scopeSelect:e,children:t,open:r,defaultOpen:s,onOpenChange:a,value:o,defaultValue:l,onValueChange:u,dir:d,name:h,autoComplete:p,disabled:x,required:y,form:v,internal_do_not_use_render:_}=n,M=n3(e),[S,A]=T.useState(null),[E,C]=T.useState(null),[I,D]=T.useState(!1),B=e3(d),[P,G]=cp({prop:r,defaultProp:s??!1,onChange:a,caller:Tx}),[k,V]=cp({prop:o,defaultProp:l,onChange:u,caller:Tx}),U=T.useRef(null),$=T.useRef(k);T.useEffect(()=>{const O=v?S?.ownerDocument.getElementById(v):S?.form;if(O instanceof HTMLFormElement){const J=Cr(()=>V($.current),"reset");return O.addEventListener("reset",J),()=>O.removeEventListener("reset",J)}},[v,S,V]);const X=S?!!v||!!S.closest("form"):!0,[ee,z]=T.useState(new Set),K=Ym(),ae=Array.from(ee).map(O=>O.props.value).join(";"),oe=T.useCallback(O=>{z(J=>new Set(J).add(O))},[]),re=T.useCallback(O=>{z(J=>{const q=new Set(J);return q.delete(O),q})},[]),F={required:y,trigger:S,onTriggerChange:A,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:I,onValueNodeHasChildrenChange:D,contentId:K,value:k,onValueChange:V,open:P,onOpenChange:G,dir:B,triggerPointerDownPosRef:U,disabled:x,name:h,autoComplete:p,form:v,nativeOptions:ee,nativeSelectKey:ae,isFormControl:X};return i.jsx(AO,{...M,children:i.jsx(bJ,{scope:e,...F,children:i.jsx(dN.Provider,{scope:e,children:i.jsx(yJ,{scope:e,onNativeOptionAdd:oe,onNativeOptionRemove:re,children:vU(_)?_(F):t})})})})}Cr(gU,"SelectProvider");var wJ=Cr(n=>{const{__scopeSelect:e,children:t,...r}=n;return i.jsx(gU,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:s})=>i.jsxs(i.Fragment,{children:[t,s?i.jsx(XJ,{__scopeSelect:e}):null]})})},"Select"),SJ="SelectTrigger",_J=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,disabled:s=!1,...a}=e,o=n3(r),l=Ch(SJ,r),u=l.disabled||s,d=xr(t,l.onTriggerChange),h=fN(r),p=T.useRef("touch"),[x,y,v]=s3(M=>{const S=h().filter(C=>!C.disabled),A=S.find(C=>C.value===l.value),E=i3(S,M,A);E!==void 0&&l.onValueChange(E.value)}),_=Cr(M=>{u||(l.onOpenChange(!0),v()),M&&(l.triggerPointerDownPosRef.current={x:Math.round(M.pageX),y:Math.round(M.pageY)})},"handleOpen");return i.jsx(CO,{asChild:!0,...o,children:i.jsx(Br.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":gv(l.value)?"":void 0,...a,ref:d,onClick:Jn(a.onClick,M=>
49{M.currentTarget.focus(),p.current!=="mouse"&&_(M)}),onPointerDown:Jn(a.onPointerDown,M=>{p.current=M.pointerType;const S=M.target;S.hasPointerCapture(M.pointerId)&&S.releasePointerCapture(M.pointerId),M.button===0&&M.ctrlKey===!1&&M.pointerType==="mouse"&&(_(M),M.preventDefault())}),onKeyDown:Jn(a.onKeyDown,M=>{const S=x.current!=="";!(M.ctrlKey||M.altKey||M.metaKey)&&M.key.length===1&&y(M.key),!(S&&M.key===" ")&&pJ.includes(M.key)&&(_(),M.preventDefault())})})})},"SelectTrigger")),MJ="SelectValue",NJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,className:s,style:a,children:o,placeholder:l="",...u}=e,d=Ch(MJ,r),{onValueNodeHasChildrenChange:h}=d,p=o!==void 0,x=xr(t,d.onValueNodeChange);fi(()=>{h(p)},[h,p]);const y=gv(d.value);return i.jsx(Br.span,{...u,asChild:y?!1:u.asChild,ref:x,style:{pointerEvents:"none"},children:i.jsx(T.Fragment,{children:y?l:o},y?"placeholder":"value")})},"SelectValue")),AJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,children:s,...a}=e;return i.jsx(Br.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})},"SelectIcon")),CJ="SelectPortal",[EJ,jJ]=Np(CJ,{forceMount:void 0}),TJ=Cr(n=>{const{__scopeSelect:e,forceMount:t,...r}=n;return i.jsx(EJ,{scope:n.__scopeSelect,forceMount:t,children:i.jsx(C2,{asChild:!0,...r})})},"SelectPortal"),dp="SelectContent",RJ=T.forwardRef(Cr(function(e,t){const r=jJ(dp,e.__scopeSelect),{forceMount:s=r.forceMount,...a}=e,o=Ch(dp,e.__scopeSelect),[l,u]=T.useState();return fi(()=>{u(new DocumentFragment)},[]),i.jsx(Zx,{present:s||o.open,children:({present:d})=>d?i.jsx(kJ,{...a,ref:t}):i.jsx(PJ,{...a,fragment:l})})},"SelectContent")),PJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,children:s,fragment:a}=e;return a?Yx.createPortal(i.jsx(xU,{scope:r,children:i.jsx(dN.Slot,{scope:r,children:i.jsx("div",{ref:t,children:s})})}),a):null},"SelectContentFragment")),gc=10,[xU,Ap]=Np(dp),DJ=Fd("SelectContent.RemoveScroll"),kJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r}=e,{position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:u,sideOffset:d,align:h,alignOffset:p,arrowPadding:x,collisionBoundary:y,collisionPadding:v,sticky:_,hideWhenDetached:M,avoidCollisions:S,...A}=e,E=Ch(dp,r),[C,I]=T.useState(null),[D,B]=T.useState(null),P=xr(t,I),[G,k]=T.useState(null),[V,U]=T.useState(null),$=fN(r),[X,ee]=T.useState(!1),z=T.useRef(!1);T.useEffect(()=>{if(C)return YF(C)},[C]),lN();const K=T.useCallback(se=>{const[me,...ze]=$().map(Le=>Le.ref.current),[Be]=ze.slice(-1),ye=document.activeElement;for(const Le of se)if(Le===ye||(Le?.scrollIntoView({block:"nearest"}),Le===me&&D&&(D.scrollTop=0),Le===Be&&D&&(D.scrollTop=D.scrollHeight),Le?.focus(),document.activeElement!==ye))return},[$,D]),ae=T.useCallback(()=>K([G,C]),[K,G,C]);T.useEffect(()=>{X&&ae()},[X,ae]);const{onOpenChange:oe,triggerPointerDownPosRef:re}=E;T.useEffect(()=>{if(C){let se={x:0,y:0};const me=Cr(Be=>{se={x:Math.abs(Math.round(Be.pageX)-(re.current?.x??0)),y:Math.abs(Math.round(Be.pageY)-(re.current?.y??0))}},"handlePointerMove"),ze=Cr(Be=>{se.x<=10&&se.y<=10?Be.preventDefault():Be.composedPath().includes(C)||oe(!1),document.removeEventListener("pointermove",me),re.current=null},"handlePointerUp");return re.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",ze,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",ze,{capture:!0})}}},[C,oe,re]),T.useEffect(()=>{const se=Cr(()=>oe(!1),"close");return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[oe]);const[F,O]=s3(se=>{const me=$().filter(ye=>!ye.disabled),ze=me.find(ye=>ye.ref.current===document.activeElement),Be=i3(me,se,ze);Be&&setTimeout(()=>Be.ref.current?.focus())}),J=T.useCallback((se,me,ze)=>{const Be=!z.current&&!ze;(E.value!==void 0&&E.value===me||Be)&&(k(se),Be&&(z.current=!0))},[E.value]),q=T.useCallback(()=>C?.focus(),[C]),Q=T.useCallback((se,me,ze)=>{const Be=!z.current&&!ze;(E.value!==void 0&&E.value===me||Be)&&U(se)},[E.value]),ne=s==="popper"?Sk:IJ,Z=ne===Sk?{side:u,sideOffset:d,align:h,alignOffset:p,arrowPadding:x,collisionBoundary:y,collisionPadding:v,sticky:_,hideWhenDetached:M,avoidCollisions:S}:{};return i.jsx(xU,{scope:r,content:C,viewport:D,onViewportChange:B,itemRefCallback:J,selectedItem:G,onItemLeave:q,itemTextRefCallback:Q,focusSelectedItem:ae,selectedItemText:V,position:s,isPositioned:X,searchRef:F,children:i.jsx(W2,{as:DJ,allowPinchZoom:!0,children:i.jsx(kF,{asChild:!0,trapped:E.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:Jn(a,se=>{E.trigger?.focus({preventScroll:!0}),se.preventDefault()}),children:i.jsx(y2,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:i.jsx(ne,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:se=>se.preventDefault(),...A,...Z,onPlaced:()=>ee(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:Jn(A.onKeyDown,se=>{const me=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!me&&se.key.length===1&&O(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.ke
vendor: 4,863 bytes, line 49
49y)){let Be=$().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(se.key)&&(Be=Be.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const ye=se.target,Le=Be.indexOf(ye);Be=Be.slice(Le+1)}setTimeout(()=>K(Be)),se.preventDefault()}})})})})})})},"SelectContentImpl")),IJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,onPlaced:s,...a}=e,o=Ch(dp,r),l=Ap(dp,r),[u,d]=T.useState(null),[h,p]=T.useState(null),x=xr(t,p),y=fN(r),v=T.useRef(!1),_=T.useRef(!0),{viewport:M,selectedItem:S,selectedItemText:A,focusSelectedItem:E}=l,C=T.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&h&&M&&S&&A){const P=o.trigger.getBoundingClientRect(),G=h.getBoundingClientRect(),k=o.valueNode.getBoundingClientRect(),V=A.getBoundingClientRect();if(o.dir!=="rtl"){const ye=V.left-G.left,Le=k.left-ye,Ce=P.left-Le,Re=P.width+Ce,De=Math.max(Re,G.width),he=window.innerWidth-gc,le=Fy(Le,[gc,Math.max(gc,he-De)]);u.style.minWidth=Re+"px",u.style.left=le+"px"}else{const ye=G.right-V.right,Le=window.innerWidth-k.right-ye,Ce=window.innerWidth-P.right-Le,Re=P.width+Ce,De=Math.max(Re,G.width),he=window.innerWidth-gc,le=Fy(Le,[gc,Math.max(gc,he-De)]);u.style.minWidth=Re+"px",u.style.right=le+"px"}const U=y(),$=window.innerHeight-gc*2,X=M.scrollHeight,ee=window.getComputedStyle(h),z=parseInt(ee.borderTopWidth,10),K=parseInt(ee.paddingTop,10),ae=parseInt(ee.borderBottomWidth,10),oe=parseInt(ee.paddingBottom,10),re=z+K+X+oe+ae,F=Math.min(S.offsetHeight*5,re),O=window.getComputedStyle(M),J=parseInt(O.paddingTop,10),q=parseInt(O.paddingBottom,10),Q=P.top+P.height/2-gc,ne=$-Q,Z=S.offsetHeight/2,se=S.offsetTop+Z,me=z+K+se,ze=re-me;if(me<=Q){const ye=U.length>0&&S===U[U.length-1].ref.current;u.style.bottom="0px";const Le=h.clientHeight-M.offsetTop-M.offsetHeight,Ce=Math.max(ne,Z+(ye?q:0)+Le+ae),Re=me+Ce;u.style.height=Re+"px"}else{const ye=U.length>0&&S===U[0].ref.current;u.style.top="0px";const Ce=Math.max(Q,z+M.offsetTop+(ye?J:0)+Z)+ze;u.style.height=Ce+"px",M.scrollTop=me-Q+M.offsetTop}u.style.margin=`${gc}px 0`,u.style.minHeight=F+"px",u.style.maxHeight=$+"px",s?.(),requestAnimationFrame(()=>v.current=!0)}},[y,o.trigger,o.valueNode,u,h,M,S,A,o.dir,s]);fi(()=>C(),[C]);const[I,D]=T.useState();fi(()=>{h&&D(window.getComputedStyle(h).zIndex)},[h]);const B=T.useCallback(P=>{P&&_.current===!0&&(C(),E?.(),_.current=!1)},[C,E]);return i.jsx(BJ,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:v,onScrollButtonChange:B,children:i.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:I},children:i.jsx(Br.div,{...a,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})},"SelectItemAlignedPosition")),Sk=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,align:s="start",collisionPadding:a=gc,...o}=e,l=n3(r);return i.jsx(EO,{...l,...o,ref:t,align:s,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[BJ,r3]=Np(dp,{}),_k="SelectViewport",LJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,nonce:s,...a}=e,o=Ap(_k,r),l=r3(_k,r),u=xr(t,o.onViewportChange),d=T.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),i.jsx(dN.Slot,{scope:r,children:i.jsx(Br.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Jn(a.onScroll,h=>{const p=h.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:y}=l;if(y?.current&&x){const v=Math.abs(d.current-p.scrollTop);if(v>0){const _=window.innerHeight-gc*2,M=parseFloat(x.style.minHeight),S=parseFloat(x.style.height),A=Math.max(M,S);if(A<_){const E=A+v,C=Math.min(_,E),I=E-C;x.style.height=C+"px",x.style.bottom==="0px"&&(p.scrollTop=I>0?I:0,x.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})},"SelectViewport")),OJ="SelectGroup",[pbe,gbe]=Np(OJ),Zj="SelectItem",[FJ,bU]=Np(Zj),UJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,value:s,disabled:a=!1,textValue:o,...l}=e,u=Ch(Zj,r),d=Ap(Zj,r),h=u.value===s,[p,x]=T.useState(o??""),[y,v]=T.useState(!1),_=Pu(C=>d.itemRefCallback?.(C,s,a)),M=xr(t,_),S=Ym(),A=T.useRef("touch"),E=Cr(()=>{a||(u.onValueChange(s),u.onOpenChange(!1))},"handleSelect");return i.jsx(FJ,{scope:r,value:s,disabled:a,textId:S,isSelected:h,onItemTextChange:T.useCallback(C=>{x(I=>
49I||(C?.textContent??"").trim())},[]),children:i.jsx(dN.ItemSlot,{scope:r,value:s,disabled:a,textValue:p,children:i.jsx(Br.div,{role:"option","aria-labelledby":S,"data-highlighted":y?"":void 0,"aria-selected":h&&y,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:M,onFocus:Jn(l.onFocus,()=>v(!0)),onBlur:Jn(l.onBlur,()=>v(!1)),onClick:Jn(l.onClick,()=>{A.current!=="mouse"&&E()}),onPointerUp:Jn(l.onPointerUp,()=>{A.current==="mouse"&&E()}),onPointerDown:Jn(l.onPointerDown,C=>{A.current=C.pointerType}),onPointerMove:Jn(l.onPointerMove,C=>{A.current=C.pointerType,a?d.onItemLeave?.():A.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Jn(l.onPointerLeave,C=>{C.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Jn(l.onKeyDown,C=>{a||C.target!==C.currentTarget||d.searchRef?.current!==""&&C.key===" "||(gJ.includes(C.key)&&E(),C.key===" "&&C.preventDefault())})})})})},"SelectItem")),jw="SelectItemText",zJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,className:s,style:a,...o}=e,l=Ch(jw,r),u=Ap(jw,r),d=bU(jw,r),h=vJ(jw,r),[p,x]=T.useState(null),y=Pu(E=>u.itemTextRefCallback?.(E,d.value,d.disabled)),v=xr(t,x,d.onItemTextChange,y),_=p?.textContent,M=T.useMemo(()=>i.jsx("option",{value:d.value,disabled:d.disabled,children:_},d.value),[d.disabled,d.value,_]),{onNativeOptionAdd:S,onNativeOptionRemove:A}=h;return fi(()=>(S(M),()=>A(M)),[S,A,M]),i.jsxs(i.Fragment,{children:[i.jsx(Br.span,{id:d.textId,...o,ref:v}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!gv(l.value)?Yx.createPortal(o.children,l.valueNode):null]})},"SelectItemText")),GJ="SelectItemIndicator",HJ=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,...s}=e;return bU(GJ,r).isSelected?i.jsx(Br.span,{"aria-hidden":!0,...s,ref:t}):null},"SelectItemIndicator")),Mk="SelectScrollUpButton",VJ=T.forwardRef(Cr(function(e,t){const r=Ap(Mk,e.__scopeSelect),s=r3(Mk,e.__scopeSelect),[a,o]=T.useState(!1),l=xr(t,s.onScrollButtonChange);return fi(()=>{if(r.viewport&&r.isPositioned){let u=function(){const h=d.scrollTop>0;o(h)};Cr(u,"handleScroll");const d=r.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?i.jsx(yU,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null},"SelectScrollUpButton")),Nk="SelectScrollDownButton",WJ=T.forwardRef(Cr(function(e,t){const r=Ap(Nk,e.__scopeSelect),s=r3(Nk,e.__scopeSelect),[a,o]=T.useState(!1),l=xr(t,s.onScrollButtonChange);return fi(()=>{if(r.viewport&&r.isPositioned){let u=function(){const h=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<h;o(p)};Cr(u,"handleScroll");const d=r.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?i.jsx(yU,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null},"SelectScrollDownButton")),yU=T.forwardRef(Cr(function(e,t){const{__scopeSelect:r,onAutoScroll:s,...a}=e,o=Ap("SelectScrollButton",r),l=T.useRef(null),u=fN(r),d=T.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return T.useEffect(()=>()=>d(),[d]),fi(()=>{u().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),i.jsx(Br.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Jn(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:Jn(a.onPointerMove,()=>{o.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:Jn(a.onPointerLeave,()=>{d()})})},"SelectScrollButtonImpl")),$J="SelectBubbleInput",XJ=T.forwardRef(Cr(function({__scopeSelect:e,...t},r){const s=Ch($J,e),{value:a,onValueChange:o,required:l,disabled:u,name:d,autoComplete:h,form:p}=s,{nativeOptions:x,nativeSelectKey:y}=s,v=T.useRef(null),_=xr(r,v),M=a??"",S=t3(M),A=Array.from(x).some(E=>(E.props.value??"")==="");return T.useEffect(()=>{const E=v.current;if(!E)return;const C=window.HTMLSelectElement.prototype,D=Object.getOwnPropertyDescriptor(C,"value").set;if(S!==M&&D){const B=new Event("change",{bubbles:!0});D.call(E,M),E.dispatchEvent(B)}},[S,M]),i.jsxs(Br.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:d,autoComplete:h,disabled:u,form:p,onChange:E=>o(E.target.value),...t,style:{...BO,...t.style},ref:_,defaultValue:M,children:[gv(a)&&!A?i.jsx("option",{value:""}):null,Array.from(x)]},y)},"SelectBubbleInput"));function vU(n){return typeof n=="function"}Cr(vU,"isFunction");
49function gv(n){return n===""||n===void 0}Cr(gv,"shouldShowPlaceholder");function s3(n){const e=Pu(n),t=T.useRef(""),r=T.useRef(0),s=T.useCallback(o=>{const l=t.current+o;e(l),Cr((function u(d){t.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[e]),a=T.useCallback(()=>{t.current="",window.clearTimeout(r.current)},[]);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),[t,s,a]}Cr(s3,"useTypeaheadSearch");function i3(n,e,t){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,a=t?n.indexOf(t):-1;let o=wU(n,Math.max(a,0));s.length===1&&(o=o.filter(d=>d!==t));const u=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==t?u:void 0}Cr(i3,"findNextItem");function wU(n,e){return n.map((t,r)=>n[(e+r)%n.length])}Cr(wU,"wrapArray");function En({...n}){return i.jsx(wJ,{"data-slot":"select",...n})}function jn({...n}){return i.jsx(NJ,{"data-slot":"select-value",...n})}function Tn({className:n,size:e="default",children:t,...r}){return i.jsxs(_J,{"data-slot":"select-trigger","data-size":e,className:br("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",n),...r,children:[t,i.jsx(AJ,{asChild:!0,children:i.jsx(dF,{className:"size-4 opacity-50"})})]})}function Rn({className:n,children:e,position:t="popper",align:r="center",...s}){return i.jsx(TJ,{children:i.jsxs(RJ,{"data-slot":"select-content",className:br("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:t,align:r,...s,children:[i.jsx(qJ,{}),i.jsx(LJ,{className:br("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),i.jsx(YJ,{})]})})}function bt({className:n,children:e,...t}){return i.jsxs(UJ,{"data-slot":"select-item",className:br("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",n),...t,children:[i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(HJ,{children:i.jsx(jx,{className:"size-4"})})}),i.jsx(zJ,{children:e})]})}function qJ({className:n,...e}){return i.jsx(VJ,{"data-slot":"select-scroll-up-button",className:br("flex cursor-default items-center justify-center py-1",n),...e,children:i.jsx(RY,{className:"size-4"})})}function YJ({className:n,...e}){return i.jsx(WJ,{"data-slot":"select-scroll-down-button",className:br("flex cursor-default items-center justify-center py-1",n),...e,children:i.jsx(dF,{className:"size-4"})})}let Tw=!1;const SU=4e3;async function QJ(n){const e=Array.from(n.images||[]).filter(t=>
49!t.complete||t.naturalWidth===0).map(t=>new Promise(r=>{const s=()=>{t.removeEventListener("load",s),t.removeEventListener("error",s),r()};t.addEventListener("load",s),t.addEventListener("error",s)}));await Promise.race([Promise.all(e),new Promise(t=>setTimeout(t,SU))])}async function KJ(n){n.fonts?.ready&&await Promise.race([n.fonts.ready.then(()=>{}),new Promise(e=>setTimeout(e,SU))])}function JJ(n){n.querySelectorAll(".quotation-page").forEach(e=>{const t=e.querySelector('[data-atomic-block="items-table"]');if(!t)return;const r=e.getBoundingClientRect(),s=t.getBoundingClientRect(),a=Array.from(e.querySelectorAll('[data-table-flow-member="true"]')).filter(p=>p!==t&&p.dataset.tableFlowRole==="follower").sort((p,x)=>Number(p.dataset.tableFlowOrder??0)-Number(x.dataset.tableFlowOrder??0));if(!a.length)return;const o=Number(e.dataset.tableFlowUsableHeight??0),l=o>0?o/100:1;let u=Number(t.dataset.tableFlowBaseY??0),d=Number(t.dataset.tableFlowBaseH??0),h=s.bottom-r.top;a.forEach((p,x)=>{const y=Number(p.dataset.tableFlowBaseY??0),v=Number(p.dataset.tableFlowBaseH??0),_=Math.max(0,(y-u-d)*l);p.style.top=`${Math.max(0,h+_)}px`,h=p.getBoundingClientRect().bottom-r.top,u=y,d=v})})}function ZJ(n){const e=n.createElement("style");e.setAttribute("data-print-preparation","native-pagination"),e.textContent=`
50    @page { size: A4 portrait; margin: 0; }
51    .quotation-page { break-after: auto; page-break-after: auto; }
52    .items-table { break-inside: auto; page-break-inside: auto; }
53    .items-table thead { display: table-header-group; }
54    .items-table tbody tr, [data-atomic-block="financial-summary"], [data-atomic-block="signature"], [data-atomic-block="bank"] { break-inside: avoid; page-break-inside: avoid; }
55    @media print { .print-page-number-explicit { position: fixed !important; bottom: 8px !important; } }
56  `,n.head?.appendChild(e)}function eZ(n){if(n.querySelector(".print-page-number-explicit"))return;const e=n.querySelector(".quotation-page");if(!e)return;const t=n.createElement("div");t.className="print-page-number-explicit",t.textContent="",t.style.cssText="position:fixed;bottom:8px;left:0;right:0;z-index:99999;text-align:center;direction:ltr;font:11px Cairo,sans-serif;color:#4b5563;background:rgba(255,255,255,.92);padding:2px 0;";const r=n.createElement("style");r.textContent=".print-page-number-explicit::after{content:counter(page) '/' counter(pages)}",n.head?.appendChild(r),e.appendChild(t)}async function _U(n){!n.body||n.body.dataset.printPrepared==="true"||(await KJ(n),await QJ(n),n.querySelectorAll('[data-atomic-block="items-table"]').forEach(e=>{e.getBoundingClientRect().height}),JJ(n),ZJ(n),eZ(n),n.body.dataset.printPrepared="true")}function tZ(n,e){if(Tw)return;Tw=!0;const t=document.createElement("iframe");t.title=e||"طباعة",t.style.cssText="position:fixed;right:0;bottom:0;width:1px;height:1px;border:none;visibility:hidden;",document.body.appendChild(t);const r=t.contentDocument||t.contentWindow?.document;if(!r){t.remove(),Tw=!1;return}r.open(),r.write(n),r.title=e,r.close(),_U(r).then(()=>{try{t.contentWindow?.print()}catch{}Tw=!1}),setTimeout(()=>{try{t.remove()}catch{}},3e4)}async function Gd(n,e){tZ(n,e)}function a3(n){const{open:e,onClose:t,documentType:r,documentNumber:s,customerName:a,date:o,items:l,subtotal:u,taxAmount:d,totalAmount:h,withTax:p,contentHtml:x}=n;if(!e)return null;const v={quotation:"عرض سعر",invoice:"فاتورة رسمية","packing-list":"بيان تعبئة",production:"أمر إنتاج","receipt-voucher":"سند قبض","payment-voucher":"سند دفع"}[r]||r,_=n.companyName||"AMZ MAKiNA",M=I=>(typeof I=="string"?parseFloat(I)||0:I||0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),S=I=>`<!DOCTYPE html><html dir="rtl" lang="ar"><head><meta charset="UTF-8"><title>${v} - ${s}</title><style>
57      @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');
58      * { margin: 0; padding: 0; box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
59      body { font-family: 'Cairo', sans-serif; padding: 32px; background: #fff; color: #111; font-size: 13px; }
60
61      .doc { max-width: 800px; margin: 0 auto; border: 1px solid #b8e6ec; border-radius: 12px; overflow: hidden; }
62      .hd { background: #0096a7; color: #fff; padding: 20px 28px; display: flex; justify-content: space-between; align-items: flex-start; }
63      .hd h1 { margin: 0; font-size: 22px; font-weight: 800; }
64      .hd .meta { font-size: 12px; opacity: .9; line-height: 1.8; text-align: left; }
65      .badge { display: inline-block; background: #fff; color: #0096a7; padding: 4px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-top: 8px; }
66      .body { padding: 24px 28px; }
67      .client-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
68      .info-card { background: #f0fbfc; padding: 10px 14px; border-radius: 8px; border: 1px solid #b8e6ec; }
69      .info-label { font-size: 11px; color: #0096a7; font-weight: 600; margin-bottom: 2px; }
70      .info-value { font-size: 14px; font-weight: 600; }
71      table { width: 100%; border-collapse: collapse; margin: 15px 0; }
72      th { background: #0096a7; color: white; padding: 10px 12px; text-align: right; font-size: 12px; font-weight: 700; }
73      td { padding: 9px 12px; border-bottom: 1px solid #d4f0f4; font-size: 13px; }
74      tr:nth-child(even) { background: #f4fbfc; }
75      .total-bar { background: #f0fbfc; padding: 12px 16px; display: flex; justify-content: flex-end; gap: 32px; font-weight: 700; font-size: 14px; border-radius: 8px; margin-top: 12px; }
76      .total-bar .sub { color: #0096a7; }
77      .total-bar .grand { color: #16a34a; font-size: 16px; }
78      .ft { margin-top: 28px; padding-top: 12px; border-top: 2px solid #0096a7; display: flex; justify-content: space-between; font-size: 11px; color: #007a88; }
79      .ft .doc-type { font-weight: 600; }
80      @media print { body { padding: 0; } .doc { border: none; } }
81    </style></head><body>${I.innerHTML}</body></html>`,A=!!x,E=()=>{A&&Gd(x,`${v} - ${s}`)},C=()=>
81{if(A)return E();const I=document.getElementById("print-preview-content");if(!I)return;const D=`${v} - ${s}`;Gd(S(I),D)};return i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:t,children:i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl w-full max-w-3xl max-h-[90vh] flex flex-col",onClick:I=>I.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("div",{children:i.jsxs("h3",{className:"text-lg font-bold text-foreground flex items-center gap-2",children:["معاينة ",v,i.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:s})]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ke,{onClick:C,className:"bg-primary hover:bg-primary/90 text-foreground text-sm",children:[i.jsx(nl,{className:"w-4 h-4 ml-1"})," طباعة"]}),i.jsx("button",{onClick:t,className:"p-2 rounded-lg hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:i.jsx(Mr,{className:"w-5 h-5"})})]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:A?i.jsx("iframe",{srcDoc:x,title:`${v} - ${s}`,className:"w-full bg-white rounded-lg",onLoad:async I=>{const D=I.currentTarget.contentDocument;try{D&&await _U(D)}catch(B){console.error("Print preview preparation failed",B)}},style:{height:"70vh",border:"none",display:"block",opacity:1}},x):i.jsx("div",{id:"print-preview-content",children:i.jsxs("div",{className:"bg-white rounded-lg overflow-hidden",children:[i.jsxs("div",{className:"flex justify-between items-start p-6",style:{borderBottom:"3px solid #0096a7"},children:[i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:24,fontWeight:800,color:"#0096a7",margin:0},children:_}),i.jsx("span",{className:"inline-block mt-2 px-3 py-1 rounded-full text-xs font-bold",style:{background:"#0096a7",color:"#fff"},children:v})]}),i.jsxs("div",{style:{textAlign:"left",fontSize:12,color:"#007a88",lineHeight:1.8},children:[i.jsxs("div",{children:[i.jsxs("strong",{children:[v," رقم:"]})," ",s]}),i.jsxs("div",{children:[i.jsx("strong",{children:"التاريخ:"})," ",o||new Date().toLocaleDateString("ar")]}),i.jsxs("div",{children:[i.jsx("strong",{children:"العميل:"})," ",a||"-"]}
81)]})]}),i.jsxs("div",{className:"p-6",children:[i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{style:{background:"#0096a7",color:"white",padding:"10px 12px",textAlign:"right",fontSize:12},children:"#"}),i.jsx("th",{style:{background:"#0096a7",color:"white",padding:"10px 12px",textAlign:"right",fontSize:12},children:"المنتج"}),i.jsx("th",{style:{background:"#0096a7",color:"white",padding:"10px 12px",textAlign:"right",fontSize:12},children:"المواصفات"}),i.jsx("th",{style:{background:"#0096a7",color:"white",padding:"10px 12px",textAlign:"right",fontSize:12},children:"الكمية"}),i.jsx("th",{style:{background:"#0096a7",color:"white",padding:"10px 12px",textAlign:"right",fontSize:12},children:"سعر الوحدة"}),i.jsx("th",{style:{background:"#0096a7",color:"white",padding:"10px 12px",textAlign:"right",fontSize:12},children:"الإجمالي"})]})}),i.jsx("tbody",{children:l.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:6,style:{textAlign:"center",padding:20,color:"#0096a7"},children:"لا توجد بنود"})}):l.map((I,D)=>i.jsxs("tr",{style:{borderBottom:"1px solid #d4f0f4"},children:[i.jsx("td",{style:{padding:"9px 12px"},children:D+1}),i.jsx("td",{style:{padding:"9px 12px",fontWeight:600},children:I.product||"-"}),i.jsx("td",{style:{padding:"9px 12px",color:"#007a88"},children:I.specs||"-"}),i.jsx("td",{style:{padding:"9px 12px",textAlign:"center"},children:I.quantity}),i.jsx("td",{style:{padding:"9px 12px"},children:M(I.unitPrice)}),i.jsx("td",{style:{padding:"9px 12px",fontWeight:600},children:M(I.total)})]},D))})]}),i.jsxs("div",{style:{background:"#f0fbfc",padding:"12px 16px",borderRadius:8,marginTop:16,display:"flex",justifyContent:"flex-end",gap:32,fontWeight:700},children:[i.jsxs("span",{children:["المجموع الفرعي: ",M(u||0)]}),p&&d?i.jsxs("span",{style:{color:"#16a34a"},children:["الضريبة (15%): ",M(d)]}):null,i.jsxs("span",{style:{color:"#16a34a",fontSize:16},children:["الإجمالي: ",M(h||0)]})]})]}),i.jsxs("div",{style:{padding:"12px 28px",borderTop:"2px solid #0096a7",display:"flex",justifyContent:"space-between",fontSize:11,color:"#007a88"},children:[i.jsxs("span",{className:"font-semibold",children:[_," — ",v]}),i.jsxs("span",{children:["تاريخ الطباعة: ",new Date().toLocaleDateString("ar-EG-u-nu-arab")]})]})]})})})]})})}const nZ=n=>n==="week"?"أسبوع":n==="month"?"شهر":n==="year"?"سنة":"يوم";function rZ(n){const e=String(n.validityDuration??"").trim(),t=String(n.deliveryDuration??"").trim();return{validity:e!==""&&e!=="0"?`${e} ${nZ(n.validityUnit)}`:"",deliveryTime:t}}function sZ(n){return{...rZ(n),deliveryMethod:String(n.deliveryMethod??"").trim()}}const o3=[{key:"quotationNumber",label:"رقم العرض"},{key:"date",label:"تاريخ العرض"},{key:"clientName",label:"اسم العميل"},{key:"clientPhone",label:"هاتف العميل"},{key:"clientEmail",label:"بريد العميل"},{key:"clientAddress",label:"عنوان العميل"},{key:"clientTaxNumber",label:"الرقم الضريبي"},{key:"clientCompany",label:"اسم الشركة"},{key:"clientCommercialReg",label:"السجل التجاري"},{key:"companyName",label:"اسم شركتنا"},{key:"companyPhone",label:"هاتف شركتنا"},{key:"companyAddress",label:"عنوان شركتنا"},{key:"companyEmail",label:"بريد شركتنا"},{key:"validity",label:"مدة الصلاحية"},{key:"paymentTerms",label:"شروط الدفع"},{key:"deliveryMethod",label:"طريقة التسليم"},{key:"deliveryTime",label:"مدة التسليم"},{key:"technicalInfo",label:"المعلومات الفنية"},{key:"bankInfo",label:"معلومات البنك"},{key:"notes",label:"ملاحظات العرض"},{key:"total",label:"الإجمالي"},{key:"taxTotal",label:"مجموع الضريبة"},{key:"amountInWords",label:"المبلغ كتابةً"}],YS=[{key:"invoiceNumber",label:"رقم الفاتورة"},{key:"date",label:"تاريخ الفاتورة"},{key:"quotationNumber",label:"رقم عرض الأسعار"},{key:"clientName",label:"اسم العميل"},{key:"clientPhone",label:"هاتف العميل"},{key:"clientEmail",label:"بريد العميل"},{key:"clientAddress",label:"عنوان العميل"},{key:"clientTaxNumber",label:"الرقم الضريبي"},{key:"clientCompany",label:"اسم الشركة"},{key:"companyName",label:"اسم شركتنا"},{key:"companyPhone",label:"هاتف شركتنا"},{key:"companyAddress",label:"عنوان شركتنا"},{key:"companyEmail",label:"بريد شركتنا"},{key:"paymentTerms",label:"شروط الدفع"},{key:"deliveryMethod",label:"طريقة التسليم"},{key:"total",label:"الإجمالي"},{key:"taxTotal",label:"مجموع الضريبة"},{key:"discountValue",label:"الخصم"},{key:"amountInWords",label:"المبلغ كتابةً"},{key:"notes",label:"ملاحظات"}],eT=[{key:"voucherNumber",label:"رقم السند"},{key:"date",label:"التاريخ"},{key:"clientName",label:"اسم العميل"},{key:"clientPhone",label:"هاتف العميل"},{key:"amount",label:"المبلغ"},{key:"amountInWords",label:"المبلغ كتابةً"},{key:"currency",label:"العملة"},{key:"paymentMethod",label:"طريقة الدفع"},{key:"notes",label:"ملاحظات"},{key:"companyName",label:"اسم شركتنا"},{key:"companyPhone",label:"هاتف شركتنا"}],MU=[{key:"invoiceNumber",label:"رقم الفاتورة"},{key:"date",label:"التاريخ"},{key:"supplierName",label:"اسم المورد"},{key:"supplierPhone",label:"هاتف المورد"},{key:"supplierAddress",label:"عنوان المورد"},{key:"machineName",label:"اسم المكنة"},{key:"paymentTerms",label:"شروط الدفع"},{key:"total",label:"الإجمالي"},{key:"marginValue",label:"الهامش"},{key:"amountInWords",label:"المبلغ كتابةً"},{key:"notes",label:"ملاحظات"}],NU=[{key:"orderNumber",label:"رقم الأمر"},{key:"date",label:"تاريخ الإنشاء"},{key:"machineName",label:"اسم المكنة"},{key:"clientName",label:"اسم العميل"},{key:"quantity",label:"الكمية"},{key:"status",label:"الحالة"},{key:"estimatedCost",label:"التكلفة التقديرية"},{key:"actualCost",label:"التكلفة الفعلية"},{key:"totalCost",label:"إجمالي التكاليف"},{key:"notes",label:"ملاحظات"}],AU=Object.fromEntries([...o3,...YS,...eT,...MU,...NU].map(({key:n,label:e})=>[n,e])),SC={quotation:{quotationNumber:"QT-0001",clientName:"م. عبدالله الحربي",clientPhone:"0555123456",clientEmail:"[email protected]",clientAddress:"الرياض - حي النخيل",clientTaxNumber:"300123456789",clientCompany:"شركة الحربي للمقاولات",clientCommercialReg:"1010123456",companyName:"شركة أمزي لإنتاج الماكينات",companyPhone:"0123456789",companyAddress:"جدة - المنطقة الصناعية",companyEmail:"[email protected]",validity:"20 يوم",paymentTerms:"50% مقدم، 50% عند التسليم",deliveryMethod:"نقل بري",deliveryTime:"30 يوم عمل",technicalInfo:"مصدر طاقة 380V - قدرة 15HP",bankInfo:`البنك: مصرف الراجحي
82اسم الحساب: شركة أمزي لإنتاج الماكينات
83الآيبان: SA0000000000000000000000`,notes:"هذا العرض صالح وفق الشروط الموضحة أعلاه.",total:"25,400.00",taxTotal:"3,810.00",amountInWords:"خمسة وعشرون ألفاً وأربعمائة ريال فقط لا غير"},salesInvoice:{invoiceNumber:"SI-0001",quotationNumber:"QT-0001",clientName:"م. عبدالله الحربي",clientPhone:"0555123456",clientEmail:"[email protected]",clientAddress:"الرياض - حي النخيل",clientTaxNumber:"300123456789",clientCompany:"شركة الحربي للمقاولات",companyName:"شركة أمزي لإنتاج الماكينات",companyPhone:"0123456789",companyAddress:"جدة - المنطقة الصناعية",companyEmail:"[email protected]",paymentTerms:"50% مقدم، 50% عند التسليم",deliveryMethod:"نقل بري",total:"25,400.00",taxTotal:"3,810.00",discountValue:"0.00",amountInWords:"خمسة وعشرون ألفاً وأربعمائة ريال فقط لا غير",notes:""},officialInvoice:{invoiceNumber:"OF-0001",quotationNumber:"QT-0001",clientName:"م. عبدالله الحربي",clientPhone:"0555123456",clientEmail:"[email protected]",clientAddress:"الرياض - حي النخيل",clientTaxNumber:"300123456789",clientCompany:"شركة الحربي للمقاولات",companyName:"شركة أمزي لإنتاج الماكينات",companyPhone:"0123456789",companyAddress:"جدة - المنطقة الصناعية",companyEmail:"[email protected]",paymentTerms:"50% مقدم، 50% عند التسليم",deliveryMethod:"نقل بري",total:"25,400.00",taxTotal:"3,810.00",discountValue:"0.00",amountInWords:"خمسة وعشرون ألفاً وأربعمائة ريال فقط لا غير",notes:""},packingList:{invoiceNumber:"PK-0001",quotationNumber:"QT-0001",clientName:"م. عبدالله الحربي",clientPhone:"0555123456",clientEmail:"[email protected]",clientAddress:"الرياض - حي النخيل",clientTaxNumber:"300123456789",clientCompany:"شركة الحربي للمقاولات",companyName:"شركة أمزي لإنتاج الماكينات",companyPhone:"0123456789",companyAddress:"جدة - المنطقة الصناعية",companyEmail:"[email protected]",paymentTerms:"50% مقدم، 50% عند التسليم",deliveryMethod:"نقل بري",total:"25,400.00",taxTotal:"3,810.00",discountValue:"0.00",amountInWords:"خمسة وعشرون ألفاً وأربعمائة ريال فقط لا غير",notes:""},purchaseInvoice:{invoiceNumber:"PI-0001",supplierName:"مؤسسة النور للتوريدات",supplierPhone:"0555987654",supplierAddress:"الدمام - المنطقة الصناعية",machineName:"مكنة قص ليزر X-200",paymentTerms:"شيكات على 90 يوم",total:"18,750.00",marginValue:"15%",amountInWords:"ثمانية عشر ألفاً وسبعمائة وخمسون ريالاً فقط لا غير",notes:""},receiptVoucher:{voucherNumber:"RV-0001",clientName:"م. عبدالله الحربي",clientPhone:"0555123456",amount:"10,000.00",amountInWords:"عشرة آلاف ريال فقط لا غير",currency:"ريال سعودي",paymentMethod:"نقداً",notes:"",companyName:"شركة أمزي لإنتاج الماكينات",companyPhone:"0123456789"},paymentVoucher:{voucherNumber:"PV-0001",clientName:"مؤسسة النور للتوريدات",clientPhone:"0555987654",amount:"6,250.00",amountInWords:"ستة آلاف ومائتان وخمسون ريالاً فقط لا غير",currency:"ريال سعودي",paymentMethod:"تحويل بنكي",notes:"",companyName:"شركة أمزي لإنتاج الماكينات",companyPhone:"0123456789"},productionOrder:{orderNumber:"PO-0001",machineName:"مكنة قص ليزر X-200",clientName:"م. عبدالله الحربي",quantity:"2",status:"قيد التنفيذ",estimatedCost:"22,500.00",actualCost:"21,800.00",totalCost:"21,800.00",notes:""}};function Ak(){return new Date().toLocaleDateString("ar-EG")}const Om=[{key:"quotation",label:"عرض الأسعار",fields:o3},{key:"salesInvoice",label:"فاتورة المبيعات",fields:YS},{key:"officialInvoice",label:"الفاتورة الرسمية",fields:YS},{key:"packingList",label:"بيان التعبئة",fields:YS},{key:"purchaseInvoice",label:"فاتورة الشراء",fields:MU},{key:"receiptVoucher",label:"سند القبض",fields:eT},{key:"paymentVoucher",label:"سند الصرف",fields:eT},{key:"productionOrder",label:"أمر الإنتاج",fields:NU}];function t0(n){return Om.find(e=>e.key===n)?.fields??o3}function iZ(n){return Om.find(e=>e.key===n)?.label??n}function fp(n){const e=iZ(n);return{docType:n,title:e,footer:"شكراً لتعاملكم معنا",primaryColor:"#0096a7",secondaryColor:"#f0fbfc",accentColor:"#1a1a2e",fontFamily:"Cairo",headerAlign:"center",showLogo:!0,showWatermark:!1,showHeader:!0,showTableHeader:!0,showTotals:!0,showSignature:!1,showFooter:!0,tableFlowGapPx:0,elements:[{id:"e-logo",type:"logo",x:88,y:1.5,w:10},{id:"e-company-block",type:"text",text:`<div style="text-align:center"><div style="font-size:16px;font-weight:700;
83color:#1a1a2e">${e}</div></div>`,x:25,y:2,w:50,align:"center"},{id:"e-company-info",type:"field",key:"companyName",x:5,y:7,w:40,fontSize:11},{id:"e-company-phone",type:"field",key:"companyPhone",x:5,y:9.5,w:40,fontSize:11},{id:"e-company-address",type:"field",key:"companyAddress",x:5,y:12,w:40,fontSize:11},{id:"e-company-email",type:"field",key:"companyEmail",x:5,y:14.5,w:40,fontSize:11},{id:"e-line1",type:"line",x:5,y:18.5,w:90},{id:"e-doc-number",type:"field",key:n==="quotation"?"quotationNumber":n==="productionOrder"?"orderNumber":"voucherNumber",x:60,y:21,w:35,fontSize:12,fontWeight:700},{id:"e-doc-date",type:"field",key:"date",x:20,y:21,w:35,fontSize:12},{id:"e-client-name",type:"field",key:"clientName",x:5,y:24.5,w:90,fontSize:12,fontWeight:700},{id:"e-client-phone",type:"field",key:"clientPhone",x:5,y:27,w:44,fontSize:11},{id:"e-client-email",type:"field",key:"clientEmail",x:51,y:27,w:44,fontSize:11},{id:"e-client-address",type:"field",key:"clientAddress",x:5,y:29.5,w:90,fontSize:11},{id:"e-items-table",type:"itemsTable",x:5,y:33.5,w:90},...n==="quotation"?[{id:"e-validity",type:"field",key:"validity",x:51,y:62,w:44,fontSize:11},{id:"e-payment-terms",type:"field",key:"paymentTerms",x:5,y:62,w:44,fontSize:11},{id:"e-delivery-method",type:"field",key:"deliveryMethod",x:51,y:65,w:44,fontSize:11},{id:"e-delivery-time",type:"field",key:"deliveryTime",x:5,y:65,w:44,fontSize:11},{id:"e-technical-info",type:"field",key:"technicalInfo",x:5,y:68,w:90,fontSize:11},{id:"e-bank-info",type:"field",key:"bankInfo",x:5,y:71,w:90,fontSize:11},{id:"e-quotation-notes",type:"field",key:"notes",x:5,y:76,w:90,fontSize:11}]:[],{id:"e-totals-box",type:"totalsBox",x:60,y:82,w:35},{id:"e-words",type:"field",key:"amountInWords",x:5,y:87,w:50,fontSize:11,fontWeight:700},{id:"e-signatures",type:"signature",x:25,y:93,w:50}
83,{id:"e-footer",type:"text",text:'<div style="text-align:center;font-size:11px;color:#4b5563">شكراً لتعاملكم معنا</div>',x:5,y:96,w:90,align:"center"}]}}function aZ(n){if(n.elements&&n.elements.length>0)return n;const e=t0(n.docType),t=[];let r=2;if(!n.sections||n.sections.length===0)return{...n,elements:fp(n.docType).elements};for(const s of n.sections){if(!s.enabled)continue;if((s.title||"").includes("الرأس")){t.push({id:`m-logo-${s.id}`,type:"logo",x:88,y:r,w:10}),t.push({id:`m-comp-${s.id}`,type:"field",key:"companyName",x:5,y:r,w:80,fontSize:13,fontWeight:700}),r+=4;continue}for(const o of s.fields||[]){if(o.type==="spacer"){r+=Math.min((o.height||16)/30,3);continue}if(o.type==="logo"){t.push({id:`m-${o.id}`,type:"logo",x:88,y:r,w:10}),r+=5;continue}if(o.type==="signature"){t.push({id:`m-${o.id}`,type:"signature",x:25,y:r,w:50}),r+=6;continue}if(o.type==="text"){t.push({id:`m-${o.id}`,type:"text",text:o.text??"",x:5,y:r,w:90,align:"center"}),r+=3;continue}if(o.key==="itemsTable"){t.push({id:`m-${o.id}`,type:"itemsTable",x:5,y:r,w:90}),r+=35;continue}if(["total","taxTotal","amountInWords"].includes(o.key||""))continue;const l=e.find(u=>u.key===o.key);t.push({id:`m-${o.id}`,type:"field",key:o.key,label:l?.label||o.label,x:5,y:r,w:90,fontSize:11}),r+=2.4}r+=1.2}if(n.showTotals&&t.push({id:"m-totals",type:"totalsBox",x:60,y:r,w:35}),n.showSignature&&t.push({id:"m-sig",type:"signature",x:25,y:r+5,w:50}),n.showFooter){const s=n.footer?`<div style="text-align:center;font-size:11px;color:#4b5563">${n.footer}</div>`:"";t.push({id:"m-footer",type:"text",text:s,x:5,y:95.5,w:90,align:"center"})}return{...n,elements:t}}function oZ(n){const e=n.docType==="quotation"?["companyAddress","companyEmail","notes"]:[];if(!n.elements?.length)return n;const t=[...n.elements],r=t.some(u=>u.type==="logo");if(n.docType==="quotation"&&!r&&n.showLogo!==!1){const u=fp("quotation").elements.find(d=>d.type==="logo");u&&t.unshift({...u,id:`${u.id}-migration`})}if(e.length===0)return t.length===n.elements.length?n:{...n,elements:t};const s=new Set(t.filter(u=>u.type==="field"&&u.key).map(u=>u.key)),o=fp(n.docType).elements.filter(u=>u.type==="field"&&u.key&&e.includes(u.key)&&!s.has(u.key));if(o.length===0&&t.length===n.elements.length)return n;const l=t.reduce((u,d)=>Math.max(u,d.zIndex??0),0);return{...n,elements:[...t,...o.map((u,d)=>({...u,id:`${u.id}-migration`,zIndex:l+d+1}))]}}function lZ(){const{data:n,isLoading:e,refetch:t}=Pe.priceQuotations.list.useQuery(),{data:r}=Pe.clients.list.useQuery(),{data:s}=Pe.machines.listAll.useQuery(),{data:a}=Pe.productCategories.list.useQuery(),{data:o}=Pe.rawMaterials.list.useQuery(),{data:l}=Pe.materialCategories.list.useQuery(),{data:u}=Pe.settings.technicalInfoOptions.list.useQuery(),{data:d}=Pe.settings.paymentTermsOptions.list.useQuery(),{data:h}=Pe.settings.deliveryMethodsOptions.list.useQuery(),[p,x]=T.useState({});T.useEffect(()=>{const Je=new URLSearchParams(window.location.search).get("new-client");if(Je){const it=(r||[]).find(Wt=>Wt.id===Number(Je));je(),it&&$(Wt=>({...Wt,customerName:it.name||"",customerId:it.id||0,customerPhone:it.phone||""}));const Et=new URL(window.location.href);Et.searchParams.delete("new-client"),window.history.replaceState({},"",Et.toString())}},[r]);const y=Pe.priceQuotations.create.useMutation(),v=Pe.priceQuotations.update.useMutation(),_=Pe.priceQuotations.delete.useMutation(),M=Pe.conversions.quotationToInvoice.useMutation(),S=Pe.conversions.quotationToPackingList.useMutation(),A=Pe.conversions.quotationToProduction.useMutation(),E=Pe.conversions.quotationToSalesInvoice.useMutation(),C=Pe.useUtils(),I=Pe.clients.create.useMutation({onSuccess:()=>{C.clients.list.invalidate()}}),[D,B]=T.useState(!1),[P,G]=T.useState(null),[k,V]=T.useState([]),[U,$]=T.useState({}),[X,ee]=T.useState(null),[z,K]=T.useState(!1),[ae,oe]=T.useState(null),[re,F]=T.useState(null),[O,J]=T.useState(null),[q,Q]=T.useState(!1),[ne,Z]=T.useState(""),[se,me]=T.useState(""),[ze,Be]=T.useState(!1),[ye,Le]=T.useState("all"),[Ce,Re]=T.useState(!0),[De,he]=T.useState(!1),[le,Xe]=T.useState({}),[qe,Ge]=T.useState({}),[ot,ve]=T.useState({}),[mt,xt]=T.useState("all"),[ge,Y]=T.useState("all"),je=()=>{G(null),ee(null),$({customerName:"",customerId:0,customerPhone:"",validityDuration:"",validityUnit:"day",withTax:!1,showTerms:!0,showBankInfo:!0,showProductImage:!0,printBlackWhite:!1,discountType:"",discountValue:0,deliveryMethod:"",deliveryDuration:"",paymentTerms:"",notes:"",status:"draft",currency:"USD",exchangeRate:1}),V([]),Ge({}),ve({}),xt("all"),Y("all"),x({}),B(!0)},Ie=async ue=>{await Ve(ue,!0)},Ve=async(ue,Je=!1)=>{G(ue),K(!0);try{const it=await C.priceQuotations.get.fetch({id:ue.id});ee(it),$({...ue,...it});const Et=(it?.items||[]).map(an=>({...an,features:an.specs?an.specs.split(`
84`).filter(Sn=>Sn.trim()):[]}));V(Et),x(Object.fromEntries(Et.map((an,Sn)=>[Sn,an.itemType==="material"||an.rawMaterialId?"material":"product"]))),it&&$(an=>({...an,...it,status:it.status||"draft",currency:it.currency||"USD"})),B(!0);let Wt={};try{if(it?.techInfo){const an=JSON.parse(it.techInfo);Array.isArray(an)&&an.forEach(Sn=>{const Lr=(u||[]).find(Gr=>Gr.label===Sn.label);Lr&&(Wt[String(Lr.id)]=Sn.value||"")})}}catch{}Xe(Wt)}catch{_e.error("حدث خطأ في تحميل البيانات")}K(!1)},ft=async()=>{try{const ue=k.map(Et=>({...Et,specs:Et.features&&Et.features.length>0?Et.features.filter(Wt=>Wt.trim()).join(`
85`):Et.specs||""})),Je=Object.entries(le).filter(([Et,Wt])=>(Wt||"").trim()).map(([Et,Wt])=>{const an=(u||[]).find(Sn=>String(Sn.id)===Et);return{label:an?.label||"",value:Wt.trim(),unit:an?.unit||""}}),it={...U,techInfo:Je.length>0?JSON.stringify(Je):""};P?(await v.mutateAsync({id:P.id,data:it,items:ue}),_e.success("تم تحديث عرض السعر")):(await y.mutateAsync({data:it,items:ue}),_e.success("تم إنشاء عرض السعر")),B(!1),t()}catch{_e.error("حدث خطأ")}},vt=async ue=>{if(confirm("هل أنت متأكد من الحذف؟"))try{await _.mutateAsync({id:ue.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},ce=async ue=>{try{await M.mutateAsync({quotationId:ue}),_e.success("تم إنشاء الفاتورة"),t()}catch{_e.error("حدث خطأ")}},Me=async ue=>{try{await S.mutateAsync({quotationId:ue}),_e.success("تم إنشاء قائمة التغليف"),t()}catch{_e.error("حدث خطأ")}},Fe=async ue=>{try{await A.mutateAsync({quotationId:ue}),_e.success("تم إنشاء أمر الإنتاج"),t(),window.dispatchEvent(new CustomEvent("navigate-to-section",{detail:"production-orders"}))}catch{_e.error("حدث خطأ")}},ie=async ue=>{try{await E.mutateAsync({quotationId:ue}),_e.success("تم إنشاء فاتورة المبيعات"),t()}catch{_e.error("حدث خطأ")}},Se=async ue=>{const Je=`عرض سعر ${ue.invoiceNumber||ue.id}`,it=await Ae(ue,Je);await Gd(it,Je)},Ae=async(ue,Je)=>{let it=k;try{const At=await C.priceQuotations.get.fetch({id:ue.id});At?.items&&At.items.length>0&&(it=At.items.map(Ht=>({...Ht,features:Ht.specs?Ht.specs.split(`
86`).filter(Dn=>Dn.trim()):[]})))}catch{}let Et={};try{Et=await C.settings.list.fetch()}catch{}const Wt=At=>{if(typeof At=="number")return Number.isFinite(At)?At:0;const Ht=Number(String(At??"").replace(/,/g,"").trim());return Number.isFinite(Ht)?Ht:0},an=it.reduce((At,Ht)=>At+Wt(Ht.totalPrice??Wt(Ht.quantity)*Wt(Ht.unitPrice)),0),Sn=Wt(ue.discountValue);let Lr=0;ue.discountType==="percentage"&&Sn>0?Lr=an*(Sn/100):ue.discountType==="fixed"&&Sn>0&&(Lr=Sn);const Gr=Math.max(0,an-Lr),Nr=ue.withTax?.11:0,Wn=Gr*Nr,jr=Math.round((Gr+Wn)*100)/100,es=ue.currency==="USD"?"$":ue.currency==="EUR"?"€":ue.currency==="SAR"?"﷼":ue.currency==="AED"?"د.إ":"ل.ل",Tr=At=>`${es}
86${Wt(String(At??"").replace(/[^0-9.-]/g,"")).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,as={};try{const At=it.filter(Ht=>Ht.productId).map(Ht=>Ht.productId);for(const Ht of At)try{const Dn=await C.products.images.fetch({productId:Ht});Dn&&Dn.length>0&&(as[Ht]=Dn[0].url)}catch{}}catch{}const Ps=At=>String(At??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),gi=it.map((At,Ht)=>{const Dn=Array.isArray(At.features)?At.features:[],In=String(At.specs||""),xs=[...Dn,...In.split(`
87`)].map(ts=>String(ts||"").trim()).filter(Boolean).filter((ts,pa,Bo)=>Bo.indexOf(ts)===pa),ii=xs.length>0?`<ul style="margin:2px 0 0;padding:0;list-style:none;line-height:1.35;overflow-wrap:anywhere;word-break:break-word;">${xs.map(ts=>`<li style="padding:1px 0;font-size:12px;color:#1a1a2e;border-bottom:1px dotted #cfeef3;overflow-wrap:anywhere;word-break:break-word;">• ${Ps(ts)}</li>`).join("")}</ul>`:"";let Cs="";return At.productId&&as[At.productId]?Cs=`<img src="${Ps(as[At.productId])}" style="width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d4f0f4" onerror="this.style.display='none'">`:At.productId&&(Cs=`<img src="/manus-storage/product_placeholder.png" style="width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d4f0f4" onerror="this.style.display='none'">`),`
88      <tr data-atomic-block="product-row" style="border-bottom:1px solid #d4f0f4;break-inside:avoid;page-break-inside:avoid">
89        <td style="padding:12px 10px;vertical-align:top;width:30px;font-weight:600;color:#0096a7">${Ht+1}</td>
90        <td style="padding:8px 10px;vertical-align:top;width:52%;white-space:normal;overflow-wrap:anywhere;word-break:break-word;line-height:1.4;border-bottom:1px solid #d4f0f4">
91          <div style="display:flex;gap:10px;align-items:flex-start">
92            ${Cs?`<div style="flex-shrink:0">${Cs}</div>`:""}
93            <div style="min-width:0;overflow-wrap:anywhere;word-break:break-word">
94              ${At.productName?`<div style="font-size:14px;font-weight:700;color:#0096a7;margin-bottom:3px;overflow-wrap:anywhere;word-break:break-word">${Ps(At.productName)}</div>`:""}
95              ${ii}
96            </div>
97          </div>
98        </td>
99        <td style="padding:8px 10px;vertical-align:middle;text-align:center;width:8%;border-bottom:1px solid #d4f0f4">${At.quantity||0}</td>
100        <td style="padding:8px 10px;vertical-align:middle;text-align:center;width:15%;border-bottom:1px solid #d4f0f4">${Tr(At.unitPrice)}</td>
101        <td style="padding:8px 10px;vertical-align:middle;text-align:center;font-weight:700;width:15%;border-bottom:1px solid #d4f0f4">${Tr(At.totalPrice)}</td>
102      </tr>`}).join(""),Xr=Et?.bank_info||"",ps=Et?.company_name||Et?.companyName||"AMZ",Ds=(At=>{const Ht=String(At??"").trim();return Ht?/^(https?:|data:|blob:|\/)/i.test(Ht)?Ht:Ht.startsWith("manus-storage/")?`/${Ht}`:Ht.startsWith("local-storage/")?`/${Ht}`:`/local-storage/uploads/${Ht.replace(/^uploads\//,"")}`:""})(Et?.company_logo||Et?.companyLogo||""),Vs=Ds&&typeof window<"u"?(()=>{try{return new URL(Ds,window.location.origin).href}catch{return Ds}})():Ds,Yt=Et?.terms_conditions||"",or=Yt?Yt.split(`
103`).filter(At=>At.trim()):[];let ks=[];try{ue.techInfo&&(ks=JSON.parse(ue.techInfo))}catch{ks=[]}Array.isArray(ks)||(ks=[]);const de=`<table class="items-table">
104    <colgroup><col style="width:5%"><col style="width:52%"><col style="width:10%"><col style="width:15%"><col style="width:18%"></colgroup>
105    <thead>
106      <tr>
107        <th style="width:30px;text-align:center">#</th>
108        <th style="text-align:right">الوصف</th>
109        <th style="text-align:center">الكمية</th>
110        <th style="text-align:center">السعر</th>
111        <th style="text-align:center">الإجمالي</th>
112      </tr>
113    </thead>
114    <tbody>
115      ${gi||'<tr><td colspan="5" style="text-align:center;padding:20px;color:#0096a7">لا توجد بنود</td></tr>'}
116    </tbody>
117  </table>`,He=sZ({validityDuration:ue.validityDuration,validityUnit:ue.validityUnit,deliveryDuration:ue.deliveryDuration,deliveryMethod:ue.deliveryMethod});let rt="";try{const{tafsit:At}=await A_(async()=>{const{tafsit:Ht}=await import("./tafsit-B5jM7qNn.js");return{tafsit:Ht}},[]);rt=At(jr,ue.currency||"USD")}catch{}const Ze=new Date(ue.createdAt||Date.now()).toLocaleDateString("ar-LB",{day:"numeric",month:"long",year:"numeric"});let We=null;try{const At=await C.templates.get.fetch({docType:"quotation"});At&&(We=At)}catch{}We=We?oZ(aZ(We)):fp("quotation");const Ct=!!We&&Array.isArray(We?.elements)&&We.elements.length>0,zt=!!We&&Array.isArray(We?.sections)&&We.sections.length>0,Pt=We||{primaryColor:"#0096a7",secondaryColor:"#f0fbfc",accentColor:"#1a1a2e",fontFamily:"Cairo",headerAlign:"center"},_t=Pt.primaryColor,kt=Pt.secondaryColor,Rt=Pt.accentColor,qt=Pt.fontFamily,Qt=At=>String(At??"").replace(/<[^>]*>/g," ").replace(/&nbsp;/gi," ").replace(/\s+/g," ").trim(),nn=At=>Qt(At).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Cn=ks.map(At=>({label:Qt(At?.label),value:Qt(At?.value),unit:Qt(At?.unit)})).filter(At=>At.label&&At.value),Zt=Cn.map(At=>`${At.label}${At.unit?` (${At.unit})`:""}: ${At.value}`).join(" • "),Fn=Cn.map(At=>`<span><strong>${nn(At.label)}${At.unit?` (${nn(At.unit)})`:""}:</strong> ${nn(At.value)}</span>`),_n={quotationNumber:"رقم العرض",date:"تاريخ العرض",clientName:"اسم العميل",clientPhone:"هاتف العميل",clientEmail:"بريد العميل",clientAddress:"عنوان العميل",clientTaxNumber:"الرقم الضريبي",clientCompany:"شركة العميل",clientCommercialReg:"السجل التجاري",companyName:"اسم الشركة",companyPhone:"هاتف الشركة",companyAddress:"عنوان الشركة",companyEmail:"بريد الشركة",validity:"مدة الصلاحية",paymentTerms:"شروط الدفع",deliveryMethod:"طريقة التسليم",deliveryTime:"مدة التسليم",technicalInfo:"المعلومات الفنية",bankInfo:"معلومات البنك",notes:"ملاحظات العرض",total:"المجموع الإجمالي",taxTotal:"الضريبة",amountInWords:"المبلغ كتابةً"},Gt={quotationNumber:String(ue.quotationNumber||""),date:Ze,clientName:ue.customerName||"",clientPhone:ue.customerPhone||"",clientEmail:ue.customerEmail||"",clientAddress:ue.customerAddress||"",clientTaxNumber:ue.customerTaxNumber||"",clientCompany:ue.customerCompany||"",clientCommercialReg:ue.customerCommercialReg||"",companyName:ps,companyPhone:Et?.whatsapp_number||"",companyAddress:Et?.company_address||"",companyEmail:Et?.company_email||Et?.website||"",validity:He.validity,paymentTerms:ue.paymentTerms||"",deliveryMethod:He.deliveryMethod,deliveryTime:He.deliveryTime,technicalInfo:Zt,bankInfo:Xr,notes:ue.notes||ue.quotationNotes||"",total:Tr(jr),taxTotal:Tr(Wn),amountInWords:rt};let Rr="";if(Ct)try{const{renderTemplateToHtml:At}=await A_(async()=>{const{renderTemplateToHtml:Dn}=await Promise.resolve().then(()=>dZ);return{renderTemplateToHtml:Dn}},void 0),Ht=JSON.stringify(it.map(Dn=>({label:Dn.productName||"",name:Dn.productName||"",specs:Array.isArray(Dn.features)&&Dn.features.length?Dn.features.filter(In=>In.trim()).join(`
118`):Dn.specs||"",qty:String(Dn.quantity||0),unit:Dn.unit||"",price:Tr(Dn.unitPrice),total:Tr(Dn.totalPrice),lineTotal:Tr(Dn.totalPrice),image:Dn.productId&&as[Dn.productId]||""})));Rr=At(We,{...Gt,__itemsJson:Ht,__totals:Tr(jr),__taxTotal:Wn>0?Tr(Wn):"",__discount:Lr?String(Lr):""},{logoUrl:Vs,companyTitle:ps,deferTableFlow:!0})}catch{}const mn=At=>At.fields.map(Ht=>{if(Ht.type==="spacer")return`<div style="height:${Ht.height||16}px"></div>`;if(Ht.type==="text")return Ht.text?`<div style="color:${Rt}">${Ht.text}</div>`:"";if(Ht.type==="logo")return We?.showLogo?Vs?`<img src="${Vs}" style="max-height:60px;max-width:150px;object-fit:contain" />`:`<div style="font-weight:800;color:${_t};font-size:18px">${ps}</div>`:"";if(Ht.type==="signature")return`<div style="display:flex;gap:30px;margin-top:16px;justify-content:center"><div style="text-align:center"><div style="border-bottom:1px solid ${_t};width:140px;height:44px"></div><div style="font-size:11px;color:#4b5563;margin-top:3px">التوقيع والختم</div></div><div style="text-align:center"><div style="border-bottom:1px solid ${_t};width:140px;height:44px"></div><div style="font-size:11px;color:#4b5563;margin-top:3px">اسم المسؤول</div></div></div>`;if(Ht.key==="itemsTable")return"__ITEMS_TABLE__";const Dn=Gt[Ht.key??""]??"";if(!Dn)return"";if(Ht.key==="bankInfo"){const In=Dn.split(/\r?\n/).map(xs=>
118xs.trim()).filter(Boolean);return`<div style="padding:3px 0;font-size:13px"><div style="font-weight:700;color:${_t};margin-bottom:4px;direction:rtl;text-align:right">${Ht.label||_n[Ht.key]||Ht.key}:</div><ul style="margin:0;padding-right:22px;list-style:disc;line-height:1.8;color:#374151">${In.map(xs=>`<li>${nn(xs)}</li>`).join("")}</ul></div>`}return`<div style="display:flex;gap:6px;padding:2px 0;font-size:13px"><span style="font-weight:700;color:${_t};white-space:nowrap">${Ht.label||_n[Ht.key]||Ht.key}:</span><span style="color:#374151;white-space:pre-wrap;flex:1">${nn(Dn)}</span></div>`}).filter(Boolean).join(""),Or=We?.sections?.filter(At=>At.enabled).map(At=>`<div style="margin-bottom:14px">${mn(At)}</div>`).join("").replace("__ITEMS_TABLE__",de),os=Vs?`<img src="${Vs}" style="max-height:80px;max-width:150px;object-fit:contain" />`:`<div class="company-name">${ps}</div>`,gs=Fn.length>0?`<div class="tech-info" data-atomic-block="technical-info"><strong style="color:${_t};margin-left:8px">المعلومات الفنية للمصنع:</strong>${Fn.join("")}</div>`:"",As=`<!DOCTYPE html>
119<html dir="rtl" lang="ar">
120<head>
121<meta charset="UTF-8">
122<title>عرض أسعار - ${ue.quotationNumber||""}</title>
123<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&family=Tajawal:wght@400;500;700;800&family=Amiri:wght@400;700&family=Noto+Kufi+Arabic:wght@400;500;700;800&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap" rel="stylesheet">
124<style>
125  * { margin: 0; padding: 0; box-sizing: border-box; }
126  body { font-family: '${qt}', 'Cairo', sans-serif; color: ${Rt}; padding: 30px; background: #fff; position: relative; }
127  .page { max-width: 800px; margin: 0 auto; }
128  /* HEADER */
129  .header { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 15px; border-bottom: 3px solid #0096a7; margin-bottom: 20px; }
130  .header-right { text-align: left; }
131  .header-right h1 { font-size: 28px; font-weight: 800; color: #0096a7; margin: 0; }
132  .header-right .invoice-no { font-size: 16px; color: #16a34a; font-weight: 700; margin-top: 4px; }
133  .header-left { text-align: right; }
134  .header-left .company-name { font-size: 22px; font-weight: 800; color: #0096a7; }
135  .header-left .company-sub { font-size: 11px; color: #16a34a; letter-spacing: 1px; }
136  .header-left .contact-line { font-size: 12px; color: #1a1a2e; margin-top: 4px; }
137  .phone-icon { display:inline-block; color:#0096a7; font-weight:700; font-size:14px; line-height:1; }
138  /* META INFO */
139  .meta-row { display: flex; justify-content: space-between; margin-bottom: 15px; }
140  .meta-date { font-size: 13px; color: #1a1a2e; }
141  .meta-date strong { color: #0096a7; }
142  /* TEAL BAR */
143  .teal-bar { background: #0096a7; color: white; padding: 10px 20px; border-radius: 8px; margin: 15px 0; display: flex; justify-content: space-between; align-items: center; }
144  .teal-bar .bar-title { font-size: 16px; font-weight: 700; }
145  .teal-bar .bar-client { font-size: 13px; }
146  /* TABLE */
147  .items-table { width: 100%; border-collapse: collapse; border-spacing: 0; margin: 10px 0; table-layout: fixed; }
148  .items-table thead { display: table-header-group; }
149  .items-table tr { break-inside: avoid; page-break-inside: avoid; }
150  .items-table thead th { background: #fff; color: #1a1a2e; padding: 10px 12px; text-align: center; font-weight: 700; font-size: 13px; border-bottom: 2px solid #0096a7; }
151  .items-table tbody tr { height: auto !important; break-inside: avoid; page-break-inside: avoid; }
152  .items-table tbody td { height: auto !important; padding: 12px 10px; font-size: 13px; vertical-align: top; overflow-wrap: anywhere; word-break: break-word; }
153  [data-atomic-block] { break-inside: avoid; page-break-inside: avoid; }
154  /* TOTAL */
155  .total-bar { background: #0096a7; color: white; padding: 12px 20px; border-radius: 8px; margin: 15px 0; display: flex; justify-content: flex-end; align-items: center; gap: 15px; }
156  .total-bar .total-label { font-size: 16px; font-weight: 600; }
157  .total-bar .total-amount { font-size: 22px; font-weight: 800; }
158  /* FOOTER */
159  .footer { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 2px solid #0096a7; justify-content: flex-start; }
160  .footer-left { font-size: 11px; color: #1a1a2e; }
161  .footer-left p { margin: 3px 0; }
162  .footer-right { font-size: 11px; color: #1a1a2e; text-align: right; }
163  .footer-right p { margin: 3px 0; }
164  .footer-right .bank-title { font-weight: 700; color: #0096a7; margin-bottom: 5px; }
165  .bank-list { margin: 4px 0 0; padding-right: 20px; list-style: disc; line-height: 1.8; }
166  .bank-list li { margin: 2px 0;
166 overflow-wrap: anywhere; word-break: break-word; }
167  /* TECH INFO */
168  .tech-info { display: flex; flex-wrap: wrap; gap: 15px; padding: 12px 20px; background: #ffffff; border-radius: 8px; margin: 10px 0; border: 1.5px solid #0096a7; font-size: 13px; color: #1a1a2e; }
169  .tech-info span { display: inline-flex; gap: 4px; }
170  .tech-info strong { color: #0096a7; }
171  .print-page-number { display: none; }
172  .footer, .total-bar, .tech-info, .meta-row { break-inside: avoid; page-break-inside: avoid; }
173  @page { size: A4; margin: 0; }
174  @media print {
175    body { padding: 0 !important; background: #fff !important; }
176    html, body { margin: 0 !important; }
177    .page { width:210mm !important; max-width:none !important; margin:0 !important; box-sizing:border-box !important; }
178    .canvas-page { width:210mm !important; min-height:297mm !important; height:auto !important; margin:0 !important; box-sizing:border-box !important; overflow:visible !important; }
179    .canvas-page ~ .default-page, .canvas-page ~ .custom-page { display:none !important; }
180    .print-page-number {
181      display: block !important;
182      position: fixed;
183      bottom: 8px;
184      left: 0;
185      right: 0;
186      z-index: 9999;
187      text-align: center;
188      direction: rtl;
189      font: 11px '${qt}', 'Cairo', sans-serif;
190      color: #4b5563;
191      background: rgba(255,255,255,.92);
192      padding: 2px 0;
193    }
194    .print-page-number::after { content: 'صفحة ' counter(page) ' من ' counter(pages); }
195    * { print-color-adjust: exact !important; -webkit-print-color-adjust: exact !important; }
196  }
197  html * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
198  /* TEMPLATE CUSTOMIZATION */
199  .custom-page { ${zt?"":"display:none"}; }
200  .default-page { ${zt||Ct?"display:none":""}; }
201  .canvas-page { ${Ct?"":"display:none"}; position: relative; width: 210mm; min-height:297mm; height:auto; margin: 0 auto; box-sizing:border-box; direction: rtl; overflow: visible; }
202  .tpl-heading { font-size: 26px; font-weight: 800; color: ${_t}; ${Pt.headerAlign==="right"?"text-align:right":Pt.headerAlign==="left"?"text-align:left":"text-align:center"}; margin-bottom: 6px; }
203  .tpl-sub { font-size: 14px; color: ${Rt}; text-align: center; margin-bottom: 10px; }
204  .tpl-divider { border: none; border-top: 3px solid ${_t}; margin: 12px 0; }
205  .tpl-box { background: ${kt}; border: 1.5px solid ${_t}; border-radius: 8px; padding: 12px 18px; margin: 10px 0; }
206  .tpl-total-bar { background: ${_t}; color: #fff; padding: 12px 20px; border-radius: 8px; margin: 15px 0; display: flex; justify-content: flex-end; align-items: center; gap: 15px; }
207  .tpl-total-bar .total-label { font-size: 16px; font-weight: 600; }
208  .tpl-total-bar .total-amount { font-size: 22px; font-weight: 800; }
209  .tpl-footer { border-top: 2px solid ${_t}; margin-top: 25px; padding-top: 12px; font-size: 12px; color: #4b5563; text-align: center; }
210  .tpl-watermark { position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; }
211  .tpl-watermark span { font-size: 56px; font-weight: 800; color: ${_t}; opacity: 0.06; transform: rotate(-30deg); }
212  .tpl-section-title { font-size: 15px; font-weight: 700; color: ${_t}; border-bottom: 2px solid ${kt}; padding-bottom: 5px; margin-bottom: 8px; }
213  .page > * { position: relative; z-index: 1; }
214</style>
215</head>
216<body>
217  <div class="page">
218  ${Ct?`<div class="canvas-page">${Rr}</div>`:""}
219  <!-- LEGACY DEFAULT PAGE (only when no canvas template) -->
220  <div class="default-page" style="${Ct||zt?"display:none !important":""}">
221  <!-- HEADER -->
222  <div class="header" data-atomic-block="company-header">
223    <div class="header-right">
224      <h1>عرض أسعار</h1>
225      <div class="invoice-no">رقم: ${ue.quotationNumber||""}</div>
226    </div>
227    <div class="header-left">
228      ${os}
229      ${Et?.whatsapp_number?`<div class="contact-line"><span class="phone-icon" aria-hidden="true">&#9742;</span> تلفون: ${nn(Et.whatsapp_number)}</div>`:""}
230      ${Et?.website?`<div class="contact-line">الموقع: ${nn(Et.website)}</div>`:""}
231    </div>
232  </div>
233  <!-- DATE & VALIDITY -->
234  <div class="meta-row" data-atomic-block="meta">
235    <div class="meta-date"><strong>التاريخ:</strong> ${Ze}</div>
236    ${He.validity?`<div class="meta-date"><strong>مدة الصلاحية: ${He.validity}</strong></div>`:""}
237  </div>
238  <!-- TEAL BAR -->
239  <div class="teal-bar" data-atomic-block="order-summary">
240    <div class="bar-title">تفاصيل الطلب</div>
241    <div class="bar-client">${ue.customerName||"-"}${ue.customerCompany?" — "+ue.customerCompany:""}${ue.customerPhone?` — <span class="phone-icon" aria-hidden="true">&#9742;</span> ${nn(ue.customerPhone)}`:""}</div>
242  </div>
243  ${ue.customerAddress||ue.customerEmail||ue.customerTaxNumber?`<div class="meta-row" style="margin-top:8px">
244    ${ue.customerAddress?`<div class="meta-date"><strong>العنوان:</strong> ${nn(ue.customerAddress)}</div>`:""}
245    ${ue.customerEmail?`<div class="meta-date"><strong>البريد:</strong> ${nn(ue.customerEmail)}</div>`:""}
246    ${ue.customerTaxNumber?`<div class="meta-date"><strong>الرقم الضريبي:</strong> ${nn(ue.customerTaxNumber)}</div>`:""}
247  </div>`:""}
248  ${ue.paymentTerms||ue.deliveryMethod||He.deliveryTime?`<div class="meta-row" data-atomic-block="payment-delivery" style="margin-top:10px">
249    ${ue.deliveryMethod?`<div class="meta-date"><strong>طريقة التسليم:</strong> ${nn(ue.deliveryMethod)}</div>`:""}
250    ${He.deliveryTime?`<div class="meta-date"><strong>مدة التسليم:</strong> ${nn(He.deliveryTime)}</div>`:""}
251    ${ue.paymentTerms?`<div class="meta-date"><strong>شروط الدفع:</strong> ${nn(ue.paymentTerms)}</div>`:""}
252  </div>`:""}
253  <!-- TECH INFO (before bank info and terms per original template flow) -->
254  ${gs?`<div data-atomic-block="technical-info">${gs}</div>`:""}
255  <!-- ITEMS TABLE -->
256  <table class="items-table" data-atomic-table="true" data-atomic-block="items-table">
257    <colgroup><col style="width:5%"><col style="width:52%"><col style="width:10%"><col style="width:15%"><col style="width:18%"></colgroup>
258    <thead>
259      <tr>
260        <th style="width:30px;text-align:center">#</th>
261        <th style="text-align:right">الوصف</th>
262        <th style="text-align:center">الكمية</th>
263        <th style="text-align:center">السعر</th>
264        <th style="text-align:center">الإجمالي</th>
265      </tr>
266    </thead>
267    <tbody>
268      ${gi||'<tr><td colspan="5" style="text-align:center;padding:20px;color:#0096a7">لا توجد بنود</td></tr>'}
269    </tbody>
270  </table>
271  <!-- TOTAL: normal flow, with the original template dimensions -->
272  <div class="total-bar" data-atomic-block="financial-summary">
273    <div class="total-label">المجموع الإجمالي:</div>
274    <div class="total-amount">${Tr(jr)}</div>
275  </div>
276  ${rt?`<div data-atomic-block="amount-in-words" style="background:#ffffff;border:1.5px solid ${_t};border-radius:8px;padding:10px 20px;margin:10px 0;font-size:13px;color:${Rt}"><strong style="color:${_t}">المبلغ كتابةً:</strong> ${rt}</div>`:""}
277  <!-- CUSTOM TEMPLATE (design editor output) -->
278  <div class="custom-page">
279    ${We?.title?`<div class="tpl-heading">${We.title}</div>`:""}
280    ${zt?Or:""}
281    ${We?.showTotals?`<div class="tpl-total-bar"><div class="total-label">المجموع الإجمالي:</div><div class="total-amount">${Tr(jr)}</div></div>`:""}
282    ${We?.showTotals&&rt?`<div class="tpl-box" style="font-size:13px"><strong style="color:${_t}">المبلغ كتابةً:</strong> ${rt}</div>`:""}
283    ${We?.showSignature?`<div style="display:flex;gap:30px;margin-top:18px;justify-content:center"><div style="text-align:center"><div style="border-bottom:1px solid ${_t};width:140px;height:44px"></div><div style="font-size:11px;color:#4b5563;margin-top:3px">التوقيع والختم</div></div><div style="text-align:center"><div style="border-bottom:1px solid ${_t};width:140px;height:44px"></div><div style="font-size:11px;color:#4b5563;margin-top:3px">اسم المسؤول</div></div></div>`:""}
284    ${We?.showFooter&&We?.footer?`<div class="tpl-footer">${We.footer}</div>`:""}
285  </div>
286  <!-- FOOTER: original normal-flow placement after totals and template content -->
287  <div class="footer" data-atomic-block="footer" style="justify-content: ${or.length>0&&Xr?"space-between":or.length>0?"flex-start":Xr?"flex-end":"flex-start"}">
288    ${or.length>0?`<div class="footer-left"><strong style="color:#0096a7">الشروط والأحكام:</strong>${or.map(At=>`<p>${nn(At)}</p>`).join("")}</div>`:""}
289    ${Xr?`<div class="footer-right"><div class="bank-title">معلومات البنك</div><ul class="bank-list">${Xr.split(`
290`).filter(At=>At.trim()).map(At=>`<li>${nn(At)}</li>`).join("")}</ul></div>`:""}
291  </div>
292  ${We?.showWatermark?`<div class="tpl-watermark"><span>${ps}</span></div>`:""}
293</div>
294  <div class="print-page-number" aria-hidden="true"></div>
295  </div>
296</body></html>`;return Ct&&Rr?`<!DOCTYPE html><html dir="rtl" lang="ar"><head><meta charset="UTF-8"><title>${nn(Je)}</title><style>@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');html,body{margin:0;padding:0;background:#fff}body{font-family:'Cairo',sans-serif;direction:rtl}*{box-sizing:border-box}@media print{html,body{margin:0;padding:0}}</style></head><body>${Rr}</body></html>`:As},at=ue=>Je=>{Je&&Je.stopPropagation();const it=ue!==void 0?ue+1:k.length,Et=[...k];Et.splice(it,0,{productId:0,productName:"",specs:"",features:[],quantity:1,unitPrice:0,totalPrice:0}),V(Et),Ge({...qe,[it]:""})},pe=ue=>{V(k.filter((it,Et)=>Et!==ue));const Je={...qe};delete Je[ue],Ge(Je)},Ke=(ue,Je,it)=>{const Et=[...k];Et[ue]={...Et[ue],[Je]:it},(Je==="quantity"||Je==="unitPrice")&&(Et[ue].totalPrice=(Et[ue].quantity||0)*(Et[ue].unitPrice||0)),V(Et)},Ne=(ue,Je)=>{if((p[ue]||"product")==="material"){const an=[...k];an[ue]={...an[ue],productId:0,rawMaterialId:Je.id,itemType:"material",productName:Je.name,specs:Je.description||"",features:Je.description?Je.description.split(`
297`).filter(Sn=>Sn.trim()):[],unitPrice:Number(Je.purchasePrice||0)*(1+Number(Je.retailMargin||0)/100),unit:Je.unit||"piece",totalPrice:Number(Je.purchasePrice||0)*(1+Number(Je.retailMargin||0)/100)*(an[ue].quantity||1)},V(an),Ge({...qe,[ue]:""}),ve({...ot,[ue]:!1});return}const Et=[];if(Je.specs)try{const an=JSON.parse(Je.specs);Array.isArray(an)?an.forEach(Sn=>{Sn.trim()&&Et.push(Sn.trim())}):typeof an=="string"&&an.trim()&&Et.push(an.trim())}catch{Je.specs.split(`
298`).forEach(an=>{an.trim()&&Et.push(an.trim())})}Je.features&&Je.features.trim()&&Je.features.split(`
299`).forEach(an=>{an.trim()&&Et.push(an.trim())}),Je.weight&&Je.weight.trim()&&Et.push(`الوزن: ${Je.weight}`),Je.dimensions&&Je.dimensions.trim()&&Et.push(`الأبعاد: ${Je.dimensions}`);const Wt=[...k];Wt[ue]={...Wt[ue],productId:Je.id,rawMaterialId:0,itemType:"product",productName:Je.name,specs:Je.specs||"",features:Et,unitPrice:Je.sellingPrice||Je.salePrice||0,unit:Je.unit||"piece",totalPrice:(Je.sellingPrice||Je.salePrice||0)*(Wt[ue].quantity||1)},V(Wt),Ge({...qe,[ue]:""}),ve({...ot,[ue]:!1})},Ye=ue=>{const Je=[...k],it=Je[ue].features||[];Je[ue]={...Je[ue],features:[...it,""]},V(Je)},Te=(ue,Je,it)=>{const Et=[...k],Wt=[...Et[ue].features||[]];Wt[Je]=it,Et[ue]={...Et[ue],features:Wt},V(Et)},st=(ue,Je)=>{const it=[...k],Et=[...it[ue].features||[]];Et.splice(Je,1),it[ue]={...it[ue],features:Et},V(it)},et=ue=>{const Je=qe[ue]||"";if((p[ue]||"product")==="material"){let Wt=o||[];return ge!=="all"&&(Wt=Wt.filter(an=>String(an.categoryId)===ge)),Je&&(Wt=Wt.filter(an=>(an.name||"").toLowerCase().includes(Je.toLowerCase())||(an.description||"").toLowerCase().includes(Je.toLowerCase()))),Wt.slice(0,20)}let Et=s||[];return mt!=="all"&&(Et=Et.filter(Wt=>String(Wt.categoryId)===mt)),Je&&(Et=Et.filter(Wt=>(Wt.name||"").toLowerCase().includes(Je.toLowerCase())||(Wt.code||"").toLowerCase().includes(Je.toLowerCase())||(Wt.categoryName||"").toLowerCase().includes(Je.toLowerCase()))),Et.slice(0,20)},Qe=(n||[]).filter(ue=>{const Je=ne===""||(ue.quotationNumber||"").toLowerCase().includes(ne.toLowerCase())||(ue.customerName||"").toLowerCase().includes(ne.toLowerCase()),it=ye==="all"||ue.status===ye;return Je&&it}),Mt={draft:"مسودة",pending:"معلقة",confirmed:"مؤكد",cancelled:"ملغي"};return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-xl font-bold text-foreground",children:"عروض الأسعار"}),i.jsxs(ke,{onClick:je,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," إنشاء عرض جديد"]})]}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),i.jsx("input",{value:ne,onChange:ue=>Z(ue.target.value),placeholder:"بحث برقم العرض أو اسم العميل...",className:"w-full bg-input border border-border rounded-lg pr-10 pl-3 py-2 text-foreground text-sm focus:border-primary focus:outline-none"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(eN,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),i.jsxs("select",{value:ye,onChange:ue=>Le(ue.target.value),className:"bg-input border border-border rounded-lg pr-9 pl-3 py-2 text-foreground text-sm appearance-none focus:border-primary focus:outline-none cursor-pointer",children:[i.jsx("option",{value:"all",children:"كل الحالات"}),i.jsx("option",{value:"draft",children:"مسودة"}),i.jsx("option",{value:"pending",children:"معلقة"}),i.jsx("option",{value:"confirmed",children:"مؤكد"}),i.jsx("option",{value:"cancelled",children:"ملغي"})]})]})]}),i.jsx("div",{className:"space-y-3",children:e?i.jsx("p",{className:"text-muted-foreground text-center py-8",children:"جاري التحميل..."}):Qe.length===0?i.jsx("p",{className:"text-muted-foreground text-center py-8",children:"لا توجد عروض أسعار"}):Qe.map(ue=>i.jsx("div",{className:"bg-card rounded-xl border border-border p-4 hover:border-primary/30 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"رقم العرض"}),i.jsx("div",{className:"text-foreground font-bold",children:ue.quotationNumber||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"العميل"}),i.jsx("div",{className:"text-foreground",children:ue.customerName||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"البنود"}),i.jsxs("div",{className:"text-foreground",children:[ue.itemsCount||ue.items?.length||0," منتج"]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"المبلغ"}),i.jsxs("div",{className:"text-primary font-bold",children:[(ue.totalAmount||0).toLocaleStr
299ing()," ",ue.currencySymbol||"$"]})]}),ue.revision>0&&i.jsxs(Ul,{className:"bg-blue-500/20 text-blue-400 border border-blue-500/30 text-xs",children:["Rev.",ue.revision]}),ue.withTax&&i.jsx(Ul,{className:"bg-primary/20 text-primary border border-primary/30 text-xs",children:"شامل الضريبة"}),ue.status&&i.jsx(Ul,{className:`text-xs ${ue.status==="confirmed"?"bg-green-500/20 text-green-400 border-green-500/30":ue.status==="pending"?"bg-yellow-500/20 text-yellow-400 border-yellow-500/30":ue.status==="cancelled"?"bg-red-500/20 text-red-400 border-red-500/30":"bg-gray-500/20 text-muted-foreground border-gray-500/30"} border`,children:Mt[ue.status]||ue.status})]}),i.jsx(ZM,{children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>Ie(ue),className:"p-2 rounded-lg hover:bg-accent text-blue-400 transition-colors",title:"تعديل",children:i.jsx(hh,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"تعديل"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:async()=>{Q(!0),J(null);try{let Je=ue;try{Je=await C.priceQuotations.get.fetch({id:ue.id})}catch{}const it=await Ae(ue,`عرض سعر ${ue.quotationNumber||ue.invoiceNumber||ue.id}`);if(!it)throw new Error("empty quotation preview");F(Je),J(it),oe(ue)}catch{_e.error("تعذّر تجهيز معاينة ملف عرض السعر")}finally{Q(!1)}},disabled:q,className:"p-2 rounded-lg hover:bg-accent text-blue-500 transition-colors disabled:opacity-50",title:"معاينة PDF",children:i.jsx(jc,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:q?"جارٍ تجهيز المعاينة...":"معاينة PDF"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>Se(ue),className:"p-2 rounded-lg hover:bg-accent text-green-400 transition-colors",title:"حفظ PDF",children:i.jsx(nl,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"طباعة"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>ce(ue.id),className:"p-2 rounded-lg hover:bg-accent text-yellow-400 transition-colors",title:"فاتورة رسمية",children:i.jsx(zj,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"فاتورة رسمية"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>ie(ue.id),className:"p-2 rounded-lg hover:bg-accent text-teal-400 transition-colors",title:"فاتورة مبيعات",children:i.jsx(Oj,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"فاتورة مبيعات"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>Me(ue.id),className:"p-2 rounded-lg hover:bg-accent text-purple-400 transition-colors",title:"بيان تعبئة",children:i.jsx(ma,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"بيان تعبئة"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>Fe(ue.id),className:"p-2 rounded-lg hover:bg-accent text-orange-400 transition-colors",title:"أمر إنتاج",children:i.jsx(uy,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"أمر إنتاج"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>vt(ue),className:"p-2 rounded-lg hover:bg-destructive/10 text-red-400 transition-colors",title:"حذف",children:i.jsx(Ar,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"حذف"})]})]})})]})},ue.id))}),D&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-start justify-center p-4 overflow-y-auto",onClick:()=>B(!1),children:i.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-4xl my-8",onClick:ue=>ue.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-bold text-card-foreground",children:P?"تعديل عرض سعر":"إنشاء عرض سعر جديد"}),i.jsx("button",{onClick:()=>B(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4 max-h-[70vh] overflow-y-auto",children:[i.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary mb-3",children:"1. معلومات العميل والتفاصيل"}),i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("button",{type:"button",onClick:()=>Re(!0),className:`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors ${Ce?"bg-primary text-primary-foreground":"bg-card text-muted-foreground border border-border"}`,children:"إدخال يدوي"}),i.jsx("button",{type:"button",onClick:()=>Re(!1),className:`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors ${Ce?"bg-card text-muted-foreground border border-border":"bg-primary text-primary-foreground"}`,children:"اختيار عميل"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[!Ce&&i.jsxs("div",{className:"relative",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العميل"}),i.jsx(Ee,{placeholder:"ابحث عن عميل...",value:se,onChange:ue=>{me(ue.target.value),Be(!0)},onFocus:()=>Be(!0),onBlur:()=>setTimeout(()=>Be(!1),200),className:"bg-input border-border text-foreground text-sm"}),ze&&se&&i.jsxs("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-lg shadow-lg z-50 max-h-48 overflow-y-auto",children:[r?.filter(ue=>ue.name?.includes(se)||ue.companyName?.includes(se)||ue.phone?.includes(se)).slice(0,8).map(ue=>i.jsxs("button",{className:"w-full text-right px-3 py-2 hover:bg-accent text-sm text-popover-foreground flex items-center gap-2",onMouseDown:()=>
299{$({...U,customerId:ue.id,customerName:ue.name,customerPhone:ue.phone||"",customerCompany:ue.companyName||"",customerEmail:ue.email||"",customerAddress:ue.address||"",customerTaxNumber:ue.taxNumber||"",customerCommercialReg:ue.commercialReg||""}),me(ue.name),Be(!1)},children:[i.jsx("span",{children:ue.name}),ue.companyName&&i.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",ue.companyName,")"]})]},ue.id)),i.jsxs("button",{className:"w-full text-right px-3 py-2 hover:bg-accent text-sm text-primary",onMouseDown:()=>{I.mutate({name:se,companyName:"",phone:"",type:"customer"},{onSuccess:ue=>{const Je=ue?.insertId||ue?.id||0;$({...U,customerId:Je,customerName:se}),me(se),Be(!1),C.clients.list.invalidate()},onError:()=>{}})},children:["+ إضافة: ",se]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم العميل *"}),i.jsx(Ee,{value:U.customerName||"",onChange:ue=>$({...U,customerName:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هاتف العميل"}),i.jsx(Ee,{value:U.customerPhone||"",onChange:ue=>$({...U,customerPhone:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم الشركة"}),i.jsx(Ee,{value:U.customerCompany||"",onChange:ue=>$({...U,customerCompany:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"البريد الإلكتروني"}),i.jsx(Ee,{value:U.customerEmail||"",onChange:ue=>$({...U,customerEmail:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العنوان"}),i.jsx(Ee,{value:U.customerAddress||"",onChange:ue=>$({...U,customerAddress:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الرقم الضريبي"}),i.jsx(Ee,{value:U.customerTaxNumber||"",onChange:ue=>$({...U,customerTaxNumber:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"السجل التجاري"}),i.jsx(Ee,{value:U.customerCommercialReg||"",onChange:ue=>$({...U,customerCommercialReg:ue.target.value}),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"طريقة التسليم"}),i.jsxs(En,{value:U.deliveryMethod||"",onValueChange:ue=>$({...U,deliveryMethod:ue}),children:[i.jsx(Tn,{className:"bg-input border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر طريقة التسليم"})}),i.jsx(Rn,{className:"bg-popover/95 border-border",children:(h||[]).map(ue=>i.jsxs(bt,{value:ue.label,children:[ue.label,ue.duration_label?` (${ue.duration_label})`:""]},ue.id))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"مدة التسليم"}),i.jsx(Ee,{value:U.deliveryDuration||"",onChange:ue=>$({...U,deliveryDuration:ue.target.value}),placeholder:"مثال: 15 يوم عمل",className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"شروط الدفع"}),i.jsxs(En,{value:U.paymentTerms||"",onValueChange:ue=>$({...U,paymentTerms:ue}),children:[i.jsx(Tn,{className:"bg-input border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر شروط الدفع"})}),i.jsx(Rn,{className:"bg-popover/95 border-border",children:(d||[]).map(ue=>i.jsx(bt,{value:ue.label,children:ue.label},ue.id))})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"حالة العرض"}),i.jsxs(En,{value:U.status||"draft",onValueChange:ue=>$({...U,status:ue}),children:[i.jsx(Tn,{className:"bg-input border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر الحالة"})}),i.jsxs(Rn,{className:"bg-popover border-border",children:[i.jsx(bt,{value:"draft",children:"مسودة"}),i.jsx(bt,{value:"pending",children:"معلقة"}),i.jsx(bt,{value:"confirmed",children:"مؤكد"}),i.jsx(bt,{value:"cancelled",children:"ملغي"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العملة"}),i.jsxs(En,{value:U.currency||"USD",onValueChange:ue=>$({...U,currency:ue}),children:[i.jsx(Tn,{className:"bg-input border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر العملة"})}),i.jsxs(Rn,{className:"bg-popover border-border",children:[i.jsx(bt,{value:"USD",children:"دولار USD"}),i.jsx(bt,{value:"EUR",children:"يورو EUR"}),i.jsx(bt,{value:"SAR",children:"ريال سعودي SAR"}),i.jsx(bt,{value:"AED",children:"درهم إماراتي AED"}),i.jsx(bt,{value:"LBP",children:"ليرة لبنانية LBP"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"مدة الصلاحية"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(Ee,{type:"number",min:0,value:U.validityDuration||"",onChange:ue=>
299$({...U,validityDuration:ue.target.value}),placeholder:"20",className:"bg-input border-border text-foreground text-sm w-20"}),i.jsxs(En,{value:U.validityUnit||"day",onValueChange:ue=>$({...U,validityUnit:ue}),children:[i.jsx(Tn,{className:"bg-input border-border text-foreground text-sm flex-1",children:i.jsx(jn,{placeholder:"الوحدة"})}),i.jsxs(Rn,{className:"bg-popover border-border",children:[i.jsx(bt,{value:"day",children:"يوم"}),i.jsx(bt,{value:"week",children:"أسبوع"}),i.jsx(bt,{value:"month",children:"شهر"}),i.jsx(bt,{value:"year",children:"سنة"})]})]})]}),U.validityDuration&&String(U.validityDuration)!=="0"?i.jsxs("div",{className:"text-xs text-primary mt-1",children:["الصلاحية: ",U.validityDuration," ",U.validityUnit==="day"?"يوم":U.validityUnit==="week"?"أسبوع":U.validityUnit==="month"?"شهر":"سنة"]}):null]})]}),i.jsxs("div",{className:"mt-3 pt-3 border-t border-border",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{checked:U.withTax,onCheckedChange:ue=>$({...U,withTax:ue})}),i.jsx("label",{className:"text-sm text-card-foreground",children:"شامل الضريبة"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"نوع الخصم"}),i.jsxs(En,{value:U.discountType||"",onValueChange:ue=>$({...U,discountType:ue}),children:[i.jsx(Tn,{className:"bg-input border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"لا يوجد"})}),i.jsxs(Rn,{className:"bg-popover border-border",children:[i.jsx(bt,{value:"percentage",children:"نسبة مئوية"}),i.jsx(bt,{value:"fixed",children:"مبلغ ثابت"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"قيمة الخصم"}),i.jsx(Ee,{type:"number",value:U.discountValue||0,onChange:ue=>$({...U,discountValue:parseFloat(ue.target.value)||0}),className:"bg-input border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"mt-3",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"ملاحظات"}),i.jsx(ni,{value:U.notes||"",onChange:ue=>$({...U,notes:ue.target.value}),placeholder:"ملاحظات إضافية...",className:"bg-input border-border text-foreground text-sm min-h-[60px]"})]})]}),i.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary mb-3",children:"2. بنود العرض"}),i.jsxs("div",{className:"flex items-center justify-between mb-3 gap-3",children:[i.jsxs(En,{value:mt,onValueChange:xt,children:[i.jsx(Tn,{className:"w-[200px] bg-input border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"كل التصنيفات"})}),i.jsxs(Rn,{className:"bg-popover text-popover-foreground",children:[i.jsx(bt,{value:"all",children:"كل التصنيفات"}),(a||[]).map(ue=>i.jsx(bt,{value:String(ue.id),children:ue.name},ue.id))]})]}),i.jsxs(ke,{size:"sm",variant:"outline",onClick:at(),className:"border-primary text-primary text-xs",children:[i.jsx(Nn,{className:"w-3 h-3 ml-1"})," إضافة بند"]})]}),k.map((ue,Je)=>i.jsxs("div",{className:"mb-4 p-3 bg-card rounded-lg border border-border",children:[i.jsxs("div",{className:"mb-3",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"نوع البند"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ke,{size:"sm",variant:(p[Je]||"product")==="product"?"default":"outline",onClick:()=>{x({...p,[Je]:"product"}),Ge({...qe,[Je]:""}),ve({...ot,[Je]:!1})},className:"text-xs",children:"منتج / مكنة"}),i.jsx(ke,{size:"sm",variant:(p[Je]||"product")==="material"?"default":"outline",onClick:()=>{x({...p,[Je]:"material"}),Ge({...qe,[Je]:""}),ve({...ot,[Je]:!1})},className:"text-xs",children:"مادة أولية"}),(p[Je]||"product")==="product"&&i.jsxs(En,{value:mt,onValueChange:xt,children:[i.jsx(Tn,{className:"w-[150px] bg-input border-border text-foreground text-xs",children:i.jsx(jn,{placeholder:"التصنيف"})}),i.jsxs(Rn,{className:"bg-popover text-popover-foreground",children:[i.jsx(bt,{value:"all",children:"كل التصنيفات"}),(a||[]).map(it=>i.jsx(bt,{value:String(it.id),children:it.name},it.id))]})]}),(p[Je]||"product")==="material"&&i.jsxs(En,{value:ge,onValueChange:Y,children:[i.jsx(Tn,{className:"w-[150px] bg-input border-border text-foreground text-xs",children:i.jsx(jn,{placeholder:"التصنيف"})}),i.jsxs(Rn,{className:"bg-popover text-popover-foreground",children:[i.jsx(bt,{value:"all",children:"كل التصنيفات"}),(l||[]).map(it=>i.jsx(bt,{value:String(it.id),children:it.name},it.id))]})]})]})]}),i.jsxs("div",{className:"mb-3 relative",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:(p[Je]||"product")==="material"?"اختر مادة أولية من المخزون":"اختر المكنة من قائمة المكنات"}),i.jsx(Ee,{placeholder:(p[Je]||"product")==="material"?"ابحث عن مادة أولية بالاسم أو الوصف...":"ابحث عن مكنة بالاسم أو الرمز...",value:qe[Je]||ue.productName||"",onChange:it=>{Ge({...qe,[Je]:it.target.value}),ve({...ot,[Je]:!0})},onFocus:()=>ve({...ot,[Je]:!0}),onBlur:()=>setTimeout(()=>ve({...ot,[Je]:!1}),200),className:"bg-input border-border text-foreground text-sm"}),ot[Je]&&i.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover/95 backdrop-blur-sm border border-border rounded-lg shadow-lg z-50 max-h-48 overflow-y-auto",children:et(Je).length===0?i.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground text-center",children:"لا توجد نتائج"}):et(Je).map(it=>i.jsxs("button",{className:"w-full text-right px-3 py-2 hover:bg-accent text-sm text-popover-foreground flex items-center justify-between gap-2",onMouseDown:()=>Ne(Je,it),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[(p[Je]||"product")==="product"&&it.imageUrl?i.jsx("img",{src:it.imageUrl,alt:"",className:"w-8 h-8 object-cover rounded border border-border flex-shrink-0"}):null,i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:it.name}),it.code&&i.jsxs("span",{className:"text-xs text-muted-foreground mr-2",children:["(",it.code,")"]}),it.categoryName&&(p[Je]||"product")!=="product"&&i.jsxs("span",{className:"text-xs text-muted-foreground mr-2",children:["[",it.categoryName,"]"]})]})]}),i.jsx("span",{className:"text-xs text-primary font-semibold",children:p[Je]==="material"?`${(Number(it.purchasePrice||0)*(1+Number(it.retailMargin||0)/100)).toLocaleStr
299ing()} $ / ${it.unit||"piece"} (هامش البيع ${it.retailMargin||0}%)`:`${(it.sellingPrice||it.salePrice||0).toLocaleString()} $`})]},it.id))})]}),i.jsxs("div",{className:"grid grid-cols-5 gap-2 items-start",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم المكنة"}),i.jsx(Ee,{value:ue.productName||"",onChange:it=>Ke(Je,"productName",it.target.value),placeholder:"اسم المكنة",className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المميزات (نقاط)"}),i.jsxs("div",{className:"space-y-1.5",children:[(ue.features||[]).map((it,Et)=>i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-primary text-xs mt-1.5",children:"•"}),i.jsx(Ee,{value:it,onChange:Wt=>Te(Je,Et,Wt.target.value),placeholder:"أدخل ميزة...",className:"bg-input border-border text-foreground text-sm flex-1"}),i.jsx("button",{onClick:()=>st(Je,Et),className:"p-1 text-red-400 hover:text-red-300 mt-0.5",children:i.jsx(Mr,{className:"w-3 h-3"})})]},Et)),i.jsxs("button",{type:"button",onClick:()=>Ye(Je),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 mt-1 transition-colors",children:[i.jsx(Nn,{className:"w-3 h-3"})," إضافة ميزة يدوية"]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الكمية"}),i.jsx(Ee,{type:"number",value:ue.quantity||1,onChange:it=>Ke(Je,"quantity",parseFloat(it.target.value)||0),className:"bg-input border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر الوحدة"}),i.jsx(Ee,{type:"number",value:ue.unitPrice||0,onChange:it=>Ke(Je,"unitPrice",parseFloat(it.target.value)||0),className:"bg-input border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"flex gap-1 items-end mt-2 justify-between",children:[i.jsxs("div",{className:"text-sm text-card-foreground",children:["الإجمالي: ",i.jsxs("span",{className:"text-primary font-bold",children:[(ue.totalPrice||0).toLocaleString()," $"]})]}),i.jsx("button",{onClick:()=>pe(Je),className:"p-1.5 text-red-400 hover:bg-destructive/10 rounded transition-colors",children:i.jsx(Mr,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"flex justify-center mt-1",children:i.jsxs("button",{type:"button",onClick:at(Je),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 transition-colors",children:[i.jsx(Nn,{className:"w-3 h-3"})," إضافة بند جديد"]})})]},Je)),k.length===0&&i.jsx("p",{className:"text-muted-foreground text-sm text-center py-4",children:'لم يتم إضافة أي بنود - اضغط "إضافة بند" لاختيار منتج'}),i.jsxs("div",{className:"mt-2 text-left text-sm text-card-foreground",children:["المجموع: ",i.jsxs("span",{className:"text-primary font-bold text-lg",children:[k.reduce((ue,Je)=>ue+(Je.totalPrice||0),0).toLocaleString()," $"]})]}),i.jsx("div",{className:"mt-4 pt-3 border-t border-border",children:i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{checked:U.showTerms,onCheckedChange:ue=>$({...U,showTerms:ue})}),i.jsx("label",{className:"text-sm text-card-foreground",children:"إظهار الشروط والأحكام"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{checked:U.showBankInfo,onCheckedChange:ue=>$({...U,showBankInfo:ue})}),i.jsx("label",{className:"text-sm text-card-foreground",children:"إظهار البيانات البنكية"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{checked:U.showProductImage,onCheckedChange:ue=>$({...U,showProductImage:ue})}),i.jsx("label",{className:"text-sm text-card-foreground",children:"إظهار صورة المنتج"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{checked:U.printBlackWhite,onCheckedChange:ue=>$({...U,printBlackWhite:ue})}),i.jsx("label",{className:"text-sm text-card-foreground",children:"طباعة أبيض وأسود"})]})]})}),i.jsxs("div",{className:"mt-4 pt-3 border-t border-border",children:[i.jsxs("button",{type:"button",onClick:()=>he(!De),className:"flex items-center gap-2 text-xs text-primary hover:text-primary/80 transition-colors",children:[i.jsx(Nn,{className:"w-3 h-3"})," ",De?"إخفاء المعلومات الفنية للمصنع":"إظهار المعلومات الفنية للمصنع"]}),De&&i.jsxs("div",{className:"mt-3 space-y-2",children:[(u||[]).length===0&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"لا توجد خيارات معلومات فنية — أدرها من قسم الإعدادات"}),(u||[]).map(ue=>{const Je=String(ue.id)in le;return i.jsxs("div",{className:"flex items-center gap-2 bg-card border border-border rounded-lg p-2",children:[i.jsxs("button",{type:"button",onClick:()=>{const it={...le};Je?delete it[String(ue.id)]:it[String(ue.id)]="",Xe(it)},className:`text-xs px-2.5 py-1 rounded-md border transition-colors ${Je?"bg-primary text-primary-foreground border-primary":"bg-input text-muted-foreground border-border"}`,children:[ue.label,ue.unit?` (${ue.unit})`:""]}),Je&&i.jsx(Ee,{value:le[String(ue.id)]||"",onChange:it=>Xe({...le,[String(ue.id)]:it.target.value}),placeholder:ue.unit?`القيمة (${ue.unit})`:"القيمة",className:"bg-input border-border text-foreground text-sm flex-1"})]},ue.id)})]})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>B(!1),className:"border-border text-card-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:ft,className:"bg-primary hover:bg-primary/90 text-primary-foreground",disabled:y.isPending||v.isPending,children:y.isPending||v.isPending?"جاري الحفظ...":"حفظ"})]})]})}),ae&&re&&i.jsx(a3,{open:!!ae,onClose:()=>{oe(null),F(null),J(null)},documentType:"quotation",documentNumber:ae.quotationNumber||"",contentHtml:O??void 0,customerName:ae.customerName||"",date:ae.createdAt?new Date(ae.createdAt).toLocaleDateString("ar-LB"):new Date().toLocaleDateString("ar-LB"),items:(re?.items||[]).map(ue=>
299({product:ue.productName||"",specs:ue.specs||"",quantity:ue.quantity||0,unitPrice:ue.unitPrice||0,total:ue.totalPrice||0})),subtotal:re?.subtotal??(re?.items||[]).reduce((ue,Je)=>ue+(Je.totalPrice||0),0),taxAmount:re?.taxAmount??0,totalAmount:re?.totalAmount??(re?.items||[]).reduce((ue,Je)=>ue+(Je.totalPrice||0),0),withTax:ae.withTax})]})}const QS=794,KS=1123,Uy=35,hN=34,l3=1,c3=[{key:"description",label:"الوصف"},{key:"quantity",label:"الكمية"},{key:"unitPrice",label:"سعر الوحدة"},{key:"total",label:"الإجمالي"}];function u3(n){return Uy+Math.max(1,n)*hN+l3}function CU(n){const e=Math.max(1,Math.ceil(String(n.label??"").length/34)),t=String(n.specs??"").split(/\n+/).map(a=>a.trim()).filter(Boolean).reduce((a,o)=>a+Math.max(1,Math.ceil(o.length/47)),0),r=14+e*17+(t?2+t*15:0),s=n.image?52:0;return Math.max(hN,s,r)}function EU(n){return Uy+(n.length?n.reduce((e,t)=>e+CU(t),0):hN)+l3}function cZ(n,e,t){if(e.h!=null&&e.h>0)return e.h/100*t;const r=n.filter(s=>s.id!==e.id&&s.enabled!==!1&&s.y>e.y).reduce((s,a)=>s==null||a.y<s?a.y:s,null);return r==null?0:Math.max(0,(r-e.y)/100*t)}function jU(n,e,t,r){return u3(t)}function TU(n,e,t,r,s,a=0,o){const l=n.find(p=>p.type==="itemsTable"&&p.enabled!==!1);if(!l||e.y<=l.y||o?.has(e.id)===!1)return 0;const u=n.filter(p=>p.id!==l.id&&p.enabled!==!1&&p.y>l.y&&o?.has(p.id)!==!1).sort((p,x)=>p.y-x.y)[0];if(!u)return 0;const d=s?EU(s):u3(t),h=Math.max(0,(u.y-l.y)/100*r);return d+Math.max(0,Math.min(120,a))-h}const RU=22,PU=2,DU=26,kU=36;function d3(n){return!!n&&n!=="0"&&n.replace(/[0\s.,$]+/g,"")!==""}function f3(n,e){const t=(n?1:0)+(d3(e)?1:0);return RU+PU+kU+t*DU}function uZ(n,e){return`${Math.max(0,n/100*e)}px`}function Rx(n,e,t={}){const r=n.primaryColor??"#0096a7",s=n.accentColor??"#1a1a2e",a=n.fontFamily??"Cairo",o=(z,K)=>{const ae=String(z??"").trim();return ae?ae.replace(/var\(\s*--primary\s*\)/gi,r).replace(/var\(\s*--secondary\s*\)/gi,String(n.secondaryColor??"#f0fbfc")).replace(/var\(\s*--accent\s*\)/gi,s):K},l=z=>{let K=String(z??"").trim();if(!K)return"";if(K.startsWith("manus-storage/")?K=`/${K}`:K.startsWith("local-storage/")?K=`/${K}`:/^(uploads\/|[^/]+\.(?:png|jpe?g|webp|gif|svg)(?:\?.*)?$)/i.test(K)&&(K=`/local-storage/uploads/${K.replace(/^uploads\//,"")}`),/^(https?:|data:|blob:)/i.test(K))return K;if(typeof window<"u")try{return new URL(K,window.location.origin).href}catch{return K}return K},u=(z,K="")=>(e[z]??K).trim(),d=z=>z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),h=z=>d(z).replace(/"/g,"&quot;").replace(/'/g,"&#39;"),p=(e.__itemsJson?JSON.parse(e.__itemsJson):[]).map(z=>({label:String(z.label??z.name??"").trim(),specs:String(z.specs??"").trim(),qty:String(z.qty??z.quantity??"1").trim(),unit:String(z.unit??"").trim(),price:String(z.price??"0").trim(),total:String(z.total??z.lineTotal??"0").trim(),image:String(z.image??"").trim()})),x=e.__totals??"",y=e.__taxTotal??"",v=e.__discount??"";u("amountInWords");const _=z=>{const K=z.specs.split(/\n+/).map(oe=>oe.trim()).filter(Boolean);return`<div style="display:flex;align-items:flex-start;gap:7px;min-width:0;">${z.image?`<img src="${h(l(z.image))}" alt="" loading="eager" decoding="sync" style="width:48px;height:48px;object-fit:cover;flex:0 0 48px;border-radius:5px;border:1px solid #d4f0f4;" onerror="this.style.display='none'" />`:""}<div style="min-width:0;"><div style="font-weight:700;overflow-wrap:anywhere;word-break:break-word;">${d(z.label)}</div>`+(K.length?`<div style="margin-top:2px;font-size:11px;font-weight:400;line-height:1.35;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;">${K.map(oe=>`• ${d(oe)}`).join(`
300`)}</div>`:"")+"</div></div>"},M=n.safeMarginInPx??0,S=QS-M*2,A=KS-M*2,E=n.elements??[],C=new Set(E.filter(z=>z.enabled===!1?!1:z.type==="field"?!!u(z.key??""):z.type==="text"?!!String(z.text??"").trim():z.type==="itemsTable"?p.length>0:!0).map(z=>z.id)),I=t.deferTableFlow!==!1,D=I?E.find(z=>z.type==="itemsTable"&&z.enabled!==!1):void 0,B=D?E.filter(z=>z.enabled===!1||!C.has(z.id)||z.id===D.id||z.y<=D.y?!1:z.type==="field"||z.type==="text"||z.type==="totalsBox"||z.type==="signature").sort((z,K)=>z.y-K.y):[],P=new Set([...D?[D.id]:[],...B.map(z=>z.id)]),G=new Map(B.map((z,K)=>[z.id,K])),k=(z,K)=>{if(z.enabled===!1)return"";const ae=`${(M+z.x/100*S)/QS*100}%`,oe=`${(M+z.y/100*A)/KS*100}%`,re=`${z.w/100*S/QS*100}%`,F=z.h!=null?`${z.h/100*A/KS*100}%`:"",O=`position:absolute;
300left:${ae};top:${oe};width:${re};${F?`height:${F};`:""}z-index:${z.zIndex??K+1};`,J=z.fontSize?`font-size:${z.fontSize}px;`:"",q=z.fontWeight?`font-weight:${z.fontWeight};`:"",Q=z.color?`color:${z.color};`:"",ne=z.align?`text-align:${z.align};`:"";switch(z.type){case"logo":{const Z=d(t.companyTitle||"اسم الشركة"),se=z.h==null?"height:8%;":"",me=l(t.logoUrl);return me?`<div data-atomic-block="logo" style="${O}${se}">
301          <img src="${h(me)}" alt="شعار الشركة" decoding="sync" loading="eager" referrerpolicy="no-referrer" style="display:block;width:100%;height:100%;object-fit:contain;object-position:center top;" onerror="this.style.display='none';this.nextElementSibling.style.display='flex';" />
302          <div style="display:none;width:100%;height:100%;align-items:center;justify-content:center;font-family:'${a}',sans-serif;font-weight:800;color:${r};text-align:center;">${Z}</div>
303        </div>`:`<div style="${O}${se}display:flex;align-items:center;justify-content:center;font-family:'${a}',sans-serif;font-weight:800;color:${r};text-align:center;">${Z}</div>`}case"text":return`<div data-atomic-block="text" style="${O}${J}${q}${Q}${ne}font-family:'${a}',sans-serif;line-height:1.5;">${z.text??""}</div>`;case"field":{const Z=AU[z.key??""]??"",se=z.hiddenLabel?"":z.label||Z||"",me=u(z.key??"");if(!me)return"";const ze=z.labelColor||s;if(z.key==="bankInfo"){const Be=me.split(/\r?\n/).map(Re=>Re.trim()).filter(Boolean),ye=z.align==="left"?"left":z.align==="center"?"center":"right",Le=z.align==="left"?"ltr":"rtl",Ce=z.align==="left"?"padding-left:22px;padding-right:0;":"padding-right:22px;padding-left:0;";return`<div data-atomic-block="bank" style="${O}${J}${q}${Q}text-align:${ye};font-family:'${a}',sans-serif;line-height:1.6;direction:${Le};overflow-wrap:anywhere;word-break:break-word;">${se?`<div style="font-weight:700;color:${ze};margin-bottom:4px;direction:rtl;text-align:right;">${d(se)}:</div>`:""}<ul style="margin:0;${Ce}list-style:disc;list-style-position:outside;line-height:1.8;text-align:${ye};">${Be.map(Re=>`<li>${d(Re)}</li>`).join("")}</ul></div>`}return`<div data-atomic-block="field" style="${O}${J}${q}${Q}${ne}font-family:'${a}',sans-serif;line-height:1.6;direction:rtl;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;">${se?`<span style="font-weight:700;color:${ze}">${d(se)}:</span> `:""}${d(me)}</div>`}case"line":return`<div data-static-decoration="line" aria-hidden="true" style="${O}${z.h==null?"height:1px;":""}display:flex;align-items:center;"><div style="width:100%;height:1px;background:${s};opacity:0.25;"></div></div>`;case"itemsTable":{if(p.length===0)return"";const Z=p.map(se=>`<tr data-atomic-block="product-row" style="height:auto;border-bottom:1px solid #e5f5f7;break-inside:avoid;page-break-inside:avoid;">
304            <td style="height:auto;padding:7px 6px;font-size:12px;text-align:right;vertical-align:top;border-bottom:1px solid #e5f5f7;white-space:normal;overflow-wrap:anywhere;word-break:break-word;">${_(se)}</td>
305            <td style="height:auto;padding:7px 6px;font-size:12px;text-align:center;vertical-align:top;border-bottom:1px solid #e5f5f7;white-space:nowrap;overflow:visible;text-overflow:clip;">${d(se.qty)}${se.unit?` ${d(se.unit)}`:""}</td>
306            <td style="height:auto;padding:7px 6px;font-size:12px;text-align:center;vertical-align:top;border-bottom:1px solid #e5f5f7;white-space:nowrap;overflow:visible;text-overflow:clip;">${d(se.price)}</td>
307            <td style="height:auto;padding:7px 6px;font-size:12px;text-align:center;vertical-align:top;font-weight:700;border-bottom:1px solid #e5f5f7;white-space:nowrap;overflow:visible;text-overflow:clip;">${d(se.total)}</td>
308          </tr>`).join("");return`<div data-atomic-block="items-table" style="${O}height:auto;font-family:'${a}',sans-serif;direction:rtl;min-height:0;overflow:visible;">
309          <table class="items-table" style="width:100%;height:auto;table-layout:fixed;border-collapse:collapse;border-spacing:0;border:1px solid ${r};">
310            <thead><tr style="height:${Uy}px;background:${r};color:#fff;">
311              ${c3.map(se=>`<th style="height:${Uy}px;padding:8px 6px;font-size:12px;font-weight:700;">${se.label}</th>`).join("")}
312            </tr></thead>
313            <tbody>${Z}</tbody>
314          </table></div>`}case"totalsBox":{const Z=[];v&&Z.push(`<div style="display:flex;justify-content:space-between;padding:3px 0;border-bottom:1px dashed #cce3e6;"><span>الخصم</span><span style="font-weight:700">${d(v)}</span></div>`),d3(y)&&Z.push(`<div style="display:flex;justify-content:space-between;padding:3px 0;border-bottom:1px dashed #cce3e6;"><span>الضريبة</span><span style="font-weight:700">${d(y)}</span></div>`),Z.push(`<div style="display:flex;justify-content:space-between;padding:6px 0;font-size:15px;"><span style="font-weight:700;color:${s};">الإجمالي النهائي</span><span style="font-weight:800;color:${r};">${d(x)}</span></div>`);const se=f3(v,y);return`<div data-atomic-block="financial-summary" style="${O}height:${se}px;box-sizing:border-box;overflow:visible;font-family:'${a}',sans-serif;direction:rtl;background:${n.secondaryColor??"#f0fbfc"};border:1px solid #cce3e6;border-radius:6px;padding:10px 14px;">${Z.join("")}</div>`}case"signature":return`<div data-atomic-block="signature" style="${O}font-family:'${a}',sans-serif;direction:rtl;display:flex;justify-content:space-around;">
315          <div style="text-align:center;"><div style="border-top:1px solid ${s};width:140px;margin-top:38px;padding-top:6px;font-size:11px;">المدير</div></div>
316          <div style="text-align:center;"><div style="border-top:1px solid ${s};width:140px;margin-top:38px;padding-top:6px;font-size:11px;">المحاسب</div></div>
317        </div>`;case"shape":{const Z=o(z.shapeColor,r),se=z.h!=null&&z.h>0?"min-height:1px;":"height:0.3%;min-height:1px;",me=String(z.shapeBorder??"").trim(),ze=me?o(me.split(/\s+/).slice(-1)[0]||s,s):"",Be=me?`border:${h(me.replace(/\s+[^\s]+\s*$/,` ${ze}`))};`:"",ye=z.shapeOpacity!=null?`opacity:${Math.max(0,Math.min(1,z.shapeOpacity))};`:"",Le=Math.max(0,z.shapeRadius??0),Ce=Math.max(0,Number(z.zIndex??K+1));return`<div data-static-decoration="shape" data-print-shape="true" aria-hidden="true" style="${O.replace(`z-index:${z.zIndex??K+1};`,`z-index:${Ce};`)}${se}display:block !important;visibility:visible !important;box-sizing:border-box;isolation:isolate;background:${h(Z)} !important;background-color:${h(Z)} !important;background-image:linear-gradient(${h(Z)},${h(Z)}) !important;border-radius:${Le}px;${Be}${ye}overflow:visible;contain:paint;-webkit-print-color-adjust:exact !important;print-color-adjust:exact !important;"></div>`}case"pageInfo":return`<div data-atomic-block="page-info" style="${O}font-family:'${a}',sans-serif;font-size:10px;color:#6b7280;text-align:center;">${new Date().toLocaleDateString("ar-SA")}</div>`;default:return""}},V=(z,K)=>{const ae=k(z,K);if(!I||!P.has(z.id))return ae;
317const oe=z.id===D?.id?"table":"follower",re=G.get(z.id);return ae.replace(/^<div\s/,`<div data-table-flow-member="true" data-table-flow-role="${oe}"${re==null?"":` data-table-flow-order="${re}"`} data-table-flow-base-y="${z.y}" data-table-flow-base-h="${z.h??0}" `)},U=E.map((z,K)=>V(z,K)).join(""),$=M>0?`<div style="position:absolute;left:${M}px;top:${M}px;width:${S}px;height:${A}px;border:1px dashed rgba(255,0,0,0.25);pointer-events:none;"></div>`:"",X=n.showWatermark?`<div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;opacity:0.07;font-size:90px;font-weight:800;color:${s};transform:rotate(-35deg);pointer-events:none;">مسودة</div>`:"";return`<div class="quotation-page" data-table-flow-gap="${Math.max(0,Math.min(120,Number(n.tableFlowGapPx??0)||0))}" data-table-flow-usable-height="${A}" style="position:relative;width:210mm;min-height:297mm;box-sizing:border-box;font-family:'${a}',sans-serif;direction:rtl;color:#111;overflow:visible;">
318    <style>@page{size:A4 portrait;margin:0}html,body{margin:0;padding:0}html,body,*{box-sizing:border-box}html *{print-color-adjust:exact;-webkit-print-color-adjust:exact}[data-print-shape]{display:block !important;visibility:visible !important;-webkit-print-color-adjust:exact !important;print-color-adjust:exact !important}.items-table{break-inside:auto;page-break-inside:auto}.items-table thead{display:table-header-group}.items-table tbody tr{break-inside:avoid;page-break-inside:avoid}@media print{*{print-color-adjust:exact !important;-webkit-print-color-adjust:exact !important}[data-print-shape]{display:block !important;visibility:visible !important}.items-table thead{display:table-header-group}.items-table tbody tr{break-inside:avoid;page-break-inside:avoid}}</style>
319    ${X}${$}${U}</div>`}const dZ=Object.freeze(Object.defineProperty({__proto__:null,A4_H:KS,A4_W:QS,ITEMS_TABLE_BORDER_HEIGHT_PX:l3,ITEMS_TABLE_COLUMNS:c3,ITEMS_TABLE_HEADER_HEIGHT_PX:Uy,ITEMS_TABLE_ROW_HEIGHT_PX:hN,TOTALS_BOX_BORDER_HEIGHT_PX:PU,TOTALS_BOX_DETAIL_ROW_HEIGHT_PX:DU,TOTALS_BOX_FINAL_ROW_HEIGHT_PX:kU,TOTALS_BOX_PADDING_VERTICAL_PX:RU,getItemRowNaturalHeightPx:CU,getItemsTableFlowShiftPx:TU,getItemsTableNaturalHeightForItems:EU,getItemsTableNaturalHeightPx:u3,getItemsTableReservedHeightPx:cZ,getItemsTableVisualHeightPx:jU,getTotalsBoxNaturalHeightPx:f3,hasVisibleTaxValue:d3,px:uZ,renderTemplateToHtml:Rx},Symbol.toStringTag,{value:"Module"}));
319function jd(n,e){if(!Array.isArray(n))return"";const t=n.find(r=>r?.key===e);return String(t?.value??"").trim()}function fZ(n){const e=String(n??"").trim();return e?/^(https?:|data:|blob:)/i.test(e)||e.startsWith("/local-storage/")||e.startsWith("/manus-storage/")||e.startsWith("/uploads/")?e:`/local-storage/uploads/${e.replace(/^\/?(?:local-storage\/)?(?:uploads\/)?/,"")}`:""}function hZ(n,e){return n.map(t=>({label:t.productName||t.name||"",qty:String(t.quantity??0),unit:String(t.unit??""),price:String(t.unitPrice??0),total:String(t.totalPrice??(Number(t.quantity)||0)*(Number(t.unitPrice)||0))}))}function IU(n,e,t,r,s={}){const a=Number(n?.totalAmount??n?.total??e.reduce((h,p)=>h+Number(p.totalPrice??0),0))||0,o=Number(n?.subtotal??a)||0,l=Number(n?.taxAmount??0)||0,u=jd(t,"company_name");return{invoiceNumber:String(n?.invoiceNumber??""),date:n?.invoiceDate?new Date(n.invoiceDate).toLocaleDateString("ar-EG"):new Date().toLocaleDateString("ar-EG"),quotationNumber:String(n?.quotationNumber??""),clientName:String(n?.customerName??n?.clientName??""),clientPhone:String(n?.customerPhone??n?.clientPhone??""),clientEmail:String(n?.customerEmail??n?.clientEmail??""),clientAddress:String(n?.customerAddress??n?.clientAddress??""),clientTaxNumber:String(n?.customerTaxNumber??n?.clientTaxNumber??""),clientCompany:String(n?.customerCompany??n?.clientCompany??""),companyName:u,companyPhone:jd(t,"company_phone")||jd(t,"whatsapp_number"),companyAddress:jd(t,"company_address"),companyEmail:jd(t,"company_email"),paymentTerms:String(n?.paymentMethod??n?.paymentTerms??""),deliveryMethod:String(n?.deliveryMethod??""),total:a.toLocaleString("en-US",{minimumFractionDigits:2}),taxTotal:l>0?l.toLocaleString("en-US",{minimumFractionDigits:2}):"",discountValue:String(n?.discountValue??n?.discount??""),amountInWords:String(n?.amountInWords??""),notes:String(n?.notes??""),supplierName:String(n?.supplierName??""),supplierPhone:String(n?.supplierPhone??""),supplierAddress:String(n?.supplierAddress??""),machineName:String(n?.machineName??""),marginValue:String(n?.marginValue??""),subtotal:o.toLocaleString("en-US",{minimumFractionDigits:2}),__totals:a.toLocaleString("en-US",{minimumFractionDigits:2}),__taxTotal:l>0?l.toLocaleString("en-US",{minimumFractionDigits:2}):"",__itemsJson:JSON.stringify(hZ(e)),...Object.fromEntries(Object.entries(s).map(([h,p])=>[h,String(p??"")]))}}function h3(n){return fZ(jd(n,"company_logo"))}function BU({products:n,value:e="",onSelect:t,onClear:r}){const[s,a]=T.useState(!1),[o,l]=T.useState(e),[u,d]=T.useState(!1),[h,p]=T.useState({name:"",sellingPrice:"",unit:"قطعة",specs:""}),x=Pe.products.create.useMutation(),y=Pe.useUtils(),v=(n||[]).filter(S=>{const A=String(S.name||"").toLocaleLowerCase();return!o.trim()||A.includes(o.trim().toLocaleLowerCase())}).slice(0,12),_=S=>{l(S.name||""),a(!1),t(S)},M=async()=>{if(h.name.trim())try{const S=await x.mutateAsync({name:h.name.trim(),sellingPrice:Number(h.sellingPrice||0),costPrice:0,unit:h.unit||"قطعة",specs:h.specs||"",features:"",notes:"",showOnWebsite:!1});await y.products.list.invalidate();const A=await y.products.list.fetch(),E=S,C=Number(E?.id||E?.insertId||0),I=(A||[]).find(D=>C&&Number(D.id)===C||D.name===h.name.trim())||{id:C,name:h.name.trim(),sellingPrice:Number(h.sellingPrice||0),unit:h.unit||"قطعة",specs:h.specs||""};_(I),d(!1),p({name:"",sellingPrice:"",unit:"قطعة",specs:""})}catch{}};return i.jsxs("div",{className:"relative min-w-0",children:[i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),i.jsx(Ee,{value:o,onChange:S=>{l(S.target.value),a(!0),S.target.value||r?.()},onFocus:()=>a(!0),onBlur:()=>window.setTimeout(()=>a(!1),160),placeholder:"ابحث عن المنتج...",className:"h-9 bg-white border-slate-300 pr-7 pl-7 text-slate-900 text-sm"}),o&&i.jsx("button",{type:"button",onMouseDown:S=>S.preventDefault(),onClick:()=>{l(""),r?.(),a(!0)},className:"absolute left-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-red-500",children:i.jsx(Mr,{className:"h-3.5 w-3.5"})})]}),s&&i.jsxs("div",{className:"absolute right-0 z-[100] mt-1 max-h-64 w-[min(24rem,calc(100vw-3rem))] overflow-y-auto rounded-md border border-slate-300 bg-white p-1 text-slate-900 shadow-2xl",children:[v.map(S=>i.jsxs("button",{type:"button",onMouseDown:A=>A.preventDefault(),onClick:()=>_(S),className:"flex w-full items-center justify-between rounded px-2 py-2 text-right hover:bg-cyan-50",children:[i.jsx("span",{className:"font-medium",children:S.name}),i.jsxs("span",{className:"text-xs text-slate-500",children:[Number(S.sellingPrice||0).toFixed(2)," $ · ",S.unit||""]})]},S.id)),v.length===0&&i.jsx("div",{className:"px-2 py-2 text-center text-xs text-slate-500",children:"لا يوجد منتج مطابق"}),i.jsxs("button",{type:"button",onMouseDown:S=>S.preventDefault(),onClick:()=>{d(!0),a(!1)},className:"mt-1 flex w-full items-center justify-center gap-1 border-t border-slate-200 px-2 py-2 text-xs font-semibold text-cyan-700 hover:bg-cyan-50",children:[i.jsx(Nn,{className:"h-3.5 w-3.5"})," إضافة منتج جديد"]})]}),u&&i.jsxs("div",{className:"mt-2 rounded-md border border-cyan-200 bg-white p-2 shadow-sm",children:[i.jsx("div",{className:"mb-2 text-xs font-semibold text-cyan-800",children:"إنشاء منتج جديد"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Ee,{autoFocus:!0,value:h.name,onChange:S=>p({...h,name:S.target.value}),placeholder:"اسم المنتج",className:"bg-white border-slate-300 text-slate-900 text-xs"}),i.jsx(Ee,{type:"number",value:h.sellingPrice,onChange:S=>p({...h,sellingPrice:S.target.value}),placeholder:"سعر البيع",className:"bg-white border-slate-300 text-slate-900 text-xs"}),i.jsx(Ee,{value:h.unit,onChange:S=>p({...h,unit:S.target.value}),placeholder:"الوحدة",className:"bg-white border-slate-300 text-slate-900 text-xs"}),i.jsx(Ee,{value:h.specs,onChange:S=>p({...h,specs:S.target.value}),placeholder:"المواصفات",className:"bg-white border-slate-300 text-slate-900 text-xs"})]}),i.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>d(!1),className:"h-7 border-slate-300 text-xs",children:"إلغاء"}),i.jsx(ke,{type:"button",size:"sm",onClick:M,disabled:!h.name.trim()||x.isPending,className:"h-7 text-xs",children:x.isPending?"جاري...":"حفظ واختيار"})]})]})]})}function mZ(){const{data:n,isLoading:e,refetch:t}=Pe.salesInvoices.list.useQuery(),{data:r}=Pe.clients.list.useQuery(),{data:s}=Pe.priceQuotations.list.useQuery(),{data:a}=Pe.products.list.useQuery(),{data:o}=Pe.templates.get.useQuery({docType:"salesInvoice"}),{data:l}=Pe.settings.list.useQuery(void 0,{retry:!1}),u=Pe.salesInvoices.create.useMutation(),d=Pe.salesInvoices.update.useMutation(),h=Pe.salesInvoices.delete.useMutation(),p=Pe.useUtils(),[x,y]=T.useState(!1),[v,_]=T.useState(null),[M,S]=T.useState({}),[A,E]=T.useState([]),[C,I]=T.useState(""),[D,B]=T.useState("all"),[P,G]=T.useState(!0),[k,V]=T.useState(null),U={draft:"bg-gray-500/20 text-muted-foreground",pending:"bg-yellow-500/20 text-yellow-400",paid:"bg-green-500/20 text-green-400",cancelled:"bg-red-500/20 text-red-400"},$=()=>{_(null),V(null),S({invoiceNumber:"",customerId:0,customerName:"",customerAddress:"",customerPhone:"",customerTaxNumber:"",withTax:!1,status:"draft",paymentMethod:"",deliveryMethod:"",notes:"",subtotal:0,taxAmount:0,totalAmount:0}),E([]),y(!0)},X=async Z=>{_(Z),V(Z.quotationId||null);try{const se=await p.salesInvoices.get.fetch({id:Z.id});S(se),E(se?.items||[]),y(!0)}catch{_e.error("حدث خطأ")}},ee=async Z=>{let me=s?.find(ze=>ze.id===Z);try{const ze=await p.priceQuotations.get.fetch({id:Z});ze&&(me=ze)}catch{}if(me){S(Be=>({...Be,customerId:me.customerId||0,customerName:me.customerName||"",customerPhone:me.customerPhone||"",customerAddress:me.customerAddress||"",customerTaxNumber:me.customerTaxNumber||"",withTax:me.withTax||!1,paymentMethod:"",deliveryMethod:me.deliveryMethod||""}));const ze=me.items||[];E(ze.map(Be=>({productId:Be.productId||0,productName:Be.productName||"",specs:Be.specs||"",quantity:Be.quantity||1,unitPrice:Be.unitPrice||0,totalPrice:Be.totalPrice||0})))}V(Z)},z=(Z,se)=>{const me=Z.reduce((ye,Le)=>ye+(Le.totalPrice||0),0),ze=se?me*.15:0,Be=me+ze;return{subtotal:me,taxAmount:ze,totalAmount:Be}},K=async()=>{try{const Z=z(A,M.withTax);v?(await d.mutateAsync({id:v.id,data:{...M,...Z},items:A}),_e.success("تم التحديث")):(await u.mutateAsync({data:{...M,...Z,quotationId:k||0},items:A}),_e.success("تم الإنشاء")),y(!1),t()}catch{_e.error("حدث خطأ")}},ae=async Z=>{if(confirm("هل أنت متأكد؟"))try{await h.mutateAsync({id:Z.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},oe=async(Z,se)=>{try{await d.mutateAsync({id:Z,data:{status:se},items:[]}),_e.success("تم تحديث الحالة"),t()}catch{_e.error("حدث خطأ")}},re=async Z=>{try{const se=await p.salesInvoices.get.fetch({id:Z.id}),me=se||Z,ze=se?.items||[],Be=o||fp("salesInvoice"),ye=IU(me,ze,l,"product"),Le=Rx(Be,ye,{logoUrl:h3(l),companyTitle:jd(l,"company_name"),deferTableFlow:!0});await Gd(Le,`فاتورة مبيعات ${me.invoiceNumber||""}`)}catch(se){_e.error(se?.message||"تعذر تجهيز فاتورة المبيعات للطباعة")}},F=async Z=>{try{await p.salesInvoices.get.fetch({id:Z.id}),_e.success("جاري تحويل إلى بيان تعبئة..."),window.dispatchEvent(new CustomEvent("navigate-to-packing",{detail:{sourceId:Z.id,sourceType:"sales-invoice"}}))}catch{_e.error("حدث خطأ")}},O=async Z=>{try{_e.success("جاري تحويل إلى أمر إنتاج..."),window.dispatchEvent(new CustomEvent("navigate-to-production",{detail:{sourceId:Z.id,sourceType:"sales-invoice"}}))}catch{_e.error("حدث خطأ")}},J=()=>E([...A,{productName:"",specs:"",quantity:1,unitPrice:0,totalPrice:0}]),q=Z=>E(A.filter((se,me)=>me!==Z)),Q=(Z,se,me)=>{const ze=[...A];ze[Z]={...ze[Z],[se]:me},(se==="quantity"||se==="unitPrice")&&(ze[Z].totalPrice=(ze[Z].quantity||0)*(ze[Z].unitPrice||0)),E(ze)},ne=(n||[]).filter(Z=>{const se=C===""||(Z.invoiceNumber||"").toLowerCase().includes(C.toLowerCase())||(Z.customerName||"").toLowerCase().includes(C.toLowerCase()),me=D==="all"||Z.status===D;return se&&me});return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-xl font-bold text-foreground",children:"فواتير المبيعات"}),i.jsxs(ke,{onClick:$,className:"bg-primary hover:bg-primary/90 text-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," فاتورة مبيعات جديدة"]})]}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground
319/70"}),i.jsx("input",{value:C,onChange:Z=>I(Z.target.value),placeholder:"بحث برقم الفاتورة أو اسم العميل...",className:"w-full bg-muted/50 border border-border rounded-lg pr-10 pl-3 py-2 text-foreground text-sm focus:border-primary focus:outline-none"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(eN,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70 pointer-events-none"}),i.jsxs("select",{value:D,onChange:Z=>B(Z.target.value),className:"bg-muted/50 border border-border rounded-lg pr-9 pl-3 py-2 text-foreground text-sm appearance-none focus:border-primary focus:outline-none cursor-pointer",children:[i.jsx("option",{value:"all",children:"كل الحالات"}),i.jsx("option",{value:"draft",children:"مسودة"}),i.jsx("option",{value:"pending",children:"معلقة"}),i.jsx("option",{value:"paid",children:"مدفوعة"}),i.jsx("option",{value:"cancelled",children:"ملغاة"})]})]})]}),i.jsx("div",{className:"space-y-3",children:e?i.jsx("p",{className:"text-muted-foreground/70 text-center py-8",children:"جاري التحميل..."}):ne.length===0?i.jsx("p",{className:"text-muted-foreground/70 text-center py-8",children:"لا توجد فواتير مبيعات"}):ne.map(Z=>i.jsx("div",{className:"bg-muted/50 rounded-xl border border-border p-4 hover:border-primary/30 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"رقم الفاتورة"}),i.jsx("div",{className:"text-foreground font-bold",children:Z.invoiceNumber||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"العميل"}),i.jsx("div",{className:"text-foreground",children:Z.customerName||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"المبلغ"}),i.jsxs("div",{className:"text-primary font-bold",children:["$",(Z.totalAmount||0).toFixed(2)]})]}),Z.withTax&&i.jsx(Ul,{className:"bg-primary/20 text-primary border border-primary/30 text-xs",children:"شامل الضريبة"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("div",{className:"relative group",children:[i.jsx("button",{className:"p-1.5 rounded-lg hover:bg-accent text-purple-400",title:"تحويل إلى",children:i.jsx(Ly,{className:"w-4 h-4"})}),i.jsxs("div",{className:"hidden group-hover:block absolute left-0 top-full mt-1 bg-muted/50 border border-border rounded-lg shadow-xl z-50 min-w-[160px]",children:[i.jsxs("button",{onClick:()=>F(Z),className:"w-full text-right px-3 py-2 text-xs text-foreground hover:bg-accent flex items-center gap-2",children:[i.jsx(ma,{className:"w-3 h-3"})," بيان تعبئة"]}),i.jsxs("button",{onClick:()=>O(Z),className:"w-full text-right px-3 py-2 text-xs text-foreground hover:bg-accent flex items-center gap-2",children:[i.jsx(FY,{className:"w-3 h-3"})," أمر إنتاج"]}),i.jsxs("button",{onClick:()=>pZ(Z),className:"w-full text-right px-3 py-2 text-xs text-foreground hover:bg-accent flex items-center gap-2",children:[i.jsx(Ki,{className:"w-3 h-3"})," فاتورة رسمية"]})]})]}),i.jsxs(En,{value:Z.status,onValueChange:se=>oe(Z.id,se),children:[i.jsx(Tn,{className:`w-[100px] border-border text-foreground text-xs h-8 ${U[Z.status]||""}`,children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"draft",children:"مسودة"}),i.jsx(bt,{value:"pending",children:"معلقة"}),i.jsx(bt,{value:"paid",children:"مدفوعة"}),i.jsx(bt,{value:"cancelled",children:"ملغاة"})]})]}),i.jsx("button",{onClick:()=>re(Z),className:"p-1.5 rounded-lg hover:bg-accent text-green-400",title:"طباعة",children:i.jsx(nl,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>X(Z),className:"p-1.5 rounded-lg hover:bg-accent text-primary",title:"تعديل",children:i.jsx(Ki,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>ae(Z),className:"p-1.5 rounded-lg hover:bg-accent text-red-400",title:"حذف",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]})},Z.id))}),x&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-start justify-center p-4 overflow-y-auto",onClick:()=>y(!1),children:i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl w-full max-w-4xl my-8",onClick:Z=>Z.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:v?"تعديل فاتورة مبيعات":"فاتورة مبيعات جديدة"}),i.jsx("button",{onClick:()=>y(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4 max-h-[70vh] overflow-y-auto",children:[!v&&i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary mb-2",children:"إنشاء من عرض سعر (اختياري)"}),i.jsxs(En,{value:k?String(k):"none",onValueChange:Z=>{Z==="none"?(V(null),S({invoiceNumber:"",customerId:0,customerName:"",customerAddress:"",customerPhone:"",customerTaxNumber:"",withTax:!1,status:"draft",paymentMethod:"",deliveryMethod:"",notes:"",subtotal:0,taxAmount:0,totalAmount:0}),E([])):ee(Number(Z))},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر عرض سعر أو ابدأ من الصفر"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"none",children:"بدون عرض سعر"}),s?.map(Z=>i.jsxs(bt,{value:String(Z.id),children:[Z.quotationNumber||""," - ",Z.customerName||"-"]},Z.id))]})]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary mb-2",children:"معلومات العميل"}),i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("button",{type:"button",onClick:()=>G(!0),className:`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors ${P?"bg-primary text-foreground":"bg-muted/50 text-muted-foreground border border-border"}`,children:"إدخال يدوي"}),i.jsx("button",{type:"button",onClick:()=>G(!1),className:`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors ${P?"bg-muted/50 text-muted-foreground border border-border":"bg-primary text-foreground"}`,children:"اختيار عميل"})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[!P&&i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العميل"}),i.jsxs(En,{value:M.customerId?String(M.customerId):"0",onValueChange:Z=>{const se=r?.find(me=>String(me.id)===Z);S({...M,customerId:Number(Z),customerName:se?.name||"",customerPhone:se?.phone||"",customerAddress:se?.address||"",customerTaxNumber:se?.taxNumber||""})},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر العميل"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"0",children:"بدون عميل"}),r?.map(Z=>i.jsx(bt,{value:String(Z.id),children:Z.name},Z.id))]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم العميل *"}),i.jsx(Ee,{value:M.customerName||"",onChange:Z=>S({...M,customerName:Z.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هاتف العميل"}),i.jsx(Ee,{value:M.customerPhone||"",onChange:Z=>S({...M,customerPhone:Z.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"عنوان العميل"}),i.jsx(Ee,{value:M.customerAddress||"",onChange:Z=>S({...M,customerAddress:Z.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الرقم الضريبي"}),i.jsx(Ee,{value:M.customerTaxNumber||"",onChange:Z=>S({...M,customerTaxNumber:Z.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"طريقة الدفع"}),i.jsxs(En,{value:M.paymentMethod||"cash",onValueChange:Z=>S({...M,paymentMethod:Z}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر طريقة الدفع"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"cash",children:"نقداً"}),i.jsx(bt,{value:"bank",children:"تحويل بنكي"}),i.jsx(bt,{value:"check",children:"شيك"}),i.jsx(bt,{value:"credit",children:"آجل"})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[i.jsx(Yo,{checked:M.withTax,onCheckedChange:Z=>S({...M,withTax:Z})}),i.jsx("label",{className:"text-sm text-foreground",children:"شامل الضريبة (15%)"})]})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary",children:"البنود"}),i.jsxs(ke,{size:"sm",variant:"outline",onClick:J,className:"border-primary text-primary text-xs",children:[i.jsx(Nn,{className:"w-3 h-3 ml-1"})," إضافة بند"]})]}),A.map((Z,se)=>
319i.jsxs("div",{className:"grid grid-cols-5 gap-2 mb-2 items-end",children:[i.jsx(BU,{products:a||[],value:Z.productName||"",onClear:()=>Q(se,"productId",0),onSelect:me=>{Q(se,"productId",me.id),Q(se,"productName",me.name||""),Q(se,"unitPrice",Number(me.sellingPrice||0)),Q(se,"specs",me.specs||"")}}),i.jsx(Ee,{value:Z.specs||"",onChange:me=>Q(se,"specs",me.target.value),placeholder:"المواصفات",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsx(Ee,{type:"number",value:Z.quantity,onChange:me=>Q(se,"quantity",parseFloat(me.target.value)||0),placeholder:"الكمية",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsx(Ee,{type:"number",value:Z.unitPrice,onChange:me=>Q(se,"unitPrice",parseFloat(me.target.value)||0),placeholder:"سعر الوحدة",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(Ee,{value:`$${Z.totalPrice?.toFixed(2)||0}`,readOnly:!0,className:"bg-muted/50 border-border text-primary text-sm font-bold"}),i.jsx("button",{onClick:()=>q(se),className:"p-1.5 text-red-400 hover:bg-red-400/10 rounded",children:i.jsx(Mr,{className:"w-4 h-4"})})]})]},se)),i.jsxs("div",{className:"mt-2 bg-muted/50 rounded-lg p-3 space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[i.jsx("span",{children:"المجموع الفرعي"}),i.jsxs("span",{children:["$",A.reduce((Z,se)=>Z+(se.totalPrice||0),0).toFixed(2)]})]}),M.withTax&&i.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[i.jsx("span",{children:"الضريبة (15%)"}),i.jsxs("span",{children:["$",(A.reduce((Z,se)=>Z+(se.totalPrice||0),0)*.15).toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between text-sm font-bold text-primary border-t border-border pt-1",children:[i.jsx("span",{children:"الإجمالي"}),i.jsxs("span",{children:["$",(M.withTax?A.reduce((Z,se)=>Z+(se.totalPrice||0),0)*1.15:A.reduce((Z,se)=>Z+(se.totalPrice||0),0)).toFixed(2)]})]})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>y(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:K,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:u.isPending||d.isPending,children:"حفظ"})]})]})})]})}function pZ(n){window.dispatchEvent(new CustomEvent("navigate-to-invoice",{detail:{sourceId:n.id,sourceType:"sales-invoice"}})),_e.success("جاري تحويل إلى فاتورة رسمية...")}function gZ(){const{data:n,isLoading:e,refetch:t}=Pe.officialInvoices.list.useQuery(),{data:r}=Pe.clients.list.useQuery(),{data:s}=Pe.products.list.useQuery(),{data:a}=Pe.templates.get.useQuery({docType:"officialInvoice"}),{data:o}=Pe.settings.list.useQuery(void 0,{retry:!1});T.useEffect(()=>{const O=new URLSearchParams(window.location.search).get("new-invoice-client");if(O){const J=(r||[]).find(Q=>Q.id===Number(O));k(),J&&M(Q=>({...Q,customerId:J.id||0,customerName:J.name||"",customerPhone:J.phone||"",customerAddress:J.address||""}));const q=new URL(window.location.href);q.searchParams.delete("new-invoice-client"),window.history.replaceState({},"",q.toString())}},[r]);const l=Pe.officialInvoices.create.useMutation(),u=Pe.officialInvoices.update.useMutation(),d=Pe.officialInvoices.delete.useMutation(),h=Pe.useUtils(),[p,x]=T.useState(!1),[y,v]=T.useState(null),[_,M]=T.useState({}),[S,A]=T.useState([]),[E,C]=T.useState(""),[I,D]=T.useState("all"),[B,P]=T.useState(!0),G={draft:"bg-teal-500/20 text-teal-400",pending:"bg-yellow-500/20 text-yellow-400",paid:"bg-green-500/20 text-green-400",cancelled:"bg-red-500/20 text-red-400"},k=()=>{v(null),M({invoiceNumber:"",customerId:0,customerName:"",customerAddress:"",customerPhone:"",customerTaxNumber:"",withTax:!1,status:"draft",paymentMethod:"",deliveryMethod:"",notes:"",subtotal:0,taxAmount:0,totalAmount:0}),A([]),x(!0)},V=async F=>{v(F);try{const O=await h.officialInvoices.get.fetch({id:F.id});M(O),A(O?.items||[]),x(!0)}catch{_e.error("حدث خطأ")}},U=(F,O)=>
319{const J=F.reduce((ne,Z)=>ne+(Z.totalPrice||0),0),q=O?J*.15:0,Q=J+q;return{subtotal:J,taxAmount:q,totalAmount:Q}},$=async()=>{try{const F=U(S,_.withTax);y?(await u.mutateAsync({id:y.id,data:{..._,...F},items:S}),_e.success("تم التحديث")):(await l.mutateAsync({data:{..._,...F},items:S}),_e.success("تم الإنشاء")),x(!1),t()}catch{_e.error("حدث خطأ")}},X=async F=>{if(confirm("هل أنت متأكد؟"))try{await d.mutateAsync({id:F.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},ee=async(F,O)=>{try{await u.mutateAsync({id:F,data:{status:O},items:[]}),_e.success("تم تحديث الحالة"),t()}catch{_e.error("حدث خطأ")}},z=async F=>{try{const O=await h.officialInvoices.get.fetch({id:F.id}),J=O||F,q=O?.items||[],Q=a||fp("officialInvoice"),ne=IU(J,q,o,"product"),Z=Rx(Q,ne,{logoUrl:h3(o),companyTitle:jd(o,"company_name"),deferTableFlow:!0});await Gd(Z,`فاتورة ${J.invoiceNumber||""}`)}catch(O){_e.error(O?.message||"تعذر تجهيز الفاتورة الرسمية للطباعة")}},K=()=>A([...S,{productName:"",specs:"",quantity:1,unitPrice:0,totalPrice:0}]),ae=F=>A(S.filter((O,J)=>J!==F)),oe=(F,O,J)=>{const q=[...S];q[F]={...q[F],[O]:J},(O==="quantity"||O==="unitPrice")&&(q[F].totalPrice=(q[F].quantity||0)*(q[F].unitPrice||0)),A(q)},re=(n||[]).filter(F=>{const O=E===""||(F.invoiceNumber||"").toLowerCase().includes(E.toLowerCase())||(F.customerName||"").toLowerCase().includes(E.toLowerCase()),J=I==="all"||F.status===I;return O&&J});return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-xl font-bold text-foreground",children:"الفواتير الرسمية"}),i.jsxs(ke,{onClick:k,className:"bg-primary hover:bg-primary/90 text-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," فاتورة جديدة"]})]}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx("input",{value:E,onChange:F=>C(F.target.value),placeholder:"بحث برقم الفاتورة أو اسم العميل...",className:"w-full bg-muted/50 border border-border rounded-lg pr-10 pl-3 py-2 text-foreground text-sm focus:border-primary focus:outline-none"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(eN,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70 pointer-events-none"}),i.jsxs("select",{value:I,onChange:F=>D(F.target.value),className:"bg-muted/50 border border-border rounded-lg pr-9 pl-3 py-2 text-foreground text-sm appearance-none focus:border-primary focus:outline-none cursor-pointer",children:[i.jsx("option",{value:"all",children:"كل الحالات"}),i.jsx("option",{value:"draft",children:"مسودة"}),i.jsx("option",{value:"pending",children:"معلقة"}),i.jsx("option",{value:"paid",children:"مدفوعة"}),i.jsx("option",{value:"cancelled",children:"ملغاة"})]})]})]}),i.jsx("div",{className:"space-y-3",children:e?i.jsx("p",{className:"text-muted-foreground/70 text-center py-8",children:"جاري التحميل..."}):re.length===0?i.jsx("p",{className:"text-muted-foreground/70 text-center py-8",children:"لا توجد فواتير"}):re.map(F=>i.jsx("div",{className:"bg-muted/50 rounded-xl border border-border p-4 hover:border-primary/30 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"رقم الفاتورة"}),i.jsx("div",{className:"text-foreground font-bold",children:F.invoiceNumber||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"العميل"}),i.jsx("div",{className:"text-foreground",children:F.customerName||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"المبلغ"}),i.jsxs("div",{className:"text-primary font-bold",children:[(F.totalAmount||0).toLocaleStr
319ing()," $"]})]}),F.withTax&&i.jsx(Ul,{className:"bg-primary/20 text-primary border border-primary/30 text-xs",children:"شامل الضريبة"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(En,{value:F.status,onValueChange:O=>ee(F.id,O),children:[i.jsx(Tn,{className:`w-[100px] border-border text-foreground text-xs h-8 ${G[F.status]||""}`,children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"draft",children:"مسودة"}),i.jsx(bt,{value:"pending",children:"معلقة"}),i.jsx(bt,{value:"paid",children:"مدفوعة"}),i.jsx(bt,{value:"cancelled",children:"ملغاة"})]})]}),i.jsx("button",{onClick:()=>z(F),className:"p-1.5 rounded-lg hover:bg-accent text-green-400",title:"طباعة الفاتورة",children:i.jsx(nl,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>V(F),className:"p-1.5 rounded-lg hover:bg-accent text-primary",title:"تعديل",children:i.jsx(Ki,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>X(F),className:"p-1.5 rounded-lg hover:bg-accent text-red-400",title:"حذف",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]})},F.id))}),p&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-start justify-center p-4 overflow-y-auto",onClick:()=>x(!1),children:i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl w-full max-w-4xl my-8",onClick:F=>F.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:y?"تعديل فاتورة":"فاتورة جديدة"}),i.jsx("button",{onClick:()=>x(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4 max-h-[70vh] overflow-y-auto",children:[i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary mb-2",children:"معلومات العميل"}),i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("button",{type:"button",onClick:()=>P(!0),className:`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors ${B?"bg-primary text-foreground":"bg-muted/50 text-muted-foreground border border-border"}`,children:"إدخال يدوي"}),i.jsx("button",{type:"button",onClick:()=>P(!1),className:`px-4 py-1.5 rounded-lg text-xs font-medium transition-colors ${B?"bg-muted/50 text-muted-foreground border border-border":"bg-primary text-foreground"}`,children:"اختيار عميل"})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[!B&&i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العميل"}),i.jsxs(En,{value:_.customerId?String(_.customerId):"",onValueChange:F=>{const O=r?.find(J=>String(J.id)===F);M({..._,customerId:Number(F),customerName:O?.name||"",customerPhone:O?.phone||"",customerAddress:O?.address||""})},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر العميل"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"0",children:"بدون عميل"}),r?.map(F=>i.jsx(bt,{value:String(F.id),children:F.name},F.id))]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم العميل *"}),i.jsx(Ee,{value:_.customerName||"",onChange:F=>M({..._,customerName:F.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هاتف العميل"}),i.jsx(Ee,{value:_.customerPhone||"",onChange:F=>M({..._,customerPhone:F.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"عنوان العميل"}),i.jsx(Ee,{value:_.customerAddress||"",onChange:F=>M({..._,customerAddress:F.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الرقم الضريبي"}),i.jsx(Ee,{value:_.customerTaxNumber||"",onChange:F=>M({..._,customerTaxNumber:F.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[i.jsx(Yo,{checked:_.withTax,onCheckedChange:F=>M({..._,withTax:F})}),i.jsx("label",{className:"text-sm text-foreground",children:"شامل الضريبة (15%)"})]})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-sm font-semibold text-primary",children:"البنود"}),i.jsxs(ke,{size:"sm",variant:"outline",onClick:K,className:"border-primary text-primary text-xs",children:[i.jsx(Nn,{className:"w-3 h-3 ml-1"})," إضافة بند"]})]}),S.map((F,O)=>
319i.jsxs("div",{className:"grid grid-cols-5 gap-2 mb-2 items-end",children:[i.jsx(BU,{products:s||[],value:F.productName||"",onClear:()=>oe(O,"productId",0),onSelect:J=>{oe(O,"productId",J.id),oe(O,"productName",J.name||""),oe(O,"unitPrice",Number(J.sellingPrice||0)),oe(O,"specs",J.specs||"")}}),i.jsx(Ee,{value:F.specs||"",onChange:J=>oe(O,"specs",J.target.value),placeholder:"المواصفات",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsx(Ee,{type:"number",value:F.quantity,onChange:J=>oe(O,"quantity",parseFloat(J.target.value)||0),placeholder:"الكمية",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsx(Ee,{type:"number",value:F.unitPrice,onChange:J=>oe(O,"unitPrice",parseFloat(J.target.value)||0),placeholder:"سعر الوحدة",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(Ee,{value:F.totalPrice,readOnly:!0,className:"bg-muted/50 border-border text-primary text-sm font-bold"}),i.jsx("button",{onClick:()=>ae(O),className:"p-1.5 text-red-400 hover:bg-red-400/10 rounded",children:i.jsx(Mr,{className:"w-4 h-4"})})]})]},O)),i.jsxs("div",{className:"mt-2 bg-muted/50 rounded-lg p-3 space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[i.jsx("span",{children:"المجموع الفرعي"}),i.jsxs("span",{children:[S.reduce((F,O)=>F+(O.totalPrice||0),0)," $"]})]}),_.withTax&&i.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[i.jsx("span",{children:"الضريبة (15%)"}),i.jsxs("span",{children:[(S.reduce((F,O)=>F+(O.totalPrice||0),0)*.15).toFixed(2)," $"]})]}),i.jsxs("div",{className:"flex justify-between text-sm font-bold text-primary border-t border-border pt-1",children:[i.jsx("span",{children:"الإجمالي"}),i.jsxs("span",{children:[(_.withTax?S.reduce((F,O)=>F+(O.totalPrice||0),0)*1.15:S.reduce((F,O)=>F+(O.totalPrice||0),0)).toFixed(2)," $"]})]})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>x(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:$,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:l.isPending||u.isPending,children:"حفظ"})]})]})})]})}function Eh({title:n,columns:e,data:t,loading:r=!1,onAdd:s,onEdit:a,onDelete:o,onPrint:l,onExport:u,actions:d=[],searchPlaceholder:h="بحث...",searchKey:p="",emptyMessage:x="لا توجد بيانات",children:y}){const[v,_]=T.useState(""),M=p?t.filter(S=>{const A=S[p];return typeof A=="string"?A.toLowerCase().includes(v.toLowerCase()):typeof A=="number"?A.toString().includes(v):!1}):t;return i.jsxs(bn,{className:"bg-card border-border p-0 overflow-hidden",children:[i.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between flex-wrap gap-3",children:[i.jsx("h2",{className:"text-lg font-bold text-foreground",style:{fontFamily:"'Cairo', sans-serif"},children:n}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y,i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),i.jsx(Ee,{value:v,onChange:S=>_(S.target.value),placeholder:h,className:"bg-input border-border text-foreground pr-8 text-sm w-48"})]}),s&&i.jsxs(ke,{size:"sm",onClick:s,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," إضافة"]}),u&&i.jsx(ke,{size:"sm",variant:"outline",onClick:u,className:"border-border text-muted-foreground",children:"تصدير"})]})]}),i.jsx("div",{className:"overflow-x-auto",children:r?i.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"جاري التحميل..."}):M.length===0?i.jsx("div",{className:"p-8 text-center text-muted-foreground",children:x}):i.jsxs("table",{className:"w-full text-sm",style:{fontFamily:"'Cairo', sans-serif"},children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[e.map(S=>i.jsx("th",{className:`px-4 py-3 text-right font-semibold text-muted-foreground whitespace-nowrap ${S.className||""}`,children:S.label},S.key)),(a||o||l||d.length>0)&&i.jsx("th",{className:"px-4 py-3 text-center font-semibold text-muted-foreground whitespace-nowrap",children:"إجراءات"})]})}),i.jsx("tbody",{children:M.map((S,A)=>i.jsxs("tr",{className:"border-t border-border hover:bg-muted/30 transition-colors",children:[e.map(E=>i.jsx("td",{className:`px-4 py-3 text-foreground whitespace-nowrap ${E.className||""}`,children:E.render?E.render(S[E.key],S):S[E.key]??"-"},E.key)),(a||o||l||d.length>0)&&i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center justify-center gap-1",children:[l&&i.jsx(ke,{size:"sm",variant:"outline",onClick:()=>l(S),className:"w-8 h-8 p-0 border-border text-muted-foreground hover:text-blue-500",children:i.jsx(nl,{className:"w-3.5 h-3.5"})}),a&&i.jsx(ke,{size:"sm",variant:"outline",onClick:()=>a(S),className:"w-8 h-8 p-0 border-border text-muted-foreground hover:text-primary",children:i.jsx(hh,{className:"w-3.5 h-3.5"})}),o&&i.jsx(ke,{size:"sm",variant:"outline",onClick:()=>o(S),className:"w-8 h-8 p-0 border-border text-muted-foreground hover:text-red-500",children:i.jsx(Ar,{className:"w-3.5 h-3.5"})}),d.filter(E=>!E.visible||E.visible(S)).map(E=>i.jsxs(ke,{size:E.size||"sm",variant:E.variant||"outline",onClick:()=>E.onClick(S),className:"h-8 border-border text-muted-foreground hover:text-primary",children:[E.icon,i.jsx("span",{className:E.icon?"mr-1":"",children:E.label})]},E.label))]})})]},A))})]})})]})}function Qo({open:n,onOpenChange:e,title:t,children:r,onSubmit:s,submitLabel:a="حفظ",className:o=""}){return i.jsx(Qa,{open:n,onOpenChange:e,children:i.jsxs(Ka,{className:`bg-card border-border max-w-2xl max-h-[90vh] overflow-y-auto ${o}`,dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",style:{fontFamily:"'Cairo', sans-serif"},children:t})}
319),i.jsx("div",{className:"space-y-4 mt-4",children:r}),i.jsxs("div",{className:"flex justify-start gap-2 mt-6",children:[i.jsx(ke,{onClick:s,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:a}),i.jsx(ke,{variant:"outline",onClick:()=>e(!1),className:"border-border text-muted-foreground",children:"إلغاء"})]})]})})}function Vt({label:n,children:e}){return i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-muted-foreground mb-1.5",children:n}),e]})}function xZ(){const{data:n,isLoading:e,refetch:t}=Pe.packingLists.list.useQuery(),r=Pe.packingLists.create.useMutation(),s=Pe.packingLists.update.useMutation(),a=Pe.packingLists.delete.useMutation(),[o,l]=T.useState(!1),[u,d]=T.useState(null),[h,p]=T.useState({listNumber:"",customerName:"",date:new Date().toISOString().split("T")[0],totalCartons:0,totalWeight:0,notes:""}),[x,y]=T.useState([]),v=()=>{d(null),p({listNumber:"",customerName:"",date:new Date().toISOString().split("T")[0],totalCartons:0,totalWeight:0,notes:""}),y([]),l(!0)},_=async D=>{d(D);const B=await Pe.packingLists.get.useQuery({id:D.id});p(D),y(B?.data?.items||[]),l(!0)},M=async()=>{try{u?(await s.mutateAsync({id:u.id,data:h,items:x}),_e.success("تم التحديث")):(await r.mutateAsync({data:h,items:x}),_e.success("تم الإضافة")),l(!1),t()}catch{_e.error("حدث خطأ")}},S=async D=>{if(confirm("هل أنت متأكد؟"))try{await a.mutateAsync({id:D.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},A=D=>{const B=`<!DOCTYPE html><html dir="rtl" lang="ar"><head><meta charset="UTF-8"><title>قائمة تعبئة</title><style>@page{margin:0}*{print-color-adjust:exact;-webkit-print-color-adjust:exact}@media print{*{print-color-adjust:exact !important;-webkit-print-color-adjust:exact !important}}body{font-family:Cairo,sans-serif;padding:20px}table{width:100%;border-collapse:collapse;margin:15px 0}th{background:#0096a7;color:white;padding:8px;text-align:right}td{padding:8px;border-bottom:1px solid #d4f0f4}</style></head><body><h2>قائمة تعبئة رقم ${D.listNumber||""}</h2><p>العميل: ${D.customerName||""}</p><p>التاريخ: ${new Date(D.date||"").toLocaleDateString("ar")}</p><p>إجمالي الكراتين: ${D.totalCartons||0}</p><p>إجمالي الوزن: ${D.totalWeight||0} كجم</p></body></html>`;Gd(B,`قائمة تعبئة ${D.listNumber||""}`)},E=[{key:"listNumber",label:"رقم القائمة"},{key:"customerName",label:"العميل"},{key:"date",label:"التاريخ",render:D=>D?new Date(D).toLocaleDateString("ar"):"-"},{key:"totalCartons",label:"الكراتين"},{key:"totalWeight",label:"الوزن",render:D=>`${D||0} كجم`}],C=()=>y([...x,{productName:"",quantity:0,cartonCount:0,weight:0,dimensions:""}]),I=(D,B,P)=>{const G=[...x];G[D]={...G[D],[B]:P},y(G)};return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"}
319,dir:"rtl",children:[i.jsx(Eh,{title:"قوائم التعبئة",columns:E,data:n||[],loading:e,searchKey:"customerName",onAdd:v,onEdit:_,onDelete:S,onPrint:A}),i.jsxs(Qo,{open:o,onOpenChange:l,title:u?"تعديل قائمة تعبئة":"إضافة قائمة تعبئة",onSubmit:M,children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"رقم القائمة",children:i.jsx(Ee,{value:u?h.listNumber:"يُنشأ تلقائيًا بالتسلسل",disabled:!u,className:"bg-muted/50 border-border text-foreground disabled:opacity-100",dir:"rtl"})}),i.jsx(Vt,{label:"اسم العميل",children:i.jsx(Ee,{value:h.customerName,onChange:D=>p({...h,customerName:D.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"التاريخ",children:i.jsx(Ee,{type:"date",value:h.date,onChange:D=>p({...h,date:D.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"إجمالي الكراتين",children:i.jsx(Ee,{type:"number",value:h.totalCartons,onChange:D=>p({...h,totalCartons:parseInt(D.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"إجمالي الوزن (كجم)",children:i.jsx(Ee,{type:"number",value:h.totalWeight,onChange:D=>p({...h,totalWeight:parseFloat(D.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]}),i.jsx(Vt,{label:"ملاحظات",children:i.jsx(ni,{value:h.notes,onChange:D=>p({...h,notes:D.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsxs("div",{className:"mt-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-sm font-semibold text-foreground",children:"البنود"}),i.jsx(ke,{size:"sm",variant:"outline",onClick:C,className:"border-border text-primary",children:"+ إضافة بند"})]}),x.map((D,B)=>i.jsxs("div",{className:"grid grid-cols-5 gap-2 mb-2",children:[i.jsx(Ee,{value:D.productName,onChange:P=>I(B,"productName",P.target.value),placeholder:"المنتج",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"}),i.jsx(Ee,{type:"number",value:D.quantity,onChange:P=>I(B,"quantity",parseInt(P.target.value)||0),placeholder:"الكمية",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"}),i.jsx(Ee,{type:"number",value:D.cartonCount,onChange:P=>I(B,"cartonCount",parseInt(P.target.value)||0),placeholder:"الكراتين",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"}),i.jsx(Ee,{type:"number",value:D.weight,onChange:P=>I(B,"weight",parseFloat(P.target.value)||0),placeholder:"الوزن",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"}),i.jsx(Ee,{value:D.dimensions,onChange:P=>I(B,"dimensions",P.target.value),placeholder:"الأبعاد",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]},B))]})]})]})}function bZ(){const{data:n,isLoading:e,refetch:t}=Pe.purchaseRequests.list.useQuery(),r=Pe.purchaseRequests.create.useMutation(),s=Pe.purchaseRequests.update.useMutation(),a=Pe.purchaseRequests.delete.useMutation(),[o,l]=T.useState(!1),[u,d]=T.useState(null),[h,p]=T.useState({requestNumber:"",date:new Date().toISOString().split("T")[0],requestedBy:"",status:"pending",priority:"normal",notes:""}),x=()=>{d(null),p({requestNumber:"",date:new Date().toISOString().split("T")[0],requestedBy:"",status:"pending",priority:"normal",notes:""}),l(!0)},y=S=>{d(S),p(S),l(!0)},v=async()=>{try{u?(await s.mutateAsync({id:u.id,data:h,items:[]}),_e.success("تم التحديث")):(await r.mutateAsync({data:h,items:[]}),_e.success("تم الإضافة")),l(!1),t()}catch{_e.error("حدث خطأ")}},_=async S=>{if(confirm("هل أنت متأكد؟"))try{await a.mutateAsync({id:S.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},M=[{key:"requestNumber",label:"رقم الطلب"},{key:"date",label:"التاريخ",render:S=>S?new Date(S).toLocaleDateString("ar"):"-"},{key:"requestedBy",label:"طالب الشراء"},{key:"status",label:"الحالة",render:S=>{const A={pending:"text-yellow-400",approved:"text-[#10b981]",rejected:"text-red-400",completed:"text-blue-400"};return i.jsx("span",{className:`text-xs font-semibold ${A[S]||"text-muted-foreground"}`,children:S||"-"})}},{key:"priority",label:"الأولوية",render:S=>{const A={high:"text-red-400",normal:"text-yellow-400",low:"text-muted-foreground"};return i.jsx("span",{className:`text-xs font-semibold ${A[S]||"text-muted-foreground"}`,children:S||"-"})}}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"}
319,dir:"rtl",children:[i.jsx(Eh,{title:"طلبات الشراء",columns:M,data:n||[],loading:e,searchKey:"requestNumber",onAdd:x,onEdit:y,onDelete:_}),i.jsxs(Qo,{open:o,onOpenChange:l,title:u?"تعديل طلب شراء":"إضافة طلب شراء",onSubmit:v,children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"رقم الطلب",children:i.jsx(Ee,{value:u?h.requestNumber:"يُنشأ تلقائيًا بالتسلسل",disabled:!u,className:"bg-muted/50 border-border text-foreground disabled:opacity-100",dir:"rtl"})}),i.jsx(Vt,{label:"التاريخ",children:i.jsx(Ee,{type:"date",value:h.date,onChange:S=>p({...h,date:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"طالب الشراء",children:i.jsx(Ee,{value:h.requestedBy,onChange:S=>p({...h,requestedBy:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الحالة",children:i.jsxs(En,{value:h.status,onValueChange:S=>p({...h,status:S}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{placeholder:"اختر الحالة"})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"pending",children:"معلق"}),i.jsx(bt,{value:"approved",children:"معتمد"}),i.jsx(bt,{value:"rejected",children:"مرفوض"}),i.jsx(bt,{value:"completed",children:"مكتمل"})]})]})}),i.jsx(Vt,{label:"الأولوية",children:i.jsxs(En,{value:h.priority,onValueChange:S=>p({...h,priority:S}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{placeholder:"اختر الأولوية"})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"high",children:"عالية"}),i.jsx(bt,{value:"normal",children:"عادية"}),i.jsx(bt,{value:"low",children:"منخفضة"})]})]})})]}),i.jsx(Vt,{label:"ملاحظات",children:i.jsx(Ee,{value:h.notes,onChange:S=>p({...h,notes:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]})]})}const yZ=["accepted","approved","مقبول"];function vZ(n){return yZ.includes(String(n||""))}const LU=()=>({rawMaterialId:0,materialName:"",unit:"",quantity:1,unitPrice:0,totalPrice:0}),_C=()=>({quotationNumber:"",supplierId:0,supplierName:"",supplierPhone:"",supplierFileNumber:"",status:"pending",notes:"",items:[LU()]}),MC=n=>{if(Array.isArray(n))return n;if(typeof n=="string")try{const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}return[]};function wZ(){const{data:n,isLoading:e,refetch:t}=Pe.purchaseQuotations.list.useQuery(),{data:r}=Pe.clients.list.useQuery(),{data:s}=Pe.rawMaterials.list.useQuery(),a=Pe.purchaseQuotations.create.useMutation(),o=Pe.purchaseQuotations.update.useMutation(),l=Pe.purchaseQuotations.delete.useMutation(),u=Pe.purchaseQuotations.convertToInvoice.useMutation(),d=Pe.clients.create.useMutation(),h=Pe.useUtils(),[p,x]=T.useState(!1),[y,v]=T.useState(null),[_,M]=T.useState(_C),[S,A]=T.useState(""),[E,C]=T.useState(!1),[I,D]=T.useState({}),[B,P]=T.useState(null),[G,k]=T.useState(!1),[V,U]=T.useState({name:"",companyName:"",phone:""}),[$,X]=T.useState(null),[,ee]=pv(),z=T.useMemo(()=>(r||[]).filter(ye=>["supplier","both"].includes(ye.type)),[r]),K=T.useMemo(()=>z.filter(ye=>!S.trim()||[ye.name,ye.companyName,ye.phone].some(Le=>String(Le||"").toLocaleLowerCase().includes(S.trim().toLocaleLowerCase()))).slice(0,10),[S,z]),ae=T.useMemo(()=>_.items.reduce((ye,Le)=>ye+Number(Le.totalPrice||0),0),[_.items]),oe=()=>
319{v(null),M(_C()),A(""),D({}),x(!0)},re=ye=>{v(ye),M({..._C(),...ye,supplierId:Number(ye.supplierId||0),items:MC(ye.items)}),A(ye.supplierName||""),D({}),x(!0)},F=(ye,Le)=>{M(Ce=>{const Re=[...Ce.items],De={...Re[ye],...Le};return De.totalPrice=Number(De.quantity||0)*Number(De.unitPrice||0),Re[ye]=De,{...Ce,items:Re}})},O=()=>M(ye=>({...ye,items:[...ye.items,LU()]})),J=ye=>M(Le=>({...Le,items:Le.items.filter((Ce,Re)=>Re!==ye)})),q=ye=>{M(Le=>({...Le,supplierId:ye.id,supplierName:ye.name||"",supplierPhone:ye.phone||"",supplierFileNumber:ye.supplierFileNumber||Le.supplierFileNumber})),A(ye.name||""),C(!1)},Q=(ye,Le)=>{F(ye,{rawMaterialId:Le.id,materialName:Le.name||"",unit:Le.unit||"",unitPrice:Number(Le.purchasePrice||0)}),D(Ce=>({...Ce,[ye]:Le.name||""})),P(null)},ne=async()=>{if(!V.name.trim()){_e.error("أدخل اسم المورد");return}try{const ye=await d.mutateAsync({...V,name:V.name.trim(),type:"supplier"});await h.clients.list.invalidate(),q({id:ye.insertId||ye.id,...V}),U({name:"",companyName:"",phone:""}),k(!1),_e.success("تمت إضافة المورد")}catch{_e.error("تعذر إضافة المورد")}},Z=async()=>{if(!_.supplierName.trim()){_e.error("اختر المورد أو أضفه أولاً");return}try{const ye={..._,items:_.items.filter(Le=>Le.rawMaterialId||Le.materialName.trim())};y?(await o.mutateAsync({id:y.id,data:ye}),_e.success("تم التحديث")):(await a.mutateAsync(ye),_e.success("تم الحفظ")),x(!1),t()}catch{_e.error("حدث خطأ")}},se=async ye=>{if(confirm("هل أنت متأكد؟"))try{await l.mutateAsync({id:ye.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},me=async ye=>{const Le=`سيتم إنشاء فاتورة شراء جديدة من العرض ${ye.quotationNumber} وتحديث المخزون والصندوق وفقاً لبنوده. هل تريد المتابعة؟`;if(window.confirm(Le))try{const Ce=await u.mutateAsync({id:ye.id});_e.success(`تم إنشاء فاتورة الشراء ${Ce.invoiceNumber||""}`.trim()),await t(),ee("/admin?tab=purchase-invoices")}catch(Ce){_e.error(Ce?.message||"تعذر تحويل عرض الشراء")}},ze=ye=>{const Le=MC(ye.items),Ce=he=>String(he??"").replace(/[&<>'"]/g,le=>({"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#039;",'"':"&quot;"})[le]||le),Re=Le.map(he=>`<tr><td>${Ce(he.materialName)}</td><td>${Ce(he.unit||"-")}</td><td>${Number(he.quantity||0).toLocaleString("ar-EG")}</td><td>${Number(he.unitPrice||0).toFixed(2)} $</td><td>${Number(he.totalPrice||0).toFixed(2)} $</td></tr>`).join(""),De=window.open("","purchase-quotation-print","width=960,height=720");if(!De){_e.error("تعذر فتح نافذة الطباعة؛ يرجى السماح بالنوافذ المنبثقة");return}De.document.write(`<!doctype html><html dir="rtl"><head><meta charset="utf-8"><title>عرض شراء ${Ce(ye.quotationNumber)}</title><style>@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');*{box-sizing:border-box}body{font-family:Cairo,Arial,sans-serif;color:#18212f;padding:34px;direction:rtl}header{display:flex;justify-content:space-between;align-items:start;border-bottom:2px solid #0f8b9e;padding-bottom:18px;margin-bottom:22px}h1{margin:0;color:#0f8b9e;font-size:25px}.meta{line-height:2}table{width:100%;border-collapse:collapse;margin-top:20px}th{background:#e7f7f8;color:#11606d}th,td{border:1px solid #bfd8da;padding:10px;text-align:right}.total{margin-top:20px;font-size:18px;font-weight:700;color:#0f8b9e}.notes{margin-top:26px;border-top:1px solid #d8e1e4;padding-top:12px;white-space:pre-line}@media print{body{padding:18px}}</style></head><body><header><div><h1>عرض سعر شراء</h1><div class="meta">رقم العرض: <b>${Ce(ye.quotationNumber)}</b><br>الحالة: ${Ce({pending:"قيد الانتظار",sent:"مرسل للمورد",received:"تم الاستلام",accepted:"مقبول",converted:"تم التحويل لفاتورة",rejected:"مرفوض"}[ye.status]||ye.status||"-")}</div></div><div class="meta">المورد: <b>${Ce(ye.supplierName)}</b><br>ملف المورد: ${Ce(ye.supplierFileNumber||"-")}</div></header><h3>المواد</h3><table><thead><tr><th>
319المادة</th><th>الوحدة</th><th>الكمية</th><th>سعر الوحدة</th><th>الإجمالي</th></tr></thead><tbody>${Re||'<tr><td colspan="5">لا توجد مواد</td></tr>'}</tbody></table><div class="total">المبلغ الإجمالي: ${Number(ye.totalAmount||0).toFixed(2)} $</div>${ye.notes?`<div class="notes"><b>ملاحظات:</b><br>${Ce(ye.notes)}</div>`:""}</body></html>`),De.document.close(),De.focus(),window.setTimeout(()=>De.print(),250)},Be=[{key:"quotationNumber",label:"رقم العرض"},{key:"supplierName",label:"المورد"},{key:"supplierFileNumber",label:"ملف المورد",render:ye=>ye||"-"},{key:"totalAmount",label:"المبلغ",render:ye=>`${ye||0} $`},{key:"status",label:"الحالة",render:ye=>i.jsx("span",{className:"text-xs font-semibold",children:{pending:"قيد الانتظار",sent:"مرسل للمورد",received:"تم الاستلام",accepted:"مقبول",converted:"تم التحويل لفاتورة",rejected:"مرفوض"}[ye]||ye||"-"})}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"}
319,dir:"rtl",children:[i.jsx(Eh,{title:"عروض الشراء",columns:Be,data:n||[],loading:e,searchKey:"supplierName",onAdd:oe,onEdit:re,onDelete:se,actions:[{label:"معاينة",icon:i.jsx(jc,{className:"h-3.5 w-3.5"}),onClick:X,variant:"outline"},{label:"طباعة",icon:i.jsx(nl,{className:"h-3.5 w-3.5"}),onClick:ze,variant:"outline"},{label:"تحويل لفاتورة",icon:i.jsx(OY,{className:"h-3.5 w-3.5"}),onClick:me,visible:ye=>vZ(ye.status),variant:"outline"}]}),i.jsxs(Qo,{open:p,onOpenChange:x,title:y?"تعديل عرض سعر شراء":"عرض سعر مشتريات جديد",onSubmit:Z,className:"w-[min(96vw,1400px)] max-w-[96vw] sm:w-[min(96vw,1400px)] sm:max-w-[96vw]",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"رقم العرض",children:i.jsx(Ee,{value:y?_.quotationNumber:"يُنشأ تلقائياً بالتسلسل",disabled:!0,className:"bg-muted/50 border-border text-foreground disabled:opacity-100",dir:"rtl"})}),i.jsx(Vt,{label:"اسم المورد *",children:i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:"absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),i.jsx(Ee,{value:S,onChange:ye=>{A(ye.target.value),C(!0),M(Le=>({...Le,supplierId:0,supplierName:ye.target.value}))},onFocus:()=>C(!0),onBlur:()=>window.setTimeout(()=>C(!1),150),placeholder:"ابحث عن مورد...",className:"bg-muted/50 border-border pr-8 text-foreground"}),E&&i.jsxs("div",{className:"absolute z-50 mt-1 max-h-44 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 shadow-lg",children:[K.map(ye=>i.jsxs("button",{type:"button",onMouseDown:Le=>Le.preventDefault(),onClick:()=>q(ye),className:"w-full rounded px-2 py-2 text-right hover:bg-accent",children:[i.jsx("div",{className:"font-medium text-foreground",children:ye.name}),i.jsx("div",{className:"text-xs text-muted-foreground",children:ye.companyName||ye.phone||"مورد"})]},ye.id)),K.length===0&&i.jsx("div",{className:"p-2 text-center text-xs text-muted-foreground",children:"لا يوجد مورد مطابق"})]})]})}),i.jsx(Vt,{label:"ملف المورد",children:i.jsx(Ee,{value:_.supplierFileNumber,onChange:ye=>M({..._,supplierFileNumber:ye.target.value}),placeholder:"رقم ملف المورد",className:"bg-muted/50 border-border text-foreground"})}),i.jsx(Vt,{label:"الحالة",children:i.jsxs(En,{value:_.status,onValueChange:ye=>M({..._,status:ye}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{})}),i.jsxs(Rn,{children:[i.jsx(bt,{value:"pending",children:"قيد الانتظار"}),i.jsx(bt,{value:"sent",children:"مرسل للمورد"}),i.jsx(bt,{value:"received",children:"تم الاستلام"}),i.jsx(bt,{value:"accepted",children:"مقبول"}),i.jsx(bt,{value:"converted",children:"تم التحويل لفاتورة"}),i.jsx(bt,{value:"rejected",children:"مرفوض"})]})]})})]}),i.jsx("div",{className:"flex justify-end",children:i.jsxs(ke,{type:"button",variant:"outline",onClick:()=>k(!0),className:"border-primary/40 text-primary",children:[i.jsx(hQ,{className:"ml-1 h-4 w-4"}),"إضافة مورد جديد"]})}),i.jsx(Vt,{label:"ملاحظات",children:i.jsx(ni,{value:_.notes,onChange:ye=>M({..._,notes:ye.target.value}),placeholder:"ملاحظات إضافية",className:"min-h-20 bg-muted/50 border-border text-foreground"})}),i.jsxs("div",{className:"border-t border-border pt-4",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h3",{className:"font-bold text-foreground",children:"المواد"}),i.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:O,className:"border-primary/40 text-primary",children:[i.jsx(Nn,{className:"ml-1 h-4 w-4"}),"إضافة مادة"]})]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[680px] text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-right text-muted-foreground",children:[i.jsx("th",{className:"p-2",children:"المادة"}),i.jsx("th",{className:"p-2",children:"الكمية"}),i.jsx("th",{className:"p-2",children:"سعر الوحدة"}),i.jsx("th",{className:"p-2",children:"الإجمالي"}),i.jsx("th",{className:"w-10 p-2"})]})}),i.jsxs("tbody",{children:[_.items.map((ye,Le)=>i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("td",{className:"p-2",children:i.jsxs("div",{className:"relative min-w-64",children:[i.jsx(Ee,{value:I[Le]??ye.materialName,onChange:Ce=>{D(Re=>({...Re,[Le]:Ce.target.value})),P(Le),F(Le,{rawMaterialId:0,materialName:Ce.target.value})},onFocus:()=>P(Le),onBlur:()=>window.setTimeout(()=>P(Ce=>Ce===Le?null:Ce),150),placeholder:"ابحث عن مادة...",className:"h-8 bg-muted/50 border-border text-foreground"}),B===Le&&i.jsx("div",{className:"absolute z-50 mt-1 max-h-48 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 shadow-lg",children:(s||[]).filter(Ce=>!String(I[Le]??ye.materialName).trim()||String(Ce.name||"").toLocaleLowerCase().includes(String(I[Le]??ye.materialName).trim().toLocaleLowerCase())).slice(0,12).map(Ce=>i.jsxs("button",{type:"button",onMouseDown:Re=>Re.preventDefault(),onClick:()=>Q(Le,Ce),className:"w-full rounded px-2 py-2 text-right hover:bg-accent",children:[i.jsx("span",{className:"font-medium text-foreground",children:Ce.name}),i.jsxs("span",{className:"mr-2 text-xs text-muted-foreground",children:[Ce.unit||""," · ",Number(Ce.purchasePrice||0).toFixed(2)," $"]})]},Ce.id))})]})}),i.jsx("td",{className:"p-2",children:i.jsx(Ee,{type:"number",min:"0",value:ye.quantity,onChange:Ce=>F(Le,{quantity:Number(Ce.target.value||0)}),className:"h-8 w-24 bg-muted/50 border-border text-foreground"})}),i.jsx("td",{className:"p-2",children:i.jsx(Ee,{type:"number",min:"0",step:"0.01",value:ye.unitPrice,onChange:Ce=>F(Le,{unitPrice:Number(Ce.target.value||0)}),className:"h-8 w-28 bg-muted/50 border-border text-foreground"})}),i.jsxs("td",{className:"p-2 font-bold text-primary",children:[Number(ye.totalPrice||0).toFixed(2)," $"]}),i.jsx("td",{className:"p-2",children:i.jsx(ke,{type:"button",size:"icon",variant:"ghost",onClick:()=>J(Le),className:"h-8 w-8 text-red-500 hover:text-red-600",children:i.jsx(Ar,{className:"h-4 w-4"})})})]},Le)),_.items.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"p-5 text-center text-sm text-muted-foreground",children:"أضف مادة واحدة على الأقل لتسجيل عرض سعر المورد"})})]})]})}),i.jsxs("div",{className:"mt-4 inline-flex rounded-lg border border-primary/25 bg-primary/10 px-4 py-2 text-sm",children:[i.jsx("span",{className:"text-muted-foreground",children:"المبلغ الإجمالي:"}),i.jsxs("span",{className:"mr-2 text-lg font-bold text-primary",children:[ae.toFixed(2)," $"]})]})]})]}),i.jsx(Qa,{open:!!$,onOpenChange:ye=>!ye&&X(null),children:i.jsxs(Ka,{className:"max-h-[90vh] w-[min(96vw,1100px)] max-w-[96vw] overflow-y-auto bg-card border-border sm:w-[min(96vw,1100px)] sm:max-w-[9
3196vw]",dir:"rtl",children:[i.jsx(Ja,{children:i.jsxs(Za,{className:"text-foreground",children:["معاينة عرض الشراء ",$?.quotationNumber]})}),$&&i.jsxs("div",{className:"space-y-5",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3 rounded-lg border border-border bg-muted/30 p-4 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"المورد"}),i.jsx("div",{className:"font-semibold text-foreground",children:$.supplierName||"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"ملف المورد"}),i.jsx("div",{className:"font-semibold text-foreground",children:$.supplierFileNumber||"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"رقم العرض"}),i.jsx("div",{className:"font-semibold text-foreground",children:$.quotationNumber||"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"الحالة"}),i.jsx("div",{className:"font-semibold text-foreground",children:{pending:"قيد الانتظار",sent:"مرسل للمورد",received:"تم الاستلام",accepted:"مقبول",converted:"تم التحويل لفاتورة",rejected:"مرفوض"}[$.status]||$.status||"-"})]})]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[640px] text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-right text-muted-foreground",children:[i.jsx("th",{className:"p-3",children:"المادة"}),i.jsx("th",{className:"p-3",children:"الوحدة"}),i.jsx("th",{className:"p-3",children:"الكمية"}),i.jsx("th",{className:"p-3",children:"سعر الوحدة"}),i.jsx("th",{className:"p-3",children:"الإجمالي"})]})}),i.jsx("tbody",{children:MC($.items).map((ye,Le)=>i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("td",{className:"p-3 font-medium text-foreground",children:ye.materialName||"-"}),i.jsx("td",{className:"p-3",children:ye.unit||"-"}),i.jsx("td",{className:"p-3",children:ye.quantity||0}),i.jsxs("td",{className:"p-3",children:[Number(ye.unitPrice||0).toFixed(2)," $"]}),i.jsxs("td",{className:"p-3 font-bold text-primary",children:[Number(ye.totalPrice||0).toFixed(2)," $"]})]},Le))})]})}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"text-lg font-bold text-primary",children:["المبلغ الإجمالي: ",Number($.totalAmount||0).toFixed(2)," $"]}),i.jsxs(ke,{type:"button",onClick:()=>ze($),children:[i.jsx(nl,{className:"ml-2 h-4 w-4"}),"طباعة العرض"]})]}),$.notes&&i.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm whitespace-pre-line",children:[i.jsx("div",{className:"mb-1 font-semibold text-foreground",children:"ملاحظات"}),i.jsx("div",{className:"text-muted-foreground",children:$.notes})]})]})]})}),i.jsx(Qo,{open:G,onOpenChange:k,title:"إضافة مورد جديد",onSubmit:ne,submitLabel:"حفظ المورد",children:i.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[i.jsx(Vt,{label:"اسم المورد *",children:i.jsx(Ee,{value:V.name,onChange:ye=>U({...V,name:ye.target.value}),className:"bg-muted/50 border-border text-foreground"})}),i.jsx(Vt,{label:"اسم الشركة",children:i.jsx(Ee,{value:V.companyName,onChange:ye=>U({...V,companyName:ye.target.value}),className:"bg-muted/50 border-border text-foreground"})}),i.jsx(Vt,{label:"الهاتف",children:i.jsx(Ee,{value:V.phone,onChange:ye=>U({...V,phone:ye.target.value}),className:"bg-muted/50 border-border text-foreground"})})]})})]})}const m3=T.createContext({});function p3(n){const e=T.useRef(null);return e.current===null&&(e.current=n()),e.current}const SZ=typeof window<"u",g3=SZ?T.useLayoutEffect:T.useEffect,mN=T.createContext(null);function x3(n,e){n.indexOf(e)===-1&&n.push(e)}function C_(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}const Iu=(n,e,t)=>t>e?e:t<n?n:t;let pN=()=>{};const ph={},OU=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),FU=n=>typeof n=="object"&&n!==null,UU=n=>/^0[^.\s]+$/u.test(n);function zU(n){let e;return()=>(e===void 0&&(e=n()),e)}const zl=n=>n,xv=(...n)=>n.reduce((e,t)=>
vendor: 58,321 bytes, line 319
319r=>t(e(r))),zy=(n,e,t)=>{const r=e-n;return r?(t-n)/r:1};class b3{constructor(){this.subscriptions=[]}add(e){return x3(this.subscriptions,e),()=>C_(this.subscriptions,e)}notify(e,t,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,t,r);else for(let a=0;a<s;a++){const o=this.subscriptions[a];o&&o(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Jo=n=>n*1e3,Ol=n=>n/1e3,GU=(n,e)=>e?n*(1e3/e):0,HU=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,_Z=1e-7,MZ=12;function NZ(n,e,t,r,s){let a,o,l=0;do o=e+(t-e)/2,a=HU(o,r,s)-n,a>0?t=o:e=o;while(Math.abs(a)>_Z&&++l<MZ);return o}function bv(n,e,t,r){if(n===e&&t===r)return zl;const s=a=>NZ(a,0,1,n,t);return a=>a===0||a===1?a:HU(s(a),e,r)}const VU=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,WU=n=>e=>1-n(1-e),$U=bv(.33,1.53,.69,.99),y3=WU($U),XU=VU(y3),qU=n=>n>=1?1:(n*=2)<1?.5*y3(n):.5*(2-Math.pow(2,-10*(n-1))),v3=n=>1-Math.sin(Math.acos(n)),YU=WU(v3),QU=VU(v3),AZ=bv(.42,0,1,1),CZ=bv(0,0,.58,1),KU=bv(.42,0,.58,1),EZ=n=>Array.isArray(n)&&typeof n[0]!="number",JU=n=>Array.isArray(n)&&typeof n[0]=="number",jZ={linear:zl,easeIn:AZ,easeInOut:KU,easeOut:CZ,circIn:v3,circInOut:QU,circOut:YU,backIn:y3,backInOut:XU,backOut:$U,anticipate:qU},TZ=n=>typeof n=="string",Ck=n=>{if(JU(n)){pN(n.length===4);const[e,t,r,s]=n;return bv(e,t,r,s)}else if(TZ(n))return jZ[n];return n},Rw=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function RZ(n){let e=new Set,t=new Set,r=!1,s=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(d){a.has(d)&&(u.schedule(d),n()),d(o)}const u={schedule:(d,h=!1,p=!1)=>{const y=p&&r?e:t;return h&&a.add(d),y.add(d),d},cancel:d=>{t.delete(d),a.delete(d)},process:d=>{if(o=d,r){s=!0;return}r=!0;const h=e;e=t,t=h,e.forEach(l),e.clear(),r=!1,s&&(s=!1,u.process(d))}};return u}const PZ=40;function ZU(n,e){let t=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>t=!0,o=Rw.reduce((E,C)=>(E[C]=RZ(a),E),{}),{setup:l,read:u,resolveKeyframes:d,preUpdate:h,update:p,preRender:x,render:y,postRender:v}=o,_=()=>{const E=ph.useManualTiming,C=E?s.timestamp:performance.now();t=!1,E||(s.delta=r?1e3/60:Math.max(Math.min(C-s.timestamp,PZ),1)),s.timestamp=C,s.isProcessing=!0,l.process(s),u.process(s),d.process(s),h.process(s),p.process(s),x.process(s),y.process(s),v.process(s),s.isProcessing=!1,t&&e&&(r=!1,n(_))},M=()=>{t=!0,r=!0,s.isProcessing||n(_)};return{schedule:Rw.reduce((E,C)=>{const I=o[C];return E[C]=(D,B=!1,P=!1)=>(t||M(),I.schedule(D,B,P)),E},{}),cancel:E=>{for(let C=0;C<Rw.length;C++)o[Rw[C]].cancel(E)},state:s,steps:o}}const{schedule:is,cancel:gh,state:fa,steps:NC}=ZU(typeof requestAnimationFrame<"u"?requestAnimationFrame:zl,!0);let JS;function DZ(){JS=void 0}const ro={now:()=>(JS===void 0&&ro.set(fa.isProcessing||ph.useManualTiming?fa.timestamp:performance.now()),JS),set:n=>{JS=n,queueMicrotask(DZ)}},ez=n=>e=>typeof e=="string"&&e.startsWith(n),tz=ez("--"),kZ=ez("var(--"),w3=n=>kZ(n)?IZ.test(n.split("/*")[0].trim()):!1,IZ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ek(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const n0={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Gy={...n0,transform:n=>Iu(0,1,n)},Pw={...n0,default:1},fy=n=>Math.round(n*1e5)/1e5,S3=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function BZ(n){return n==null}const LZ=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_3=(n,e)=>t=>!!(typeof t=="string"&&LZ.test(t)&&t.startsWith(n)||e&&!BZ(t)&&Object.prototype.hasOwnProperty.call(t,e)),nz=(n,e,t)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(S3);return{[n]:parseFloat(s),[e]:parseFloat(a),[t]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},OZ=n=>Iu(0,255,n),AC={...n0,transform:n=>Math.round(OZ(n))},Fm={test:_3("rgb","red"),parse:nz("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+AC.transform(n)+", "+AC.transform(e)+", "+AC.transform(t)+", "+fy(Gy.transform(r))+")"};function FZ(n){let e="",t="",r="",s="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),s=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),s=n.substring(4,5),e+=e,t+=t,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const tT={test:_3("#"),parse:FZ,transform:Fm.transform},yv=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Md=yv("deg"),ju=yv("%"),cn=yv("px"),UZ=yv("vh"),zZ=yv("vw"),jk={...ju,parse:n=>ju.parse(n)/100,transform:n=>ju.transform(n*100)},px={test:_3("hsl","hue"),parse:nz("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+ju.transform(fy(e))+", "+ju.transform(fy(t))+", "+fy(Gy.transform(r))+")"},Ai={test:n=>Fm.test(n)||tT.test(n)||px.test(n),parse:n=>Fm.test(n)?Fm.parse(n):px.test(n)?px.parse(n):tT.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Fm.transform(n):px.transform(n),getAnimatableNone:n=>{const e=Ai.parse(n);return e.alpha=0,Ai.transform(e)}},GZ=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function HZ(n){return isNaN(n)&&typeof n=="string"&&(n.match(S3)?.length||0)+(n.match(GZ)?.length||0)>0}const rz="number",sz="color",VZ="var",WZ="var(",Tk="${}",$Z=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Px(n){const e=n.toString(),t=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace($Z,u=>(Ai.test(u)?(r.color.push(a),s.push(sz),t.push(Ai.parse(u))):u.startsWith(WZ)?(r.var.push(a),s.push(VZ),t.push(u)):(r.number.push(a),s.push(rz),t.push(parseFloat(u))),++a,Tk)).split(Tk);return{values:t,split:l,indexes:r,types:s}}function XZ(n){return Px(n).values}function iz({split:n,types:e}){const t=n.length;return r=>{let s="";for(let a=0;a<t;a++)if(s+=n[a],r[a]!==void 0){const o=e[a];o===rz?s+=fy(r[a]):o===sz?s+=Ai.transform(r[a]):s+=r[a]}return s}}function qZ(n){return iz(Px(n))}const YZ=n=>typeof n=="number"?0:Ai.test(n)?Ai.getAnimatableNone(n):n,QZ=(n,e)=>typeof n=="number"?e?.trim().endsWith("/")?n:0:YZ(n);function KZ(n){const e=Px(n);return iz(e)(e.values.map((r,s)=>QZ(r,e.split[s])))}const Mc={test:HZ,parse:XZ,createTransformer:qZ,getAnimatableNone:KZ};function CC(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function JZ({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let s=0,a=0,o=0;if(!e)s=a=o=t;else{const l=t<.5?t*(1+e):t+e-t*e,u=2*t-l;s=CC(u,l,n+1/3),a=CC(u,l,n),o=CC(u,l,n-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function E_(n,e){return t=>t>0?e:n}const ss=(n,e,t)=>n+(e-n)*t,EC=(n,e,t)=>{const r=n*n,s=t*(e*e-r)+r;return s<0?0:Math.sqrt(s)},ZZ=[tT,Fm,px],eee=n=>ZZ.find(e=>e.test(n));function Rk(n){const e=eee(n);if(!e)return!1;let t=e.parse(n);return e===px&&(t=JZ(t)),t}const Pk=(n,e)=>{const t=Rk(n),r=Rk(e);if(!t||!r)return E_(n,e);const s={...t};return a=>(s.red=EC(t.red,r.red,a),s.green=EC(t.green,r.green,a),s.blue=EC(t.blue,r.blue,a),s.alpha=ss(t.alpha,r.alpha,a),Fm.transform(s))},nT=new Set(["none","hidden"]);function tee(n,e){return nT.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function nee(n,e){return t=>ss(n,e,t)}function M3(n){return typeof n=="number"?nee:typeof n=="string"?w3(n)?E_:Ai.test(n)?Pk:iee:Array.isArray(n)?az:typeof n=="object"?Ai.test(n)?Pk:ree:E_}function az(n,e){const t=[...n],r=t.length,s=n.map((a,o)=>M3(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)t[o]=s[o](a);return t}}function ree(n,e){const t={...n,...e},r={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(r[s]=M3(n[s])(n[s],e[s]));return s=>{for(const a in r)t[a]=r[a](s);return t}}function see(n,e){const t=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const a=e.types[s],o=n.indexes[a][r[a]],l=n.values[o]??0;t[s]=l,r[a]++}return t}const iee=(n,e)=>{const t=Mc.createTransformer(e),r=Px(n),s=Px(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?nT.has(n)&&!s.values.length||nT.has(e)&&!r.values.length?tee(n,e):xv(az(see(r,s),s.values),t):E_(n,e)};function oz(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?ss(n,e,t):M3(n)(n,e)}const aee=n=>{const e=({timestamp:t})=>n(t);return{start:(t=!0)=>is.update(e,t),stop:()=>gh(e),now:()=>fa.isProcessing?fa.timestamp:ro.now()}},lz=(n,e,t=10)=>{let r="";const s=Math.max(Math.round(e/t),2);for(let a=0;a<s;a++)r+=Math.round(n(a/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},j_=2e4;function N3(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<j_;)e+=t,r=n.next(e);return e>=j_?1/0:e}function oee(n,e=100,t){const r=t({...n,keyframes:[0,e]}),s=Math.min(N3(r),j_);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:Ol(s)}}const Js={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function rT(n,e){return n*Math.sqrt(1-e*e)}const lee=12;function cee(n,e,t){let r=t;for(let s=1;s<lee;s++)r=r-n(r)/e(r);return r}const jC=.001;function uee({duration:n=Js.duration,bounce:e=Js.bounce,velocity:t=Js.velocity,mass:r=Js.mass}){let s,a,o=1-e;o=Iu(Js.minDamping,Js.maxDamping,o),n=Iu(Js.minDuration,Js.maxDuration,Ol(n)),o<1?(s=d=>{const h=d*o,p=h*n,x=h-t,y=rT(d,o),v=Math.exp(-p);return jC-x/y*v},a=d=>{const p=d*o*n,x=p*t+t,y=Math.pow(o,2)*Math.pow(d,2)*n,v=Math.exp(-p),_=rT(Math.pow(d,2),o);return(-s(d)+jC>0?-1:1)*((x-y)*v)/_}):(s=d=>{const h=Math.exp(-d*n),p=(d-t)*n+1;return-jC+h*p},a=d=>{const h=Math.exp(-d*n),p=(t-d)*(n*n);return h*p});const l=5/n,u=cee(s,a,l);if(n=Jo(n),isNaN(u))return{stiffness:Js.stiffness,damping:Js.damping,duration:n};{const d=Math.pow(u,2)*r;return{stiffness:d,damping:o*2*Math.sqrt(r*d),duration:n}}}const dee=["duration","bounce"],fee=["stiffness","damping","mass"];function Dk(n,e){return e.some(t=>n[t]!==void 0)}function hee(n){let e={velocity:Js.velocity,stiffness:Js.stiffness,damping:Js.damping,mass:Js.mass,isResolvedFromDuration:!1,...n};if(!Dk(n,fee)&&Dk(n,dee))if(e.velocity=0,n.visualDuration){const t=n.visualDuration,r=2*Math.PI/(t*1.2),s=r*r,a=2*Iu(.05,1,1-(n.bounce||0))*Math.sqrt(s);e={...e,mass:Js.mass,stiffness:s,damping:a}}else{const t=uee({...n,velocity:0});e={...e,...t,mass:Js.mass},e.isResolvedFromDuration=!0}return e}function T_(n=Js.visualDuration,e=Js.bounce){const t=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:r,restDelta:s}=t;const a=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],l={done:!1,value:a},{stiffness:u,damping:d,mass:h,duration:p,velocity:x,isResolvedFromDuration:y}=hee({...t,velocity:-Ol(t.velocity||0)}),v=x||0,_=d/(2*Math.sqrt(u*h)),M=o-a,S=Ol(Math.sqrt(u/h)),A=Math.abs(M)<5;r||(r=A?Js.restSpeed.granular:Js.restSpeed.default),s||(s=A?Js.restDelta.granular:Js.restDelta.default);let E,C,I,D,B,P;if(_<1)I=rT(S,_),D=(v+_*S*M)/I,E=k=>{const V=Math.exp(-_*S*k);return o-V*(D*Math.sin(I*k)+M*Math.cos(I*k))},B=_*S*D+M*I,P=_*S*M-D*I,C=k=>Math.exp(-_*S*k)*(B*Math.sin(I*k)+P*Math.cos(I*k));else if(_===1){E=V=>o-Math.exp(-S*V)*(M+(v+S*M)*V);const k=v+S*M;C=V=>Math.exp(-S*V)*(S*k*V-v)}else{const k=S*Math.sqrt(_*_-1);E=X=>{const ee=Math.exp(-_*S*X),z=Math.min(k*X,300);return o-ee*((v+_*S*M)*Math.sinh(z)+k*M*Math.cosh(z))/k};const V=(v+_*S*M)/k,U=_*S*V-M*k,$=_*S*M-V*k;C=X=>{const ee=Math.exp(-_*S*X),z=Math.min(k*X,300);return ee*(U*Math.sinh(z)+$*Math.cosh(z))}}const G={calculatedDuration:y&&p||null,velocity:k=>Jo(C(k)),next:k=>{if(!y&&_<1){const U=Math.exp(-_*S*k),$=Math.sin(I*k),X=Math.cos(I*k),ee=o-U*(D*$+M*X),z=Jo(U*(B*$+P*X));return l.done=Math.abs(z)<=r&&Math.abs(o-ee)<=s,l.value=l.done?o:ee,l}const V=E(k);if(y)l.done=k>=p;else{const U=Jo(C(k));l.done=Math.abs(U)<=r&&Math.abs(o-V)<=s}return l.value=l.done?o:V,l},toString:()=>{const k=Math.min(N3(G),j_),V=lz(U=>G.next(k*U).value,k,30);return k+"ms "+V},toTransition:()=>{}};return G}T_.applyToOptions=n=>{const e=oee(n,100,T_);return n.ease=e.ease,n.duration=Jo(e.duration),n.type="keyframes",n};const mee=5;function cz(n,e,t){const r=Math.max(e-mee,0);return GU(t-n(r),e-r)}function sT({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:u,restDelta:d=.5,restSpeed:h}){const p=n[0],x={done:!1,value:p},y=P=>l!==void 0&&P<l||u!==void 0&&P>u,v=P=>l===void 0?u:u===void 0||Math.abs(l-P)<Math.abs(u-P)?l:u;let _=t*e;const M=p+_,S=o===void 0?M:o(M);S!==M&&(_=S-p);const A=P=>-_*Math.exp(-P/r),E=P=>S+A(P),C=P=>{const G=A(P),k=E(P);x.done=Math.abs(G)<=d,x.value=x.done?S:k};let I,D;const B=P=>{y(x.value)&&(I=P,D=T_({keyframes:[x.value,v(x.value)],velocity:cz(E,P,x.value),damping:s,stiffness:a,restDelta:d,restSpeed:h}))};return B(0),{calculatedDuration:null,next:P=>{let G=!1;return!D&&I===void 0&&(G=!0,C(P),B(P)),I!==void 0&&P>=I?D.next(P-I):(!G&&C(P),x)}}}function pee(n,e,t){const r=[],s=t||ph.mix||oz,a=n.length-1;for(let o=0;o<a;o++){let l=s(n[o],n[o+1]);if(e){const u=Array.isArray(e)?e[o]||zl:e;l=xv(u,l)}r.push(l)}return r}function gee(n,e,{clamp:t=!0,ease:r,mixer:s}={}){const a=n.length;if(pN(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=n[0]===n[1];n[0]>n[a-1]&&(n=[...n].reverse(),e=[...e].reverse());const l=pee(e,r,s),u=l.length,d=h=>{if(o&&h<n[0])return e[0];let p=0;if(u>1)for(;p<n.length-2&&!(h<n[p+1]);p++);const x=zy(n[p],n[p+1],h);return l[p](x)};return t?h=>d(Iu(n[0],n[a-1],h)):d}function xee(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const s=zy(0,e,r);n.push(ss(t,1,s))}}function bee(n){const e=[0];return xee(e,n.length-1),e}function yee(n,e){return n.map(t=>t*e)}function vee(n,e){return n.map(()=>e||KU).splice(0,n.length-1)}function hy({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const s=EZ(r)?r.map(Ck):Ck(r),a={done:!1,value:e[0]},o=yee(t&&t.length===e.length?t:bee(e),n),l=gee(o,e,{ease:Array.isArray(s)?s:vee(e,s)});return{calculatedDuration:n,next:u=>(a.value=l(u),a.done=u>=n,a)}}const wee=n=>n!==null;function gN(n,{repeat:e,repeatType:t="loop"},r,s=1){const a=n.filter(wee),l=s<0||e&&t!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const See={decay:sT,inertia:sT,tween:hy,keyframes:hy,spring:T_};function uz(n){typeof n.type=="string"&&(n.type=See[n.type])}class A3{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const _ee=n=>n/100;class R_ extends A3{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==ro.now()&&this.tick(ro.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;uz(e);const{type:t=hy,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const u=t||hy;u!==hy&&typeof l[0]!="number"&&(this.mixKeyframes=xv(_ee,oz(l[0],l[1])),l=[0,100]);const d=u({...e,keyframes:l});a==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...l].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=N3(d));const{calculatedDuration:h}=d;this.calculatedDuration=h,this.resolvedDuration=h+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=d}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:s,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:u}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:h,repeat:p,repeatType:x,repeatDelay:y,type:v,onUpdate:_,finalKeyframe:M}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const S=this.currentTime-d*(this.playbackSpeed>=0?1:-1),A=this.playbackSpeed>=0?S<0:S>s;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let E=this.currentTime,C=r;if(p){const P=Math.min(this.currentTime,s)/l;let G=Math.floor(P),k=P%1;!k&&P>=1&&(k=1),k===1&&G--,G=Math.min(G,p+1),G%2&&(x==="reverse"?(k=1-k,y&&(k-=y/l)):x==="mirror"&&(C=o)),E=Iu(0,1,k)*l}let I;A?(this.delayState.value=h[0],I=this.delayState):I=C.next(E),a&&!A&&(I.value=a(I.value));let{done:D}=I;!A&&u!==null&&(D=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return B&&v!==sT&&(I.value=gN(h,this.options,M,this.speed)),_&&_(I.value),B&&this.finish(),I}then(e,t){return this.finished.then(e,t)}get duration(){return Ol(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ol(e)}get time(){return Ol(this.currentTime)}set time(e){e=Jo(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const t=this.generator.next(e).value;return cz(r=>this.generator.next(r).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(ro.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Ol(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=aee,startTime:t}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ro.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Mee(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const Um=n=>n*180/Math.PI,iT=n=>{const e=Um(Math.atan2(n[1],n[0]));return aT(e)},Nee={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:iT,rotateZ:iT,skewX:n=>Um(Math.atan(n[1])),skewY:n=>Um(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},aT=n=>(n=n%360,n<0&&(n+=360),n),kk=iT,Ik=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),Bk=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),Aee={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ik,scaleY:Bk,scale:n=>(Ik(n)+Bk(n))/2,rotateX:n=>aT(Um(Math.atan2(n[6],n[5]))),rotateY:n=>aT(Um(Math.atan2(-n[2],n[0]))),rotateZ:kk,rotate:kk,skewX:n=>Um(Math.atan(n[4])),skewY:n=>Um(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function oT(n){return n.includes("scale")?1:0}function lT(n,e){if(!n||n==="none")return oT(e);const t=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(t)r=Aee,s=t;else{const l=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Nee,s=l}if(!s)return oT(e);const a=r[e],o=s[1].split(",").map(Eee);return typeof a=="function"?a(o):o[a]}const Cee=(n,e)=>{const{transform:t="none"}=getComputedStyle(n);return lT(t,e)};function Eee(n){return parseFloat(n.trim())}const r0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],s0=new Set([...r0,"pathRotation"]),Lk=n=>n===n0||n===cn,jee=new Set(["x","y","z"]),Tee=r0.filter(n=>!jee.has(n));function Ree(n){const e=[];return Tee.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e}const nh={width:({x:n},{paddingLeft:e="0",paddingRight:t="0",boxSizing:r})=>{const s=n.max-n.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(t)},height:({y:n},{paddingTop:e="0",paddingBottom:t="0",boxSizing:r})=>{const s=n.max-n.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(t)},top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>lT(e,"x"),y:(n,{transform:e})=>lT(e,"y")};nh.translateX=nh.x;nh.translateY=nh.y;const Jm=new Set;let cT=!1,uT=!1,dT=!1;function dz(){if(uT){const n=Array.from(Jm).filter(r=>r.needsMeasurement),e=new Set(n.map(r=>r.element)),t=new Map;e.forEach(r=>{const s=Ree(r);s.length&&(t.set(r,s),r.render())}),n.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=t.get(r);s&&s.forEach(([a,o])=>{r.getValue(a)?.set(o)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}uT=!1,cT=!1,Jm.forEach(n=>n.complete(dT)),Jm.clear()}function fz(){Jm.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(uT=!0)})}function Pee(){dT=!0,fz(),dz(),dT=!1}class C3{constructor(e,t,r,s,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Jm.add(this),cT||(cT=!0,is.read(fz),is.resolveKeyframes(dz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:s}=this;if(e[0]===null){const a=s?.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&t){const l=r.readValue(t,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),s&&a===void 0&&s.set(e[0])}Mee(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Jm.delete(this)}cancel(){this.state==="scheduled"&&(Jm.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Dee=n=>n.startsWith("--");function hz(n,e,t){Dee(e)?n.style.setProperty(e,t):n.style[e]=t}const kee={};function mz(n,e){const t=zU(n);return()=>kee[e]??t()}const Iee=mz(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),pz=mz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Zb=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,Ok={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zb([0,.65,.55,1]),circOut:Zb([.55,0,1,.45]),backIn:Zb([.31,.01,.66,-.59]),backOut:Zb([.33,1.53,.69,.99])};function gz(n,e){if(n)return typeof n=="function"?pz()?lz(n,e):"ease-out":JU(n)?Zb(n):Array.isArray(n)?n.map(t=>gz(t,e)||Ok.easeOut):Ok[n]}function Bee(n,e,t,{delay:r=0,duration:s=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:u}={},d=void 0){const h={[e]:t};u&&(h.offset=u);const p=gz(l,s);Array.isArray(p)&&(h.easing=p);const x={delay:r,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return d&&(x.pseudoElement=d),n.animate(h,x)}function xz(n){return typeof n=="function"&&"applyToOptions"in n}function Lee({type:n,...e}){return xz(n)&&pz()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class bz extends A3{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:s,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:u}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,pN(typeof e.type!="string");const d=Lee(e);this.animation=Bee(t,r,s,d,a),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const h=gN(s,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(h),hz(t,r,h),this.animation.cancel()}u?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Ol(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ol(e)}get time(){return Ol(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Jo(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:r,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Iee()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),zl):s(this)}}const yz={anticipate:qU,backInOut:XU,circInOut:QU};function Oee(n){return n in yz}function Fee(n){typeof n.ease=="string"&&Oee(n.ease)&&(n.ease=yz[n.ease])}const TC=10;class Uee extends bz{constructor(e){Fee(e),uz(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:s,element:a,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const l=new R_({...o,autoplay:!1}),u=Math.max(TC,ro.now()-this.startTime),d=Iu(0,TC,u-TC),h=l.sample(u).value,{name:p}=this.options;a&&p&&hz(a,p,h),t.setWithVelocity(l.sample(Math.max(0,u-d)).value,h,d),l.stop()}}const Fk=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(Mc.test(n)||n==="0")&&!n.startsWith("url("));function zee(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function Gee(n,e,t,r){const s=n[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const a=n[n.length-1],o=Fk(s,e),l=Fk(a,e);return!o||!l?!1:zee(n)||(t==="spring"||xz(t))&&r}function fT(n){n.duration=0,n.type="keyframes"}const vz=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Hee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Vee(n){for(let e=0;e<n.length;e++)if(typeof n[e]=="string"&&Hee.test(n[e]))return!0;return!1}const Wee=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),$ee=zU(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Xee(n){const{motionValue:e,name:t,repeatDelay:r,repeatType:s,damping:a,type:o,keyframes:l}=n,u=e?.owner?.current;if(!(u instanceof HTMLElement)&&!(u instanceof SVGElement))return!1;const{onUpdate:d,transformTemplate:h}=e.owner.getProps();return $ee()&&t&&(vz.has(t)||Wee.has(t)&&Vee(l))&&(t!=="transform"||!h)&&!d&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const qee=40;class Yee extends A3{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:o="loop",keyframes:l,name:u,motionValue:d,element:h,...p}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ro.now();const x={autoplay:e,delay:t,type:r,repeat:s,repeatDelay:a,repeatType:o,name:u,motionValue:d,element:h,...p},y=h?.KeyframeResolver||C3;this.keyframeResolver=new y(l,(v,_,M)=>this.onKeyframesResolved(v,_,x,!M),u,d,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,s){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:u,isHandoff:d,onUpdate:h}=r;this.resolvedAt=ro.now();let p=!0;Gee(e,a,o,l)||(p=!1,(ph.instantAnimations||!u)&&h?.(gN(e,r,t)),e[0]=e[e.length-1],fT(r),r.repeat=0);const y={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>qee?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},v=p&&!d&&Xee(y),_=y.motionValue?.owner?.current;let M;if(v)try{M=new Uee({...y,element:_})}catch{M=new R_(y)}else M=new R_(y);M.finished.then(()=>{this.notifyFinished()}).catch(zl),this.pendingTimeline&&(this.stopTimeline=M.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=M}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Pee()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function wz(n,e,t,r=0,s=1){const a=Array.from(n).sort((d,h)=>d.sortNodePosition(h)).indexOf(e),o=n.size,l=(o-1)*r;return typeof t=="function"?t(a,o):s===1?a*r:l-a*r}const Uk=30,Qee=n=>!isNaN(parseFloat(n));class Kee{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=ro.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=ro.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Qee(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new b3);const r=this.events[e].add(t);return e==="change"?()=>{r(),is.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=ro.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Uk)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,Uk);return GU(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Dx(n,e){return new Kee(n,e)}function Sz(n,e){if(n?.inherit&&e){const{inherit:t,...r}=n;return{...e,...r}}return n}function E3(n,e){const t=n?.[e]??n?.default??n;return t!==n?Sz(t,n):t}const Jee={type:"spring",stiffness:500,damping:25,restSpeed:10},Zee=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),ete={type:"keyframes",duration:.8},tte={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nte=(n,{keyframes:e})=>e.length>2?ete:s0.has(n)?n.startsWith("scale")?Zee(e[1]):Jee:tte,rte=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function ste(n){for(const e in n)if(!rte.has(e))return!0;return!1}const j3=(n,e,t,r={},s,a)=>o=>{const l=E3(r,n)||{},u=l.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Jo(u);const h={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:x=>{e.set(x),l.onUpdate&&l.onUpdate(x)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:n,motionValue:e,element:a?void 0:s};ste(l)||Object.assign(h,nte(n,h)),h.duration&&(h.duration=Jo(h.duration)),h.repeatDelay&&(h.repeatDelay=Jo(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let p=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(fT(h),h.delay===0&&(p=!0)),(ph.instantAnimations||ph.skipAnimations||s?.shouldSkipAnimations||l.skipAnimations)&&(p=!0,fT(h),h.delay=0),h.allowFlatten=!l.type&&!l.ease,p&&!a&&e.get()!==void 0){const x=gN(h.keyframes,l);if(x!==void 0){is.update(()=>{h.onUpdate(x),h.onComplete()});return}}return l.isSync?new R_(h):new Yee(h)},ite=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ate(n){const e=ite.exec(n);if(!e)return[,];const[,t,r,s]=e;return[`--${t??r}`,s]}function _z(n,e,t=1){const[r,s]=ate(n);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return OU(o)?parseFloat(o):o}return w3(s)?_z(s,e,t+1):s}function zk(n){const e=[{},{}];return n?.values.forEach((t,r)=>{e[0][r]=t.get(),e[1][r]=t.getVelocity()}),e}function T3(n,e,t,r){if(typeof e=="function"){const[s,a]=zk(r);e=e(t!==void 0?t:n.custom,s,a)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,a]=zk(r);e=e(t!==void 0?t:n.custom,s,a)}return e}function Zm(n,e,t){const r=n.getProps();return T3(r,e,t!==void 0?t:r.custom,n)}const Mz=new Set(["width","height","top","left","right","bottom",...r0]),hT=n=>Array.isArray(n);function ote(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Dx(t))}function lte(n){return hT(n)?n[n.length-1]||0:n}function cte(n,e){const t=Zm(n,e);let{transitionEnd:r={},transition:s={},...a}=t||{};a={...a,...r};for(const o in a){const l=lte(a[o]);ote(n,o,l)}}const ha=n=>!!(n&&n.getVelocity);function ute(n){return!!(ha(n)&&n.add)}function mT(n,e){const t=n.getValue("willChange");if(ute(t))return t.add(e);if(!t&&ph.WillChange){const r=new ph.WillChange("auto");n.addValue("willChange",r),r.add(e)}}function R3(n){return n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const dte="framerAppearId",Nz="data-"+R3(dte);function Az(n){return n.props[Nz]}function fte({protectedKeys:n,needsAnimating:e},t){const r=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,r}function Cz(n,e,{delay:t=0,transitionOverride:r,type:s}={}){let{transition:a,transitionEnd:o,...l}=e;const u=n.getDefaultTransition();a=a?Sz(a,u):u;const d=a?.reduceMotion,h=a?.skipAnimations;r&&(a=r);const p=[],x=s&&n.animationState&&n.animationState.getState()[s],y=a?.path;y&&y.animateVisualElement(n,l,a,t,p);for(const v in l){const _=n.getValue(v,n.latestValues[v]??null),M=l[v];if(M===void 0||x&&fte(x,v))continue;const S={delay:t,...E3(a||{},v)};h&&(S.skipAnimations=!0);const A=_.get();if(A!==void 0&&!_.isAnimating()&&!Array.isArray(M)&&M===A&&!S.velocity){is.update(()=>_.set(M));continue}let E=!1;if(window.MotionHandoffAnimation){const D=Az(n);if(D){const B=window.MotionHandoffAnimation(D,v,is);B!==null&&(S.startTime=B,E=!0)}}mT(n,v);const C=d??n.shouldReduceMotion;_.start(j3(v,_,M,C&&Mz.has(v)?{type:!1}:S,n,E));const I=_.animation;I&&p.push(I)}if(o){const v=()=>is.update(()=>{o&&cte(n,o)});p.length?Promise.all(p).then(v):v()}return p}function pT(n,e,t={}){const r=Zm(n,e,t.type==="exit"?n.presenceContext?.custom:void 0);let{transition:s=n.getDefaultTransition()||{}}=r||{};t.transitionOverride&&(s=t.transitionOverride);const a=r?()=>Promise.all(Cz(n,r,t)):()=>Promise.resolve(),o=n.variantChildren&&n.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=s;return hte(n,e,u,d,h,p,t)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(t.delay)])}function hte(n,e,t=0,r=0,s=0,a=1,o){const l=[];for(const u of n.variantChildren)u.notify("AnimationStart",e),l.push(pT(u,e,{...o,delay:t+(typeof r=="function"?0:r)+wz(n.variantChildren,u,r,s,a)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(l)}function mte(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>pT(n,a,t));r=Promise.all(s)}else if(typeof e=="string")r=pT(n,e,t);else{const s=typeof e=="function"?Zm(n,e,t.custom):e;r=Promise.all(Cz(n,s,t))}return r.then(()=>{n.notify("AnimationComplete",e)})}const pte={test:n=>n==="auto",parse:n=>n},Ez=n=>e=>e.test(n),jz=[n0,cn,ju,Md,zZ,UZ,pte],Gk=n=>jz.find(Ez(n));function gte(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||UU(n):!0}const xte=new Set(["brightness","contrast","saturate","opacity"]);function bte(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(S3)||[];if(!r)return n;const s=t.replace(r,"");let a=xte.has(e)?1:0;return r!==t&&(a*=100),e+"("+a+s+")"}const yte=/\b([a-z-]*)\(.*?\)/gu,gT={...Mc,getAnimatableNone:n=>{const e=n.match(yte);return e?e.map(bte).join(" "):n}},xT={...Mc,getAnimatableNone:n=>{const e=Mc.parse(n);return Mc.createTransformer(n)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Hk={...n0,transform:Math.round},vte={rotate:Md,pathRotation:Md,rotateX:Md,rotateY:Md,rotateZ:Md,scale:Pw,scaleX:Pw,scaleY:Pw,scaleZ:Pw,skew:Md,skewX:Md,skewY:Md,distance:cn,translateX:cn,translateY:cn,translateZ:cn,x:cn,y:cn,z:cn,perspective:cn,transformPerspective:cn,opacity:Gy,originX:jk,originY:jk,originZ:cn},P_={borderWidth:cn,borderTopWidth:cn,borderRightWidth:cn,borderBottomWidth:cn,borderLeftWidth:cn,borderRadius:cn,borderTopLeftRadius:cn,borderTopRightRadius:cn,borderBottomRightRadius:cn,borderBottomLeftRadius:cn,width:cn,maxWidth:cn,height:cn,maxHeight:cn,top:cn,right:cn,bottom:cn,left:cn,inset:cn,insetBlock:cn,insetBlockStart:cn,insetBlockEnd:cn,insetInline:cn,insetInlineStart:cn,insetInlineEnd:cn,padding:cn,paddingTop:cn,paddingRight:cn,paddingBottom:cn,paddingLeft:cn,paddingBlock:cn,paddingBlockStart:cn,paddingBlockEnd:cn,paddingInline:cn,paddingInlineStart:cn,paddingInlineEnd:cn,margin:cn,marginTop:cn,marginRight:cn,marginBottom:cn,marginLeft:cn,marginBlock:cn,marginBlockStart:cn,marginBlockEnd:cn,marginInline:cn,marginInlineStart:cn,marginInlineEnd:cn,fontSize:cn,backgroundPositionX:cn,backgroundPositionY:cn,...vte,zIndex:Hk,fillOpacity:Gy,strokeOpacity:Gy,numOctaves:Hk},wte={...P_,color:Ai,backgroundColor:Ai,outlineColor:Ai,fill:Ai,stroke:Ai,borderColor:Ai,borderTopColor:Ai,borderRightColor:Ai,borderBottomColor:Ai,borderLeftColor:Ai,filter:gT,WebkitFilter:gT,mask:xT,WebkitMask:xT},Tz=n=>wte[n],Ste=new Set([gT,xT]);function Rz(n,e){let t=Tz(n);return Ste.has(t)||(t=Mc),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const _te=new Set(["auto","none","0"]);function Mte(n,e,t){let r=0,s;for(;r<n.length&&!s;){const a=n[r];typeof a=="string"&&!_te.has(a)&&Px(a).values.length&&(s=n[r]),r++}if(s&&t)for(const a of e)n[a]=Rz(t,s)}class Nte extends C3{constructor(e,t,r,s,a){super(e,t,r,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let p=e[h];if(typeof p=="string"&&(p=p.trim(),w3(p))){const x=_z(p,t.current);x!==void 0&&(e[h]=x),h===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!Mz.has(r)||e.length!==2)return;const[s,a]=e,o=Gk(s),l=Gk(a),u=Ek(s),d=Ek(a);if(u!==d&&nh[r]){this.needsMeasurement=!0;return}if(o!==l)if(Lk(o)&&Lk(l))for(let h=0;h<e.length;h++){const p=e[h];typeof p=="string"&&(e[h]=parseFloat(p))}else nh[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||gte(e[s]))&&r.push(s);r.length&&Mte(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=nh[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const s=t[t.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(t);s&&s.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=nh[t](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const P3=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Pz(n,e,t){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let r=document;const s=t?.[n]??r.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n).filter(r=>r!=null)}const bT=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function ZS(n){return FU(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:D3}=ZU(queueMicrotask,!1),xc={x:!1,y:!1};function Dz(){return xc.x||xc.y}function Ate(n){return n==="x"||n==="y"?xc[n]?null:(xc[n]=!0,()=>{xc[n]=!1}):xc.x||xc.y?null:(xc.x=xc.y=!0,()=>{xc.x=xc.y=!1})}function kz(n,e){const t=Pz(n),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[t,s,()=>r.abort()]}function Cte(n){return!(n.pointerType==="touch"||Dz())}function Ete(n,e,t={}){const[r,s,a]=kz(n,t);return r.forEach(o=>{let l=!1,u=!1,d;const h=()=>{o.removeEventListener("pointerleave",v)},p=M=>{d&&(d(M),d=void 0),h()},x=M=>{l=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),u&&(u=!1,p(M))},y=()=>{l=!0,window.addEventListener("pointerup",x,s),window.addEventListener("pointercancel",x,s)},v=M=>{if(M.pointerType!=="touch"){if(l){u=!0;return}p(M)}},_=M=>{if(!Cte(M))return;u=!1;const S=e(o,M);typeof S=="function"&&(d=S,o.addEventListener("pointerleave",v,s))};o.addEventListener("pointerenter",_,s),o.addEventListener("pointerdown",y,s)}),a}const Iz=(n,e)=>e?n===e?!0:Iz(n,e.parentElement):!1,k3=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,jte=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Tte(n){return jte.has(n.tagName)||n.isContentEditable===!0}const Rte=new Set(["INPUT","SELECT","TEXTAREA"]);function Pte(n){return Rte.has(n.tagName)||n.isContentEditable===!0}const e_=new WeakSet;function Vk(n){return e=>{e.key==="Enter"&&n(e)}}function RC(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Dte=(n,e)=>{const t=n.currentTarget;if(!t)return;const r=Vk(()=>{if(e_.has(t))return;RC(t,"down");const s=Vk(()=>{RC(t,"up")}),a=()=>RC(t,"cancel");t.addEventListener("keyup",s,e),t.addEventListener("blur",a,e)});t.addEventListener("keydown",r,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",r),e)};function Wk(n){return k3(n)&&!Dz()}const $k=new WeakSet;function kte(n,e,t={}){const[r,s,a]=kz(n,t),o=l=>{const u=l.currentTarget;if(!Wk(l)||$k.has(l))return;e_.add(u),t.stopPropagation&&$k.add(l);const d=e(u,l),h={...s,capture:!0},p=(v,_)=>{window.removeEventListener("pointerup",x,h),window.removeEventListener("pointercancel",y,h),e_.has(u)&&e_.delete(u),Wk(v)&&typeof d=="function"&&d(v,{success:_})},x=v=>{p(v,u===window||u===document||t.useGlobalTarget||Iz(u,v.target))},y=v=>{p(v,!1)};window.addEventListener("pointerup",x,h),window.addEventListener("pointercancel",y,h)};return r.forEach(l=>{(t.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),ZS(l)&&(l.addEventListener("focus",d=>Dte(d,s)),!Tte(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function I3(n){return FU(n)&&"ownerSVGElement"in n}const t_=new WeakMap;let n_;const Bz=(n,e,t)=>(r,s)=>s&&s[0]?s[0][n+"Size"]:I3(r)&&"getBBox"in r?r.getBBox()[e]:r[t],Ite=Bz("inline","width","offsetWidth"),Bte=Bz("block","height","offsetHeight");function Lte({target:n,borderBoxSize:e}){t_.get(n)?.forEach(t=>{t(n,{get width(){return Ite(n,e)},get height(){return Bte(n,e)}})})}function Ote(n){n.forEach(Lte)}function Fte(){typeof ResizeObserver>"u"||(n_=new ResizeObserver(Ote))}function Ute(n,e){n_||Fte();const t=Pz(n);return t.forEach(r=>{let s=t_.get(r);s||(s=new Set,t_.set(r,s)),s.add(e),n_?.observe(r)}),()=>{t.forEach(r=>{const s=t_.get(r);s?.delete(e),s?.size||n_?.unobserve(r)})}}const r_=new Set;let gx;function zte(){gx=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};r_.forEach(e=>e(n))},window.addEventListener("resize",gx)}function Gte(n){return r_.add(n),gx||zte(),()=>{r_.delete(n),!r_.size&&typeof gx=="function"&&(window.removeEventListener("resize",gx),gx=void 0)}}function Xk(n,e){return typeof n=="function"?Gte(n):Ute(n,e)}function Hte(n){return I3(n)&&n.tagName==="svg"}const Vte=[...jz,Ai,Mc],Wte=n=>Vte.find(Ez(n)),qk=()=>({translate:0,scale:1,origin:0,originPoint:0}),xx=()=>({x:qk(),y:qk()}),Yk=()=>({min:0,max:0}),Bi=()=>({x:Yk(),y:Yk()}),$te=new WeakMap;function xN(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function Hy(n){return typeof n=="string"||Array.isArray(n)}const B3=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],L3=["initial",...B3];function bN(n){return xN(n.animate)||L3.some(e=>Hy(n[e]))}function Lz(n){return!!(bN(n)||n.variants)}function Xte(n,e,t){for(const r in e){const s=e[r],a=t[r];if(ha(s))n.addValue(r,s);else if(ha(a))n.addValue(r,Dx(s,{owner:n}));else if(a!==s)if(n.hasValue(r)){const o=n.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=n.getStaticValue(r);n.addValue(r,Dx(o!==void 0?o:s,{owner:n}))}}for(const r in t)e[r]===void 0&&n.removeValue(r);return e}const yT={current:null},Oz={current:!1},qte=typeof window<"u";function Yte(){if(Oz.current=!0,!!qte)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>yT.current=n.matches;n.addEventListener("change",e),e()}else yT.current=!1}const Qk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let D_={};function Fz(n){D_=n}function Qte(){return D_}class Kte{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:s,skipAnimations:a,blockInitialAnimation:o,visualState:l},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=C3,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=ro.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,is.render(this.render,!1,!0))};const{latestValues:d,renderState:h}=l;this.latestValues=d,this.baseTarget={...d},this.initialValues=t.initial?{...d}:{},this.renderState=h,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=a,this.options=u,this.blockInitialAnimation=!!o,this.isControllingVariants=bN(t),this.isVariantNode=Lz(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:p,...x}=this.scrapeMotionValuesFromProps(t,{},this);for(const y in x){const v=x[y];d[y]!==void 0&&ha(v)&&v.set(d[y])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,$te.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,r)=>this.bindToMotionValue(r,t)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Oz.current||Yte(),this.shouldReduceMotion=yT.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),gh(this.notifyUpdate),gh(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&vz.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:u,ease:d,duration:h}=t.accelerate,p=new bz({element:this.current,name:e,keyframes:l,times:u,ease:d,duration:Jo(h)}),x=o(p);this.valueSubscriptions.set(e,()=>{x(),p.cancel()});return}const r=s0.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&is.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{s(),a&&a()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in D_){const t=D_[e];if(!t)continue;const{isEnabled:r,Feature:s}=t;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Bi()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<Qk.length;r++){const s=Qk[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,o=e[a];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=Xte(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Dx(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(OU(r)||UU(r))?r=parseFloat(r):!Wte(r)&&Mc.test(t)&&(r=Rz(e,t)),this.setBaseTarget(e,ha(r)?r.get():r)),ha(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let r;if(typeof t=="string"||typeof t=="object"){const a=T3(this.props,t,this.presenceContext?.custom);a&&(r=a[e])}if(t&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!ha(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new b3),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){D3.render(this.render)}}class Uz extends Kte{constructor(){super(...arguments),this.KeyframeResolver=Nte}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ha(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class jh{constructor(e){this.isMounted=!1,this.node=e}update(){}}function zz({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function Jte({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Zte(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function PC(n){return n===void 0||n===1}function vT({scale:n,scaleX:e,scaleY:t}){return!PC(n)||!PC(e)||!PC(t)}function Rm(n){return vT(n)||Gz(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function Gz(n){return Kk(n.x)||Kk(n.y)}function Kk(n){return n&&n!=="0%"}function k_(n,e,t){const r=n-t,s=e*r;return t+s}function Jk(n,e,t,r,s){return s!==void 0&&(n=k_(n,s,r)),k_(n,t,r)+e}function wT(n,e=0,t=1,r,s){n.min=Jk(n.min,e,t,r,s),n.max=Jk(n.max,e,t,r,s)}function Hz(n,{x:e,y:t}){wT(n.x,e.translate,e.scale,e.originPoint),wT(n.y,t.translate,t.scale,t.originPoint)}const Zk=.999999999999,eI=1.0000000000001;function ene(n,e,t,r=!1){const s=t.length;if(!s)return;e.x=e.y=1;let a,o;for(let l=0;l<s;l++){a=t[l],o=a.projectionDelta;const{visualElement:u}=a.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(wu(n.x,-a.scroll.offset.x),wu(n.y,-a.scroll.offset.y)),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Hz(n,o)),r&&Rm(a.latestValues)&&s_(n,a.latestValues,a.layout?.layoutBox))}e.x<eI&&e.x>Zk&&(e.x=1),e.y<eI&&e.y>Zk&&(e.y=1)}function wu(n,e){n.min+=e,n.max+=e}function tI(n,e,t,r,s=.5){const a=ss(n.min,n.max,s);wT(n,e,t,a,r)}function nI(n,e){return typeof n=="string"?parseFloat(n)/100*(e.max-e.min):n}function s_(n,e,t){const r=t??n;tI(n.x,nI(e.x,r.x),e.scaleX,e.scale,e.originX),tI(n.y,nI(e.y,r.y),e.scaleY,e.scale,e.originY)}function Vz(n,e){return zz(Zte(n.getBoundingClientRect(),e))}function tne(n,e,t){const r=Vz(n,t),{scroll:s}=e;return s&&(wu(r.x,s.offset.x),wu(r.y,s.offset.y)),r}const nne={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},rne=r0.length;function sne(n,e,t){let r="",s=!0;for(let o=0;o<rne;o++){const l=r0[o],u=n[l];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(l.startsWith("scale")?1:0);else{const h=parseFloat(u);d=l.startsWith("scale")?h===1:h===0}if(!d||t){const h=bT(u,P_[l]);if(!d){s=!1;const p=nne[l]||l;r+=`${p}(${h}
319) `}t&&(e[l]=h)}}const a=n.pathRotation;return a&&(s=!1,r+=`rotate(${bT(a,P_.pathRotation)}) `),r=r.trim(),t?r=t(e,s?"":r):s&&(r="none"),r}function O3(n,e,t){const{style:r,vars:s,transformOrigin:a}=n;let o=!1,l=!1;for(const u in e){const d=e[u];if(s0.has(u)){o=!0;continue}else if(tz(u)){s[u]=d;continue}else{const h=bT(d,P_[u]);u.startsWith("origin")?(l=!0,a[u]=h):r[u]=h}}if(e.transform||(o||t?r.transform=sne(e,n.transform,t):r.transform&&(r.transform="none")),l){const{originX:u="50%",originY:d="50%",originZ:h=0}=a;r.transformOrigin=`${u} ${d} ${h}`}}function Wz(n,{style:e,vars:t},r,s){const a=n.style;let o;for(o in e)a[o]=e[o];s?.applyProjectionStyles(a,r);for(o in t)a.setProperty(o,t[o])}function rI(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Pb={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(cn.test(n))n=parseFloat(n);else return n;const t=rI(n,e.target.x),r=rI(n,e.target.y);return`${t}% ${r}%`}},ine={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,s=Mc.parse(n);if(s.length>5)return r;const a=Mc.createTransformer(n),o=typeof s[0]!="number"?1:0,l=t.x.scale*e.x,u=t.y.scale*e.y;s[0+o]/=l,s[1+o]/=u;const d=ss(l,u,.5);return typeof s[2+o]=="number"&&(s[2+o]/=d),typeof s[3+o]=="number"&&(s[3+o]/=d),a(s)}},ST={borderRadius:{...Pb,applyTo:[...P3]},borderTopLeftRadius:Pb,borderTopRightRadius:Pb,borderBottomLeftRadius:Pb,borderBottomRightRadius:Pb,boxShadow:ine};function $z(n,{layout:e,layoutId:t}){return s0.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!ST[n]||n==="opacity")}function F3(n,e,t){const r=n.style,s=e?.style,a={};if(!r)return a;for(const o in r)(ha(r[o])||s&&ha(s[o])||$z(o,n)||t?.getValue(o)?.liveStyle!==void 0)&&(a[o]=r[o]);return a}function ane(n){return window.getComputedStyle(n)}class one extends Uz{constructor(){super(...arguments),this.type="html",this.renderInstance=Wz}mount(e){pN(!!e.style),super.mount(e)}readValueFromInstance(e,t){if(s0.has(t))return this.projection?.isProjecting?oT(t):Cee(e,t);{const r=ane(e),s=(tz(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Vz(e,t)}build(e,t,r){O3(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return F3(e,t,r)}}const lne={offset:"stroke-dashoffset",array:"stroke-dasharray"},cne={offset:"strokeDashoffset",array:"strokeDasharray"};function une(n,e,t=1,r=0,s=!0){n.pathLength=1;const a=s?lne:cne;n[a.offset]=`${-r}`,n[a.array]=`${e} ${t}`}const dne=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Xz(n,{attrX:e,attrY:t,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},u,d,h){if(O3(n,l,d),u){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:p,style:x}=n;p.transform&&(x.transform=p.transform,delete p.transform),(x.transform||p.transformOrigin)&&(x.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),x.transform&&(x.transformBox=h?.transformBox??"fill-box",delete p.transformBox);for(const y of dne)p[y]!==void 0&&(x[y]=p[y],delete p[y]);e!==void 0&&(p.x=e),t!==void 0&&(p.y=t),r!==void 0&&(p.scale=r),s!==void 0&&une(p,s,a,o,!1)}const qz=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Yz=n=>typeof n=="string"&&n.toLowerCase()==="svg";function fne(n,e,t,r){Wz(n,e,void 0,r);for(const s in e.attrs)n.setAttribute(qz.has(s)?s:R3(s),e.attrs[s])}function Qz(n,e,t){const r=F3(n,e,t);for(const s in n)if(ha(n[s])||ha(e[s])){const a=r0.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=n[s]}return r}class hne extends Uz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Bi}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(s0.has(t)){const r=Tz(t);return r&&r.default||0}return t=qz.has(t)?t:R3(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return Qz(e,t,r)}build(e,t,r){Xz(e,t,this.isSVGTag,r.transformTemplate,r.style)}
vendor: 30,124 bytes, line 319
319renderInstance(e,t,r,s){fne(e,t,r,s)}mount(e){this.isSVGTag=Yz(e.tagName),super.mount(e)}}const mne=L3.length;function Kz(n){if(!n)return;if(!n.isControllingVariants){const t=n.parent?Kz(n.parent)||{}:{};return n.props.initial!==void 0&&(t.initial=n.props.initial),t}const e={};for(let t=0;t<mne;t++){const r=L3[t],s=n.props[r];(Hy(s)||s===!1)&&(e[r]=s)}return e}function Jz(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}const pne=[...B3].reverse(),gne=B3.length;function xne(n){return e=>Promise.all(e.map(({animation:t,options:r})=>mte(n,t,r)))}function bne(n){let e=xne(n),t=sI(),r=!0,s=!1;const a=d=>(h,p)=>{const x=Zm(n,p,d==="exit"?n.presenceContext?.custom:void 0);if(x){const{transition:y,transitionEnd:v,..._}=x;h={...h,..._,...v}}return h};function o(d){e=d(n)}function l(d){const{props:h}=n,p=Kz(n.parent)||{},x=[],y=new Set;let v={},_=1/0;for(let S=0;S<gne;S++){const A=pne[S],E=t[A],C=h[A]!==void 0?h[A]:p[A],I=Hy(C),D=A===d?E.isActive:null;D===!1&&(_=S);let B=C===p[A]&&C!==h[A]&&I;if(B&&(r||s)&&n.manuallyAnimateOnMount&&(B=!1),E.protectedKeys={...v},!E.isActive&&D===null||!C&&!E.prevProp||xN(C)||typeof C=="boolean")continue;if(A==="exit"&&E.isActive&&D!==!0){E.prevResolvedValues&&(v={...v,...E.prevResolvedValues});continue}const P=yne(E.prevProp,C);let G=P||A===d&&E.isActive&&!B&&I||S>_&&I,k=!1;const V=Array.isArray(C)?C:[C];let U=V.reduce(a(A),{});D===!1&&(U={});const{prevResolvedValues:$={}}=E,X={...$,...U},ee=ae=>{G=!0,y.has(ae)&&(k=!0,y.delete(ae)),E.needsAnimating[ae]=!0;const oe=n.getValue(ae);oe&&(oe.liveStyle=!1)};for(const ae in X){const oe=U[ae],re=$[ae];if(v.hasOwnProperty(ae))continue;let F=!1;hT(oe)&&hT(re)?F=!Jz(oe,re)||P:F=oe!==re,F?oe!=null?ee(ae):y.add(ae):oe!==void 0&&y.has(ae)?ee(ae):E.protectedKeys[ae]=!0}E.prevProp=C,E.prevResolvedValues=U,E.isActive&&(v={...v,...U}),(r||s)&&n.blockInitialAnimation&&(G=!1);const z=B&&P;G&&(!z||k)&&x.push(...V.map(ae=>{const oe={type:A};if(typeof ae=="string"&&(r||s)&&!z&&n.manuallyAnimateOnMount&&n.parent){const{parent:re}=n,F=Zm(re,ae);if(re.enteringChildren&&F){const{delayChildren:O}=F.transition||{};oe.delay=wz(re.enteringChildren,n,O)}}return{animation:ae,options:oe}}))}if(y.size){const S={};if(typeof h.initial!="boolean"){const A=Zm(n,Array.isArray(h.initial)?h.initial[0]:h.initial);A&&A.transition&&(S.transition=A.transition)}y.forEach(A=>{const E=n.getBaseTarget(A),C=n.getValue(A);C&&(C.liveStyle=!0),S[A]=E??null}),x.push({animation:S})}let M=!!x.length;return r&&(h.initial===!1||h.initial===h.animate)&&!n.manuallyAnimateOnMount&&(M=!1),r=!1,s=!1,M?e(x):Promise.resolve()}function u(d,h){if(t[d].isActive===h)return Promise.resolve();n.variantChildren?.forEach(x=>x.animationState?.setActive(d,h)),t[d].isActive=h;const p=l(d);for(const x in t)t[x].protectedKeys={};return p}return{animateChanges:l,setActive:u,setAnimateFunction:o,getState:()=>t,reset:()=>{t=sI(),s=!0}}}function yne(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!Jz(e,n):!1}function mm(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sI(){return{animate:mm(!0),whileInView:mm(),whileHover:mm(),whileTap:mm(),whileDrag:mm(),whileFocus:mm(),exit:mm()}}function _T(n,e){n.min=e.min,n.max=e.max}function fc(n,e){_T(n.x,e.x),_T(n.y,e.y)}function iI(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}const Zz=1e-4,vne=1-Zz,wne=1+Zz,e6=.01,Sne=0-e6,_ne=0+e6;function so(n){return n.max-n.min}function Mne(n,e,t){return Math.abs(n-e)<=t}function aI(n,e,t,r=.5){n.origin=r,n.originPoint=ss(e.min,e.max,n.origin),n.scale=so(t)/so(e),n.translate=ss(t.min,t.max,n.origin)-n.originPoint,(n.scale>=vne&&n.scale<=wne||isNaN(n.scale))&&(n.scale=1),(n.translate>=Sne&&n.translate<=_ne||isNaN(n.translate))&&(n.translate=0)}function my(n,e,t,r){aI(n.x,e.x,t.x,r?r.originX:void 0),aI(n.y,e.y,t.y,r?r.originY:void 0)}function oI(n,e,t,r=0){const s=r?ss(t.min,t.max,r):t.min;n.min=s+e.min,n.max=n.min+so(e)}function Nne(n,e,t,r){oI(n.x,e.x,t.x,r?.x),oI(n.y,e.y,t.y,r?.y)}function lI(n,e,t,r=0){const s=r?ss(t.min,t.max,r):t.min;n.min=e.min-s,n.max=n.min+so(e)}function I_(n,e,t,r){lI(n.x,e.x,t.x,r?.x),lI(n.y,e.y,t.y,r?.y)}function cI(n,e,t,r,s){return n-=e,n=k_(n,1/t,r),s!==void 0&&(n=k_(n,1/s,r)),n}function Ane(n,e=0,t=1,r=.5,s,a=n,o=n){if(ju.test(e)&&(e=parseFloat(e),e=ss(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=ss(a.min,a.max,r);n===a&&(l-=e),n.min=cI(n.min,e,t,l,s),n.max=cI(n.max,e,t,l,s)}function uI(n,e,[t,r,s],a,o){Ane(n,e[t],e[r],e[s],e.scale,a,o)}const Cne=["x","scaleX","originX"],Ene=["y","scaleY","originY"];function dI(n,e,t,r){uI(n.x,e,Cne,t?t.x:void 0,r?r.x:void 0),uI(n.y,e,Ene,t?t.y:void 0,r?r.y:void 0)}function fI(n){return n.translate===0&&n.scale===1}function t6(n){return fI(n.x)&&fI(n.y)}function hI(n,e){return n.min===e.min&&n.max===e.max}function jne(n,e){return hI(n.x,e.x)&&hI(n.y,e.y)}function mI(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function n6(n,e){return mI(n.x,e.x)&&mI(n.y,e.y)}function pI(n){return so(n.x)/so(n.y)}function gI(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}function bu(n){return[n("x"),n("y")]}function Tne(n,e,t){let r="";const s=n.x.translate/e.x,a=n.y.translate/e.y,o=t?.z||0;if((s||a||o)&&(r=`translate3d(${s}px, ${a}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:d,rotate:h,pathRotation:p,rotateX:x,rotateY:y,skewX:v,skewY:_}=t;d&&(r=`perspective(${d}px) ${r}`),h&&(r+=`rotate(${h}deg) `),p&&(r+=`rotate(${p}deg) `),x&&(r+=`rotateX(${x}deg) `),y&&(r+=`rotateY(${y}deg) `),v&&(r+=`skewX(${v}deg) `),_&&(r+=`skewY(${_}deg) `)}const l=n.x.scale*e.x,u=n.y.scale*e.y;return(l!==1||u!==1)&&(r+=`scale(${l}, ${u})`),r||"none"}const Rne=P3.length,xI=n=>typeof n=="string"?parseFloat(n):n,bI=n=>typeof n=="number"||cn.test(n);function Pne(n,e,t,r,s,a){s?(n.opacity=ss(0,t.opacity??1,Dne(r)),n.opacityExit=ss(e.opacity??1,0,kne(r))):a&&(n.opacity=ss(e.opacity??1,t.opacity??1,r));for(let o=0;o<Rne;o++){const l=P3[o];let u=yI(e,l),d=yI(t,l);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||bI(u)===bI(d)?(n[l]=Math.max(ss(xI(u),xI(d),r),0),(ju.test(d)||ju.test(u))&&(n[l]+="%")):n[l]=d}(e.rotate||t.rotate)&&(n.rotate=ss(e.rotate||0,t.rotate||0,r))}function yI(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const Dne=r6(0,.5,YU),kne=r6(.5,.95,zl);function r6(n,e,t){return r=>r<n?0:r>e?1:t(zy(n,e,r))}function Ine(n,e,t){const r=ha(n)?n:Dx(n);return r.start(j3("",r,e,t)),r.animation}function Vy(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const Bne=(n,e)=>n.depth-e.depth;class Lne{constructor(){this.children=[],this.isDirty=!1}add(e){x3(this.children,e),this.isDirty=!0}remove(e){C_(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Bne),this.isDirty=!1,this.children.forEach(e)}}function One(n,e){const t=ro.now(),r=({timestamp:s})=>{const a=s-t;a>=e&&(gh(r),n(a-e))};return is.setup(r,!0),()=>gh(r)}function i_(n){return ha(n)?n.get():n}class Fne{constructor(){this.members=[]}add(e){x3(this.members,e);for(let t=this.members.length-1;t>=0;t--){const r=this.members[t];if(r===e||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(C_(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(C_(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const r=this.members[t];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:a}=e.options;(s===void 0||s!==a)&&(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const a_={hasAnimatedSinceResize:!0,hasEverUpdated:!1},DC=["","X","Y","Z"],Une=1e3;let zne=0;function kC(n,e,t,r){const{latestValues:s}=e;s[n]&&(t[n]=s[n],e.setStaticValue(n,0),r&&(r[n]=0))}function s6(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const t=Az(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:s,layoutId:a}=n.options;window.MotionCancelOptimisedAnimation(t,"transform",is,!(s||a))}const{parent:r}=n;r&&!r.hasCheckedOptimisedAppear&&s6(r)}function i6({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e?.()){this.id=zne++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Vne),this.nodes.forEach(Qne),this.nodes.forEach(Kne),this.nodes.forEach(Wne)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new Lne)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new b3),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const u=this.eventHandlers.get(o);u&&u.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=I3(o)&&!Hte(o),this.instance=o;const{layoutId:l,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||l)&&(this.isLayoutDirty=!0),n){let h,p=0;const x=()=>this.root.updateBlockedByResize=!1;is.read(()=>{p=window.innerWidth}),n(o,()=>{const y=window.innerWidth;y!==p&&(p=y,this.root.updateBlockedByResize=!0,h&&h(),h=One(x,250),a_.hasAnimatedSinceResize&&(a_.hasAnimatedSinceResize=!1,this.nodes.forEach(SI)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeLayoutChanged:x,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||d.getDefaultTransition()||nre,{onLayoutAnimationStart:_,onLayoutAnimationComplete:M}=d.getProps(),S=!this.targetLayout||!n6(this.targetLayout,y),A=!p&&x;if(this.options.layoutRoot||this.resumeFrom||A||p&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...E3(v,"layout"),onPlay:_,onComplete:M};(d.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(h,A,E.path)}else p||SI(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),gh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Jne),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&s6(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const p=this.path[h];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:l,layout:u}=this.options;if(l===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const u=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),u&&this.nodes.forEach(Xne),this.nodes.forEach(vI);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(wI);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(qne),this.nodes.forEach(Yne),this.nodes.forEach(Gne),this.nodes.forEach(Hne)):this.nodes.forEach(wI),this.clearAllSnapshots();const l=ro.now();fa.delta=Iu(0,1e3/60,l-fa.timestamp),fa.timestamp=l,fa.isProcessing=!0,NC.update.process(fa),NC.preRender.process(fa),NC.render.process(fa),fa.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,D3.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($ne),this.sharedNodes.forEach(Zne)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,is.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){is.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!so(this.snapshot.measuredBox.x)&&!so(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Bi()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:t(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!t6(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,h=d!==this.prevTransformTemplateValue;o&&this.instance&&(l||Rm(this.latestValues)||h)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let u=this.removeElementScroll(l);return o&&(u=this.removeTransform(u)),rre(u),{animationId:this.root.animationId,measuredBox:l,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Bi();const l=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(sre))){const{scroll:d}=this.root;d&&(wu(l.x,d.offset.x),wu(l.y,d.offset.y))}return l}removeElementScroll(o){const l=Bi();if(fc(l,o),this.scroll?.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:h,options:p}=d;d!==this.root&&h&&p.layoutScroll&&(h.wasRoot&&fc(l,o),wu(l.x,h.offset.x),wu(l.y,h.offset.y))}return l}applyTransform(o,l=!1,u){const d=u||Bi();fc(d,o);for(let h=0;h<this.path.length;h++){const p=this.path[h];!l&&p.options.layoutScroll&&p.scroll&&p!==p.root&&(wu(d.x,-p.scroll.offset.x),wu(d.y,-p.scroll.offset.y)),Rm(p.latestValues)&&s_(d,p.latestValues,p.layout?.layoutBox)}return Rm(this.latestValues)&&s_(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(o){const l=Bi();fc(l,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!Rm(d.latestValues))continue;let h;d.instance&&(vT(d.latestValues)&&d.updateSnapshot(),h=Bi(),fc(h,d.measurePageBox())),dI(l,d.latestValues,d.snapshot?.layoutBox,h)}return Rm(this.latestValues)&&dI(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==fa.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:p}=this.options;if(!this.layout||!(h||p))return;this.resolvedRelativeTargetAt=fa.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Bi(),this.targetWithTransforms=Bi()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Nne(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):fc(this.target,this.layout.layoutBox),Hz(this.target,this.targetDelta)):fc(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||vT(this.parent.latestValues)||Gz(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,u){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Bi(),this.relativeTargetOrigin=Bi(),I_(this.relativeTargetOrigin,l,u,this.options.layoutAnchor||void 0),fc(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const o=this.getLead(),l=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===fa.timestamp&&(u=!1),u)return;const{layout:d,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||h))return;fc(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,x=this.treeScale.y;ene(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Bi());const{target:y}=o;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(iI(this.prevProjectionDelta.x,this.projectionDelta.x),iI(this.prevProjectionDelta.y,this.projectionDelta.y)),my(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==x||!gI(this.projectionDelta.x,this.prevProjectionDelta.x)||!gI(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=xx(),this.projectionDelta=xx(),this.projectionDeltaWithTransform=xx()}setAnimationOrigin(o,l=!1,u){const d=this.snapshot,h=d?d.latestValues:{},p={...this.latestValues},x=xx();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const y=Bi(),v=d?d.source:void 0,_=this.layout?this.layout.source:void 0,M=v!==_,S=this.getStack(),A=!S||S.members.length<=1,E=!!(M&&!A&&this.options.crossfade===!0&&!this.path.some(tre));this.animationProgress=0;let C;const I=u?.interpolateProjection(o);this.mixTargetDelta=D=>{const B=D/1e3,P=I?.(B);P?(x.x.translate=P.x,x.x.scale=ss(o.x.scale,1,B),x.x.origin=o.x.origin,x.x.originPoint=o.x.originPoint,x.y.translate=P.y,x.y.scale=ss(o.y.scale,1,B),x.y.origin=o.y.origin,x.y.originPoint=o.y.originPoint):(_I(x.x,o.x,B),_I(x.y,o.y,B)),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(I_(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),ere(this.relativeTarget,this.relativeTargetOrigin,y,B),C&&jne(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=Bi()),fc(C,this.relativeTarget)),M&&(this.animationValues=p,Pne(p,h,this.latestValues,B,E,A)),P&&P.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=P.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=B},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(gh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=is.update(()=>{a_.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Dx(0)),this.motionValue.jump(0,!1),this.currentAnimation=Ine(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Une),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:u,layout:d,latestValues:h}=o;if(!(!l||!u||!d)){if(this!==o&&this.layout&&d&&a6(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||Bi();const p=so(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+p;const x=so(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+x}fc(l,u),s_(l,h),my(this.projectionDeltaWithTransform,this.layoutCorrected,l,h)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Fne),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(l=!0),!l)return;const d={};u.z&&kC("z",o,d,this.animationValues);for(let h=0;h<DC.length;h++)kC(`rotate${DC[h]}`,o,d,this.animationValues),kC(`skew${DC[h]}`,o,d,this.animationValues);o.render();for(const h in d)o.setStaticValue(h,d[h]),this.animationValues&&(this.animationValues[h]=d[h]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=i_(l?.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=i_(l?.pointerEvents)||""),this.hasProjected&&!Rm(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const h=d.animationValues||d.latestValues;this.applyTransformsToTarget();let p=Tne(this.projectionDeltaWithTransform,this.treeScale,h);u&&(p=u(h,p)),o.transform=p;const{x,y}=this.projectionDelta;o.transformOrigin=`${x.origin*100}% ${y.origin*100}% 0`,d.animationValues?o.opacity=d===this?h.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:o.opacity=d===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const v in ST){if(h[v]===void 0)continue;const{correct:_,applyTo:M,isCSSVariable:S}=ST[v],A=p==="none"?h[v]:_(h[v],d);if(M){const E=M.length;for(let C=0;C<E;C++)o[M[C]]=A}else S?this.options.visualElement.renderState.vars[v]=A:o[v]=A}this.options.layoutId&&(o.pointerEvents=d===this?i_(l?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(vI),this.root.sharedNodes.clear()}}}function Gne(n){n.updateLayout()}function Hne(n){const e=n.resumeFrom?.snapshot||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:r}=n.layout,{animationType:s}=n.options,a=e.source!==n.layout.source;if(s==="size")bu(h=>{const p=a?e.measuredBox[h]:e.layoutBox[h],x=so(p);p.min=t[h].min,p.max=p.min+x});else if(s==="x"||s==="y"){const h=s==="x"?"y":"x";_T(a?e.measuredBox[h]:e.layoutBox[h],t[h])}else a6(s,e.layoutBox,t)&&bu(h=>{const p=a?e.measuredBox[h]:e.layoutBox[h],x=so(t[h]);p.max=p.min+x,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[h].max=n.relativeTarget[h].min+x)});const o=xx();my(o,t,e.layoutBox);const l=xx();a?my(l,n.applyTransform(r,!0),e.measuredBox):my(l,t,e.layoutBox);const u=!t6(o);let d=!1;if(!n.resumeFrom){const h=n.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:x}=h;if(p&&x){const y=n.options.layoutAnchor||void 0,v=Bi();I_(v,e.layoutBox,p.layoutBox,y);const _=Bi();I_(_,t,x.layoutBox,y),n6(v,_)||(d=!0),h.options.layoutRoot&&(n.relativeTarget=_,n.relativeTargetOrigin=v,n.relativeParent=h)}}}n.notifyListeners("didUpdate",{layout:t,snapshot:e,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(n.isLead()){const{onExitComplete:t}=n.options;t&&t()}n.options.transition=void 0}function Vne(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}
319function Wne(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function $ne(n){n.clearSnapshot()}function vI(n){n.clearMeasurements()}function Xne(n){n.isLayoutDirty=!0,n.updateLayout()}function wI(n){n.isLayoutDirty=!1}function qne(n){n.isAnimationBlocked&&n.layout&&!n.isLayoutDirty&&(n.snapshot=n.layout,n.isLayoutDirty=!0)}function Yne(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function SI(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function Qne(n){n.resolveTargetDelta()}function Kne(n){n.calcProjection()}function Jne(n){n.resetSkewAndRotation()}function Zne(n){n.removeLeadSnapshot()}function _I(n,e,t){n.translate=ss(e.translate,0,t),n.scale=ss(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function MI(n,e,t,r){n.min=ss(e.min,t.min,r),n.max=ss(e.max,t.max,r)}function ere(n,e,t,r){MI(n.x,e.x,t.x,r),MI(n.y,e.y,t.y,r)}function tre(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const nre={duration:.45,ease:[.4,0,.1,1]},NI=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),AI=NI("applewebkit/")&&!NI("chrome/")?Math.round:zl;function CI(n){n.min=AI(n.min),n.max=AI(n.max)}function rre(n){CI(n.x),CI(n.y)}function a6(n,e,t){return n==="position"||n==="preserve-aspect"&&!Mne(pI(e),pI(t),.2)}function sre(n){return n!==n.root&&n.scroll?.wasRoot}const ire=i6({attachResizeListener:(n,e)=>Vy(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),IC={current:void 0},o6=i6({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!IC.current){const n=new ire({});n.mount(window),n.setOptions({layoutScroll:!0}),IC.current=n}return IC.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),U3=T.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function EI(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function are(...n){return e=>{let t=!1;const r=n.map(s=>{const a=EI(s,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():EI(n[s],null)}}}}function ore(...n){return T.useCallback(are(...n),n)}class lre extends T.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(ZS(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=t.offsetParent,s=ZS(r)&&r.offsetWidth||0,a=ZS(r)&&r.offsetHeight||0,o=getComputedStyle(t),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=t.offsetTop,l.left=t.offsetLeft,l.right=s-l.width-l.left,l.bottom=a-l.height-l.top,l.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function cre({children:n,isPresent:e,anchorX:t,anchorY:r,root:s,pop:a}){const o=T.useId(),l=T.useRef(null),u=T.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:d}=T.useContext(U3),h=a!==!1?n.props?.ref??n?.ref:void 0,p=ore(l,h);return T.useInsertionEffect(()=>{const{width:x,height:y,top:v,left:_,right:M,bottom:S,direction:A}=u.current;if(e||a===!1||!l.current||!x||!y)return;const E=A==="rtl",C=t==="left"?E?`right: ${M}`:`left: ${_}`:E?`left: ${_}`:`right: ${M}`,I=r==="bottom"?`bottom: ${S}`:`top: ${v}`;l.current.dataset.motionPopId=o;const D=document.createElement("style");d&&(D.nonce=d);const B=s??document.head;return B.appendChild(D),D.sheet&&D.sheet.insertRule(`
320          [data-motion-pop-id="${o}"] {
321            position: absolute !important;
322            width: ${x}px !important;
323            height: ${y}px !important;
324            ${C}px !important;
325            ${I}px !important;
326          }
327        `),()=>{l.current?.removeAttribute("data-motion-pop-id"),B.contains(D)&&B.removeChild(D)}},[e]),i.jsx(lre,{isPresent:e,childRef:l,sizeRef:u,pop:a,children:a===!1?n:T.cloneElement(n,{ref:p})})}const ure=({children:n,initial:e,isPresent:t,onExitComplete:r,custom:s,presenceAffectsLayout:a,mode:o,anchorX:l,anchorY:u,root:d})=>{const h=p3(dre),p=T.useId(),x=T.useRef(t),y=T.useRef(r);g3(()=>{x.current=t,y.current=r});let v=!0,_=T.useMemo(()=>(v=!1,{id:p,initial:e,isPresent:t,custom:s,onExitComplete:M=>{h.set(M,!0);for(const S of h.values())if(!S)return;r&&r()},register:M=>(h.set(M,!1),()=>{h.delete(M),!x.current&&!h.size&&y.current?.()})}),[t,h,r]);return a&&v&&(_={..._}),T.useMemo(()=>{h.forEach((M,S)=>h.set(S,!1))},[t]),T.useEffect(()=>{!t&&!h.size&&r&&r()},[t]),n=i.jsx(cre,{pop:o==="popLayout",isPresent:t,anchorX:l,anchorY:u,root:d,children:n}),i.jsx(mN.Provider,{value:_,children:n})};function dre(){return new Map}function l6(n=!0){const e=T.useContext(mN);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:r,register:s}=e,a=T.useId();T.useEffect(()=>{if(n)return s(a)},[n]);const o=T.useCallback(()=>n&&r&&r(a),[a,r,n]);return!t&&r?[!1,o]:[!0]}const Dw=n=>n.key||"";function jI(n){const e=[];
vendor: 4,373 bytes, line 327
327return T.Children.forEach(n,t=>{T.isValidElement(t)&&e.push(t)}),e}const zm=({children:n,custom:e,initial:t=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:a="sync",propagate:o=!1,anchorX:l="left",anchorY:u="top",root:d})=>{const[h,p]=l6(o),x=T.useMemo(()=>jI(n),[n]),y=o&&!h?[]:x.map(Dw),v=T.useRef(!0),_=T.useRef(x),M=p3(()=>new Map),S=T.useRef(new Set),[A,E]=T.useState(x),[C,I]=T.useState(x);g3(()=>{v.current=!1,_.current=x;for(let P=0;P<C.length;P++){const G=Dw(C[P]);y.includes(G)?(M.delete(G),S.current.delete(G)):M.get(G)!==!0&&M.set(G,!1)}},[C,y.length,y.join("-")]);const D=[];if(x!==A){let P=[...x];for(let G=0;G<C.length;G++){const k=C[G],V=Dw(k);y.includes(V)||(P.splice(G,0,k),D.push(k))}return a==="wait"&&D.length&&(P=D),I(jI(P)),E(x),null}const{forceRender:B}=T.useContext(m3);return i.jsx(i.Fragment,{children:C.map(P=>{const G=Dw(P),k=o&&!h?!1:x===C||y.includes(G),V=()=>{if(S.current.has(G))return;if(M.has(G))S.current.add(G),M.set(G,!0);else return;let U=!0;M.forEach($=>{$||(U=!1)}),U&&(B?.(),I(_.current),o&&p?.(),r&&r())};return i.jsx(ure,{isPresent:k,initial:!v.current||t?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:d,onExitComplete:k?void 0:V,anchorX:l,anchorY:u,children:P},G)})})},c6=T.createContext({strict:!1}),TI={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let RI=!1;function fre(){if(RI)return;const n={};for(const e in TI)n[e]={isEnabled:t=>TI[e].some(r=>!!t[r])};Fz(n),RI=!0}function u6(){return fre(),Qte()}function hre(n){const e=u6();for(const t in n)e[t]={...e[t],...n[t]};Fz(e)}const mre=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function B_(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||mre.has(n)}let d6=n=>!B_(n);function pre(n){typeof n=="function"&&(d6=e=>e.startsWith("on")?!B_(e):n(e))}try{pre(require("@emotion/is-prop-valid").default)}catch{}function gre(n,e,t){const r={};for(const s in n)s==="values"&&typeof n.values=="object"||ha(n[s])||(d6(s)||t===!0&&B_(s)||!e&&!B_(s)||n.draggable&&s.startsWith("onDrag"))&&(r[s]=n[s]);return r}const yN=T.createContext({});function xre(n,e){if(bN(n)){const{initial:t,animate:r}=n;return{initial:t===!1||Hy(t)?t:void 0,animate:Hy(r)?r:void 0}}return n.inherit!==!1?e:{}}function bre(n){const{initial:e,animate:t}=xre(n,T.useContext(yN));return T.useMemo(()=>({initial:e,animate:t}),[PI(e),PI(t)])}function PI(n){return Array.isArray(n)?n.join(" "):n}const z3=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function f6(n,e,t){for(const r in e)!ha(e[r])&&!$z(r,t)&&(n[r]=e[r])}function yre({transformTemplate:n},e){return T.useMemo(()=>{const t=z3();return O3(t,e,n),Object.assign({},t.vars,t.style)},[e])}function vre(n,e){const t=n.style||{},r={};return f6(r,t,n),Object.assign(r,yre(n,e)),r}function wre(n,e){const t={},r=vre(n,e);return n.drag&&n.dragListener!==!1&&(t.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(t.tabIndex=0),t.style=r,t}const h6=()=>({...z3(),attrs:{}});function Sre(n,e,t,r){const s=T.useMemo(()=>{const a=h6();return Xz(a,e,Yz(r),n.transformTemplate,n.style),{...a.attrs,style:{...a.style}}},[e]);if(n.style){const a={};f6(a,n.style,n),s.style={...a,...s.style}}return s}const _re=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];
vendor: 23,147 bytes, line 327
327function G3(n){return typeof n!="string"||n.includes("-")?!1:!!(_re.indexOf(n)>-1||/[A-Z]/u.test(n))}function Mre(n,e,t,{latestValues:r},s,a=!1,o){const u=(o??G3(n)?Sre:wre)(e,r,s,n),d=gre(e,typeof n=="string",a),h=n!==T.Fragment?{...d,...u,ref:t}:{},{children:p}=e,x=T.useMemo(()=>ha(p)?p.get():p,[p]);return T.createElement(n,{...h,children:x})}function Nre({scrapeMotionValuesFromProps:n,createRenderState:e},t,r,s){return{latestValues:Are(t,r,s,n),renderState:e()}}function Are(n,e,t,r){const s={},a=r(n,{});for(const x in a)s[x]=i_(a[x]);let{initial:o,animate:l}=n;const u=bN(n),d=Lz(n);e&&d&&!u&&n.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let h=t?t.initial===!1:!1;h=h||o===!1;const p=h?l:o;if(p&&typeof p!="boolean"&&!xN(p)){const x=Array.isArray(p)?p:[p];for(let y=0;y<x.length;y++){const v=T3(n,x[y]);if(v){const{transitionEnd:_,transition:M,...S}=v;for(const A in S){let E=S[A];if(Array.isArray(E)){const C=h?E.length-1:0;E=E[C]}E!==null&&(s[A]=E)}for(const A in _)s[A]=_[A]}}}return s}const m6=n=>(e,t)=>{const r=T.useContext(yN),s=T.useContext(mN),a=()=>Nre(n,e,r,s);return t?a():p3(a)},Cre=m6({scrapeMotionValuesFromProps:F3,createRenderState:z3}),Ere=m6({scrapeMotionValuesFromProps:Qz,createRenderState:h6}),jre=Symbol.for("motionComponentSymbol");function Tre(n,e,t){const r=T.useRef(t);T.useInsertionEffect(()=>{r.current=t});const s=T.useRef(null);return T.useCallback(a=>{a&&n.onMount?.(a),e&&(a?e.mount(a):e.unmount());const o=r.current;if(typeof o=="function")if(a){const l=o(a);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):o(a);else o&&(o.current=a)},[e])}const p6=T.createContext({});function fx(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function Rre(n,e,t,r,s,a){const{visualElement:o}=T.useContext(yN),l=T.useContext(c6),u=T.useContext(mN),d=T.useContext(U3),h=d.reducedMotion,p=d.skipAnimations,x=T.useRef(null),y=T.useRef(!1);r=r||l.renderer,!x.current&&r&&(x.current=r(n,{visualState:e,parent:o,props:t,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:h,skipAnimations:p,isSVG:a}),y.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const v=x.current,_=T.useContext(p6);v&&!v.projection&&s&&(v.type==="html"||v.type==="svg")&&Pre(x.current,t,s,_);const M=T.useRef(!1);T.useInsertionEffect(()=>{v&&M.current&&v.update(t,u)});const S=t[Nz],A=T.useRef(!!S&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return g3(()=>{y.current=!0,v&&(M.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),A.current&&v.animationState&&v.animationState.animateChanges())}),T.useEffect(()=>{v&&(!A.current&&v.animationState&&v.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),A.current=!1),v.enteringChildren=void 0)}),v}function Pre(n,e,t,r){const{layoutId:s,layout:a,drag:o,dragConstraints:l,layoutScroll:u,layoutRoot:d,layoutAnchor:h,layoutCrossfade:p}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:g6(n.parent)),n.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&fx(l),visualElement:n,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:p,layoutScroll:u,layoutRoot:d,layoutAnchor:h})}function g6(n){if(n)return n.options.allowProjection!==!1?n.projection:g6(n.parent)}function BC(n,{forwardMotionProps:e=!1,type:t}={},r,s){r&&hre(r);const a=t?t==="svg":G3(n),o=a?Ere:Cre;function l(d,h){let p;const x={...T.useContext(U3),...d,layoutId:Dre(d)},{isStatic:y}=x,v=bre(d),_=o(d,y);if(!y&&typeof window<"u"){kre();const M=Ire(x);p=M.MeasureLayout,v.visualElement=Rre(n,_,x,s,M.ProjectionNode,a)}return i.jsxs(yN.Provider,{value:v,children:[p&&v.visualElement?i.jsx(p,{visualElement:v.visualElement,...x}):null,Mre(n,d,Tre(_,v.visualElement,h),_,y,e,a)]})}l.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const u=T.forwardRef(l);return u[jre]=n,u}function Dre({layoutId:n}){const e=T.useContext(m3).id;return e&&n!==void 0?e+"-"+n:n}function kre(n,e){T.useContext(c6).strict}function Ire(n){const e=u6(),{drag:t,layout:r}=e;if(!t&&!r)return{};const s={...t,...r};return{MeasureLayout:t?.isEnabled(n)||r?.isEnabled(n)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Bre(n,e){if(typeof Proxy>"u")return BC;const t=new Map,r=(a,o)=>BC(a,o,n,e),s=(a,o)=>r(a,o);return new Proxy(s,{get:(a,o)=>o==="create"?r:(t.has(o)||t.set(o,BC(o,void 0,n,e)),t.get(o))})}const Lre=(n,e)=>e.isSVG??G3(n)?new hne(e):new one(e,{allowProjection:n!==T.Fragment});class Ore extends jh{constructor(e){super(e),e.animationState||(e.animationState=bne(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();xN(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Fre=0;class Ure extends jh{constructor(){super(...arguments),this.id=Fre++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a)){const l=Zm(this.node,a,o);if(l){const{transition:u,transitionEnd:d,...h}=l;for(const p in h)this.node.getValue(p)?.jump(h[p])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const zre={animation:{Feature:Ore},exit:{Feature:Ure}};function vv(n){return{point:{x:n.pageX,y:n.pageY}}}const Gre=n=>e=>k3(e)&&n(e,vv(e));function py(n,e,t,r){return Vy(n,e,Gre(t),r)}const x6=({current:n})=>n?n.ownerDocument.defaultView:null,DI=(n,e)=>Math.abs(n-e);function Hre(n,e){const t=DI(n.x,e.x),r=DI(n.y,e.y);return Math.sqrt(t**2+r**2)}const kI=new Set(["auto","scroll"]);class b6{constructor(e,t,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=kw(this.lastRawMoveEventInfo,this.transformPagePoint));const v=LC(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,M=Hre(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!M)return;const{point:S}=v,{timestamp:A}=fa;this.history.push({...S,timestamp:A});const{onStart:E,onMove:C}=this.handlers;_||(E&&E(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,v)},this.handlePointerMove=(v,_)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=_,this.lastMoveEventInfo=kw(_,this.transformPagePoint),is.update(this.updatePoint,!0)},this.handlePointerUp=(v,_)=>{this.end();const{onEnd:M,onSessionEnd:S,resumeAnimation:A}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&A&&A(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=LC(v.type==="pointercancel"?this.lastMoveEventInfo:kw(_,this.transformPagePoint),this.history);this.startEvent&&M&&M(v,E),S&&S(v,E)},!k3(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const u=vv(e),d=kw(u,this.transformPagePoint),{point:h}=d,{timestamp:p}=fa;this.history=[{...h,timestamp:p}];const{onSessionStart:x}=t;x&&x(e,LC(d,this.history));const y={passive:!0,capture:!0};this.removeListeners=xv(py(this.contextWindow,"pointermove",this.handlePointerMove,y),py(this.contextWindow,"pointerup",this.handlePointerUp,y),py(this.contextWindow,"pointercancel",this.handlePointerUp,y)),l&&this.startScrollTracking(l)}startScrollTracking(e){let t=e.parentElement;for(;t;){const r=getComputedStyle(t);(kI.has(r.overflowX)||kI.has(r.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const r=e===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:s.x-t.x,y:s.y-t.y};a.x===0&&a.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,s),is.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),gh(this.updatePoint)}}function kw(n,e){return e?{point:e(n.point)}:n}function II(n,e){return{x:n.x-e.x,y:n.y-e.y}}function LC({point:n},e){return{point:n,delta:II(n,y6(e)),offset:II(n,Vre(e)),velocity:Wre(e,.1)}}function Vre(n){return n[0]}function y6(n){return n[n.length-1]}function Wre(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const s=y6(n);for(;t>=0&&(r=n[t],!(s.timestamp-r.timestamp>Jo(e)));)t--;if(!r)return{x:0,y:0};r===n[0]&&n.length>2&&s.timestamp-r.timestamp>Jo(e)*2&&(r=n[1]);const a=Ol(s.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(s.x-r.x)/a,y:(s.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function $re(n,{min:e,max:t},r){return e!==void 0&&n<e?n=r?ss(e,n,r.min):Math.max(n,e):t!==void 0&&n>t&&(n=r?ss(t,n,r.max):Math.min(n,t)),n}function BI(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function Xre(n,{top:e,left:t,bottom:r,right:s}){return{x:BI(n.x,t,s),y:BI(n.y,e,r)}}function LI(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,r]=[r,t]),{min:t,max:r}}function qre(n,e){return{x:LI(n.x,e.x),y:LI(n.y,e.y)}}function Yre(n,e){let t=.5;const r=so(n),s=so(e);return s>r?t=zy(e.min,e.max-r,n.min):r>s&&(t=zy(n.min,n.max-s,e.min)),Iu(0,1,t)}function Qre(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const MT=.35;function Kre(n=MT){return n===!1?n=0:n===!0&&(n=MT),{x:OI(n,"left","right"),y:OI(n,"top","bottom")}}function OI(n,e,t){return{min:FI(n,e),max:FI(n,t)}}function FI(n,e){return typeof n=="number"?n:n[e]||0}const Jre=new WeakMap;class Zre{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Bi(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=p=>{t&&this.snapToCursor(vv(p).point),this.stopAnimation()},o=(p,x)=>{const{drag:y,dragPropagation:v,onDragStart:_}=this.getProps();if(y&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ate(y),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bu(S=>{let A=this.getAxisMotionValue(S).get()||0;if(ju.test(A)){const{projection:E}=this.visualElement;if(E&&E.layout){const C=E.layout.layoutBox[S];C&&(A=so(C)*(parseFloat(A)/100))}}this.originPoint[S]=A}),_&&is.update(()=>_(p,x),!1,!0),mT(this.visualElement,"transform");const{animationState:M}=this.visualElement;M&&M.setActive("whileDrag",!0)},l=(p,x)=>{this.latestPointerEvent=p,this.latestPanInfo=x;const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:_,onDrag:M}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:S}=x;if(v&&this.currentDirection===null){this.currentDirection=tse(S),this.currentDirection!==null&&_&&_(this.currentDirection);return}this.updateAxis("x",x.point,S),this.updateAxis("y",x.point,S),this.visualElement.render(),M&&is.update(()=>M(p,x),!1,!0)},u=(p,x)=>{this.latestPointerEvent=p,this.latestPanInfo=x,this.stop(p,x),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new b6(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:r,contextWindow:x6(this.visualElement),element:this.visualElement.current})}stop(e,t){const r=e||this.latestPointerEvent,s=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&is.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){const{drag:s}=this.getProps();if(!r||!Iw(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=$re(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&fx(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Xre(r.layoutBox,e):this.constraints=!1,this.elastic=Kre(t),s!==this.constraints&&!fx(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&bu(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Qre(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!fx(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;s.root&&(s.root.scroll=void 0,s.root.updateScroll());const a=tne(r,s.root,this.visualElement.getTransformPagePoint());let o=qre(s.layout.layoutBox,a);if(t){const l=t(Jte(o));this.hasMutatedConstraints=!!l,l&&(o=zz(l))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:s,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),u=this.constraints||{},d=bu(h=>{if(!Iw(h,t,this.currentDirection))return;let p=u&&u[h]||{};(o===!0||o===h)&&(p={min:0,max:0});const x=s?200:1e6,y=s?40:1e7,v={type:"inertia",velocity:r?e[h]:0,bounceStiffness:x,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...a,...p};return this.startAxisValueAnimation(h,v)});return Promise.all(d).then(l)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return mT(this.visualElement,e),r.start(j3(e,r,0,t,this.visualElement,!1))}stopAnimation(){bu(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps()[t];return s||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){bu(t=>{const{drag:r}=this.getProps();if(!Iw(t,r,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(t);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[t],u=a.get()||0;a.set(e[t]-ss(o,l,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!fx(t)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};bu(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const u=l.get();s[o]=Yre({min:u,max:u},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),bu(o=>{if(!Iw(o,e,null))return;const l=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];l.set(ss(u,d,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Jre.set(this.visualElement,this);const e=this.visualElement.current,t=py(e,"pointerdown",d=>{const{drag:h,dragListener:p=!0}=this.getProps(),x=d.target,y=x!==e&&Pte(x);h&&p&&!y&&this.start(d)});let r;const s=()=>{const{dragConstraints:d}=this.getProps();fx(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),r||(r=ese(e,d.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,o=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),is.read(s);const l=Vy(window,"resize",()=>this.scalePositionWithinConstraints()),u=a.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:h})=>{this.isDragging&&h&&(bu(p=>{const x=this.getAxisMotionValue(p);x&&(this.originPoint[p]+=d[p].translate,x.set(x.get()+d[p].translate))}),this.visualElement.render())}));return()=>{l(),t(),o(),u&&u(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:o=MT,dragMomentum:l=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function UI(n){let e=!0;return()=>{if(e){e=!1;return}n()}}function ese(n,e,t){const r=Xk(n,UI(t)),s=Xk(e,UI(t));return()=>{r(),s()}}function Iw(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function tse(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class nse extends jh{constructor(e){super(e),this.removeGroupControls=zl,this.removeListeners=zl,this.controls=new Zre(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||zl}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const OC=n=>(e,t)=>{n&&is.update(()=>n(e,t),!1,!0)};class rse extends jh{constructor(){super(...arguments),this.removePointerDownListener=zl}onPointerDown(e){this.session=new b6(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:x6(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:OC(e),onStart:OC(t),onMove:OC(r),onEnd:(a,o)=>{delete this.session,s&&is.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=py(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let FC=!1;class sse extends T.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),r&&r.register&&s&&r.register(a),FC&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),a_.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),FC=!0,s||e.layoutDependency!==t||t===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||is.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=t,r.root.didUpdate(),D3.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;FC=!0,s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function v6(n){const[e,t]=l6(),r=T.useContext(m3);return i.jsx(sse,{...n,layoutGroup:r,switchLayoutGroup:T.useContext(p6),isPresent:e,safeToRemove:t})}const ise={pan:{Feature:rse},drag:{Feature:nse,ProjectionNode:o6,MeasureLayout:v6}};function zI(n,e,t){const{props:r}=n;n.animationState&&r.whileHover&&n.animationState.setActive("whileHover",t==="Start");const s="onHover"+t,a=r[s];a&&is.postRender(()=>a(e,vv(e)))}class ase extends jh{mount(){const{current:e}=this.node;e&&(this.unmount=Ete(e,(t,r)=>(zI(this.node,r,"Start"),s=>zI(this.node,s,"End"))))}unmount(){}}class ose extends jh{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xv(Vy(this.node.current,"focus",()=>this.onFocus()),Vy(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function GI(n,e,t){const{props:r}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&r.whileTap&&n.animationState.setActive("whileTap",t==="Start");const s="onTap"+(t==="End"?"":t),a=r[s];a&&is.postRender(()=>a(e,vv(e)))}class lse extends jh{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=kte(e,(s,a)=>(GI(this.node,a,"Start"),(o,{success:l})=>GI(this.node,o,l?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:r?.tap===!1})}unmount(){}}const NT=new WeakMap,UC=new WeakMap,cse=n=>{const e=NT.get(n.target);e&&e(n)},use=n=>
327{n.forEach(cse)};function dse({root:n,...e}){const t=n||document;UC.has(t)||UC.set(t,{});const r=UC.get(t),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(use,{root:n,...e})),r[s]}function fse(n,e,t){const r=dse(e);return NT.set(n,t),r.observe(n),()=>{NT.delete(n),r.unobserve(n)}}const hse={some:0,all:1};class mse extends jh{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:s="some",once:a}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:hse[s]},l=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,a&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),x=d?h:p;x&&x(u)};this.stopObserver=fse(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(pse(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function pse({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const gse={inView:{Feature:mse},tap:{Feature:lse},focus:{Feature:ose},hover:{Feature:ase}},xse={layout:{ProjectionNode:o6,MeasureLayout:v6}},bse={...zre,...gse,...ise,...xse},Gs=Bre(bse,Lre);function Bw({icon:n,label:e,value:t,subtitle:r,color:s}){const a={teal:"from-teal-500/10 to-teal-600/5 border-teal-500/20",blue:"from-blue-500/10 to-blue-600/5 border-blue-500/20",green:"from-green-500/10 to-green-600/5 border-green-500/20",amber:"from-amber-500/10 to-amber-600/5 border-amber-500/20"},o={teal:"text-teal-500",blue:"text-blue-500",green:"text-green-500",amber:"text-amber-500"};return i.jsxs(Gs.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`bg-gradient-to-br ${a[s]} border rounded-2xl p-5`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("div",{className:"p-2.5 rounded-xl bg-background/50",children:i.jsx(n,{className:`w-5 h-5 ${o[s]}`})}),r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:r})]}),i.jsx("div",{className:"text-2xl font-bold text-foreground",children:t}),i.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:e})]})}function yse(){const{data:n,isLoading:e,refetch:t}=Pe.purchaseInvoices.list.useQuery(),{data:r}=Pe.rawMaterials.list.useQuery(),{data:s}=Pe.clients.list.useQuery(),{data:a}=Pe.productionOrders.list.useQuery(),{data:o}=Pe.materialCategories.list.useQuery(),{data:l}=Pe.templates.get.useQuery({docType:"purchaseInvoice"}),{data:u}=Pe.settings.list.useQuery(void 0,{retry:!1}),d=Pe.purchaseInvoices.create.useMutation(),h=Pe.rawMaterials.create.useMutation(),p=Pe.purchaseInvoices.update.useMutation(),x=Pe.purchaseInvoices.delete.useMutation(),y=Pe.useUtils(),[v,_]=T.useState(!1),[M,S]=T.useState(null),[A,E]=T.useState(!1),[C,I]=T.useState(null),[D,B]=T.useState(""),[P,G]=T.useState("all"),[k,V]=T.useState([]),[U,$]=T.useState(0),[X,ee]=T.useState(""),[z,K]=T.useState(new Date().toISOString().split("T")[0]),[ae,oe]=T.useState(""),[re,F]=T.useState(""),[O,J]=T.useState(!1),[q,Q]=T.useState(!1),[ne,Z]=T.useState({name:"",unit:"قطعة",purchasePrice:0,categoryId:0}),[se,me]=T.useState(""),[ze,Be]=T.useState(!1),[ye,Le]=T.useState(""),[Ce,Re]=T.useState(!1);T.useEffect(()=>{const Se=new URLSearchParams(window.location.search).get("new-purchase-invoice-client");if(!Se||!s)return;const Ae=(s||[]).find(pe=>Number(pe.id)===Number(Se));Ge(),Ae&&($(Number(Ae.id)),ee(Ae.name||Ae.companyName||""));const at=new URL(window.location.href);at.searchParams.delete("new-purchase-invoice-client"),window.history.replaceState({},"",at.toString())},[s]);const De=T.useMemo(()=>(s||[]).filter(ie=>ie.type==="supplier"||ie.type==="both"),[s]),he=T.useMemo(()=>r||[],[r]),le=T.useMemo(()=>{const ie=new Map;for(const Se of a||[]){const Ae=(Se.machineName||"").toString().trim();Ae&&!ie.has(Ae)&&ie.set(Ae,{id:String(Se.id),name:Ae,orderNumber:Se.orderNumber})}return Array.from(ie.values())},[a]),Xe=T.useMemo(()=>{const ie=n||[],Se=new Date,Ae=ie.filter(pe=>{const Ke=new Date(pe.invoiceDate||pe.entryDate);return Ke.getMonth()===Se.getMonth()&&Ke.getFullYear()===Se.getFullYear()}),at=ie.reduce((pe,Ke)=>pe+(Ke.totalAmount||0),0);return{total:ie.length,totalAmount:at,monthlyCount:Ae.length,monthlyAmount:Ae.reduce((pe,Ke)=>pe+(Ke.totalAmount||0),0)}},[n]),qe=T.useMemo(()=>(n||[]).filter(ie=>D===""||(ie.invoiceNumber||"").toLowerCase().includes(D.toLowerCase())||(ie.supplierName||"").toLowerCase().includes(D.toLowerCase())),[n,D]),Ge=T.useCallback(()=>{S(null),V([]),$(0),ee(""),K(new Date().toISOString().split("T")[0]),oe(""),_(!0)},[]),ot=T.useCallback(async ie=>{S(ie.id),$(ie.supplierId||0),ee(ie.supplierName||""),K(new Date(ie.invoiceDate||ie.entryDate).toISOString().split("T")[0]),oe(ie.notes||"");try{const Se=await y.purchaseInvoices.get.fetch({id:ie.id});Se&&Se.items&&V(Se.items.map(Ae=>({rawMaterialId:Ae.rawMaterialId||0,rawMaterialName:Ae.rawMaterialName||"",quantity:Ae.quantity||1,unitPrice:Ae.unitPrice||0,totalPrice:Ae.totalPrice||0,machineId:Ae.machineId||"",machineName:Ae.machineName||"",manufacturingQty:Ae.manufacturingQty||0,productionMargin:Ae.productionMargin||0,wholesaleMargin:Ae.wholesaleMargin||0,bulkWholesaleMargin:Ae.bulkWholesaleMargin||0,retailMargin:Ae.retailMargin||0})))}catch{V([])}_(!0)},[y]),ve=T.useCallback(()=>{V(ie=>[...ie,{rawMaterialId:0,rawMaterialName:"",quantity:1,unitPrice:0,totalPrice:0,machineId:"",machineName:"",manufacturingQty:0,productionMargin:0,wholesaleMargin:0,bulkWholesaleMargin:0,retailMargin:0}])},[]),mt=T.useCallback((ie,Se)=>{V(Ae=>Ae.map((at,pe)=>{if(pe!==ie)return at;const Ke=at.quantity*Se.purchasePrice;return{...at,rawMaterialId:Se.id,rawMaterialName:Se.name,unitPrice:Se.purchasePrice,totalPrice:Ke}}))},[]),xt=T.useCallback(async ie=>{const Se=ne.name.trim();if(!Se){_e.error("اسم المادة مطلوب");return}try{const Ae=await h.mutateAsync({name:Se,description:"",categoryId:Number(ne.categoryId||o?.[0]?.id||0),unit:ne.unit||"قطعة",purchasePrice:Number(ne.purchasePrice||0),stockQuantity:0,minReorderLevel:0,stockValue:0}),at={id:Number(Ae?.id||Ae?.insertId),name:Se,purchasePrice:Number(ne.purchasePrice||0),stockQuantity:0,categoryId:Number(ne.categoryId||o?.[0]?.id||0),unit:ne.unit||"قطعة",productionMargin:0,wholesaleMargin:0,bulkWholesaleMargin:0,retailMargin:0};if(!at.id)throw new Error("تعذر الحصول على رقم المادة الجديدة");
327mt(ie,at),await y.rawMaterials.list.invalidate(),Z({name:"",unit:"قطعة",purchasePrice:0,categoryId:0}),Q(!1),F(""),_e.success("تمت إضافة المادة وربطها ببند الفاتورة")}catch(Ae){_e.error(Ae?.message||"فشل إضافة المادة")}},[o,h,mt,ne,y]),ge=T.useCallback((ie,Se)=>{V(Ae=>Ae.map((at,pe)=>pe!==ie?at:{...at,machineId:String(Se.id),machineName:Se.name}))},[]),Y=T.useCallback((ie,Se,Ae)=>{V(at=>at.map((pe,Ke)=>{if(Ke!==ie)return pe;const Ne={...pe,[Se]:Ae};return(Se==="quantity"||Se==="unitPrice")&&(Ne.totalPrice=(Ne.quantity||0)*(Ne.unitPrice||0)),Ne}))},[]),je=T.useCallback(ie=>{V(Se=>Se.filter((Ae,at)=>at!==ie))},[]),Ie=T.useCallback(async()=>{if(k.length===0){_e.error("يجب إضافة بند واحد على الأقل");return}try{M?(await p.mutateAsync({id:M,data:{supplierId:U,supplierName:X,invoiceDate:new Date(z),notes:ae},items:k.map(ie=>({...ie,totalPrice:(ie.quantity||0)*(ie.unitPrice||0)}))}),_e.success("تم تعديل فاتورة الشراء بنجاح")):(await d.mutateAsync({data:{supplierId:U,supplierName:X,invoiceDate:new Date(z),notes:ae},items:k.map(ie=>({...ie,totalPrice:(ie.quantity||0)*(ie.unitPrice||0)}))}),_e.success("تم إنشاء فاتورة الشراء بنجاح")),_(!1),t()}catch(ie){_e.error(ie?.message||"حدث خطأ")}},[k,U,X,z,ae,d,p,M,t]),Ve=T.useCallback(async ie=>{if(confirm("هل أنت متأكد من حذف فاتورة الشراء هذه؟"))try{await x.mutateAsync({id:ie.id}),_e.success("تم حذف فاتورة الشراء"),t()}catch{_e.error("حدث خطأ")}},[x,t]),ft=T.useCallback(async ie=>{I(ie),E(!0);try{const Se=await y.purchaseInvoices.get.fetch({id:ie.id});Se&&I(Se)}catch{}},[y]),vt=T.useCallback(async ie=>{try{const Se=ie.items?ie:await y.purchaseInvoices.get.fetch({id:ie.id}),Ae=Array.isArray(u)?u:[],at=et=>jd(Ae,et),pe=(Se?.items||[]).map(et=>({label:et.rawMaterialName||et.materialName||"",qty:String(et.quantity??0),unit:et.unit||"",price:String(et.unitPrice??0),total:String(et.totalPrice??(Number(et.quantity)||0)*(Number(et.unitPrice)||0))})),Ke=pe.reduce((et,Qe)=>et+Number(Qe.total||0),0),Ne=l||fp("purchaseInvoice"),Ye={invoiceNumber:Se?.invoiceNumber||"",date:Se?.invoiceDate?new Date(Se.invoiceDate).toLocaleDateString("ar-EG"):"",supplierName:Se?.supplierName||"",supplierPhone:Se?.supplierPhone||"",supplierAddress:Se?.supplierAddress||"",companyName:at("company_name"),companyPhone:at("company_phone")||at("whatsapp_number"),companyAddress:at("company_address"),companyEmail:at("company_email"),notes:Se?.notes||"",total:Ke.toLocaleString("en-US",{minimumFractionDigits:2}),amountInWords:"",__totals:Ke.toLocaleString("en-US",{minimumFractionDigits:2}),__itemsJson:JSON.stringify(pe)},Te=h3(Ae),st=Rx(Ne,Ye,{logoUrl:Te,companyTitle:Ye.companyName,deferTableFlow:!0});Gd(st,`فاتورة شراء ${Se?.invoiceNumber||""}`)}catch(Se){_e.error(Se?.message||"تعذر تجهيز فاتورة الشراء للطباعة")}},[l,u,y]),ce=T.useMemo(()=>ye?De.filter(ie=>ie.name.toLowerCase().includes(ye.toLowerCase())).slice(0,10):De.slice(0,10),[De,ye]),Me=T.useMemo(()=>re?he.filter(ie=>ie.name.toLowerCase().includes(re.toLowerCase())).slice(0,10):he.slice(0,10),[he,re]),Fe=T.useMemo(()=>se?le.filter(ie=>ie.name.toLowerCase().includes(se.toLowerCase())).slice(0,10):le.
327slice(0,10),[le,se]);return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h2",{className:"text-xl font-bold text-foreground",children:"فواتير الشراء"}),i.jsxs(ke,{onClick:Ge,className:"bg-primary hover:bg-primary/90 text-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," فاتورة جديدة"]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsx(Bw,{icon:Uj,label:"إجمالي الفواتير",value:Xe.total,color:"teal"}),i.jsx(Bw,{icon:k2,label:"إجمالي المبالغ",value:`${Xe.totalAmount.toLocaleString()} $`,color:"blue"}),i.jsx(Bw,{icon:w_,label:"فواتير هذا الشهر",value:Xe.monthlyCount,color:"green"}),i.jsx(Bw,{icon:aN,label:"مبالغ هذا الشهر",value:`${Xe.monthlyAmount.toLocaleString()} $`,color:"amber"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx("input",{value:D,onChange:ie=>B(ie.target.value),placeholder:"بحث برقم الفاتورة أو اسم المورد...",className:"w-full bg-muted/50 border border-border rounded-xl pr-10 pl-3 py-2.5 text-foreground text-sm focus:border-primary focus:outline-none transition-colors"})]}),i.jsx("div",{className:"space-y-3",children:i.jsx(zm,{children:e?i.jsx("p",{className:"text-muted-foreground text-center py-8",children:"جاري التحميل..."}):qe.length===0?i.jsx("p",{className:"text-muted-foreground text-center py-8",children:"لا توجد فواتير شراء"}):qe.map((ie,Se)=>i.jsx(Gs.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Se*.03},className:"bg-muted/30 rounded-xl border border-border p-4 hover:border-primary/30 transition-all",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary flex items-center justify-center flex-shrink-0",children:i.jsx(Ki,{className:"w-5 h-5 text-foreground"})}),i.jsxs("div",{className:"flex-1 grid grid-cols-4 gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-xs text-muted-foreground",children:["#",Se+1]}),i.jsx("span",{className:"text-foreground font-bold text-sm",children:ie.invoiceNumber||"-"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(mQ,{className:"w-3.5 h-3.5 text-muted-foreground/70"}),i.jsx("span",{className:"text-foreground text-sm",children:ie.supplierName||i.jsx("span",{className:"text-muted-foreground/70",children:"بدون مورد"})})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(w_,{className:"w-3.5 h-3.5 text-muted-foreground/70"}),i.jsx("span",{className:"text-foreground text-sm",children:ie.invoiceDate?new Date(ie.invoiceDate).toLocaleDateString("ar"):"-"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ma,{className:"w-3.5 h-3.5 text-muted-foreground/70"}),i.jsxs("span",{className:"text-foreground text-sm",children:[ie.itemCount||0," بند"]})]})]}),i.jsx("div",{className:"flex items-center gap-3",children:i.jsxs("span",{className:"text-primary font-bold text-lg",children:[(ie.totalAmount||0).toLocaleString()," $"]})}),i.jsx(ZM,{children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>ft(ie),className:"p-2 rounded-lg hover:bg-muted text-primary transition-colors",children:i.jsx(jc,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"عرض"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>ot(ie),className:"p-2 rounded-lg hover:bg-muted text-amber-500 transition-colors",children:i.jsx(dQ,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"تعديل"})]}),i.jsxs(bc,{children:[i.jsx(yc,{asChild:!0,children:i.jsx("button",{onClick:()=>Ve(ie),className:"p-2 rounded-lg hover:bg-destructive/10 text-destructive transition-colors",children:i.jsx(Ar,{className:"w-4 h-4"})})}),i.jsx(vc,{side:"bottom",className:"text-xs",children:"حذف"})]})]})})]})},ie.id))})}),i.jsx(zm,{children:v&&i.jsx(Gs.div,{initial:{opacity:0}
327,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>_(!1),children:i.jsxs(Gs.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2},className:"bg-card rounded-2xl border border-border w-full max-w-3xl max-h-[90vh] overflow-y-auto shadow-2xl m-4",onClick:ie=>ie.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border sticky top-0 bg-card z-10",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary flex items-center justify-center",children:i.jsx(Ki,{className:"w-5 h-5 text-foreground"})}),i.jsx("h3",{className:"text-foreground font-bold text-lg",children:M?"تعديل فاتورة شراء":"إضافة فاتورة شراء"})]}),i.jsx("button",{onClick:()=>_(!1),className:"p-1.5 hover:bg-muted rounded-lg text-muted-foreground transition-colors",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-5 space-y-5",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"المورد"}),i.jsxs("div",{className:"relative",children:[i.jsx(Ee,{value:X||ye,onChange:ie=>{Le(ie.target.value),Re(!0)},onFocus:()=>Re(!0),placeholder:"ابحث عن مورد...",className:"bg-muted/50 border-border text-foreground text-sm"}),Ce&&!U&&i.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-card border border-border rounded-lg shadow-lg z-20 max-h-40 overflow-y-auto",children:ce.length===0?i.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"لا توجد نتائج"}):ce.map(ie=>i.jsxs("button",{className:"w-full text-right px-3 py-2 hover:bg-muted text-sm text-foreground transition-colors flex items-center justify-between",onMouseDown:()=>{$(ie.id),ee(ie.name),Re(!1),Le("")},children:[i.jsx("span",{children:ie.name}),i.jsx("span",{className:"text-xs text-muted-foreground",children:ie.phone||""})]},ie.id))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1.5 block",children:"التاريخ"}),i.jsx(Ee,{type:"date",value:z,onChange:ie=>K(ie.target.value),className:"bg-muted/50 border-border text-foreground"})]})]}),i.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ma,{className:"w-4 h-4 text-primary"}),i.jsx("span",{className:"text-sm font-medium text-foreground",children:"بنود الفاتورة"}),i.jsx(Ul,{variant:"outline",className:"text-xs",children:k.length})]}),i.jsxs(ke,{variant:"outline",size:"sm",onClick:ve,className:"border-border text-foreground hover:bg-muted",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة بند"]})]}),i.jsxs("div",{className:"space-y-3 max-h-[300px] overflow-y-auto",children:[i.jsx(zm,{children:k.map((ie,Se)=>i.jsxs(Gs.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-muted/30 rounded-xl border border-border p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["بند #",Se+1]}),i.jsx("button",{onClick:()=>je(Se),className:"p-1 rounded hover:bg-destructive/10 text-destructive transition-colors",children:i.jsx(Mr,{className:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"relative",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المادة الخام"}),i.jsxs("div",{className:"relative",children:[i.jsx(Ee,{value:ie.rawMaterialName||re,onChange:Ae=>{F(Ae.target.value),J(!0)},onFocus:()=>J(!0),placeholder:"ابحث عن مادة خام...",className:"bg-background border-border text-foreground text-sm"}),O&&ie.rawMaterialId===0&&i.jsxs("div",{className:"absolute top-full left-0 right-0 mt-1 bg-card border border-border rounded-lg shadow-lg z-20 max-h-40 overflow-y-auto",children:[Me.length===0?i.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"لا توجد نتائج"}):Me.map(Ae=>i.jsxs("button",{className:"w-full text-right px-3 py-2 hover:bg-muted text-sm text-foreground transition-colors flex items-center justify-between",onClick:()=>{mt(Se,Ae),J(!1),F("")},children:[i.jsx("span",{children:Ae.name}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ae.purchasePrice||0," $ / ",Ae.unit||"قطعة"]})]},Ae.id)),i.jsxs("button",{type:"button",onClick:()=>{Q(!0),J(!1)},className:"mt-1 w-full border-t border-border px-3 py-2 text-right text-xs font-bold text-primary hover:bg-muted",children:[i.jsx(Nn,{className:"ml-1 inline h-3.5 w-3.5"})," إضافة مادة جديدة"]})]})]})]}),q&&i.jsxs("div",{className:"mb-3 rounded-lg border border-primary/30 bg-primary/5 p-3",children:[i.jsx("div",{className:"mb-2 text-xs font-bold text-primary",children:"إضافة مادة جديدة إلى مخزون المواد الأولية"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Ee,{value:ne.name,onChange:Ae=>Z({...ne,name:Ae.target.value}),placeholder:"اسم المادة",className:"bg-background border-border text-foreground text-xs"}),i.jsx(Ee,{value:ne.unit,onChange:Ae=>Z({...ne,unit:Ae.target.value}),placeholder:"الوحدة",className:"bg-background border-border text-foreground text-xs"}),i.jsx(Ee,{type:"number",value:ne.purchasePrice,onChange:Ae=>Z({...ne,purchasePrice:parseFloat(Ae.target.value)||0}),placeholder:"سعر الشراء",className:"bg-background border-border text-foreground text-xs"}),i.jsxs(En,{value:ne.categoryId?String(ne.categoryId):"none",onValueChange:Ae=>Z({...ne,categoryId:Ae==="none"?0:Number(Ae)}),children:[i.jsx(Tn,{className:"bg-background border-border text-foreground text-xs",children:i.jsx(jn,{placeholder:"التصنيف"})}),i.jsxs(Rn,{children:[i.jsx(bt,{value:"none",children:"بدون تصنيف"}),(o||[]).map(Ae=>i.jsx(bt,{value:String(Ae.id),children:Ae.name},Ae.id))]})]})]}),i.jsxs("div",{className:"mt-2 flex gap-2",children:[i.jsx(ke,{type:"button",size:"sm",onClick:()=>xt(Se),disabled:h.isPending,className:"h-8 text-xs",children:h.isPending?"جاري الحفظ...":"حفظ واختيار"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>Q(!1),className:"h-8 text-xs",children:"إلغاء"})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الكمية"}),i.jsx(Ee,{type:"number",value:ie.quantity,onChange:Ae=>Y(Se,"quantity",parseFloat(Ae.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر الوحدة"}),i.jsx(Ee,{type:"number",value:ie.unitPrice,onChange:Ae=>Y(Se,"unitPrice",parseFloat(Ae.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الإجمالي"}),i.jsx(Ee,{value:ie.totalPrice.toFixed(2),readOnly:!0,className:"bg-muted/50 border-border text-foreground text-sm font-medium"})]})]}),i.jsxs("div",{className:"pt-3 border-t border-border",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(uy,{className:"w-3.5 h-3.5 text-muted-foreground"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"التصنيع (اختياري)"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"relative",children:[i.jsx(Ee,{value:ie.machineName||se,onCh
327ange:Ae=>{me(Ae.target.value),Be(!0)},onFocus:()=>Be(!0),placeholder:"اختر مكنة...",className:"bg-background border-border text-foreground text-sm"}),ze&&!ie.machineId&&i.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-card border border-border rounded-lg shadow-lg z-20 max-h-32 overflow-y-auto",children:Fe.length===0?i.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"لا توجد أوامر إنتاج — أنشئ أمر إنتاج أولاً"}):Fe.map(Ae=>i.jsxs("button",{className:"w-full text-right px-3 py-2 hover:bg-muted text-sm text-foreground transition-colors flex items-center justify-between gap-2",onClick:()=>{ge(Se,Ae),Be(!1),me("")},children:[i.jsx("span",{children:Ae.name}),Ae.orderNumber?i.jsx("span",{className:"text-xs text-muted-foreground",children:Ae.orderNumber}):null]},Ae.id))})]}),i.jsx("div",{children:i.jsx(Ee,{type:"number",value:ie.manufacturingQty,onChange:Ae=>Y(Se,"manufacturingQty",parseFloat(Ae.target.value)||0),placeholder:"كمية التصنيع",className:"bg-background border-border text-foreground text-sm",min:0})})]})]}),i.jsxs("div",{className:"pt-3 border-t border-border",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Lj,{className:"w-3.5 h-3.5 text-muted-foreground"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"حاسبة الأسعار والهوامش"})]}),(()=>{const Ae=he.find(st=>st.id===ie.rawMaterialId),at=ie.unitPrice||0,pe=ie.productionMargin??Ae?.productionMargin??0,Ke=ie.wholesaleMargin??Ae?.wholesaleMargin??0,Ne=ie.bulkWholesaleMargin??Ae?.bulkWholesaleMargin??0,Ye=ie.retailMargin??Ae?.retailMargin??0,Te=st=>at*(1+(st||0)/100);return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر الكلفة"}),i.jsx(Ee,{type:"number",value:ie.unitPrice,onChange:st=>Y(Se,"unitPrice",parseFloat(st.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{className:"grid grid-cols-[1fr_140px] gap-2 items-center",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش الإنتاج %"}),i.jsx(Ee,{type:"number",value:ie.productionMargin??Ae?.productionMargin??0,onChange:st=>Y(Se,"productionMargin",parseFloat(st.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر الإنتاج"}),i.jsxs("div",{className:"bg-teal-500/10 border border-teal-500/30 rounded-lg px-3 py-1.5 text-sm font-bold text-teal-600 dark:text-teal-400",children:[Te(pe).toFixed(2),"$"]})]})]}),i.jsxs("div",{className:"grid grid-cols-[1fr_140px] gap-2 items-center",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش الجملة %"}),i.jsx(Ee,{type:"number",value:ie.wholesaleMargin??Ae?.wholesaleMargin??0,onChange:st=>Y(Se,"wholesaleMargin",parseFloat(st.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر الجملة"}),i.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg px-3 py-1.5 text-sm font-bold text-emerald-600 dark:text-emerald-400",children:[Te(Ke).toFixed(2),"$"]})]})]}),i.jsxs("div",{className:"grid grid-cols-[1fr_140px] gap-2 items-center",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش جملة الجملة %"}),i.jsx(Ee,{type:"number",value:ie.bulkWholesaleMargin??Ae?.bulkWholesaleMargin??0,onChange:st=>Y(Se,"bulkWholesaleMargin",parseFloat(st.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر جملة الجملة"}),i.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg px-3 py-1.5 text-sm font-bold text-amber-600 dar
327k:text-amber-400",children:[Te(Ne).toFixed(2),"$"]})]})]}),i.jsxs("div",{className:"grid grid-cols-[1fr_140px] gap-2 items-center",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش المفرق %"}),i.jsx(Ee,{type:"number",value:ie.retailMargin??Ae?.retailMargin??0,onChange:st=>Y(Se,"retailMargin",parseFloat(st.target.value)||0),className:"bg-background border-border text-foreground text-sm",min:0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر المفرق"}),i.jsxs("div",{className:"bg-pink-500/10 border border-pink-500/30 rounded-lg px-3 py-1.5 text-sm font-bold text-pink-600 dark:text-pink-400",children:[Te(Ye).toFixed(2),"$"]})]})]})]})})()]})]},Se))}),k.length===0&&i.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[i.jsx(ma,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),i.jsx("p",{className:"text-sm",children:'لا توجد بنود. اضغط "إضافة بند" للبدء'})]})]}),i.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-border",children:[i.jsx("span",{className:"text-sm text-muted-foreground",children:"إجمالي الفاتورة:"}),i.jsxs("span",{className:"text-xl font-bold text-primary",children:[k.reduce((ie,Se)=>ie+Se.totalPrice,0).toLocaleString()," $"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"ملاحظات"}),i.jsx(ni,{value:ae,onChange:ie=>oe(ie.target.value),placeholder:"ملاحظات إضافية...",className:"bg-muted/50 border-border text-foreground text-sm",rows:2})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-5 border-t border-border sticky bottom-0 bg-card",children:[i.jsx(ke,{variant:"outline",onClick:()=>_(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:Ie,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:d.isPending||p.isPending||k.length===0,children:d.isPending||p.isPending?"جاري الحفظ...":"حفظ الفاتورة"})]})]})})}),i.jsx(zm,{children:A&&C&&i.jsx(Gs.div,{initial:{opacity:0}
327,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>E(!1),children:i.jsxs(Gs.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2},className:"bg-card rounded-2xl border border-border w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl m-4",onClick:ie=>ie.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary flex items-center justify-center",children:i.jsx(Ki,{className:"w-5 h-5 text-foreground"})}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-foreground font-bold",children:["فاتورة #",C.invoiceNumber]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:C.supplierName||"بدون مورد"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ke,{size:"sm",onClick:()=>vt(C),className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(nl,{className:"w-3.5 h-3.5 ml-1"})," طباعة بالقالب"]}),i.jsx("button",{onClick:()=>E(!1),className:"p-1.5 hover:bg-slate-100 rounded-lg text-slate-600 transition-colors",children:i.jsx(Mr,{className:"w-5 h-5"})})]})]}),i.jsxs("div",{className:"p-5 space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"التاريخ"}),i.jsx("p",{className:"text-foreground font-medium",children:C.invoiceDate?new Date(C.invoiceDate).toLocaleDateString("ar"):"-"})]}),i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"عدد البنود"}),i.jsxs("p",{className:"text-foreground font-medium",children:[C.items?.length||0," بند"]})]}),i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"المورد"}),i.jsx("p",{className:"text-foreground font-medium",children:C.supplierName||"-"})]}),i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"الإجمالي"}),i.jsxs("p",{className:"text-primary font-bold text-lg",children:[(C.totalAmount||0).toLocaleString()," $"]})]})]}),C.items&&C.items.length>0&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"البنود"}),i.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[i.jsx("th",{className:"text-right p-3 text-xs text-muted-foreground font-medium",children:"المادة"}),i.jsx("th",{className:"text-right p-3 text-xs text-muted-foreground font-medium",children:"الكمية"}),i.jsx("th",{className:"text-right p-3 text-xs text-muted-foreground font-medium",children:"السعر"}),i.jsx("th",{className:"text-right p-3 text-xs text-muted-foreground font-medium",children:"الإجمالي"}),i.jsx("th",{className:"text-right p-3 text-xs text-muted-foreground font-medium",children:"المكنة"})]})}),i.jsx("tbody",{children:C.items.map((ie,Se)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3 text-foreground",children:ie.rawMaterialName||"-"}),i.jsx("td",{className:"p-3 text-foreground",children:ie.quantity||0}),i.jsxs("td",{className:"p-3 text-foreground",children:[(ie.unitPrice||0).toLocaleString()," $"]}),i.jsxs("td",{className:"p-3 text-foreground font-medium",children:[(ie.totalPrice||0).toLocaleString()," $"]}),i.jsx("td",{className:"p-3 text-muted-foreground",children:ie.machineName||"-"})]},ie.id||Se))})]})})]}),C.notes&&i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"ملاحظات"}),i.jsx("p",{className:"text-foreground text-sm mt-1",children:C.notes})]})]})]})})})]})}function vse(){const{data:n,isLoading:e,refetch:t}=Pe.rawMaterials.list.useQuery(),{data:r}=Pe.materialCategories.list.useQuery(),s=Pe.rawMaterials.create.useMutation(),a=Pe.rawMaterials.update.useMutation(),o=Pe.rawMaterials.delete.useMutation(),l=Pe.rawMaterials.uploadImage.useMutation(),u=Pe.useUtils(),[d,h]=T.useState(!1),[p,x]=T.useState(null),[y,v]=T.useState(""),[_,M]=T.useState("all"),[S,A]=T.useState([]),[E,C]=T.useState(null),[I,D]=T.useState(""),[B,P]=T.useState(!1),[G,k]=T.useState(null),[V,U]=T.useState(null),$={name:"",description:"",categoryId:null,unit:"قطعة",purchasePrice:0,reorderLevel:0,productionMargin:0,wholesaleMargin:0,bulkWholesaleMargin:0,retailMargin:0},[X,ee]=T.useState($),z=X.purchasePrice*(1+(X.productionMargin||0)/100),K=X.purchasePrice*(1+(X.wholesaleMargin||0)/100),ae=X.purchasePrice*(1+(X.bulkWholesaleMargin||0)/100),oe=X.purchasePrice*(1+(X.retailMargin||0)/100),re=T.useMemo(()=>{const le=n||[],Xe=le.reduce((ot,ve)=>ot+Number(ve.purchasePrice||ve.costPrice||0)*Number(ve.stockQuantity||0),0),qe=le.filter(ot=>(ot.stockQuantity||0)<=(ot.minReorderLevel||0)&&(ot.stockQuantity||0)>0).length,Ge=le.filter(ot=>(ot.stockQuantity||0)<=0).length;return{total:le.length,totalValue:Xe,lowStock:qe,outOfStock:Ge}},[n]),F=T.useMemo(()=>{let le=n||[];if(_!=="all"&&(le=le.filter(Xe=>Xe.categoryId==_)),y.trim()){const Xe=y.toLowerCase();le=le.filter(qe=>(qe.name||"").toLowerCase().includes(Xe)||(qe.code||"").toLowerCase().includes(Xe))}return le},[n,y,_]),O=()=>{x(null),ee($),A([]),h(!0)},J=le=>{x(le),ee({name:le.name||"",description:le.description||"",categoryId:le.categoryId||null,unit:le.unit||"قطعة",purchasePrice:le.purchasePrice||le.costPrice||0,reorderLevel:le.minReorderLevel||0,productionMargin:le.productionMargin||0,wholesaleMargin:le.wholesaleMargin||0,bulkWholesaleMargin:le.bulkWholesaleMargin||0,retailMargin:le.retailMargin||0});
327try{const Xe=le.description?JSON.parse(le.description):[];A(Array.isArray(Xe)?Xe:[])}catch{A(le.description?[le.description]:[])}h(!0)},q=async()=>{try{if(!X.name.trim()){_e.error("الاسم مطلوب");return}const le={name:X.name,description:JSON.stringify(S),categoryId:X.categoryId,unit:X.unit,purchasePrice:X.purchasePrice,minReorderLevel:X.reorderLevel,productionMargin:X.productionMargin,wholesaleMargin:X.wholesaleMargin,bulkWholesaleMargin:X.bulkWholesaleMargin,retailMargin:X.retailMargin,wholesalePrice:K,bulkWholesalePrice:ae};p?(await a.mutateAsync({id:p.id,data:le}),_e.success("تم التحديث")):(await s.mutateAsync(le),_e.success("تم الإضافة")),h(!1),t()}catch{_e.error("حدث خطأ")}},Q=async()=>{if(G)try{await o.mutateAsync({id:G.id}),_e.success("تم الحذف"),k(null),t()}catch{_e.error("حدث خطأ")}},ne=[{key:"",label:"الكل"},{key:"purchase",label:"شراء"},{key:"sale",label:"بيع"},{key:"production",label:"إنتاج"},{key:"adjustment",label:"تسوية"}],Z=le=>{switch(le){case"purchase":return"bg-emerald-100 text-emerald-800";case"sale":return"bg-red-100 text-red-800";case"production":return"bg-blue-100 text-blue-800";case"adjustment":return"bg-amber-100 text-amber-800";default:return"bg-teal-50 text-teal-800"}},se=le=>{switch(le){case"purchase":return"شراء";case"sale":return"بيع";case"production":return"إنتاج";case"adjustment":return"تسوية";default:return le}},{data:me}=Pe.rawMaterials.get.useQuery({id:E?.id??0},{enabled:!!E}),ze=Number(E?.id??p?.id??0),{data:Be,isLoading:ye}=Pe.rawMaterials.movements.useQuery({materialId:E?.id??0},{enabled:!!E}),{data:Le}=Pe.rawMaterials.images.useQuery({materialId:ze},{enabled:ze>0}),Ce=me?.images,Re=(Array.isArray(Le)&&Le.length>0?Le:Array.isArray(Ce)&&Ce.length>0?Ce:Array.isArray(E?.images)?E.images:[]).filter(Boolean),De=le=>String(le?.url||le?.fileUrl||""),{data:he}=Pe.materialCategories.list.useQuery();if(E){const le=me||E,Xe=he?.find(Y=>Y.id===le.categoryId),qe=(le.stockQuantity||0)<=(le.minReorderLevel||0)&&(le.stockQuantity||0)>0,Ge=(le.stockQuantity||0)<=0,ot=(le.purchasePrice||0)*(le.stockQuantity||0);let ve=[];try{ve=JSON.parse(le.description||"[]")}catch{le.description&&(ve=[le.description])}const mt=(Be||[]).filter(Y=>!I||Y.type===I);let ge=le.stockQuantity||0;return[...mt].reverse().map(Y=>{const je=Y.type==="purchase",Ie=Y.quantity||0;return je?ge-=Ie:ge+=Ie,{...Y,runningBalance:ge,isOutgoing:!je,totalValue:ge*(Y.unitPrice||0)}}).reverse(),i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",className:"space-y-4",children:[i.jsxs("button",{onClick:()=>{C(null),D(""),P(!1)},className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[i.jsx(D2,{className:"w-4 h-4"})," العودة للمخزون"]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-card border border-border rounded-lg p-4",children:[i.jsx("div",{className:"w-full aspect-square rounded-lg bg-muted flex items-center justify-center mb-3",children:Re.length>0&&De(Re[0])?i.jsx("img",{src:De(Re[0]),alt:le.name,className:"w-full h-full object-cover rounded-lg"}):i.jsxs("div",{className:"text-center text-muted-foreground",children:[i.jsx(tN,{className:"w-8 h-8 mx-auto mb-2"}),i.jsx("span",{className:"text-xs",children:"لا توجد صور"})]})}),Re.length>1&&i.jsx("div",{className:"grid grid-cols-4 gap-1",children:Re.slice(1,5).map(Y=>i.jsx("div",{className:"aspect-square rounded bg-muted overflow-hidden",children:i.jsx("img",{src:De(Y),alt:"",className:"w-full h-full object-cover"})},Y.id))})]}),i.jsxs("div",{className:"lg:col-span-2 bg-card border border-border rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-start justify-between mb-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-bold text-foreground",children:le.name}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[Xe&&i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-primary/10 text-primary",children:Xe.name}),Ge&&i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-red-100 text-red-700",children:"نفذ المخزون"}),qe&&i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-amber-100 text-amber-700",children:"مخزون منخفض"})]})]}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx("button",{onClick:()=>{C(null),J(le)},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground",children:i.jsx(hh,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>k(le),className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-red-500",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]}),ve.length>0&&i.jsx("div",{className:"mb-3",children:i.jsx("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-0.5",children:ve.map((Y,je)=>i.jsx("li",{children:Y},je))})}),i.jsxs("div",{className:"grid grid-cols-4 gap-2 mt-3",children:[i.jsxs("div",{className:"bg-muted/50 rounded-lg p-2 text-center",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"المخزون"}),i.jsx("p",{className:`text-lg font-bold ${Ge?"text-red-500":qe?"text-amber-500":"text-foreground"}
327`,children:le.stockQuantity||0}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:le.unit})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-2 text-center",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"سعر الشراء"}),i.jsxs("p",{className:"text-lg font-bold text-foreground",children:[(le.purchasePrice||0).toFixed(2),"$"]})]}),i.jsxs("div",{className:"bg-primary/10 rounded-lg p-2 text-center",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"قيمة المخزون"}),i.jsxs("p",{className:"text-lg font-bold text-primary",children:[ot.toFixed(2),"$"]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-2 text-center",children:[i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"حد إعادة الطلب"}),i.jsx("p",{className:"text-lg font-bold text-foreground",children:le.minReorderLevel||0}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:le.unit})]})]}),i.jsxs("div",{className:"mt-3 bg-muted/30 rounded-lg p-3 space-y-2",children:[i.jsx("h4",{className:"text-xs font-semibold text-foreground mb-2",children:"معلومات المادة (الأسعار والهوامش)"}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"الوحدة"}),i.jsx("span",{className:"text-foreground",children:le.unit})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"سعر الشراء"}),i.jsxs("span",{className:"text-foreground",children:[(le.purchasePrice||0).toFixed(2),"$"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"هامش الإنتاج"}),i.jsxs("span",{className:"text-foreground",children:[le.productionMargin||0,"%"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-primary font-semibold",children:"سعر الإنتاج"}),i.jsxs("span",{className:"text-primary font-semibold",children:[(le.purchasePrice*(1+(le.productionMargin||0)/100)).toFixed(2),"$"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"هامش الجملة"}),i.jsxs("span",{className:"text-foreground",children:[le.wholesaleMargin||0,"%"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-primary font-semibold",children:"سعر الجملة"}),i.jsxs("span",{className:"text-primary font-semibold",children:[(le.purchasePrice*(1+(le.wholesaleMargin||0)/100)).toFixed(2),"$"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"هامش جملة الجملة"}),i.jsxs("span",{className:"text-foreground",children:[le.bulkWholesaleMargin||0,"%"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-primary font-semibold",children:"سعر جملة الجملة"}),i.jsxs("span",{className:"text-primary font-semibold",children:[(le.purchasePrice*(1+(le.bulkWholesaleMargin||0)/100)).toFixed(2),"$"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"هامش المفرق"}),i.jsxs("span",{className:"text-foreground",children:[le.retailMargin||0,"%"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-primary font-semibold",children:"سعر المفرق"}),i.jsxs("span",{className:"text-primary font-semibold",children:[(le.purchasePrice*(1+(le.retailMargin||0)/100)).toFixed(2),"$"]})]})]})]})]})]}),i.jsxs("div",{className:"bg-card border border-border rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"كشف حركة المادة"}),i.jsx("button",{onClick:()=>P(!B),className:"p-1.5 rounded hover:bg-muted",children:B?i.jsx(QY,{className:"w-4 h-4 text-muted-foreground"}):i.jsx(B2,{className:"w-4 h-4 text-muted-foreground"})})]}),i.jsx("div",{className:"flex gap-1 mb-3",children:ne.map(Y=>i.jsx("button",{onClick:()=>D(Y.key),className:`px-3 py-1 rounded text-xs transition-colors ${I===Y.key?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:Y.label},Y.key))}),i.jsx("div",{className:`overflow-x-auto ${B?"max-h-[70vh]":"max-h-[400px]"}`,children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur",children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"#"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"البيان"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"التاريخ"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"دخول"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"خرج"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"الرصيد"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"قيمة الوحدة"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"الإجمالي"})]})}),i.jsx("tbody",{children:ye?i.jsx("tr",{children:i.jsx("td",{colSpan:8,className:"text-center p-4 text-muted-foreground",children:"جاري التحميل..."})}):mt.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:8,className:"text-center p-4 text-muted-foreground",children:"لا توجد حركات"})}):mt.map((Y,je)=>{const Ie=Y.type==="purchase",Ve=Y.quantity||0;return i.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30",children:[i.jsx("td",{className:"p-2 text-muted-foreground",children:je+1}),i.jsxs("td",{className:"p-2",children:[i.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${Z(Y.type)}`,children:se(Y.type)}),Y.notes&&i.jsx("span",{className:"text-muted-foreground mr-1",children:Y.notes})]}),i.jsx("td",{className:"p-2 text-muted-foreground",children:Y.createdAt?new Date(Y.createdAt).toLocaleDateString("ar"):"-"}),i.jsx("td",{className:"p-2",children:Ie?i.jsxs("span",{className:"text-emerald-600 font-medium",children:["+",Ve]}):i.jsx("span",{className:"text-muted-foreground",children:"-"})}),i.jsx("td",{className:"p-2",children:Ie?i.jsx("span",{className:"text-muted-foreground",children:"-"}):i.jsxs("span",{className:"text-red-500 font-medium",children:["-",Ve]})}),i.jsx("td",{className:"p-2 font-bold text-foreground",children:Y.stockQuantity??"-"}),i.jsx("td",{className:"p-2 text-muted-foreground",children:(Y.unitPrice||0).toFixed(2)}),i.jsx("td",{className:"p-2 font-bold text-primary",children:((Y.stockQuantity||0)*(Y.unitPrice||0)).toFixed(2)})]},Y.id)})}),i.jsx("tfoot",{children:i.jsxs("tr",{className:"bg-primary/10 sticky bottom-0",children:[i.jsxs("td",{colSpan:5,className:"p-2 text-xs font-medium text-primary",children:["الرصيد الحالي: ",le.stockQuantity||0," ",le.unit]}),i.jsxs("td",{colSpan:3,className:"p-2 text-xs font-bold text-primary",children:["قيمة المخزون: ",ot.toFixed(2),"$"]})]})})]})})]})]})}return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-5",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(ma,{className:"w-5 h-5 text-primary"}),"مخزون المواد الأولية",i.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",n?.length||0,")"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"إدارة المواد الخام والمخزون والمستويات"})]}),i.jsxs(ke,{onClick:O,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," إضافة مادة"]})]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-5",children:[i.jsxs("div",{className:"bg-primary/10 border border-primary/30 rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي المواد"}),i.jsx("p",{className:"text-2xl font-bold text-primary",children:re.total})]}),i.jsx(nN,{className:"w-5 h-5 text-primary"})]}),i.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"قيمة المخزون"}),i.jsxs("p",{className:"text-2xl font-bold text-foreground",children:["$",re.totalValue.toFixed(2)]})]}),i.jsx(ma,{className:"w-5 h-5 text-muted-foreground"})]}),i.jsxs("div",{className:"bg-card border border-amber-500/30 rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"مخزون منخفض"}),i.jsx("p",{className:"text-2xl font-bold text-amber-500",children:re.lowStock})]}),i.jsx(up,{className:"w-5 h-5 text-amber-500"})]}),i.jsxs("div",{className:"bg-card border border-red-500/30 rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"نفذت"}),i.jsx("p",{className:"text-2xl font-bold text-red-500",children:re.outOfStock})]}),i.jsx(up,{className:"w-5 h-5 text-red-500"})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[220px] max-w-md",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),i.jsx(Ee,{value:y,onChange:le=>v(le.target.value),placeholder:"ابحث بالاسم أو الرمز...",className:"bg-card border-border text-foreground text-sm pr-9"})]}),i.jsxs(En,{value:_,onValueChange:M,children:[i.jsx(Tn,{className:"w-40 bg-card border-border",children:i.jsx(jn,{placeholder:"كل التصنيفات"})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"all",children:"كل التصنيفات"}),r?.map(le=>i.jsx(bt,{value:String(le.id),children:le.name}
327,le.id))]})]})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:e?Array.from({length:6}).map((le,Xe)=>i.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 animate-pulse",children:[i.jsx("div",{className:"h-4 bg-muted rounded w-32 mb-3"}),i.jsx("div",{className:"h-3 bg-muted rounded w-24"})]},Xe)):F.length===0?i.jsx("div",{className:"col-span-full text-center py-12 text-muted-foreground",children:y||_!=="all"?"لا توجد نتائج مطابقة":"لا توجد مواد خام"}):F.map(le=>{const Xe=r?.find(ve=>ve.id===le.categoryId),qe=(le.stockQuantity||0)<=(le.minReorderLevel||0)&&(le.stockQuantity||0)>0,Ge=(le.stockQuantity||0)<=0,ot=Number(le.purchasePrice||le.costPrice||0)*Number(le.stockQuantity||0);return i.jsxs("div",{className:`bg-card border rounded-lg p-4 hover:border-primary/30 transition-all cursor-pointer ${Ge?"border-red-500/50":qe?"border-amber-500/50":"border-border"}`,onClick:()=>C(le),children:[i.jsxs("div",{className:"flex items-start justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[Array.isArray(le.images)&&le.images.length>0&&De(le.images[0])?i.jsx("img",{src:De(le.images[0]),alt:le.name,className:"h-8 w-8 rounded-lg object-cover border border-border"}):i.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:i.jsx(ma,{className:"w-4 h-4 text-primary"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-semibold text-foreground text-sm",children:le.name}),i.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[Xe&&i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary",children:Xe.name}),Ge&&i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-700",children:"نفذ"}),qe&&i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-100 text-amber-700",children:"منخفض"})]})]})]}),i.jsxs("div",{className:"flex gap-1",onClick:ve=>ve.stopPropagation(),children:[i.jsx("button",{onClick:()=>C(le),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-primary transition-colors",children:i.jsx(jc,{className:"w-3.5 h-3.5"})}),i.jsx("button",{onClick:()=>J(le),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:i.jsx(hh,{className:"w-3.5 h-3.5"})}),i.jsx("button",{onClick:()=>k(le),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-red-500 transition-colors",children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("div",{className:"space-y-1.5 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"الوحدة"}),i.jsx("span",{className:"text-foreground font-medium",children:le.unit||"-"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"سعر الشراء"}),i.jsx("span",{className:"text-foreground",children:le.purchasePrice?`${(le.purchasePrice||le.costPrice||0).toFixed(2)} $`:"-"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"المخزون"}),i.jsx("span",{className:`font-semibold ${Ge?"text-red-500":qe?"text-amber-500":"text-foreground"}`,children:le.stockQuantity||0})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"قيمة المخزون"}),i.jsxs("span",{className:"text-primary font-medium",children:["$",ot.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"حد الطلب"}),i.jsx("span",{className:"text-foreground",children:le.minReorderLevel||0})]}),(le.wholesalePrice||0)>0&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"جملة"}),i.jsxs("span",{className:"text-foreground",children:[(le.wholesalePrice||0).toFixed(2)," $"]})]}),(le.bulkWholesalePrice||0)>0&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"جملة كبيرة"}),i.jsxs("span",{className:"text-foreground",children:[(le.bulkWholesalePrice||0).toFixed(2)," $"]})]})]})]},le.id)})}),d&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:()=>h(!1),children:i.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg max-h-[90vh] overflow-y-auto",onClick:le=>le.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border sticky top-0 bg-card",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:p?"تعديل المادة":"إضافة مادة جديدة"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:p?"قم بتعديل بيانات المادة":"أدخل بيانات المادة الخام"})]}),i.jsx("button",{onClick:()=>h(!1),className:"text-muted-foreground hover:text-foreground transition-colors",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم المادة *"}),i.jsx(Ee,{value:X.name,onChange:le=>ee({...X,name:le.target.value}),placeholder:"اسم المادة الخام",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف (بنود)"}),i.jsxs("div",{className:"space-y-1.5",children:[S.map((le,Xe)=>i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-primary text-xs",children:"•"}),i.jsx(Ee,{value:le,onChange:qe=>{const Ge=[...S];Ge[Xe]=qe.target.value,A(Ge)},placeholder:"بند وصف...",className:"bg-muted/50 border-border text-foreground text-sm flex-1"}),i.jsx("button",{onClick:()=>A(S.filter((qe,Ge)=>Ge!==Xe)),className:"p-1 text-red-400 hover:text-red-300",children:i.jsx(Mr,{className:"w-3 h-3"})})]},Xe)),i.jsxs("button",{type:"button",onClick:()=>A([...S,""]),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 transition-colors",children:[i.jsx(Nn,{className:"w-3 h-3"})," إضافة بند جديد"]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"التصنيف *"}),i.jsxs(En,{value:X.categoryId?String(X.categoryId):void 0,onValueChange:le=>ee({...X,categoryId:parseInt(le)}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر التصنيف"})}),i.jsx(Rn,{dir:"rtl",children:r?.map(le=>i.jsx(bt,{value:String(le.id),children:le.name}
327,le.id))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوحدة"}),i.jsxs(En,{value:X.unit||"قطعة",onValueChange:le=>ee({...X,unit:le}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"قطعة",children:"قطعة"}),i.jsx(bt,{value:"كيلوغرام",children:"كيلوغرام"}),i.jsx(bt,{value:"متر",children:"متر"}),i.jsx(bt,{value:"لتر",children:"لتر"}),i.jsx(bt,{value:"مجموعة",children:"مجموعة"}),i.jsx(bt,{value:"علبة",children:"علبة"})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"سعر الشراء ($)"}),i.jsx(Ee,{type:"number",step:"0.01",value:X.purchasePrice,onChange:le=>ee({...X,purchasePrice:parseFloat(le.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"ltr"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"حد الطلب الأدنى"}),i.jsx(Ee,{type:"number",value:X.reorderLevel,onChange:le=>ee({...X,reorderLevel:parseFloat(le.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"ltr"})]})]}),i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3 space-y-2",children:[i.jsx("h4",{className:"text-xs font-semibold text-foreground",children:"الهوامش والأسعار المحسوبة"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش الإنتاج %"}),i.jsx(Ee,{type:"number",value:X.productionMargin,onChange:le=>ee({...X,productionMargin:parseFloat(le.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"ltr"}),i.jsxs("p",{className:"text-[10px] text-primary mt-0.5",children:["= ",z.toFixed(2),"$"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش الجملة %"}),i.jsx(Ee,{type:"number",value:X.wholesaleMargin,onChange:le=>ee({...X,wholesaleMargin:parseFloat(le.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"ltr"}),i.jsxs("p",{className:"text-[10px] text-primary mt-0.5",children:["= ",K.toFixed(2),"$"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش جملة الجملة %"}),i.jsx(Ee,{type:"number",value:X.bulkWholesaleMargin,onChange:le=>ee({...X,bulkWholesaleMargin:parseFloat(le.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"ltr"}),i.jsxs("p",{className:"text-[10px] text-primary mt-0.5",children:["= ",ae.toFixed(2),"$"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"هامش المفرق %"}),i.jsx(Ee,{type:"number",value:X.retailMargin,onChange:le=>ee({...X,retailMargin:parseFloat(le.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"ltr"}),i.jsxs("p",{className:"text-[10px] text-primary mt-0.5",children:["= ",oe.toFixed(2),"$"]})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الصور"}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("label",{className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-muted/50 border border-border text-sm text-muted-foreground hover:text-foreground cursor-pointer transition-colors",children:[i.jsx(F2,{className:"w-3 h-3"})," اختر صور",i.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:async le=>{const Xe=le.target.files;if(!(!Xe||Xe.length===0)){if(!p){_e.error("يجب حفظ المادة أولاً ثم رفع الصور");return}try{const qe=Re,Ge=Number(p.id);for(let ot=0;ot<Xe.length;ot+=1){const ve=Xe[ot],mt=await new Promise((ge,Y)=>{const je=new FileReader;je.onload=()=>ge(String(je.result||"")),je.onerror=()=>Y(new Error("تعذر قراءة ملف الصورة")),je.readAsD
327ataURL(ve)}),xt=await l.mutateAsync({materialId:Ge,fileBase64:mt,fileName:ve.name,mimeType:ve.type||"image/png",order:qe.length+ot});if(!xt?.url||!xt?.image)throw new Error("لم يتم حفظ الصورة في قاعدة البيانات")}await u.rawMaterials.images.invalidate({materialId:Ge}),await u.rawMaterials.images.refetch({materialId:Ge}),await u.rawMaterials.list.invalidate(),await t(),_e.success("تم رفع الصور وحفظها وتحديث المعاينة")}catch(qe){_e.error(qe instanceof Error?qe.message:"فشل رفع الصور")}finally{le.target.value=""}}}})]})}),p&&Re.length>0&&i.jsx("div",{className:"mt-3 grid grid-cols-5 gap-2",children:Re.map(le=>i.jsx("img",{src:De(le),alt:"صورة المادة",className:"h-14 w-full rounded-md border border-border object-cover"},le.id||le.url||le.fileUrl))})]})]}),i.jsxs("div",{className:"flex justify-start gap-2 p-4 border-t border-border sticky bottom-0 bg-card",children:[i.jsx(ke,{onClick:()=>h(!1),variant:"outline",className:"border-border text-muted-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:q,className:"bg-primary hover:bg-primary/90 text-primary-foreground",disabled:s.isPending||a.isPending,children:p?"تحديث":"إضافة"})]})]})}),G&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:()=>k(null),children:i.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-sm p-6 text-center",onClick:le=>le.stopPropagation(),children:[i.jsx("h3",{className:"text-lg font-bold text-red-500 mb-2",children:"تأكيد الحذف"}),i.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:['هل أنت متأكد من حذف المادة "',G.name,'"؟ لا يمكن التراجع عن هذا الإجراء.']}),i.jsxs("div",{className:"flex justify-center gap-2",children:[i.jsx(ke,{onClick:()=>k(null),variant:"outline",className:"border-border text-muted-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:Q,className:"bg-red-500 hover:bg-red-600 text-white",children:"حذف"})]})]})}),V&&i.jsx("div",{className:"fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4",onClick:()=>U(null),children:i.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-3xl max-h-[90vh] overflow-y-auto",onClick:le=>le.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsxs("h3",{className:"text-lg font-bold text-foreground",children:["فاتورة شراء رقم ",V.number||"-"]}),i.jsx("button",{onClick:()=>U(null),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"المورد: "}),i.jsx("span",{className:"text-foreground",children:V.supplierName||"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-muted-foreground",children:"التاريخ: "}),i.jsx("span",{className:"text-foreground",children:V.date?new Date(V.date).toLocaleDateString("ar"):"-"})]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"لم يتم ربط فواتير الشراء بالتفاصيل بعد - سيتم التطبيق الكامل لاحقاً"})]})]})})]})}function wse(){const{data:n,isLoading:e,refetch:t}=Pe.materialCategories.list.useQuery(),r=Pe.materialCategories.create.useMutation(),s=Pe.materialCategories.update.useMutation(),a=Pe.materialCategories.delete.useMutation(),[o,l]=T.useState(!1),[u,d]=T.useState(null),[h,p]=T.useState({name:"",description:""}),x=()=>{d(null),p({name:"",description:""}),l(!0)},y=S=>{d(S),p(S),l(!0)},v=async()=>{try{u?(await s.mutateAsync({id:u.id,data:h}),_e.success("تم التحديث")):(await r.mutateAsync(h),_e.success("تم الإضافة")),l(!1),t()}catch{_e.error("حدث خطأ")}},_=async S=>{if(confirm("هل أنت متأكد؟"))try{await a.mutateAsync({id:S.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},M=[{key:"name",label:"اسم التصنيف"},{key:"description",label:"الوصف"}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"}
327,dir:"rtl",children:[i.jsx(Eh,{title:"تصنيفات المواد",columns:M,data:n||[],loading:e,searchKey:"name",onAdd:x,onEdit:y,onDelete:_}),i.jsxs(Qo,{open:o,onOpenChange:l,title:u?"تعديل تصنيف":"إضافة تصنيف",onSubmit:v,children:[i.jsx(Vt,{label:"اسم التصنيف",children:i.jsx(Ee,{value:h.name,onChange:S=>p({...h,name:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الوصف",children:i.jsx(ni,{value:h.description,onChange:S=>p({...h,description:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]})]})}function Sse(){const{data:n,isLoading:e,refetch:t}=Pe.inventoryAdjustments.list.useQuery(),{data:r}=Pe.rawMaterials.list.useQuery(),{data:s}=Pe.materialCategories.list.useQuery(),a=Pe.inventoryAdjustments.create.useMutation(),o=Pe.inventoryAdjustments.delete.useMutation(),l=Pe.useUtils(),[u,d]=T.useState(!1),[h,p]=T.useState(null),[x,y]=T.useState(""),[v,_]=T.useState(""),[M,S]=T.useState("all"),[A,E]=T.useState(!1),[C,I]=T.useState({}),D=T.useMemo(()=>r||[],[r]),B=T.useMemo(()=>{let $=D;if(M!=="all"&&($=$.filter(X=>X.categoryId==M)),v.trim()){const X=v.toLowerCase();$=$.filter(ee=>(ee.name||"").toLowerCase().includes(X))}return A&&($=$.filter(X=>{const ee=C[X.id];return ee!==void 0&&ee!==(X.stockQuantity||0)})),$},[D,M,v,A,C]),P=T.useMemo(()=>D.filter($=>{const X=C[$.id];return X!==void 0&&X!==($.stockQuantity||0)}).length,[D,C]),G=T.useMemo(()=>D.reduce(($,X)=>{const ee=C[X.id];if(ee===void 0||ee===(X.stockQuantity||0))return $;const z=ee-(X.stockQuantity||0);return $+z*(X.purchasePrice||0)},0),[D,C]),k=T.useCallback(($,X)=>{const ee=X===""?void 0:parseFloat(X);I(z=>{const K={...z};return ee===void 0?delete K[$]:K[$]=ee,K})},[]),V=()=>{y(""),_(""),S("all"),E(!1),I({}),d(!0)},U=async()=>{if(!x.trim()){_e.error("السبب مطلوب");return}const $=D.filter(X=>{const ee=C[X.id];return ee!==void 0&&ee!==(X.stockQuantity||0)});if($.length===0){_e.error("لم يتم تعديل أي كمية فعلية");return}try{const X={adjustmentNumber:"",date:new Date,notes:x},ee=$.map(z=>({rawMaterialId:z.id,rawMaterialName:z.name,previousQuantity:z.stockQuantity||0,newQuantity:C[z.id],reason:x}));await a.mutateAsync({data:X,items:ee}),_e.success(`تم حفظ الجردة (${$.length} مادة)`),d(!1),t(),l.rawMaterials.list.invalidate()}catch{_e.error("حدث خطأ أثناء الحفظ")}};return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-5",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(Sw,{className:"w-5 h-5 text-primary"}),"جردة المخزون",i.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",n?.length||0,")"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"سجل جردات المخزون وتعديلات الكميات الفعلية"})]}),i.jsxs(ke,{onClick:V,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," جردة جديدة"]})]}),i.jsx(Qa,{open:u,onOpenChange:d,children:i.jsxs(Ka,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",dir:"rtl",children:[i.jsxs(Ja,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Sw,{className:"w-5 h-5 text-primary"}),i.jsx(Za,{className:"text-lg font-bold",children:"جردة مخزون جديدة"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"أدخل السبب ثم عدّل الكميات الفعلية للمواد"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"السبب"}),i.jsx(Ee,{value:x,onChange:$=>y($.target.value),placeholder:"مثال: جردة شهرية يوليو",className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}
327),i.jsx(Ee,{value:v,onChange:$=>_($.target.value),placeholder:"بحث باسم المادة...",className:"bg-muted/50 border-border text-foreground text-sm pr-9"})]}),i.jsxs(En,{value:M,onValueChange:S,children:[i.jsx(Tn,{className:"w-40 bg-muted/50 border-border text-foreground",children:i.jsx(jn,{placeholder:"جميع التصنيفات"})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"all",children:"جميع التصنيفات"}),s?.map($=>i.jsx(bt,{value:String($.id),children:$.name},$.id))]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{checked:A,onCheckedChange:E}),i.jsx("span",{className:"text-sm text-foreground",children:"عرض المواد المتغيرة فقط"})]})]}),i.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:i.jsxs("div",{className:"overflow-y-auto max-h-[50vh]",children:[i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur",children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium w-10",children:"#"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"اسم المادة"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"التصنيف"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"الكمية في النظام"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"الكمية الفعلية"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"الفرق"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"قيمة الفرق"})]})}),i.jsx("tbody",{children:B.map(($,X)=>{const ee=C[$.id],z=$.stockQuantity||0,K=ee!==void 0?ee-z:0,ae=s?.find(oe=>oe.id===$.categoryId);return i.jsxs("tr",{className:`border-b border-border/50 ${K!==0?"bg-amber-500/5":""}`,children:[i.jsx("td",{className:"p-2 text-muted-foreground text-xs",children:X+1}),i.jsx("td",{className:"p-2 font-medium text-foreground",children:$.name}),i.jsx("td",{className:"p-2",children:ae&&i.jsx(Ul,{variant:"outline",className:"text-[10px]",children:ae.name})}),i.jsxs("td",{className:"p-2 text-muted-foreground",children:[z.toFixed(2)," ",$.unit||""]}),i.jsx("td",{className:"p-2",children:i.jsx(Ee,{type:"number",value:ee!==void 0?String(ee):"",onChange:oe=>k($.id,oe.target.value),placeholder:String(z),className:"bg-background border-border text-foreground text-sm w-24",min:0})}),i.jsx("td",{className:"p-2",children:K!==0?i.jsxs("span",{className:K>0?"text-emerald-600 font-bold":"text-red-500 font-bold",children:[K>0?"+":"",K]}):"-"}),i.jsx("td",{className:"p-2 text-muted-foreground",children:K!==0?`${(K*($.purchasePrice||0)).toFixed(2)}$`:"-"})]},$.id)})})]}),B.length===0&&i.jsx("div",{className:"text-center p-6 text-muted-foreground text-sm",children:"لا توجد مواد"})]})}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 bg-muted/40 rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(ma,{className:"w-4 h-4"}),"إجمالي المواد المعروضة: ",i.jsx("strong",{className:"text-foreground",children:B.length})]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(jx,{className:"w-4 h-4 text-emerald-500"}),"مواد بها فرق: ",i.jsx("strong",{className:"text-foreground",children:P})]})]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:["صافي قيمة الفرق: ",i.jsxs("strong",{className:"text-primary",children:[G.toFixed(2),"$"]})]})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx(ke,{variant:"outline",onClick:()=>d(!1),children:"إلغاء"}),i.jsxs(ke,{onClick:U,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," حفظ الجردة (",P," مادة)"]})]})]})]})}),i.jsx(Qa,{open:!!h,onOpenChange:$=>!$&&p(null),children:i.jsxs(Ka,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",dir:"rtl",children:[i.jsxs(Ja,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Sw,{className:"w-5 h-5 text-primary"}
327),i.jsxs(Za,{className:"text-lg font-bold",children:["معاينة جردة: ",h?.adjustmentNumber]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:h?.notes||""})]}),i.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-muted/60",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"المادة"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"قبل"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"بعد"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"الفرق"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"قيمة الفرق"})]})}),i.jsxs("tbody",{children:[(h?.items||[]).map($=>{const X=($.newQuantity||0)-($.previousQuantity||0),ee=r?.find(z=>z.id===$.rawMaterialId)?.purchasePrice||0;return i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"p-2 font-medium text-foreground",children:$.rawMaterialName||"-"}),i.jsx("td",{className:"p-2",children:($.previousQuantity||0).toFixed(2)}),i.jsx("td",{className:"p-2",children:($.newQuantity||0).toFixed(2)}),i.jsxs("td",{className:`p-2 font-bold ${X>0?"text-emerald-600":X<0?"text-red-500":"text-muted-foreground"}`,children:[X>0?"+":"",X.toFixed(2)]}),i.jsxs("td",{className:"p-2",children:[(X*ee).toFixed(2)," $"]})]},$.id)}),(h?.items||[]).length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center p-4 text-muted-foreground text-sm",children:"لا توجد بنود"})})]})]})})]})}),i.jsx("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-muted/60",children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"#"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"رقم الجردة"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"السبب"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"المواد المعدلة"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"التاريخ"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"إجراءات"})]})}),i.jsx("tbody",{children:e?i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"text-center p-6 text-muted-foreground",children:"جاري التحميل..."})}):(n||[]).length===0?i.jsx("tr",{children:i.jsxs("td",{colSpan:6,className:"text-center p-8 text-muted-foreground",children:[i.jsx(Sw,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),"لا توجد جردات محفوظة"]})}):n?.map(($,X)=>i.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30 transition-colors",children:[i.jsx("td",{className:"p-3 text-muted-foreground",children:X+1}),i.jsx("td",{className:"p-3 font-medium text-foreground",children:$.adjustmentNumber}),i.jsx("td",{className:"p-3 text-muted-foreground",children:$.notes||"-"}),i.jsx("td",{className:"p-3",children:i.jsxs(Ul,{variant:"outline",children:[$.items?.length||0," مادة"]})}),i.jsx("td",{className:"p-3 text-muted-foreground",children:$.date?new Date($.date).toLocaleDateString("ar"):"-"}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:async()=>{try{const ee=await l.inventoryAdjustments.get.fetch({id:$.id});p(ee)}catch{_e.error("تعذر تحميل الجردة")}},className:"p-1.5 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary transition-colors",title:"معاينة",children:i.jsx(si,{className:"w-4 h-4"})}),i.jsx("button",{onClick:async()=>{if(confirm("هل أنت متأكد من حذف هذه الجردة؟ سيتم عكس التعديلات على المخزون."))try{await o.mutateAsync({id:$.id}
327),_e.success("تم الحذف"),t(),l.rawMaterials.list.invalidate()}catch{_e.error("حدث خطأ")}},className:"p-1.5 rounded hover:bg-red-500/10 text-muted-foreground hover:text-red-500 transition-colors",children:i.jsx(Mr,{className:"w-4 h-4"})})]})})]},$.id))})]})})]})}function _se(){const{data:n,isLoading:e}=Pe.rawMaterials.movementsAll.useQuery(),{data:t}=Pe.rawMaterials.list.useQuery(),[r,s]=T.useState(""),[a,o]=T.useState("all"),[l,u]=T.useState("all"),d=T.useMemo(()=>{const _=new Map;return(t||[]).forEach(M=>_.set(M.id,M)),_},[t]),h=[{key:"all",label:"كل الأنواع"},{key:"in",label:"دخول (شراء)"},{key:"out",label:"خرج (مبيعات/إنتاج)"},{key:"adjustment",label:"تسوية/جردة"}],p=_=>{switch(_){case"in":return{text:"دخول",cls:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"out":return{text:"خرج",cls:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"adjustment":return{text:"تسوية",cls:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"};default:return{text:_,cls:"bg-teal-50 text-teal-800"}}},x=_=>{switch(_){case"purchase_invoice":return"فاتورة شراء";case"production":return"أمر إنتاج";case"inventory_adjustment":return"جردة المخزون";case"sales":return"مبيعات";case"cashier_withdrawal":return"سحب أمين صندوق";default:return _||"-"}},y=T.useMemo(()=>{let _=n||[];if(a!=="all"&&(a==="in"?_=_.filter(M=>M.type==="in"):a==="out"?_=_.filter(M=>M.type==="out"):a==="adjustment"&&(_=_.filter(M=>M.type==="adjustment"))),l!=="all"&&(_=_.filter(M=>M.rawMaterialId==l)),r.trim()){const M=r.toLowerCase();_=_.filter(S=>(d.get(S.rawMaterialId)?.name||"").toLowerCase().includes(M)||(S.notes||"").toLowerCase().includes(M)||(S.referenceId||"").toLowerCase().includes(M))}return _},[n,a,l,r,d]),v=T.useMemo(()=>{const _=n||[],M=_.filter(E=>E.type==="in").reduce((E,C)=>E+(C.quantity||0),0),S=_.filter(E=>E.type==="out").reduce((E,C)=>E+(C.quantity||0),0),A=_.reduce((E,C)=>E+(C.quantity||0)*(C.unitPrice||0),0);return{total:_.length,totalIn:M,totalOut:S,totalValue:A}},[n]);return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsx("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-5",children:i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(Ly,{className:"w-5 h-5 text-primary"}),"حركة المواد",i.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",v.total,")"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"تتبع جميع حركات دخول وخرج المواد الأولية، بما فيها سحوبات أمناء الصندوق إلى الآلات"})]})}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-5",children:[i.jsxs("div",{className:"bg-primary/10 border border-primary/30 rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي الحركات"}),i.jsx("p",{className:"text-2xl font-bold text-primary",children:v.total})]}),i.jsx(Ly,{className:"w-5 h-5 text-primary"})]}),i.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي الدخول"}),i.jsxs("p",{className:"text-2xl font-bold text-emerald-600 dark:text-emerald-400",children:["+",v.totalIn]})]}),i.jsx(aN,{className:"w-5 h-5 text-emerald-500"})]}),i.jsxs("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي الخرج"}),i.jsxs("p",{className:"text-2xl font-bold text-red-500",children:["-",v.totalOut]})]}),i.jsx(yF,{className:"w-5 h-5 text-red-500"})]}),i.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"قيمة الحركات"}),i.jsxs("p",{className:"text-2xl font-bold text-foreground",children:["$",v.totalValue.toFixed(2)]})]}),i.jsx(nN,{className:"w-5 h-5 text-muted-foreground"})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[220px] max-w-md",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),i.jsx(Ee,{value:r,onChange:_=>s(_.target.value),placeholder:"ابحث بالاسم أو رقم المرجع...",className:"bg-card border-border text-foreground text-sm pr-9"})]}),i.jsxs(En,{value:a,onValueChange:o,children:[i.jsx(Tn,{className:"w-36 bg-card border-border",children:i.jsx(jn,{placeholder:"كل الأنواع"})}),i.jsx(Rn,{dir:"rtl",children:h.map(_=>i.jsx(bt,{value:_.key,children:_.label},_.key))})]}),i.jsxs(En,{value:l,onValueChange:u,children:[i.jsx(Tn,{className:"w-44 bg-card border-border",children:i.jsx(jn,{placeholder:"كل المواد"})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"all",children:"كل المواد"}),(t||[]).map(_=>i.jsx(bt,{value:String(_.id),children:_.name},_.id))]})]})]}),i.jsx("div",{className:"bg-card border border-border rounded-lg overflow-hidden",children:i.jsx("div",{className:"overflow-x-auto max-h-[65vh]",children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur",children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"#"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"المادة"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"النوع"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"المصدر"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"رقم المرجع"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"دخول"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"خرج"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"سعر الوحدة"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"الإجمالي"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"ملاحظات"}),i.jsx("th",{className:"text-right p-3 text-muted-foreground font-medium",children:"التاريخ"})]})}),i.jsx("tbody",{children:e?i.jsx("tr",{children:i.jsx("td",{colSpan:11,className:"text-center p-8 text-muted-foreground",children:"جاري التحميل..."})}):y.length===0?i.jsx("tr",{children:i.jsxs("td",{colSpan:11,className:"text-center p-8 text-muted-foreground",children:[i.jsx(ma,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),"لا توجد حركات مواد"]})}):y.map((_,M)=>{const S=d.get(_.rawMaterialId),A=p(_.type),E=_.type==="in";return i.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30 transition-colors",children:[i.jsx("td",{className:"p-3 text-muted-foreground",children:M+1}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-6 h-6 rounded bg-primary/10 flex items-center justify-center",children:i.jsx(ma,{className:"w-3 h-3 text-primary"})}),i.jsx("span",{className:"font-medium text-foreground",children:S?.name||"—"})]})}),i.jsx("td",{className:"p-3",children:i.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-medium ${A.cls}`,children:A.text})}),i.jsx("td",{className:"p-3 text-muted-foreground",children:x(_.referenceType)}),i.jsx("td",{className:"p-3 text-muted-foreground",children:_.referenceId||"-"}),i.jsx("td",{className:"p-3",children:E?i.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 font-bold",children:["+",_.quantity]}):"-"}),i.jsx("td",{className:"p-3",children:E?"-":i.jsxs("span",{className:"text-red-500 font-bold",children:["-",_.quantity]})}),i.jsx("td",{className:"p-3 text-muted-foreground",children:(_.unitPrice||0).toFixed(2)}),i.jsxs("td",{className:"p-3 font-bold text-primary",children:[((_.quantity||0)*(_.unitPrice||0)).toFixed(2),"$"]}),i.jsx("td",{className:"p-3 text-muted-foreground max-w-[150px] truncate",title:_.notes||"",children:_.notes||"-"}),i.jsx("td",{className:"p-3 text-muted-foreground",children:_.createdAt?new Date(_.createdAt).toLocaleStr
327ing("ar",{dateStyle:"medium"}):"-"})]},_.id)})})]})})})]})}function Mse(n,e){const t=String(n?.name??n?.materialName??"").trim().toLocaleLowerCase(),r=String(e??"").trim().toLocaleLowerCase();return!!t&&(!r||t.includes(r))}function Nse(n,e){const t=Number(e.stockQuantity||0),r=Number(e.purchasePrice||0),s=Number(e.productionMargin||0),a=r*(1+s/100),o=0;return{...n,materialId:e.id,materialName:e.name,unit:e.unit||"",availableQuantity:t,quantity:o,unitPrice:a,totalPrice:o*a}}const zC=n=>{const e=Number(n?.hourlyRate??0);if(Number.isFinite(e)&&e>0)return e;const t=Number(n?.salary??0);return Number.isFinite(t)&&t>0?t:0};function Ase(){const{data:n,isLoading:e,refetch:t}=Pe.productionOrders.list.useQuery(),{data:r}=Pe.clients.list.useQuery(),{data:s}=Pe.employees.list.useQuery(),{data:a,refetch:o}=Pe.rawMaterials.list.useQuery(void 0,{staleTime:0}),l=Pe.productionOrders.create.useMutation(),u=Pe.productionOrders.update.useMutation(),d=Pe.productionOrders.delete.useMutation(),h=Pe.productionOrders.addCost.useMutation(),p=Pe.productionOrders.deleteCost.useMutation(),x=Pe.productionOrders.uploadFile.useMutation(),y=Pe.productionOrders.addFile.useMutation(),v=Pe.productionOrders.deleteFile.useMutation(),_=Pe.productionOrders.addLog.useMutation(),M=Pe.useUtils(),[S,A]=T.useState(!1),[E,C]=T.useState(!1),[I,D]=T.useState(null),[B,P]=T.useState(null),[G,k]=T.useState("info"),[V,U]=T.useState(!1),[$,X]=T.useState(""),[ee,z]=T.useState({}),{data:K}=Pe.productionOrders.costReport.useQuery({id:B?.id||0},{enabled:!!B?.id&&E&&G==="report"}),[ae,oe]=T.useState("all"),[re,F]=T.useState(""),[O,J]=T.useState("labor"),[q,Q]=T.useState({}),[ne,Z]=T.useState([]),[se,me]=T.useState({}),[ze,Be]=T.useState(null),[ye,Le]=T.useState(null),Ce=T.useRef(null),Re={pending:"bg-yellow-500/20 text-yellow-400",in_progress:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",cancelled:"bg-red-500/20 text-red-400"},De={pending:"معلق",in_progress:"جاري",completed:"مكتمل",cancelled:"ملغي"},he=[{key:"all",label:"الكل"},{key:"pending",label:"معلق"},{key:"in_progress",label:"جاري"},{key:"completed",label:"مكتمل"},{key:"cancelled",label:"ملغي"}],le=()=>{D(null),z({machineName:"",quantity:1,status:"pending",orderDate:new Date().toISOString().split("T")[0],deliveryDate:"",notes:"",customerId:0,customerName:"",estimatedCost:0}),A(!0)},Xe=async ce=>{try{const Me=await M.productionDetail.get.fetch({id:ce.id});X(String(Me.estimatedCost||"")),P(Me),k("info"),C(!0)}catch{_e.error("حدث خطأ في تحميل التفاصيل")}},qe=async()=>{try{I?(await u.mutateAsync({id:I.id,data:ee}),_e.success("تم التحديث")):(await l.mutateAsync(ee),_e.success("تم الإنشاء")),A(!1),t()}catch{_e.error("حدث خطأ")}},Ge=async ce=>{if(confirm("هل أنت متأكد؟"))try{await d.mutateAsync({id:ce.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},ot=async(ce,Me)=>{try{await u.mutateAsync({id:ce,data:{status:Me}}),_e.success("تم تحديث الحالة"),t()}catch{_e.error("حدث خطأ")}},ve=async()=>{if(B)try{const ce={productionOrderId:B.id,costType:O,amount:parseFloat(q.amount||"0"),description:q.description||""};if(O==="labor"&&q.employeeId){const Fe=s?.find(at=>String(at.id)===String(q.employeeId)),ie=parseFloat(q.hours||"0"),Se=zC(Fe),Ae=ie*Se;ce.employeeId=Number(q.employeeId),ce.employeeName=Fe?.name||"",ce.hours=ie,ce.employeeHourlyRate=Se,ce.amount=Ae>0?Ae:parseFloat(q.amount||"0"),ce.description=`${Fe?.name||""} - ${q.description||"عمل"} (${ie} ساعة × ${Se} $)`}else if(O==="materials"){if(ne.length===0){_e.error("أضف مادة خام واحدة على الأقل");return}if(ne.some(Fe=>!Number(Fe.materialId)||Number(Fe.quantity||0)<=0)){_e.error("اختر المادة الخام وأدخل كمية صحيحة لكل صف");return}ce.materialItems=JSON.stringify(ne),ce.description=`${ne.length} مادة خام`}else O==="operating"&&(ce.description=q.description||"تشغيلية");await h.mutateAsync(ce),_e.success("تم إضافة التكلفة"),Q({}),Z([]),me({}),Be(null);const Me=await M.productionDetail.get.fetch({id:B.id});P(Me)}catch(ce){_e.error(ce?.message||"تعذر حفظ تكلفة المواد الخام")}},mt=async ce=>{if(confirm("حذف هذه التكلفة؟"))try{await p.mutateAsync({id:ce}),_e.success("تم الحذف");const Me=await M.productionDetail.get.fetch({id:B.id});P(Me)}catch{_e.error("حدث خطأ")}},xt=()=>{o(),Z([...ne,{materialId:0,materialName:"",quantity:0,unit:"",unitPrice:0,totalPrice:0}])},ge=(ce,Me,Fe)=>{const ie=[...ne];if(ie[ce]={...ie[ce],[Me]:Fe},Me==="materialId"){const Se=a?.find(Ae=>String(Ae.id)===String(Fe));Se&&(ie[ce]=Nse(ie[ce],Se))}(Me==="quantity"||Me==="unitPrice")&&(ie[ce].totalPrice=(ie[ce].quantity||0)*(ie[ce].unitPrice||0)),Z(ie)},Y=(ce,Me)=>{ge(ce,"materialId",String(Me.id)),me(Fe=>
327({...Fe,[ce]:Me.name||""})),Be(null)},je=ce=>{Z(ne.filter((Me,Fe)=>Fe!==ce)),me(Me=>{const Fe={};return Object.entries(Me).forEach(([ie,Se])=>{const Ae=Number(ie);Ae<ce&&(Fe[Ae]=Se),Ae>ce&&(Fe[Ae-1]=Se)}),Fe}),Be(Me=>Me===ce?null:Me!==null&&Me>ce?Me-1:Me)},Ie=async ce=>{const Me=ce.target.files?.[0];if(Me){try{const Fe=new FileReader;Fe.onload=async()=>{const ie=Fe.result,Se=await x.mutateAsync({fileBase64:ie,fileName:Me.name,mimeType:Me.type||"application/octet-stream",productionOrderId:B.id});await y.mutateAsync({productionOrderId:B.id,fileName:Me.name,fileUrl:Se.url,fileType:Se.fileType,fileSize:Se.fileSize}),_e.success("تم رفع الملف");const Ae=await M.productionDetail.get.fetch({id:B.id});P(Ae)},Fe.readAsDataURL(Me)}catch{_e.error("فشل رفع الملف")}ce.target.value=""}},Ve=async ce=>{if(confirm("حذف هذا الملف؟"))try{await v.mutateAsync({id:ce}),_e.success("تم الحذف");const Me=await M.productionDetail.get.fetch({id:B.id});P(Me)}catch{_e.error("حدث خطأ")}},ft=[{key:"orderNumber",label:"رقم الأمر"},{key:"machineName",label:"اسم الآلية"},{key:"customerName",label:"العميل",render:ce=>ce||"-"},{key:"status",label:"الحالة",render:ce=>i.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${Re[ce]||""}`,children:De[ce]||ce})},{key:"quantity",label:"الكمية"},{key:"totalCost",label:"التكلفة",render:ce=>ce?`${ce} $`:"-"}],vt={labor:"عمالة",materials:"مواد خام",operating:"تشغيلية"};return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-xl font-bold text-foreground",children:"أوامر الإنتاج"}),i.jsxs(ke,{onClick:le,className:"bg-primary hover:bg-primary/90 text-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," أمر جديد"]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[he.map(ce=>i.jsx("button",{onClick:()=>oe(ce.key),className:`px-3 py-1.5 rounded-full text-xs font-medium transition-colors ${ae===ce.key?"bg-primary text-foreground":"bg-muted/50 border border-border text-muted-foreground hover:text-foreground"}`,children:ce.label},ce.key)),i.jsxs("div",{className:"relative mr-auto",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx(Ee,{value:re,onChange:ce=>F(ce.target.value),placeholder:"بحث بأمر الإنتاج أو الآلية أو العميل...",className:"bg-muted/50 border-border text-foreground text-sm pr-9 w-64"})]})]}),i.jsx("div",{className:"bg-muted/50 rounded-xl border border-border p-4",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border",children:[ft.map(ce=>i.jsx("th",{className:"text-right py-3 px-3 text-muted-foreground font-medium",children:ce.label},ce.key)),i.jsx("th",{className:"text-right py-3 px-3 text-muted-foreground font-medium",children:"إجراءات"})]})}),i.jsx("tbody",{children:e?i.jsx("tr",{children:i.jsx("td",{colSpan:ft.length+1,className:"text-center py-8 text-muted-foreground/70",children:"جاري التحميل..."})}):n?.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:ft.length+1,className:"text-center py-8 text-muted-foreground/70",children:"لا توجد أوامر إنتاج"})}):(n||[]).filter(ce=>{if(ae!=="all"&&ce.status!==ae)return!1;if(re.trim()){const Me=re.toLowerCase();return(ce.orderNumber||"").toLowerCase().includes(Me)||(ce.machineName||"").toLowerCase().includes(Me)||(ce.customerName||"").toLowerCase().includes(Me)}return!0}).map(ce=>i.jsxs("tr",{className:"border-b border-border/50 hover:bg-accent/30",children:[ft.map(Me=>i.jsx("td",{className:"py-3 px-3 text-foreground",children:Me.render?Me.render(ce[Me.key]):ce[Me.key]||"-"},Me.key)),i.jsx("td",{className:"py-3 px-3",children:i.jsxs("div",{className:"flex gap-1",children:[i.jsx("button",{onClick:()=>Xe(ce),className:"p-1.5 rounded-lg hover:bg-accent text-primary",children:i.jsx(Ki,{className:"w-4 h-4"})}),i.jsxs(En,{value:ce.status,onValueChange:Me=>ot(ce.id,Me),children:[i.jsx(Tn,{className:"w-[90px] bg-muted/50 border-border text-foreground text-xs h-7",children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"pending",children:"معلق"}),i.jsx(bt,{value:"in_progress",children:"جاري"}),i.jsx(bt,{value:"completed",children:"مكتمل"}),i.jsx(bt,{value:"cancelled",children:"ملغي"})]})]}),i.jsx("button",{onClick:()=>Ge(ce),className:"p-1.5 rounded-lg hover:bg-accent text-red-400",children:i.jsx(Ar,{className:"w-4 h-4"})})]})})]},ce.id))})]})})}),S&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:()=>A(!1),children:i.jsxs("div",{className:"bg-white border border-border rounded-xl w-full max-w-xl",onClick:ce=>ce.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:I?"تعديل أمر إنتاج":"أمر إنتاج جديد"}),i.jsx("button",{onClick:()=>A(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم الآلية *"}),i.jsx(Ee,{value:ee.machineName||"",onChange:ce=>z({...ee,machineName:ce.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العميل"}),i.jsxs(En,{value:ee.customerId?String(ee.customerId):"",onValueChange:ce=>{const Me=r?.find(Fe=>String(Fe.id)===ce);z({...ee,customerId:Number(ce),customerName:Me?.name||""})},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"0",children:"بدون عميل"}),r?.map(ce=>i.jsx(bt,{value:String(ce.id),children:ce.name},ce.id))]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الكمية"}),i.jsx(Ee,{type:"number",value:ee.quantity||1,onChange:ce=>z({...ee,quantity:parseFloat(ce.target.value)||1}),className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"تاريخ الأمر"}),i.jsx(Ee,{type:"date",value:ee.orderDate||"",onChange:ce=>z({...ee,orderDate:ce.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"تاريخ التسليم"}),i.jsx(Ee,{type:"date",value:ee.deliveryDate||"",onChange:ce=>z({...ee,deliveryDate:ce.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"التكلفة التقديرية ($) — اختياري"}),i.jsx(Ee,{type:"number",value:ee.estimatedCost??0,onChange:ce=>z({...ee,estimatedCost:parseFloat(ce.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm",placeholder:"0",min:0,step:.
32701})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"ملاحظات"}),i.jsx(ni,{value:ee.notes||"",onChange:ce=>z({...ee,notes:ce.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>A(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:qe,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:l.isPending||u.isPending,children:l.isPending||u.isPending?"جاري...":"حفظ"})]})]})}),E&&B&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-start justify-center p-4 overflow-y-auto",onClick:()=>C(!1),children:i.jsxs("div",{className:"bg-white border border-border rounded-xl w-full max-w-4xl my-8",onClick:ce=>ce.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:()=>C(!1),className:"p-2 rounded-lg hover:bg-accent text-foreground",children:i.jsx(D2,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-xl font-bold text-foreground",children:B.orderNumber}),i.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:B.machineName})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`px-3 py-1.5 rounded-full text-xs font-medium ${Re[B.status]||""}`,children:De[B.status]||B.status}),i.jsx("button",{onClick:()=>C(!1),className:"p-2 rounded-lg hover:bg-accent text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-4 h-4"})})]})]}),i.jsxs("div",{className:"p-5 border-b border-border bg-muted/20",children:[i.jsx("div",{className:"flex items-center justify-between mb-2",children:i.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"تتبع حالة الإنتاج"})}),i.jsx("div",{className:"flex items-center gap-0",children:[{key:"pending",label:"قيد الانتظار",num:1},{key:"in_progress",label:"قيد التنفيذ",num:2},{key:"completed",label:"مكتمل",num:3}].map((ce,Me)=>{const Fe=B.status===ce.key,ie=["pending","in_progress","completed"].indexOf(B.status)>=Me;return i.jsxs("div",{className:"flex-1 flex items-center gap-3",children:[i.jsxs("div",{className:"flex flex-col items-center gap-1",children:[i.jsx("div",{className:`w-9 h-9 rounded-full flex items-center justify-center text-sm font-bold border-2 transition-colors ${Fe?"bg-primary text-primary-foreground border-primary":ie?"bg-primary/10 text-primary border-primary/50":"bg-muted/30 text-muted-foreground border-border"}`,children:ie&&!Fe?i.jsx(jx,{className:"w-4 h-4"}):ce.num}),i.jsx("span",{className:`text-xs font-medium ${Fe?"text-primary":"text-muted-foreground"}`,children:ce.label})]}),Me<2&&i.jsx("div",{className:`flex-1 h-0.5 mx-2 ${ie?"bg-primary/40":"bg-border"}`})]},ce.key)})})]}),i.jsx("div",{className:"flex border-b border-border",children:[{id:"info",label:"المعلومات",icon:HY},{id:"quotation",label:"تفاصيل العرض",icon:Ki},{id:"costs",label:"التكاليف",icon:k2},{id:"report",label:"تقرير التكلفة",icon:S_},{id:"timeline",label:"سجل المتابعة",icon:Cu},{id:"files",label:"الملفات",icon:KD}].map(ce=>i.jsxs("button",{onClick:()=>k(ce.id),className:`flex-1 py-3 text-sm font-medium transition-colors flex items-center justify-center gap-1.5 ${G===ce.id?"text-primary bg-primary/5 border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:[i.jsx(ce.icon,{className:"w-4 h-4"}),ce.label]},ce.id))}),i.jsxs("div",{className:"p-4 max-h-[60vh] overflow-y-auto",children:[G==="info"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"الماكينه"}),i.jsx("div",{className:"text-foreground font-bold",children:B.machineName||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"الحد"}),i.jsx("div",{className:"text-foreground font-bold",children:B.quantity})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"العميل"}),i.jsx("div",{className:"text-foreground font-bold",children:B.customerName||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"تاريخ الطلب"}),i.jsx("div",{className:"text-foreground font-bold",children:B.orderDate||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"التسليم"}),i.jsx("div",{className:"text-foreground font-bold",children:B.deliveryDate||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"التكلفة التقديرية"}),V?i.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[i.jsx(Ee,{type:"number",value:$,onChange:ce=>X(ce.target.value),className:"bg-white border-border text-foreground text-sm h-8",placeholder:"0",min:0}),i.jsx("button",{onClick:async()=>{try{await u.mutateAsync({id:B.id,data:{estimatedCost:parseFloat($)||0}}),_e.success("تم تحديث التكلفة التقديرية"),U(!1);const ce=await M.productionDetail.get.fetch({id:B.id});P(ce),t()}catch{_e.error("حدث خطأ")}},className:"p-1.5 rounded-lg bg-primary/10 text-primary",children:i.jsx(jx,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>U(!1),className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground",children:i.jsx(Mr,{className:"w-4 h-4"})})]}):i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("div",{className:"text-foreground font-bold",children:B.estimatedCost?`${B.estimatedCost} $`:"-"}),i.jsx("button",{onClick:()=>U(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",children:i.jsx(tQ,{className:"w-3.5 h-3.5"})})]})]})]}),B.notes&&i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"ملاحظات"}),i.jsx("div",{className:"text-foreground text-sm",children:B.notes})]})]}),G==="quotation"&&(()=>{const ce=B.quotationSnapshot;return ce?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"رقم العرض"}),i.jsx("div",{className:"font-bold text-foreground",children:ce.quotationNumber||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"العميل"}),i.jsx("div",{className:"font-bold text-foreground",children:ce.customer?.name||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"طريقة التسليم"}),i.jsx("div",{className:"font-bold text-foreground",children:ce.delivery?.method||"-"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"مدة التسليم"}),i.jsx("div",{className:"font-bold text-foreground",children:ce.delivery?.duration||"-"})]})]}),i.jsx("div",{className:"border border-border rounded-lg overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50 text-right",children:[i.jsx("th",{className:"p-3",children:"البند"}),i.jsx("th",{className:"p-3",children:"المواصفات"}),i.jsx("th",{className:"p-3",children:"الكمية"}),i.jsx("th",{className:"p-3",children:"السعر"}),i.jsx("th",{className:"p-3",children:"الإجمالي"})]})}),i.jsx("tbody",{children:(ce.items||[]).length?(ce.items||[]).map((Me,Fe)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3 font-medium",children:i.jsxs("div",{className:"flex items-center gap-2",children:[Me.name||"-",Me.itemType==="material"&&i.jsx("span",{className:"rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] font-medium text-amber-600",children:"مادة خام"})]})}),i.jsx("td",{className:"p-3 whitespace-pre-line text-muted-foreground",children:Me.specs||"
327-"}),i.jsxs("td",{className:"p-3",children:[Me.quantity||0," ",Me.unit||""]}),i.jsxs("td",{className:"p-3",children:[Number(Me.unitPrice||0).toFixed(2)," $"]}),i.jsxs("td",{className:"p-3 font-bold text-primary",children:[Number(Me.totalPrice||0).toFixed(2)," $"]})]},Fe)):i.jsx("tr",{children:i.jsx("td",{className:"p-4 text-center text-muted-foreground",colSpan:5,children:"لا توجد بنود محفوظة في العرض"})})})]})}),(ce.rawMaterials||[]).length>0&&i.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-3",children:[i.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-bold text-amber-700",children:[i.jsx(ma,{className:"h-4 w-4"})," المواد الأولية الواردة في عرض السعر"]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-amber-500/20 text-right text-muted-foreground",children:[i.jsx("th",{className:"p-2",children:"المادة"}),i.jsx("th",{className:"p-2",children:"الكمية"}),i.jsx("th",{className:"p-2",children:"سعر الوحدة"}),i.jsx("th",{className:"p-2",children:"الإجمالي"})]})}),i.jsx("tbody",{children:ce.rawMaterials.map((Me,Fe)=>i.jsxs("tr",{className:"border-b border-amber-500/10 last:border-0",children:[i.jsx("td",{className:"p-2 font-medium text-foreground",children:Me.name||"-"}),i.jsxs("td",{className:"p-2",children:[Me.quantity||0," ",Me.unit||""]}),i.jsxs("td",{className:"p-2",children:[Number(Me.unitPrice||0).toFixed(2)," $"]}),i.jsxs("td",{className:"p-2 font-bold text-primary",children:[Number(Me.totalPrice||0).toFixed(2)," $"]})]},`${Me.rawMaterialId||Me.name}-${Fe}`))})]})})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"شروط الدفع"}),i.jsx("div",{className:"text-sm text-foreground",children:ce.delivery?.paymentTerms||"-"})]}),i.jsxs("div",{className:"bg-primary/10 border border-primary/20 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي العرض"}),i.jsxs("div",{className:"font-bold text-primary",children:[Number(ce.totals?.total||ce.totals?.subtotal||0).toFixed(2)," $"]})]})]})]}):i.jsx("p",{className:"text-muted-foreground/70 text-sm text-center py-8",children:"لا توجد لقطة تفصيلية للعرض لهذا الأمر. ستظهر تفاصيل الأوامر المحوّلة من عروض الأسعار هنا."})})(),G==="costs"&&i.jsxs("div",{children:[i.jsx("div",{className:"flex justify-between items-center mb-4",children:i.jsxs("span",{className:"text-sm text-muted-foreground",children:["إجمالي التكاليف: ",i.jsxs("span",{className:"text-primary font-bold text-lg",children:[B.totalCost||0," $"]})]})}),i.jsx("div",{className:"flex gap-2 mb-4",children:[{key:"labor",label:"عمالة",icon:_c},{key:"materials",label:"مواد خام",icon:ma},{key:"operating",label:"تشغيلية",icon:oQ}].map(ce=>i.jsxs("button",{onClick:()=>{J(ce.key),Q({}),Z([])},className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${O===ce.key?"bg-primary/20 text-primary border border-primary/40":"bg-muted/30 text-muted-foreground border border-border hover:text-foreground"}`,children:[i.jsx(ce.icon,{className:"w-3.5 h-3.5"}),ce.label]},ce.key))}),i.jsxs("div",{className:"bg-muted/30 rounded-lg p-4 mb-4 border border-border",children:[O==="labor"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الموظف"}),i.jsxs(En,{value:q.employeeId||"",onValueChange:ce=>{const Me=s?.find(Fe=>String(Fe.id)===ce);Q({...q,employeeId:ce,employeeHourlyRate:zC(Me)})},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر موظف"})}),i.jsx(Rn,{className:"bg-muted/50 border-border max-h-48",children:s?.map(ce=>i.jsxs(bt,{value:String(ce.id),children:[ce.name," - ",ce.position]},ce.id))})]})]}),(()=>{const ce=s?.find(Se=>String(Se.id)===String(q.employeeId)),Me=parseFloat(q.hours||"0"),Fe=zC(ce),ie=Me*Fe;return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"عدد الساعات *"}),i.jsx(Ee,{type:"number",value:q.hours||"",onChange:Se=>Q({...q,hours:Se.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",placeholder:"0",min:0,step:.5})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الراتب بالساعة ($)"}),i.jsx(Ee,{type:"number",value:Fe.toFixed(2),readOnly:!0,className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المبلغ المحسوب تلقائياً ($)"}),i.jsxs("div",{className:"bg-primary/10 border border-primary/30 rounded-lg px-3 py-2 text-sm font-bold text-primary",children:[Me>0?ie.toFixed(2):"0.00"," $",Me>0&&Fe>0&&i.jsxs("span",{className:"text-xs font-normal text-muted-foreground mr-2",children:["(",Me," ساعة × ",Fe," $)"]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف"}),i.jsx(Ee,{value:q.description||"",onChange:Se=>Q({...q,description:Se.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",placeholder:"وصف العمل"})]})]})})()]}),O==="materials"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"relative z-10 overflow-visible rounded-lg border border-border",children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium",children:"المادة"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium w-20",children:"الكمية"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium w-24",children:"سعر الإفرادي ($)"}),i.jsx("th",{className:"text-right p-2 text-muted-foreground font-medium w-24",children:"الإجمالي ($)"}),i.jsx("th",{className:"w-8"})]})}),i.jsx("tbody",{children:ne.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center p-3 text-muted-foreground",children:"أضف مادة أولية"})}):ne.map((ce,Me)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-2",children:i.jsxs("div",{className:"relative min-w-44",children:[i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:"absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),i.jsx(Ee,{value:se[Me]??ce.materialName??"",onChange:Fe=>{const ie=Fe.target.value;me(Se=>({...Se,[Me]:ie})),ce.materialId&&ge(Me,"materialId",0),Be(Me)},onFocus:()=>Be(Me),onBlur:()=>window.setTimeout(()=>Be(Fe=>Fe===Me?null:Fe),150),className:"h-8 bg-muted/50 border-border pr-7 text-xs text-foreground",placeholder:"ابحث عن مادة خام...","aria-label":"البحث عن مادة خام"})]}),ze===Me&&i.jsxs("div",{className:"absolute right-0 z-[100] mt-1 max-h-56 w-[min(22rem,calc(100vw-3rem))] overflow-y-auto rounded-md border border-border bg-white p-1 text-slate-900 shadow-2xl",children:[!a&&i.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"جاري تحميل المواد الخام..."}),(a||[]).filter(Fe=>Mse(Fe,se[Me]??"")).slice(0,12).map(Fe=>i.jsxs("button",{type:"button",onMouseDown:ie=>ie.preventDefault(),onClick:()=>Y(Me,Fe),className:"flex w-full flex-col gap-0.5 rounded px-2 py-2 text-right transition-colors hover:bg-accent focus:bg-accent focus:outline-none",children:[i.jsx("span",{className:"font-medium text-foreground",children:Fe.name}),i.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["المتاح: ",Number(Fe.stockQuantity||0).toLocaleStr
327ing("ar-EG")," ",Fe.unit||""," · سعر الشراء: ",Number(Fe.purchasePrice||0).toFixed(2)," $"]})]},Fe.id)),(a||[]).filter(Fe=>{const ie=String(se[Me]??"").trim().toLocaleLowerCase(),Se=String(Fe.name??Fe.materialName??"").trim().toLocaleLowerCase();return!!Se&&(!ie||Se.includes(ie))}).length===0&&i.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"لا توجد مادة مطابقة في المخزون"})]}),ce.materialId?i.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:["المتاح: ",Number(ce.availableQuantity??0).toLocaleString("ar-EG")," ",ce.unit||""]}):null]})}),i.jsx("td",{className:"p-2",children:i.jsx(Ee,{type:"number",value:ce.quantity||"",onChange:Fe=>ge(Me,"quantity",parseFloat(Fe.target.value)||0),className:"bg-muted/50 border-border text-foreground text-xs h-8 w-full",placeholder:"كمية",min:0})}),i.jsx("td",{className:"p-2",children:i.jsx(Ee,{type:"number",value:ce.unitPrice||"",onChange:Fe=>ge(Me,"unitPrice",parseFloat(Fe.target.value)||0),className:"bg-muted/50 border-border text-foreground text-xs h-8 w-full",placeholder:"0",min:0,step:"0.01"})}),i.jsx("td",{className:"p-2",children:i.jsx("div",{className:"bg-primary/10 border border-primary/20 rounded px-2 py-1.5 text-xs font-bold text-primary",children:(ce.totalPrice||0).toFixed(2)})}),i.jsx("td",{className:"p-2",children:i.jsx("button",{onClick:()=>je(Me),className:"p-1 rounded hover:bg-red-500/20 text-red-400",children:i.jsx(Mr,{className:"w-3.5 h-3.5"})})})]},Me))})]})}),ne.length>0&&i.jsxs("div",{className:"flex items-center justify-between text-xs px-1",children:[i.jsx("span",{className:"text-muted-foreground",children:"مجموع المواد:"}),i.jsxs("span",{className:"font-bold text-primary",children:[ne.reduce((ce,Me)=>ce+(Me.totalPrice||0),0).toFixed(2)," $"]})]}),i.jsxs(ke,{variant:"outline",size:"sm",onClick:xt,className:"border-border text-foreground text-xs w-full",children:[i.jsx(Nn,{className:"w-3 h-3 ml-1"})," إضافة مادة"]}),i.jsxs("div",{className:"mt-2",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المبلغ الإجمالي المحسوب تلقائياً ($)"}),i.jsx(Ee,{type:"number",value:ne.reduce((ce,Me)=>ce+(Me.totalPrice||0),0).toFixed(2),readOnly:!0,className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),O==="operating"&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف"}),i.jsx(Ee,{value:q.description||"",onChange:ce=>Q({...q,description:ce.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",placeholder:"وصف التكلفة التشغيلية"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المبلغ ($)"}),i.jsx(Ee,{type:"number",value:q.amount||"",onChange:ce=>Q({...q,amount:ce.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",placeholder:"0"})]})]}),i.jsxs(ke,{onClick:ve,size:"sm",className:"bg-primary text-foreground text-xs mt-3",disabled:h.isPending,children:[i.jsx(Nn,{className:"w-3 h-3 ml-1"})," ",h.isPending?"جاري...":"إضافة التكلفة"]})]}),B.costs?.length===0?i.jsx("p",{className:"text-muted-foreground/70 text-sm text-center py-6",children:"لا توجد تكاليف"}):i.jsx("div",{className:"space-y-2",children:B.costs?.map(ce=>i.jsxs("div",{className:"bg-muted/30 rounded-lg p-3 border border-border/50",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${ce.costType==="labor"?"bg-blue-500/20 text-blue-400":ce.costType==="materials"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400"}`,children:vt[ce.costType]||ce.costType}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground font-medium",children:ce.description||"-"}),ce.employeeName&&i.jsxs("div",{className:"text-xs text-muted-foreground",children:[ce.employeeName," • ",ce.hours||0," ساعة × ",Number(ce.employeeHourlyRate||0).toFixed(2)," $ = ",Number(ce.amount||0).toFixed(2)," $"]})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("span",{className:"text-primary font-medium",children:[ce.amount," $"]}),i.jsx("button",{onClick:()=>mt(ce.id),className:"text-red-400 hover:text-red-300",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]}),Array.isArray(ce.materialItems)&&ce.materialItems.length>0&&i.jsx("div",{className:"mt-3 border border-border rounded-md overflow-x-auto",children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[i.jsx("th",{className:"p-2 text-right",children:"المادة"}),i.jsx("th",{className:"p-2 text-right",children:"الكمية"}),i.jsx("th",{className:"p-2 text-right",children:"السعر الوحدوي"}),i.jsx("th",{className:"p-2 text-right",children:"الإجمالي"})]})}),i.jsx("tbody",{children:ce.materialItems.map((Me,Fe)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-2",children:Me.materialName||Me.name||"-"}),i.jsxs("td",{className:"p-2",children:[Me.quantity||0," ",Me.unit||""]}),i.jsxs("td",{className:"p-2",children:[Number(Me.unitPrice||0).toFixed(2)," $"]}),i.jsxs("td",{className:"p-2 font-medium",children:[Number(Me.totalPrice||0).toFixed(2)," $"]})]},Fe))})]})})]},ce.id))})]}),G==="report"&&(()=>{const ce=Number(K?.estimatedCost||B?.estimatedCost||0),Me=Number(K?.actualCost||B?.totalCost||0),Fe=Number(K?.materialsCost||0),ie=Number(K?.laborCost||0),Se=Number(K?.otherCost||0),Ae=Me-ce,at=ce>0?Math.round(Ae/ce*100):null,pe=Ae>0,Ke=Ae<0,Ne=ce>0?Math.min(100,Math.round(Me/ce*100)):Me>0?100:0,Ye={labor:"bg-blue-500/20 text-blue-400",materials:"bg-green-500/20 text-green-400",operating:"bg-orange-500/20 text-orange-400"};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1.5",children:"التكلفة التقديرية"}),i.jsx("div",{className:"text-xl font-bold text-foreground",children:ce?`${ce.toLocaleStr
327ing("en",{maximumFractionDigits:2})} $`:"—"})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1.5",children:"التكلفة الفعلية"}),i.jsxs("div",{className:"text-xl font-bold text-primary",children:[Me.toLocaleString("en",{maximumFractionDigits:2})," $"]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 border border-border/50",children:[i.jsx("div",{className:"text-xs text-muted-foreground mb-1.5",children:"الفرق"}),ce?i.jsxs("div",{className:`text-xl font-bold ${pe?"text-red-400":Ke?"text-green-500":"text-primary"}`,children:[pe?"+":"",Ae.toLocaleString("en",{maximumFractionDigits:2})," $",at!==null&&i.jsxs("span",{className:"text-xs mr-1",children:["(",at>0?"+":"",at,"%)"]})]}):i.jsx("div",{className:"text-xs text-muted-foreground",children:"أدخل التكلفة التقديرية من تبويب المعلومات"})]})]}),ce>0&&i.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 border border-border/50",children:[i.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-2",children:[i.jsxs("span",{children:["نسبة التنفيذ ",Ne,"%"]}),i.jsxs("span",{children:[Me.toLocaleString("en",{maximumFractionDigits:2})," / ",ce.toLocaleString("en",{maximumFractionDigits:2})," $"]})]}),i.jsx("div",{className:"h-3 rounded-full bg-border overflow-hidden",children:i.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${pe?"bg-red-400":Ke?"bg-green-500":"bg-primary"}`,style:{width:`${Ne}%`}})}),i.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:pe?`تجاوزت التكلفة الفعلية التقديرية بـ ${Ae.toLocaleString("en",{maximumFractionDigits:2})} $`:Ke?`أقل من التقديرية بـ ${Math.abs(Ae).toLocaleString("en",{maximumFractionDigits:2})} $`:"مطابقة للتقديرية"})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-green-400 mb-1",children:"مواد خام"}),i.jsxs("div",{className:"text-lg font-bold text-foreground",children:[Fe.toLocaleString("en",{maximumFractionDigits:2})," $"]})]}),i.jsxs("div",{className:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-blue-400 mb-1",children:"عمالة"}),i.jsxs("div",{className:"text-lg font-bold text-foreground",children:[ie.toLocaleString("en",{maximumFractionDigits:2})," $"]})]}),i.jsxs("div",{className:"bg-orange-500/10 border border-orange-500/30 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-orange-400 mb-1",children:"تشغيلية"}),i.jsxs("div",{className:"text-lg font-bold text-foreground",children:[Se.toLocaleString("en",{maximumFractionDigits:2})," $"]})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:"كشف تفصيلي للتكلفة الفعلية"}),i.jsxs("div",{className:"border border-border rounded-lg overflow-x-auto",children:[i.jsx("div",{className:"px-3 py-2 bg-green-500/10 text-green-500 text-xs font-bold",children:"المواد الخام"}),i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[i.jsx("th",{className:"p-2 text-right",children:"المادة"}),i.jsx("th",{className:"p-2 text-right",children:"الكمية"}),i.jsx("th",{className:"p-2 text-right",children:"السعر الوحدوي"}),i.jsx("th",{className:"p-2 text-right",children:"الإجمالي"})]})}),i.jsx("tbody",{children:(K?.materials||[]).length?K?.materials?.map((Te,st)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-2",children:Te.materialName||Te.name||"-"}),i.jsxs("td",{className:"p-2",children:[Te.quantity||0," ",Te.unit||""]}),i.jsxs("td",{className:"p-2",children:[Number(Te.unitPrice||0).toFixed(2)," $"]}),i.jsxs("td",{className:"p-2 font-medium",children:[Number(Te.totalPrice||0).toFixed(2)," $"]})]},`${Te.costId||"material"}-${st}`)):i.jsx("tr",{children:i.jsx("td",{className:"p-3 text-center text-muted-foreground",colSpan:4,children:"لا توجد مواد مسجلة"})})})]})]}),i.jsxs("div",{className:"border border-border rounded-lg overflow-x-auto",children:[i.jsx("div",{className:"px-3 py-2 bg-blue-500/10 text-blue-500 text-xs font-bold",children:"العمالة بالساعات"}),i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[i.jsx("th",{className:"p-2 text-right",children:"الموظف"}),i.jsx("th",{className:"p-2 text-right",children:"الساعات"}),i.jsx("th",{className:"p-2 text-right",children:"أجر الساعة"}),i.jsx("th",{className:"p-2 text-right",children:"الإجمالي"})]})}),i.jsx("tbody",{children:(K?.labor||[]).length?K?.labor?.map((Te,st)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-2",children:Te.employeeName||"-"}),i.jsx("td",{className:"p-2",children:Te.hours||0}),i.jsxs("td",{className:"p-2",children:[Number(Te.hourlyRate||Te.employeeHourlyRate||0).toFixed(2)," $"]}),i.jsxs("td",{className:"p-2 font-medium",children:[Number(Te.amount||0).toFixed(2)," $"]})]},Te.costId||st)):i.jsx("tr",{children:i.jsx("td",{className:"p-3 text-center text-muted-foreground",colSpan:4,children:"لا توجد عمالة مسجلة"})})})]})]}),i.jsxs("div",{className:"border border-border rounded-lg overflow-x-auto",children:[i.jsx("div",{className:"px-3 py-2 bg-orange-500/10 text-orange-500 text-xs font-bold",children:"تكاليف تشغيلية أخرى"}),i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-muted/50",children:[i.jsx("th",{className:"p-2 text-right",children:"الوصف"}),i.jsx("th",{className:"p-2 text-right",children:"المبلغ"})]})}),i.jsx("tbody",{children:(K?.operating||[]).length?K?.operating?.map((Te,st)=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-2",children:Te.description||"-"}),i.jsxs("td",{className:"p-2 font-medium",children:[Number(Te.amount||0).toFixed(2)," $"]})]},Te.costId||st)):i.jsx("tr",{children:i.jsx("td",{className:"p-3 text-center text-muted-foreground",colSpan:2,children:"لا توجد تكاليف تشغيلية"})})})]})]})]}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"تفاصيل التكاليف المسجلة"}),(K?.costs?.length||0)===0?i.jsx("p",{className:"text-muted-foreground
327/70 text-sm text-center py-6",children:"لا توجد تكاليف مسجلة بعد"}):i.jsx("div",{className:"space-y-2",children:K?.costs?.map(Te=>i.jsxs("div",{className:"flex items-center justify-between bg-muted/30 rounded-lg p-3 border border-border/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${Ye[Te.costType]||""}`,children:vt[Te.costType]||Te.costType}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground font-medium",children:Te.description||"-"}),Te.materialItems?.length>0&&i.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:Te.materialItems.map((st,et)=>`${st.quantity||0} ${st.unit||""} ${st.materialName||""}`).join(" • ")})]})]}),i.jsxs("span",{className:"text-primary font-medium",children:[Number(Te.amount||0).toLocaleString("en",{maximumFractionDigits:2})," $"]})]},Te.id))})]})})(),G==="files"&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("span",{className:"text-sm text-muted-foreground",children:"الملفات المرفقة"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{ref:Ce,type:"file",className:"hidden",onChange:Ie}),i.jsxs(ke,{size:"sm",onClick:()=>Ce.current?.click(),className:"bg-primary text-foreground text-xs",disabled:x.isPending,children:[i.jsx(F2,{className:"w-3 h-3 ml-1"})," ",x.isPending?"جاري الرفع...":"رفع ملف"]})]})]}),ye?.fileUrl&&(()=>{const ce=`${ye.fileType||""} ${ye.fileName||""}`.toLowerCase(),Me=/image\/|\.(png|jpe?g|gif|webp|svg)$/.test(ce),Fe=/application\/pdf|\.pdf$/.test(ce);return i.jsxs("div",{className:"mb-4 border border-border rounded-lg overflow-hidden bg-muted/20",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[i.jsxs("span",{className:"text-sm font-medium text-foreground truncate",children:["معاينة: ",ye.fileName]}),i.jsx("button",{type:"button",onClick:()=>Le(null),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-4 h-4"})})]}),Me?i.jsx("img",{src:ye.fileUrl,alt:ye.fileName,className:"max-h-[430px] w-full object-contain bg-white"}):Fe?i.jsx("iframe",{title:`معاينة ${ye.fileName}`,src:ye.fileUrl,className:"w-full h-[430px] bg-white"}):i.jsx("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"لا تتوفر معاينة مضمنة لهذا النوع من الملفات. استخدم زر «فتح» لعرضه."})]})})(),B.files?.length===0?i.jsx("p",{className:"text-muted-foreground/70 text-sm text-center py-6",children:"لا توجد ملفات"}):i.jsx("div",{className:"space-y-2",children:B.files?.map(ce=>i.jsxs("div",{className:"flex items-center justify-between bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(KD,{className:"w-4 h-4 text-primary"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground",children:ce.fileName}),i.jsxs("div",{className:"text-xs text-muted-foreground/70",children:[ce.fileType," • ",ce.fileSize?`${(ce.fileSize/1024).toFixed(1)} KB`:""]})]})]}),i.jsxs("div",{className:"flex gap-2",children:[ce.fileUrl&&i.jsxs("button",{type:"button",onClick:()=>Le(ce),className:"text-primary text-sm hover:underline flex items-center gap-1",children:[i.jsx(jc,{className:"w-3 h-3"})," معاينة"]}),ce.fileUrl&&i.jsx("a",{href:ce.fileUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground text-xs hover:underline",children:"فتح"}),i.jsx("button",{onClick:()=>Ve(ce.id),className:"text-red-400",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]},ce.id))})]}),G==="timeline"&&i.jsxs("div",{children:[i.jsx("div",{className:"bg-muted/30 rounded-lg p-4 border border-border mb-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"px-2 py-0.5 rounded bg-purple-500/20 text-purple-400 text-xs font-medium",children:"تغيير الحالة"}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:["الحالة الحالية: ",De[B.status]]})]}),i.jsxs(En,{value:B.status,onValueChange:async ce=>{try{await u.mutateAsync({id:B.id,data:{status:ce}}),await _.mutateAsync({productionOrderId:B.id,logType:"status",title:"تغيير الحالة",content:`من ${De[B.status]} إلى ${De[ce]}`}),_e.success("تم تغيير الحالة");const Me=await M.productionDetail.get.fetch({id:B.id});P(Me),t()}catch{_e.error("حدث خطأ")}},children:[i.jsx(Tn,{className:"w-[130px] bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"pending",children:"قيد الانتظار"}),i.jsx(bt,{value:"in_progress",children:"قيد التنفيذ"}),i.jsx(bt,{value:"completed",children:"مكتمل"}),i.jsx(bt,{value:"cancelled",children:"ملغي"})]})]})]})}),B.logs?.length===0?i.jsx("p",{className:"text-muted-foreground
327/70 text-sm text-center py-6",children:"لا يوجد سجل متابعة"}):i.jsx("div",{className:"space-y-3",children:B.logs?.map(ce=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-primary mt-2 shrink-0"}),i.jsxs("div",{className:"flex-1 bg-muted/50 rounded-lg p-3 border border-border/50",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-foreground",children:ce.title}),i.jsx("span",{className:"text-xs text-muted-foreground/70",children:new Date(ce.createdAt).toLocaleString("ar")})]}),ce.content&&i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ce.content})]})]},ce.id))})]})]})]})})]})}const w6=()=>new Date().toISOString().slice(0,10),GC=n=>`$ ${(n||0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,HI={cash:"نقدي",check:"شيك",transfer:"تحويل بنكي",card:"بطاقة"},Lg=()=>({voucherNumber:"",clientId:0,clientName:"",amount:0,date:w6(),paymentMethod:"cash",bankName:"",checkNumber:"",referenceNumber:"",invoiceNumber:"",description:""});function VI(){const[n,e]=T.useState("receipt"),[t,r]=T.useState(!1),[s,a]=T.useState(null),[o,l]=T.useState(""),[u,d]=T.useState(Lg()),[h,p]=T.useState(""),[x,y]=T.useState(!1),v=T.useRef(null),{data:_}=Pe.clients.list.useQuery(),{data:M}=Pe.settings.list.useQuery(),S=Pe.receiptVouchers.list.useQuery(),A=Pe.paymentVouchers.list.useQuery(),E=Pe.receiptVouchers.create.useMutation(),C=Pe.receiptVouchers.update.useMutation(),I=Pe.receiptVouchers.delete.useMutation(),D=Pe.paymentVouchers.create.useMutation(),B=Pe.paymentVouchers.update.useMutation(),P=Pe.paymentVouchers.delete.useMutation(),G=n==="receipt",k=G?S:A,V=k.data||[],U=k.isLoading;T.useEffect(()=>{const O=J=>{v.current&&!v.current.contains(J.target)&&y(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]),T.useEffect(()=>{const O=new URLSearchParams(window.location.search),J=O.get("new-receipt-client"),q=O.get("new-payment-client");if(J){const Q=(_||[]).find(Z=>Z.id===Number(J));e("receipt"),a(null),d(Lg()),Q&&(d({...Lg(),clientId:Q.id,clientName:Q.name||"",referenceNumber:""}),p(Q.name||"")),r(!0);const ne=new URL(window.location.href);ne.searchParams.delete("new-receipt-client"),window.history.replaceState({},"",ne.toString())}else if(q){const Q=(_||[]).find(Z=>Z.id===Number(q));e("payment"),a(null),d(Lg()),Q&&(d({...Lg(),clientId:Q.id,clientName:Q.name||"",referenceNumber:""}),p(Q.name||"")),r(!0);const ne=new URL(window.location.href);ne.searchParams.delete("new-payment-client"),window.history.replaceState({},"",ne.toString())}},[_]);const $=()=>{a(null),d(Lg()),p(""),r(!0)},X=O=>{a(O),d({voucherNumber:O.voucherNumber||"",clientId:O.clientId||0,clientName:O.clientName||"",amount:O.amount||0,date:O.date||w6(),paymentMethod:O.paymentMethod||"cash",bankName:O.bankName||"",checkNumber:O.checkNumber||"",referenceNumber:O.referenceNumber||"",invoiceNumber:O.invoiceNumber||"",description:O.description||""}),p(O.clientName||""),r(!0)},ee=async()=>{if(!u.clientName?.trim()){_e.error(G?"اسم العميل مطلوب":"اسم المورد مطلوب");return}if(!u.amount||u.amount<=0){_e.error("أدخل مبلغاً صحيحاً");return}const O={...u};try{s?(G?await C.mutateAsync({id:s.id,data:O}):await B.mutateAsync({id:s.id,data:O}),_e.success("تم تحديث السند")):(G?await E.mutateAsync(O):await D.mutateAsync(O),_e.success("تم إنشاء السند")),r(!1),k.refetch()}catch{_e.error("حدث خطأ أثناء الحفظ")}},z=async O=>{if(confirm(`هل أنت متأكد من حذف السند ${O.voucherNumber}؟`))try{G?await I.mutateAsync({id:O.id}):await P.mutateAsync({id:O.id}),_e.success("تم الحذف"),k.refetch()}catch{_e.error("حدث خطأ")}},K=O=>{const J=M?.companyName||"AMZ MAKiNA",q=M?.companyPhone||"",Q=M?.companyAddress||"",ne=`${G?"سند قبض":"سند دفع"} - ${O.voucherNumber}`,Z=G?"استلمنا من السيد/السادة":"دفعنا إلى السيد/السادة",se=new Date().toLocaleDateString("ar-EG-u-nu-arab"),me=`<!DOCTYPE html>
328<html dir="rtl" lang="ar"><head><meta charset="utf-8"><title>${ne}</title>
329<style>
330  @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');
331  *{box-sizing:border-box}
332  body{font-family:'Cairo',sans-serif;margin:0;padding:32px;background:#fff;color:#111}
333  .doc{max-width:760px;margin:0 auto;border:1px solid #b8e6ec;border-radius:12px;overflow:hidden}
334  .hd{background:#0096a7;color:#fff;padding:20px 24px;display:flex;justify-content:space-between;align-items:flex-start}
335  .hd h1{margin:0;font-size:20px}
336  .hd .meta{font-size:12px;opacity:.9;line-height:1.7;text-align:left}
337  .badge{display:inline-block;background:#fff;color:#0096a7;padding:4px 12px;border-radius:999px;font-size:12px;font-weight:700;margin-top:6px}
338  .body{padding:24px}
339  .row{display:flex;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px dashed #b8e6ec;font-size:14px}
340  .row .k{color:#0096a7}
341  .row .v{font-weight:600}
342  .amount{margin:20px 0;padding:18px;background:#f0fbfc;border:1px solid #0096a7;border-radius:10px;text-align:center}
343  .amount .lbl{font-size:12px;color:#0096a7;margin-bottom:4px}
344  .amount .val{font-size:30px;font-weight:700;color:#0096a7}
345  .desc{margin-top:16px;padding:12px;background:#f0fbfc;border-radius:8px;font-size:13px;min-height:52px;border:1px solid #b8e6ec}
346  .sign{display:flex;justify-content:space-between;margin-top:44px;font-size:13px;color:#007a88}
347  .sign div{text-align:center;width:42%}
348  .sign .line{margin-top:44px;border-top:1px solid #0096a7;padding-top:6px}
349  .ft{margin-top:24px;padding-top:12px;border-top:1px solid #b8e6ec;text-align:center;font-size:11px;color:#007a88}
350  @media print{body{padding:0}.doc{border:none}*{print-color-adjust:exact !important;-webkit-print-color-adjust:exact !important}}html *{print-color-adjust:exact;-webkit-print-color-adjust:exact}
351</style></head><body>
352<div class="doc">
353  <div class="hd">
354    <div>
355      <h1>${J}</h1>
356      <div class="badge">${G?"سند قبض":"سند دفع"}</div>
357    </div>
358    <div class="meta">
359      ${q?`هاتف: ${q}<br>`:""}
360      ${Q?`${Q}<br>`:""}
361      رقم السند: <strong>${O.voucherNumber}</strong>
362    </div>
363  </div>
364  <div class="body">
365    <div class="row"><span class="k">${Z}</span><span class="v">${O.clientName||"-"}</span></div>
366    <div class="row"><span class="k">التاريخ</span><span class="v">${O.date||"-"}</span></div>
367    <div class="row"><span class="k">طريقة الدفع</span><span class="v">${HI[O.paymentMethod]||O.paymentMethod||"-"}</span></div>
368    ${O.bankName?`<div class="row"><span class="k">البنك</span><span class="v">${O.bankName}</span></div>`:""}
369    ${O.checkNumber?`<div class="row"><span class="k">رقم الشيك</span><span class="v">${O.checkNumber}</span></div>`:""}
370    ${O.referenceNumber?`<div class="row"><span class="k">رقم المرجع</span><span class="v">${O.referenceNumber}</span></div>`:""}
371    ${O.invoiceNumber?`<div class="row"><span class="k">رقم الفاتورة المرتبطة</span><span class="v">${O.invoiceNumber}</span></div>`:""}
372    <div class="amount">
373      <div class="lbl">المبلغ</div>
374      <div class="val">${GC(O.amount)}</div>
375    </div>
376    <div class="desc"><strong>البيان:</strong> ${O.description||"-"}</div>
377    <div class="sign">
378      <div><div class="line">توقيع المستلم</div></div>
379      <div><div class="line">توقيع المسؤول</div></div>
380    </div>
381    <div class="ft">${J} — ${G?"سند قبض رسمي":"سند دفع رسمي"} • تاريخ الطباعة: ${se}</div>
382  </div>
383</div>
384<script>window.onload=function(){window.print()}<\/script>
385</body></html>`;Gd(me,ne)},ae=T.useMemo(()=>
385{if(!o.trim())return V;const O=o.toLowerCase();return V.filter(J=>(J.voucherNumber||"").toLowerCase().includes(O)||(J.clientName||"").toLowerCase().includes(O)||(J.invoiceNumber||"").toLowerCase().includes(O)||(J.referenceNumber||"").toLowerCase().includes(O))},[V,o]),oe=T.useMemo(()=>ae.reduce((O,J)=>O+(J.amount||0),0),[ae]),re=T.useMemo(()=>{const O=_||[],J=G?O.filter(ne=>ne.type==="client"||ne.type==="both"):O.filter(ne=>ne.type==="supplier"||ne.type==="both"),q=J.length?J:O;if(!h.trim())return q.slice(0,8);const Q=h.toLowerCase();return q.filter(ne=>(ne.name||"").toLowerCase().includes(Q)||(ne.companyName||"").toLowerCase().includes(Q)||(ne.phone||"").toLowerCase().includes(Q)).slice(0,8)},[_,h,G]),F=u.paymentMethod==="check"||u.paymentMethod==="transfer";return i.jsxs("div",{dir:"rtl",children:[i.jsxs("div",{className:"flex gap-2 mb-5",children:[i.jsxs("button",{onClick:()=>{e("receipt"),l("")},className:`flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-medium transition-colors ${G?"bg-primary text-foreground":"bg-muted/50 text-muted-foreground border border-border hover:text-foreground"}`,children:[i.jsx(cF,{className:"w-4 h-4"})," سندات القبض"]}),i.jsxs("button",{onClick:()=>{e("payment"),l("")},className:`flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-medium transition-colors ${G?"bg-muted/50 text-muted-foreground border border-border hover:text-foreground":"bg-primary text-foreground"}`,children:[i.jsx(uF,{className:"w-4 h-4"})," سندات الدفع"]})]}),i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-4",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[G?i.jsx(aN,{className:"w-5 h-5 text-green-400"}):i.jsx(yF,{className:"w-5 h-5 text-red-400"}),G?"سندات القبض":"سندات الدفع",i.jsxs("span",{className:"text-sm font-normal text-muted-foreground/70",children:["(",V.length,")"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:G?"المبالغ المستلمة من العملاء":"المبالغ المدفوعة للموردين والمصروفات"})]}),i.jsxs(ke,{onClick:$,className:"bg-primary hover:bg-primary/90 text-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," سند جديد"]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-5",children:[i.jsxs("div",{className:"relative flex-1 min-w-[240px] max-w-md",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx(Ee,{value:o,onChange:O=>l(O.target.value),placeholder:"بحث برقم السند أو اسم العميل...",className:"bg-muted/50 border-border text-foreground text-sm pr-9"})]}),i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl px-4 py-2.5",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"الإجمالي: "}),i.jsx("span",{className:`text-sm font-bold ${G?"text-green-400":"text-red-400"}`,children:GC(oe)})]})]}),i.jsx("div",{className:"space-y-3",children:U?i.jsx("p",{className:"text-muted-foreground/70 text-center py-10",children:"جاري التحميل..."}):ae.length===0?i.jsxs("div",{className:"text-center py-12 bg-muted/50 rounded-xl border border-border",children:[i.jsx(N_,{className:"w-10 h-10 text-teal-600 mx-auto mb-3"}),i.jsx("p",{className:"text-muted-foreground/70 text-sm",children:o?"لا توجد نتائج مطابقة":`لا توجد ${G?"سندات قبض":"سندات دفع"} بعد`})]}):ae.map(O=>i.jsx("div",{className:"bg-muted/50 rounded-xl border border-border p-4 hover:border-primary/30 transition-colors",children:i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[i.jsx("span",{className:"font-bold text-foreground text-sm",children:O.voucherNumber}),i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-accent text-foreground",children:HI[O.paymentMethod]||O.paymentMethod||"غير محدد"}),O.invoiceNumber&&i.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-blue-500/15 text-blue-400",children:["فاتورة: ",O.invoiceNumber]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(fh,{className:"w-3.5 h-3.5"})," ",O.clientName||"-"]}),i.jsx("span",{children:O.date||"-"}),O.referenceNumber&&i.jsxs("span",{children:["مرجع: ",O.referenceNumber]})]}),O.description&&i.jsx("p",{className:"text-xs text-muted-foreground
385/70 mt-2 line-clamp-2",children:O.description})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:`text-xl font-bold ${G?"text-green-400":"text-red-400"}`,children:GC(O.amount)}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx("button",{onClick:()=>X(O),title:"تعديل",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:i.jsx(hh,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>K(O),title:"طباعة السند",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-primary transition-colors",children:i.jsx(nl,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>z(O),title:"حذف",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-red-400 transition-colors",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]})]})},O.id))}),t&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-start justify-center p-4 overflow-y-auto",onClick:()=>r(!1),children:i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl w-full max-w-lg my-8",onClick:O=>O.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsxs("h3",{className:"text-lg font-bold text-foreground",children:[s?"تعديل ":"",G?"سند قبض":"سند دفع",s?"":" جديد"]}),i.jsx("button",{onClick:()=>r(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"رقم السند"}),i.jsx(Ee,{value:s?u.voucherNumber:"يُنشأ تلقائيًا بالتسلسل",onChange:O=>d({...u,voucherNumber:O.target.value}),placeholder:"يُنشأ تلقائيًا بالتسلسل",disabled:!s,className:"bg-muted/50 border-border text-foreground text-sm disabled:opacity-100"})]}),i.jsxs("div",{ref:v,className:"relative",children:[i.jsxs("label",{className:"text-xs text-muted-foreground mb-1 block",children:[G?"اسم العميل":"اسم المورد"," *"]}),i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx(Ee,{value:h,onChange:O=>{p(O.target.value),d({...u,clientName:O.target.value,clientId:0}),y(!0)},onFocus:()=>y(!0),placeholder:G?"ابحث عن عميل...":"ابحث عن مورد...",className:"bg-muted/50 border-border text-foreground text-sm pr-9"})]}),x&&re.length>0&&i.jsx("div",{className:"absolute z-10 mt-1 w-full bg-muted/50 border border-border rounded-lg shadow-xl max-h-60 overflow-y-auto",children:re.map(O=>i.jsxs("button",{type:"button",onClick:()=>{d({...u,clientId:O.id,clientName:O.name}),p(O.name),y(!1)},className:"w-full text-right px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 last:border-0",children:[i.jsx("div",{className:"text-sm text-foreground",children:O.name}),i.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:[O.companyName,O.phone].filter(Boolean).join(" • ")||"بدون بيانات إضافية"})]},O.id))}),i.jsx("p",{className:"text-[10px] text-muted-foreground/70 mt-1",children:"يمكنك الكتابة يدوياً إذا لم يكن مسجلاً"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المبلغ ($) *"}),i.jsx(Ee,{type:"number",step:"0.01",value:u.amount||"",onChange:O=>d({...u,amount:parseFloat(O.target.value)||0}),placeholder:"0.00",className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"التاريخ"}),i.jsx(Ee,{type:"date",value:u.date,onChange:O=>d({...u,date:O.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"طريقة الدفع"}),i.jsxs(En,{value:u.paymentMethod,onValueChange:O=>d({...u,paymentMethod:O}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر طريقة الدفع"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",dir:"rtl",children:[i.jsx(bt,{value:"cash",children:"نقدي"}),i.jsx(bt,{value:"check",children:"شيك"}),i.jsx(bt,{value:"transfer",children:"تحويل بنكي"}),i.jsx(bt,{value:"card",children:"بطاقة"})]})]})]}),F&&i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم البنك"}),i.jsx(Ee,{value:u.bankName,onChange:O=>d({...u,bankName:O.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:u.paymentMethod==="check"?"رقم الشيك":"رقم الحوالة"}),i.jsx(Ee,{value:u.checkNumber,onChange:O=>d({...u,checkNumber:O.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"رقم المرجع"}),i.jsx(Ee,{value:u.referenceNumber,onChange:O=>d({...u,referenceNumber:O.target.value}),placeholder:"رقم المرجع",className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"رقم الفاتورة"}),i.jsx(Ee,{value:u.invoiceNumber,onChange:O=>d({...u,invoiceNumber:O.target.value}),placeholder:"رقم الفاتورة المرتبطة",className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف / البيان"}),i.jsx(ni,{value:u.description,onChange:O=>d({...u,description:O.target.value}),placeholder:"وصف إضافي (اختياري)",rows:3,className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>r(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:ee,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:E.isPending||C.isPending||D.isPending||B.isPending,children:s?"تحديث السند":"حفظ السند"})]})]})})]})}const Db=()=>new Date().toISOString().slice(0,10);function Cse(){const{data:n,isLoading:e,refetch:t}=Pe.cashBoxes.list.useQuery(),r=Pe.cashBoxes.create.useMutation(),s=Pe.cashBoxes.update.useMutation(),a=Pe.cashBoxes.delete.useMutation(),o=Pe.cashBoxes.setMain.useMutation(),l=Pe.cashBoxTransfer.transfer.useMutation(),u=Pe.cashBoxes.addTransaction.useMutation(),d=Pe.useUtils(),[h,p]=T.useState(!1),[x,y]=T.useState(!1),[v,_]=T.useState(!1),[M,S]=T.useState(!1),[A,E]=T.useState(null),[C,I]=T.useState(null),[D,B]=T.useState([]),[P,G]=T.useState({type:"deposit",amount:0,description:"",date:Db()}),[k,V]=T.useState(""),[U,$]=T.useState({cashBoxId:"all",type:"all",fromDate:"",toDate:"",search:""}),[X,ee]=T.useState({name:"",initialBalance:0,notes:"",boxType:"cash",isActive:!0}),[z,K]=T.useState({fromCashBoxId:0,toCashBoxId:0,amount:0,fromCashBoxName:"",toCashBoxName:"",description:"",date:Db()}),ae=T.useMemo(()=>
385({cashBoxId:U.cashBoxId==="all"?void 0:Number(U.cashBoxId),type:U.type==="all"?void 0:U.type,fromDate:U.fromDate||void 0,toDate:U.toDate||void 0,search:U.search||void 0}),[U]),{data:oe,refetch:re}=Pe.cashBoxes.report.useQuery(ae),F=()=>{E(null),ee({name:"",initialBalance:0,notes:"",boxType:"cash",isActive:!0}),p(!0)},O=async he=>{let le=Number(he.balance||0);try{const qe=(await d.cashBoxes.transactions.fetch({cashBoxId:Number(he.id)})||[]).find(Ge=>Ge.type==="opening_balance"||Ge.referenceType==="opening_balance");qe&&(le=Number(qe.amount||0))}catch{}E(he),ee({name:he.name,initialBalance:le,notes:he.description||he.notes||"",boxType:he.boxType||"cash",isActive:he.isActive!==!1}),p(!0)},J=async()=>{if(!X.name.trim()){_e.error("اسم الصندوق مطلوب");return}try{A?(await s.mutateAsync({id:A.id,data:X}),_e.success("تم التحديث")):(await r.mutateAsync(X),_e.success("تم الإنشاء")),p(!1),await Promise.all([t(),d.cashBoxes.report.invalidate()])}catch(he){_e.error(he?.message||"تعذر حفظ بيانات الصندوق")}},q=async he=>{if(confirm("هل أنت متأكد من حذف هذا الصندوق؟"))try{await a.mutateAsync({id:he.id}),_e.success("تم الحذف"),await t()}catch(le){_e.error(le?.message||"تعذر حذف الصندوق")}},Q=async he=>{if(!he.isMain)try{await o.mutateAsync({id:he.id}),await Promise.all([t(),d.cashBoxes.report.invalidate()]),_e.success(`تم تعيين «${he.name}» صندوقاً رئيسياً`)}catch(le){_e.error(le?.message||"تعذر تعيين الصندوق الرئيسي")}},ne=async he=>{I(he),B([]),_(!0);try{const le=await d.cashBoxes.transactions.fetch({cashBoxId:Number(he.id)});B(Array.isArray(le)?le:[])}catch(le){_e.error(le?.message||"تعذر تحميل سجل حركات الصندوق")}},Z=async()=>{if(C){if(!P.amount||P.amount<=0){_e.error("أدخل مبلغاً صحيحاً");return}if(!P.description.trim()){_e.error("اكتب وصف الحركة");return}try{await u.mutateAsync({cashBoxId:C.id,type:P.type,amount:P.amount,description:P.description.trim(),date:P.date,referenceType:"manual"});const he=await d.cashBoxes.transactions.fetch({cashBoxId:C.id}),le=await d.cashBoxes.list.fetch();B(he||[]),I((le||[]).find(Xe=>Xe.id===C.id)||C),G({type:"deposit",amount:0,description:"",date:Db()}),_e.success("تم تسجيل الحركة وتحديث الرصيد"),await t()}catch(he){_e.error(he?.message||"تعذر تسجيل الحركة")}}},se=async()=>{if(!z.fromCashBoxId||!z.toCashBoxId){_e.error("اختر الصندوق المصدر والهدف");return}if(z.fromCashBoxId===z.toCashBoxId){_e.error("لا يمكن التحويل لنفس الصندوق");return}if(!z.amount||z.amount<=0){_e.error("أدخل مبلغاً صحيحاً");return}try{await l.mutateAsync(z),_e.success("تم التحويل بنجاح"),y(!1),K({fromCashBoxId:0,toCashBoxId:0,amount:0,fromCashBoxName:"",toCashBoxName:"",description:"",date:Db()}),t()}catch{_e.error("حدث خطأ في التحويل")}},me={opening_balance:"text-green-400",deposit:"text-green-400",withdrawal:"text-red-400",income:"text-green-400",expense:"text-red-400",transfer_in:"text-blue-400",transfer_out:"text-yellow-400",receipt_voucher_reversal:"text-red-400",payment_voucher_reversal:"text-green-400"},ze={opening_balance:"رصيد افتتاحي",deposit:"إيداع",withdrawal:"سحب",income:"سند قبض / إيراد",expense:"سند صرف / مصروف",transfer_in:"استلام تحويل",transfer_out:"إرسال تحويل",receipt_voucher_reversal:"عكس سند قبض",payment_voucher_reversal:"عكس سند صرف"},Be=he=>he==="opening_balance"||he==="deposit"||he==="income"||he==="transfer_in"||he==="payment_voucher_reversal",ye=he=>`$ ${(he||0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,Le=D.filter(he=>Be(he.type)).reduce((he,le)=>he+Number(le.amount||0),0),Ce=D.filter(he=>!Be(he.type)).reduce((he,le)=>he+Number(le.amount||0),0),Re=T.useMemo(()=>{const he=n||[];return{totalBalance:he.reduce((le,Xe)=>le+(Xe.balance||0),0),activeCount:he.filter(le=>le.isActive!==!1).length,totalCount:he.length,txnCount:he.reduce((le,Xe)=>le+(Xe.transactionCount||0),0)}},[n]),De=T.useMemo(()=>{const he=n||[];if(!k.trim())return he;const le=k.toLowerCase();return he.filter(Xe=>(Xe.name||"").toLowerCase().includes(le)||(Xe.description||Xe.notes||"").toLowerCase().includes(le))},[n,k]);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-5",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(N_,{className:"w-5 h-5 text-primary"}
385),"الصناديق",i.jsxs("span",{className:"text-sm font-normal text-muted-foreground/70",children:["(",n?.length||0,")"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"إدارة صناديق النقد والبنوك وحركاتها المالية"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(ke,{onClick:()=>{S(!0),re()},className:"bg-muted/50 hover:bg-accent text-foreground border border-border",children:[i.jsx(Uj,{className:"w-4 h-4 ml-1"})," تقرير الحركات"]}),i.jsxs(ke,{onClick:()=>y(!0),className:"bg-muted/50 hover:bg-accent text-foreground border border-border",children:[i.jsx(Ly,{className:"w-4 h-4 ml-1"})," تحويل"]}),i.jsxs(ke,{onClick:F,className:"bg-primary hover:bg-primary/90 text-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," صندوق جديد"]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 mb-5",children:[i.jsxs("div",{className:"bg-primary/10 border border-primary/30 rounded-xl p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي الأرصدة"}),i.jsx("p",{className:"text-2xl font-bold text-primary",children:ye(Re.totalBalance)})]}),i.jsx("div",{className:"w-11 h-11 rounded-xl bg-primary/20 flex items-center justify-center",children:i.jsx(k2,{className:"w-5 h-5 text-primary"})})]}),i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"الصناديق النشطة"}),i.jsxs("p",{className:"text-2xl font-bold text-foreground",children:[Re.activeCount," / ",Re.totalCount]})]}),i.jsx("div",{className:"w-11 h-11 rounded-xl bg-accent flex items-center justify-center",children:i.jsx(nQ,{className:"w-5 h-5 text-foreground"})})]}),i.jsxs("div",{className:"bg-muted/50 border border-border rounded-xl p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"عدد الحركات"}),i.jsx("p",{className:"text-2xl font-bold text-foreground",children:Re.txnCount})]}),i.jsx("div",{className:"w-11 h-11 rounded-xl bg-accent flex items-center justify-center",children:i.jsx(aN,{className:"w-5 h-5 text-foreground"})})]})]}),i.jsxs("div",{className:"relative mb-5 max-w-md",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx(Ee,{value:k,onChange:he=>V(he.target.value),placeholder:"ابحث عن صندوق...",className:"bg-muted/50 border-border text-foreground text-sm pr-9"})]}),i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:e?i.jsx("p",{className:"text-muted-foreground/70 col-span-2 py-8 text-center",children:"جاري التحميل..."}):De.length===0?i.jsx("p",{className:"text-muted-foreground/70 col-span-2 text-center py-10",children:k?"لا توجد نتائج مطابقة":"لا توجد صناديق"}):De.map(he=>i.jsxs("div",{onClick:()=>ne(he),role:"button",tabIndex:0,"aria-label":`فتح صندوق ${he.name}`,onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),ne(he))},className:"bg-muted/50 rounded-xl border border-border p-5 hover:border-primary/30 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary/50",children:[i.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[i.jsx("div",{className:"w-11 h-11 rounded-xl bg-accent flex items-center justify-center shrink-0",children:he.boxType==="bank"?i.jsx(Hj,{className:"w-5 h-5 text-primary"}):i.jsx(N_,{className:"w-5 h-5 text-primary"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"font-bold text-foreground mb-1.5",children:he.name}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[he.isMain&&i.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-amber-500/15 text-amber-600 flex items-center gap-1",children:[i.jsx(Wj,{className:"w-3 h-3 fill-current"})," الصندوق الرئيسي"]}),i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-accent text-foreground",children:he.boxType==="bank"?"بنكي":"نقدي"}),i.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full ${he.isActive!==!1?"bg-green-500/15 text-green-400":"bg-gray-500/15 text-muted-foreground"}`,children:he.isActive!==!1?"نشط":"غير نشط"})]})]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 mb-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground
385/70 mb-1",children:"الرصيد الحالي"}),i.jsx("p",{className:"text-2xl font-bold text-primary",children:ye(he.balance)})]}),i.jsx("p",{className:"text-xs text-muted-foreground/70 mb-3",children:he.description||he.notes||"بدون وصف"}),i.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-border",children:[i.jsxs("button",{type:"button",onClick:le=>{le.stopPropagation(),ne(he)},className:"inline-flex items-center gap-1.5 rounded-lg bg-primary/10 px-3 py-1.5 text-xs font-semibold text-primary hover:bg-primary hover:text-white transition-colors",children:[i.jsx(jc,{className:"w-3.5 h-3.5"}),"فتح الصندوق (",he.transactionCount||0," حركة)"]}),i.jsxs("div",{className:"flex gap-1",children:[!he.isMain&&i.jsx("button",{onClick:le=>{le.stopPropagation(),Q(he)},title:"تعيين كصندوق رئيسي",className:"p-1.5 rounded-lg hover:bg-amber-500/10 text-muted-foreground hover:text-amber-600 transition-colors",children:i.jsx(Wj,{className:"w-4 h-4"})}),i.jsx("button",{onClick:le=>{le.stopPropagation(),O(he)},title:"تعديل",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:i.jsx(hh,{className:"w-4 h-4"})}),i.jsx("button",{onClick:le=>{le.stopPropagation(),q(he)},title:"حذف",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-red-400 transition-colors",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]})]},he.id))}),h&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:()=>p(!1),children:i.jsxs("div",{className:"bg-white text-slate-900 border border-slate-200 rounded-xl w-full max-w-md 
385shadow-2xl",onClick:he=>he.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:A?"تعديل الصندوق":"صندوق جديد"}),i.jsx("button",{onClick:()=>p(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم الصندوق *"}),i.jsx(Ee,{value:X.name,onChange:he=>ee({...X,name:he.target.value}),placeholder:"مثال: الصندوق الرئيسي",className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"نوع الصندوق"}),i.jsxs(En,{value:X.boxType,onValueChange:he=>ee({...X,boxType:he}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر النوع"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"cash",children:"نقدي"}),i.jsx(bt,{value:"bank",children:"بنكي"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الحالة"}),i.jsxs(En,{value:X.isActive?"active":"inactive",onValueChange:he=>ee({...X,isActive:he==="active"}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر الحالة"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"active",children:"نشط"}),i.jsx(bt,{value:"inactive",children:"غير نشط"})]})]})]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"text-xs text-muted-foreground mb-1 block",children:["الرصيد ",A?"الحالي":"الابتدائي"," ($)"]}),i.jsx(Ee,{type:"number",step:"0.01",value:X.initialBalance,onChange:he=>ee({...X,initialBalance:parseFloat(he.target.value)||0}),className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف"}),i.jsx(Ee,{value:X.notes,onChange:he=>ee({...X,notes:he.target.value}),placeholder:"وصف الصندوق (اختياري)",className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>p(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:J,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:r.isPending||s.isPending,children:"حفظ"})]})]})}),x&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:()=>y(!1),children:i.jsxs("div",{className:"bg-white text-slate-900 border border-slate-200 rounded-xl w-full max-w-md 
385shadow-2xl",onClick:he=>he.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-bold text-foreground flex items-center gap-2",children:[i.jsx(Ly,{className:"w-4 h-4 text-primary"})," تحويل بين الصناديق"]}),i.jsx("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:"تحويل مبلغ من صندوق إلى آخر"})]}),i.jsx("button",{onClick:()=>y(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"من صندوق"}),i.jsxs(En,{value:z.fromCashBoxId?String(z.fromCashBoxId):void 0,onValueChange:he=>{const le=n?.find(Xe=>String(Xe.id)===he);K({...z,fromCashBoxId:Number(he),fromCashBoxName:le?.name||""})},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر الصندوق المصدر..."})}),i.jsx(Rn,{className:"bg-muted/50 border-border",children:n?.map(he=>i.jsxs(bt,{value:String(he.id),children:[he.name," — ",ye(he.balance)]},he.id))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"إلى صندوق"}),i.jsxs(En,{value:z.toCashBoxId?String(z.toCashBoxId):void 0,onValueChange:he=>{const le=n?.find(Xe=>String(Xe.id)===he);K({...z,toCashBoxId:Number(he),toCashBoxName:le?.name||""})},children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"اختر الصندوق الهدف..."})}),i.jsx(Rn,{className:"bg-muted/50 border-border",children:n?.filter(he=>he.id!==z.fromCashBoxId).map(he=>i.jsxs(bt,{value:String(he.id),children:[he.name," — ",ye(he.balance)]},he.id))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المبلغ ($)"}),i.jsx(Ee,{type:"number",step:"0.01",value:z.amount||"",onChange:he=>K({...z,amount:parseFloat(he.target.value)||0}),placeholder:"0.00",className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف (اختياري)"}),i.jsx(Ee,{value:z.description,onChange:he=>K({...z,description:he.target.value}),placeholder:"وصف التحويل...",className:"bg-muted/50 border-border text-foreground text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"التاريخ"}),i.jsx(Ee,{type:"date",value:z.date,onChange:he=>K({...z,date:he.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>y(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:se,className:"bg-primary hover:bg-primary/90 text-foreground",disabled:l.isPending,children:"تحويل"})]})]})}),v&&C&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-start justify-center p-4 overflow-y-auto",onClick:()=>_(!1),children:i.jsxs("div",{className:"bg-white text-slate-900 border border-slate-200 rounded-xl w-full max-w-3xl my-8 shadow-2xl",onClick:he=>he.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-bold text-foreground flex items-center gap-2",children:[C.name,i.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-accent text-foreground font-normal",children:C.boxType==="bank"?"بنكي":"نقدي"})]}),i.jsx("p",{className:"text-2xl font-bold text-primary mt-1",children:ye(C.balance)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ke,{onClick:()=>G({type:"deposit",amount:0,description:"",date:Db()}),className:"bg-primary hover:bg-primary/90 text-foreground text-xs",children:"إضافة حركة مالية"}),i.jsx("button",{onClick:()=>_(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"w-5 h-5"})})]})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-4",children:[i.jsx("h4",{className:"text-sm font-bold text-foreground mb-3",children:"إضافة مال إلى الصندوق"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[i.jsxs(En,{value:P.type,onValueChange:he=>G({...P,type:he}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"deposit",children:"إيداع / إضافة"}),i.jsx(bt,{value:"withdrawal",children:"سحب / خصم"})]})]}),i.jsx(Ee,{type:"number",min:"0",step:"0.01",value:P.amount||"",onChange:he=>G({...P,amount:Number(he.target.value)||0}),placeholder:"المبلغ",className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsx(Ee,{type:"date",value:P.date,onChange:he=>G({...P,date:he.target.value}),className:"bg-muted/50 border-border text-foreground text-sm"}),i.jsx(ke,{onClick:Z,disabled:u.isPending,className:"bg-primary hover:bg-primary/90 text-foreground",children:u.isPending?"جاري الحفظ...":"حفظ الحركة"})]}),i.jsx(Ee,{value:P.description,onChange:he=>G({...P,description:he.target.value}),placeholder:"الوصف، مثال: إيداع نقدي من المبيعات",className:"bg-muted/50 border-border text-foreground text-sm mt-3"})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"الوارد"}),i.jsxs("p",{className:"mt-1 text-lg font-bold text-green-500",children:["+",ye(Le)]})]}),i.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"الصادر"}),i.jsxs("p",{className:"mt-1 text-lg font-bold text-red-500",children:["-",ye(Ce)]})]}),i.jsxs("div",{className:"rounded-xl border border-border bg-muted/50 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"عدد الحركات"}),i.jsx("p",{className:"mt-1 text-lg font-bold text-foreground",children:D.length})]})]}),i.jsxs("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:["سجل الحركات (",D.length,")"]}
385),D.length===0?i.jsx("p",{className:"text-muted-foreground/70 text-sm text-center py-6",children:"لا توجد حركات"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-right py-2 px-3 text-muted-foreground font-medium",children:"النوع"}),i.jsx("th",{className:"text-right py-2 px-3 text-muted-foreground font-medium",children:"الوصف"}),i.jsx("th",{className:"text-right py-2 px-3 text-muted-foreground font-medium",children:"المبلغ"}),i.jsx("th",{className:"text-right py-2 px-3 text-muted-foreground font-medium",children:"الرصيد بعد الحركة"}),i.jsx("th",{className:"text-right py-2 px-3 text-muted-foreground font-medium",children:"المرجع"}),i.jsx("th",{className:"text-right py-2 px-3 text-muted-foreground font-medium",children:"التاريخ"})]})}),i.jsx("tbody",{children:D.map(he=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3",children:i.jsx("span",{className:`text-xs font-medium ${me[he.type]||"text-foreground"}`,children:ze[he.type]||he.type})}),i.jsx("td",{className:"py-2 px-3 text-foreground",children:he.description||"-"}),i.jsxs("td",{className:`py-2 px-3 font-medium ${me[he.type]||"text-foreground"}`,children:[Be(he.type)?"+":"-",ye(he.amount)]}),i.jsx("td",{className:"py-2 px-3 font-medium text-primary",children:ye(he.balanceAfter)}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground text-xs",children:he.referenceType?`${he.referenceType}${he.referenceId?` #${he.referenceId}`:""}`:"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground text-xs",children:he.date?new Date(he.date).toLocaleDateString("ar-EG"):"-"})]},he.id))})]})})]})]})}),M&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-black/60 p-4",onClick:()=>S(!1),children:i.jsxs("div",{className:"my-6 w-full max-w-6xl rounded-xl border border-slate-200 bg-white text-slate-900 shadow-2xl",onClick:he=>he.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-border p-4",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"flex items-center gap-2 text-lg font-bold text-foreground",children:[i.jsx(Uj,{className:"h-5 w-5 text-primary"})," التقرير المالي التفصيلي"]}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"الحركات والأرصدة مع فلاتر متقدمة لكل صندوق"})]}),i.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:i.jsx(Mr,{className:"h-5 w-5"})})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 border-b border-border p-4 sm:grid-cols-2 lg:grid-cols-5",children:[i.jsxs(En,{value:U.cashBoxId,onValueChange:he=>$({...U,cashBoxId:he}),children:[i.jsx(Tn,{className:"bg-muted/50 text-sm",children:i.jsx(jn,{placeholder:"كل الصناديق"})}),i.jsxs(Rn,{children:[i.jsx(bt,{value:"all",children:"كل الصناديق"}),n?.map(he=>i.jsx(bt,{value:String(he.id),children:he.name},he.id))]})]}),i.jsxs(En,{value:U.type,onValueChange:he=>$({...U,type:he}),children:[i.jsx(Tn,{className:"bg-muted/50 text-sm",children:i.jsx(jn,{placeholder:"كل الحركات"})}),i.jsxs(Rn,{children:[i.jsx(bt,{value:"all",children:"كل الحركات"}),i.jsx(bt,{value:"income",children:"إيراد"}),i.jsx(bt,{value:"expense",children:"مصروف"}),i.jsx(bt,{value:"transfer_in",children:"تحويل وارد"}),i.jsx(bt,{value:"transfer_out",children:"تحويل صادر"}),i.jsx(bt,{value:"deposit",children:"إيداع"}),i.jsx(bt,{value:"withdrawal",children:"سحب"})]})]}),i.jsx(Ee,{type:"date",value:U.fromDate,onChange:he=>$({...U,fromDate:he.target.value}),className:"bg-muted/50 text-sm"}),i.jsx(Ee,{type:"date",value:U.toDate,onChange:he=>$({...U,toDate:he.target.value}),className:"bg-muted/50 text-sm"}),i.jsx(Ee,{value:U.search,onChange:he=>$({...U,search:he.target.value}),placeholder:"بحث بالوصف أو المرجع...",className:"bg-muted/50 text-sm"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 p-4 md:grid-cols-5",children:[i.jsxs("div",{className:"rounded-lg border border-primary/20 bg-primary/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"إجمالي الأرصدة"}),i.jsx("p",{className:"mt-1 font-bold text-primary",children:ye(oe?.summary.totalBalance||0)})]}),i.jsxs("div",{className:"rounded-lg bg-green-500/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"إيرادات"}),i.jsx("p",{className:"mt-1 font-bold text-green-500",children:ye(oe?.summary.income||0)})]}),i.jsxs("div",{className:"rounded-lg bg-red-500/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"مصروفات"}),i.jsx("p",{className:"mt-1 font-bold text-red-500",children:ye(oe?.summary.expenses||0)})]}),i.jsxs("div",{className:"rounded-lg bg-blue-500/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"تحويلات واردة"}),i.jsx("p",{className:"mt-1 font-bold text-blue-500",children:ye(oe?.summary.transfersIn||0)})]}),i.jsxs("div",{className:"rounded-lg bg-amber-500/10 p-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"عدد الحركات"}),i.jsx("p",{className:"mt-1 font-bold text-amber-600",children:oe?.summary.movementCount||0})]})]}),i.jsx("div",{className:"max-h-[48vh] overflow-auto px-4 pb-4",children:i.jsxs("table",{className:"w-full min-w-[760px] text-sm",children:[i.jsx("thead",{className:"sticky top-0 bg-muted/50",children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"التاريخ"}),i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"الصندوق"}),i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"الحركة"}),i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"الوصف"}),i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"المبلغ"}),i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"الرصيد بعد الحركة"}),i.jsx("th",{className:"p-2 text-right text-muted-foreground",children:"المرجع"})]})}),i.jsxs("tbody",{children:[(oe?.transactions||[]).map(he=>i.jsxs("tr",{className:"border-b border-border/60",children:[i.jsx("td",{className:"p-2 text-xs text-muted-foreground",children:he.date?new Date(he.date).toLocaleDateString("ar-EG"):"-"}),i.jsx("td",{className:"p-2 font-medium text-foreground",children:he.cashBoxName}),i.jsxs("td",{className:`p-2 ${he.direction==="in"?"text-green-500":"text-red-500"}`,children:[he.direction==="in"?i.jsx(cF,{className:"ml-1 inline h-3.5 w-3.5"}):i.jsx(uF,{className:"ml-1 inline h-3.5 w-3.5"}),ze[he.type]||he.type]}),i.jsx("td",{className:"p-2 text-foreground",children:he.description||"-"}),i.jsxs("td",{className:`p-2 font-bold ${he.direction==="in"?"text-green-500":"text-red-500"}`,children:[he.direction==="in"?"+":"-",ye(he.amount)]}),i.jsx("td",{className:"p-2 font-medium text-primary",children:ye(he.balanceAfter)}),i.jsx("td",{className:"p-2 text-xs text-muted-foreground",children:he.referenceType?`${he.referenceType}${he.referenceId?` #${he.referenceId}`:""}`:"-"})]},he.id)),(oe?.transactions||[]).length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"p-8 text-center text-muted-foreground",children:"لا توجد حركات مطابقة للفلاتر المختارة"})})]})]})})]})})]})}function Ese(){const{data:n,isLoading:e,refetch:t}=Pe.clients.list.useQuery(),r=Pe.clients.create.useMutation(),s=Pe.clients.update.useMutation(),a=Pe.clients.delete.useMutation();Pe.useUtils(),Pe.clientDocuments.create.useMutation(),Pe.clientDocuments.delete.useMutation(),Pe.clientCommLogs.create.useMutation(),Pe.clientCommLogs.delete.useMutation();const[o,l]=T.useState(!1),[u,d]=T.useState(null),[h,p]=T.useState({}),[x,y]=T.useState(""),[v,_]=T.useState("all"),M=k=>
385`$ ${Math.abs(k||0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,S=T.useMemo(()=>{const k=n||[];return{total:k.length,clients:k.filter(V=>V.type==="client").length,suppliers:k.filter(V=>V.type==="supplier").length,both:k.filter(V=>V.type==="both").length}},[n]),A=T.useMemo(()=>{let k=n||[];if(v!=="all"&&(k=k.filter(V=>V.type===v)),x.trim()){const V=x.toLowerCase();k=k.filter(U=>(U.name||"").toLowerCase().includes(V)||(U.companyName||"").toLowerCase().includes(V)||(U.phone||"").toLowerCase().includes(V)||(U.email||"").toLowerCase().includes(V))}return k},[n,x,v]),E={client:"زبون",supplier:"مورد",both:"زبون ومورد"},C={client:"bg-primary/15 text-primary",supplier:"bg-purple-500/15 text-purple-500",both:"bg-amber-500/15 text-amber-600"},I=()=>{d(null),p({name:"",companyName:"",type:"client",phone:"",email:"",address:"",taxNumber:"",commercialReg:"",notes:"",balance:0}),l(!0)},D=k=>{d(k),p(k),l(!0)},B=k=>{window.location.href=`/admin/clients/${k.id}`},P=async()=>{try{u?(await s.mutateAsync({id:u.id,data:h}),_e.success("تم التحديث")):(await r.mutateAsync(h),_e.success("تم الإنشاء")),l(!1),t()}catch{_e.error("حدث خطأ")}},G=async k=>{if(confirm("هل أنت متأكد من حذف هذا العميل؟"))try{await a.mutateAsync({id:k.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}};return i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-5",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(_c,{className:"w-5 h-5 text-primary"}),"إدارة العملاء",i.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",n?.length||0,")"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"إدارة بيانات العملاء والموردين وأرصدتهم المالية"})]}),i.jsxs(ke,{onClick:I,className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:[i.jsx(Nn,{className:"w-4 h-4 ml-1"})," عميل جديد"]})]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-5",children:[i.jsxs(bn,{className:"bg-primary/10 border-primary/30 p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"إجمالي العملاء"}),i.jsx("p",{className:"text-2xl font-bold text-primary",children:S.total})]}),i.jsx(_c,{className:"w-5 h-5 text-primary"})]}),i.jsxs(bn,{className:"bg-card border-border p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"زبائن"}),i.jsx("p",{className:"text-2xl font-bold text-foreground",children:S.clients})]}),i.jsx(fQ,{className:"w-5 h-5 text-muted-foreground"})]}),i.jsxs(bn,{className:"bg-card border-border p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"موردين"}),i.jsx("p",{className:"text-2xl font-bold text-foreground",children:S.suppliers})]}),i.jsx(O2,{className:"w-5 h-5 text-purple-500"})]}),i.jsxs(bn,{className:"bg-card border-border p-4 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"زبون ومورد"}),i.jsx("p",{className:"text-2xl font-bold text-foreground",children:S.both})]}),i.jsx(rQ,{className:"w-5 h-5 text-amber-500"})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1 min-w-[220px] max-w-md",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),i.jsx(Ee,{value:x,onChange:k=>y(k.target.value),placeholder:"ابحث بالاسم، الشركة، البريد أو الهاتف...",className:"bg-card border-border text-foreground text-sm pr-9"})]}),i.jsxs(En,{value:v,onValueChange:_,children:[i.jsx(Tn,{className:"w-32 bg-card border-border",children:i.jsx(jn,{placeholder:"الكل"})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"all",children:"الكل"}),i.jsx(bt,{value:"client",children:"زبائن"}),i.jsx(bt,{value:"supplier",children:"موردين"}),i.jsx(bt,{value:"both",children:"زبون ومورد"})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e?Array.from({length:4}).map((k,V)=>i.jsxs(bn,{className:"bg-card border-border p-4 animate-pulse",children:[i.jsx("div",{className:"h-4 bg-muted rounded w-32 mb-3"}),i.jsx("div",{className:"h-3 bg-muted rounded w-48"})]},V)):A.length===0?i.jsx("div",{className:"col-span-full text-center py-12 text-muted-foreground",children:x||v!=="all"?"لا توجد نتائج مطابقة":"لا يوجد عملاء"}):A.map(k=>i.jsx(bn,{className:"bg-card border-border p-4 hover:border-primary/30 transition-all",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("h4",{className:"font-semibold text-foreground",children:k.name}),i.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-medium ${C[k.type]||C.client}`,children:E[k.type]||"زبون"})]}),i.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[k.companyName&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(fh,{className:"w-3 h-3"}),i.jsx("span",{children:k.companyName})]}),k.email&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(rN,{className:"w-3 h-3"}),i.jsx("span",{children:k.email})]}),k.phone&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(sN,{className:"w-3 h-3"}),i.jsx("span",{children:k.phone})]})]}),i.jsxs("div",{className:"flex items-center justify-between mt-3 pt-2 border-t border-border",children:[i.jsxs("div",{children:[i.jsxs("span",{className:`text-sm font-bold ${(k.balance||0)>0?"text-red-500":(k.balance||0)<0?"text-green-600":"text-muted-foreground"}`,children:[((k.balance||0)>0||(k.balance||0)<0,""),M(k.balance)]}),(k.balance||0)>0&&i.jsx("span",{className:"text-[10px] text-red-500 mr-1",children:"مدين"}),(k.balance||0)<0&&i.jsx("span",{className:"text-[10px] text-green-600 mr-1",children:"دائن"})]}),k.createdAt&&i.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(k.createdAt).toLocaleDateString("ar-SA",{year:"numeric",month:"2-digit",day:"2-digit"})})]})]}),i.jsxs("div",{className:"flex flex-col gap-1 mr-2",children:[i.jsx("button",{onClick:()=>B(k),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-primary transition-colors",title:"ملف العميل",children:i.jsx(__,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>D(k),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"تعديل",children:i.jsx(hh,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>G(k),className:"p-1.5 rounded-lg hover:bg-muted text-muted-foreground hover:text-red-500 transition-colors",title:"حذف",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]})},k.id))}),o&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4",onClick:()=>l(!1),children:i.jsxs("div",{className:"bg-card border-border rounded-xl w-full max-w-lg",onClick:k=>k.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:u?"تعديل العميل":"إضافة عميل جديد"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:u?"قم بتعديل بيانات العميل":"أدخل بيانات العميل الجديد"})]}),i.jsx("button",{onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground transition-colors",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الاسم *"}),i.jsx(Ee,{value:h.name||"",onChange:k=>p({...h,name:k.target.value}),placeholder:"اسم العميل",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم الشركة"}),i.jsx(Ee,{value:h.companyName||"",onChange:k=>p({...h,companyName:k.target.value}),placeholder:"اسم الشركة (اختياري)",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"النوع"}),i.jsxs(En,{value:h.type||"client",onValueChange:k=>p({...h,type:k}
385),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{})}),i.jsxs(Rn,{dir:"rtl",children:[i.jsx(bt,{value:"client",children:"زبون"}),i.jsx(bt,{value:"supplier",children:"مورد"}),i.jsx(bt,{value:"both",children:"زبون ومورد"})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"البريد الإلكتروني"}),i.jsx(Ee,{type:"email",value:h.email||"",onChange:k=>p({...h,email:k.target.value}),placeholder:"[email protected]",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الهاتف"}),i.jsx(Ee,{value:h.phone||"",onChange:k=>p({...h,phone:k.target.value}),placeholder:"0xxx xxx xxx",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العنوان"}),i.jsx(Ee,{value:h.address||"",onChange:k=>p({...h,address:k.target.value}),placeholder:"عنوان العميل",className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الرقم الضريبي"}),i.jsx(Ee,{value:h.taxNumber||"",onChange:k=>p({...h,taxNumber:k.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الرقم التجاري"}),i.jsx(Ee,{value:h.commercialReg||"",onChange:k=>p({...h,commercialReg:k.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"})]})]})]}),i.jsxs("div",{className:"flex justify-start gap-2 p-4 border-t border-border",children:[i.jsx(ke,{variant:"outline",onClick:()=>l(!1),className:"border-border text-muted-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:P,className:"bg-primary hover:bg-primary/90 text-primary-foreground",disabled:r.isPending||s.isPending,children:u?"حفظ التعديلات":"إضافة العميل"})]})]})})]})}function jse(){const{data:n,isLoading:e,refetch:t}=Pe.machines.list.useQuery(),{data:r}=Pe.productCategories.list.useQuery(),s=Pe.machines.create.useMutation(),a=Pe.machines.update.useMutation(),o=Pe.machines.delete.useMutation(),[l,u]=T.useState(!1),[d,h]=T.useState(null),p={name:"",nameEn:"",code:"",categoryId:null,description:"",descriptionEn:"",specs:"",sellingPrice:0,costPrice:0,websitePrice:0,weight:"",dimensions:"",videoUrl1:"",videoUrl2:"",showOnWebsite:!0,isFeatured:!1,unit:"جهاز",notes:""},[x,y]=T.useState(p),v=()=>{h(null),y(p),u(!0)},_=E=>{h(E),y({...p,...E}),u(!0)},M=async()=>{try{d?(await a.mutateAsync({id:d.id,data:x}),_e.success("تم تحديث الآلة")):(await s.mutateAsync(x),_e.success("تم إضافة الآلة")),u(!1),t()}catch{_e.error("حدث خطأ")}},S=async E=>{if(confirm("هل أنت متأكد من حذف هذه الآلة؟"))try{await o.mutateAsync({id:E.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},A=[{key:"code",label:"الرمز"},{key:"name",label:"اسم الآلة"},{key:"nameEn",label:"English Name",render:E=>E||"-"},{key:"categoryId",label:"التصنيف",render:E=>r?.find(C=>C.id===E)?.name||"-"},{key:"sellingPrice",label:"السعر",render:E=>E?`${E} $`:"-"},{key:"websitePrice",label:"سعر الموقع",render:E=>E?`${E} $`:"-"},{key:"isFeatured",label:"مميزة",render:E=>E?"✅":"-"},{key:"showOnWebsite",label:"معروض",render:E=>E?"✅":"❌"}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"}
385,dir:"rtl",children:[i.jsx(Eh,{title:"الآلات",columns:A,data:n||[],loading:e,searchKey:"name",onAdd:v,onEdit:_,onDelete:S}),i.jsx(Qo,{open:l,onOpenChange:u,title:d?"تعديل آلة":"إضافة آلة",onSubmit:M,children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"المعلومات الأساسية"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"اسم الآلة (عربي) *",children:i.jsx(Ee,{value:x.name,onChange:E=>y({...x,name:E.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"اسم الآلة (إنجليزي)",children:i.jsx(Ee,{value:x.nameEn||"",onChange:E=>y({...x,nameEn:E.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"ltr"})}),i.jsx(Vt,{label:"رمز الآلة",children:i.jsx(Ee,{value:x.code||"",onChange:E=>y({...x,code:E.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"التصنيف",children:i.jsxs(En,{value:x.categoryId?String(x.categoryId):void 0,onValueChange:E=>y({...x,categoryId:parseInt(E)}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{placeholder:"اختر التصنيف"})}),i.jsx(Rn,{dir:"rtl",children:r?.map(E=>i.jsx(bt,{value:String(E.id),children:E.name},E.id))})]})})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"الوصف"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"الوصف (عربي)",children:i.jsx(ni,{value:x.description||"",onChange:E=>y({...x,description:E.target.value}),className:"bg-muted/50 border-border text-foreground min-h-[80px]",dir:"rtl"})}),i.jsx(Vt,{label:"الوصف (إنجليزي)",children:i.jsx(ni,{value:x.descriptionEn||"",onChange:E=>y({...x,descriptionEn:E.target.value}),className:"bg-muted/50 border-border text-foreground min-h-[80px]",dir:"ltr"})})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"الأسعار"}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsx(Vt,{label:"سعر البيع",children:i.jsx(Ee,{type:"number",value:x.sellingPrice||0,onChange:E=>y({...x,sellingPrice:parseFloat(E.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"سعر التكلفة",children:i.jsx(Ee,{type:"number",value:x.costPrice||0,onChange:E=>y({...x,costPrice:parseFloat(E.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"سعر الموقع",children:i.jsx(Ee,{type:"number",value:x.websitePrice||0,onChange:E=>y({...x,websitePrice:parseFloat(E.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"المواصفات الفنية"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"الوزن",children:i.jsx(Ee,{value:x.weight||"",onChange:E=>y({...x,weight:E.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الأبعاد",children:i.jsx(Ee,{value:x.dimensions||"",onChange:E=>y({...x,dimensions:E.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الوحدة",children:i.jsx(Ee,{value:x.unit||"جهاز",onChange:E=>y({...x,unit:E.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"مواصفات إضافية (JSON)",children:i.jsx(ni,{value:x.specs||"",onChange:E=>y({...x,specs:E.target.value}),placeholder:'[{"key": "القدرة", "value": "500 وات"}]',className:"bg-muted/50 border-border text-foreground min-h-[80px] text-xs",dir:"ltr"})})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"الوسائط"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"رابط فيديو 1",children:i.jsx(Ee,{value:x.videoUrl1||"",onChange:E=>y({...x,videoUrl1:E.target.value}),placeholder:"https://youtube.com/...",className:"bg-muted/50 border-border text-foreground",dir:"ltr"})}),i.jsx(Vt,{label:"رابط فيديو 2",children:i.jsx(Ee,{value:x.videoUrl2||"",onChange:E=>y({...x,videoUrl2:E.target.value}),placeholder:"https://youtube.com/...",className:"bg-muted/50 border-border text-foreground",dir:"ltr"})})]}
385),i.jsx("p",{className:"text-xs text-muted-foreground/70 mt-2",children:"ملاحظة: لرفع صور الآلة، استخدم تبويب الصور في المنتج المربوط"})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"خيارات العرض"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border border-border",children:[i.jsx(Yo,{checked:x.showOnWebsite,onCheckedChange:E=>y({...x,showOnWebsite:E})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground",children:"عرض على الموقع"}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"تظهر في كتالوج الموقع"})]})]}),i.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border border-border",children:[i.jsx(Yo,{checked:x.isFeatured,onCheckedChange:E=>y({...x,isFeatured:E})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground",children:"آلة مميزة"}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"تظهر في قسم المميزة"})]})]})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-bold text-primary mb-3",children:"ملاحظات"}),i.jsx(Vt,{label:"ملاحظات داخلية",children:i.jsx(ni,{value:x.notes||"",onChange:E=>y({...x,notes:E.target.value}),className:"bg-muted/50 border-border text-foreground min-h-[60px]",dir:"rtl"})})]})]})})]})}function Tse(){const{data:n,isLoading:e,refetch:t}=Pe.products.list.useQuery(),{data:r}=Pe.productCategories.list.useQuery(),s=Pe.products.create.useMutation(),a=Pe.products.update.useMutation(),o=Pe.products.delete.useMutation(),[l,u]=T.useState(!1),[d,h]=T.useState(!1),[p,x]=T.useState(null),[y,v]=T.useState({name:"",code:"",categoryId:null,unit:"",sellingPrice:0,costPrice:0,websitePrice:0,showOnWebsite:!1,weight:"",dimensions:"",specs:"",features:"",notes:"",videoUrl1:"",videoUrl2:""}),[_,M]=T.useState([]),S=Pe.products.images.useQuery({productId:p?.id||0},{enabled:!!l&&!!p?.id}),A=Array.isArray(S.data)?S.data:[],E=Pe.products.addImage.useMutation(),C=Pe.products.deleteImage.useMutation(),I=Pe.productionOrders.uploadFile.useMutation(),D=()=>{x(null),M([]),v({name:"",code:"",categoryId:null,unit:"",sellingPrice:0,costPrice:0,websitePrice:0,showOnWebsite:!1,weight:"",dimensions:"",specs:"",features:"",notes:"",videoUrl1:"",videoUrl2:""}),u(!0)},B=V=>{x(V),M([]),v(V),u(!0)},P=async()=>{try{let V=p?.id;if(p)await a.mutateAsync({id:p.id,data:y}),_e.success("تم التحديث");else{const U=await s.mutateAsync(y);if(V=Number(U?.id||U?.insertId||0),!V)throw new Error("تم إنشاء المنتج لكن لم يُرجع الخادم رقم المنتج لحفظ الصورة");if(_e.success("تم الإضافة"),V&&_.length>0){for(let $=0;$<_.length;$++){const X=_[$];try{const ee=await new Promise(K=>{const ae=new FileReader;ae.onload=()=>
385K(ae.result),ae.readAsDataURL(X.file)}),z=await I.mutateAsync({fileBase64:ee,fileName:X.fileName||"image.png",mimeType:X.file?.type||"image/png"});if(!z?.url)throw new Error("لم يرجع الخادم رابط الصورة");await E.mutateAsync({productId:Number(V),url:z.url,order:$+1})}catch(ee){throw _e.error(ee instanceof Error?ee.message:"فشل حفظ صورة المنتج"),ee}}M([])}}u(!1),t()}catch{_e.error("حدث خطأ")}},G=async V=>{if(confirm("هل أنت متأكد؟"))try{await o.mutateAsync({id:V.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},k=[{key:"code",label:"الرمز"},{key:"name",label:"اسم المنتج"},{key:"categoryId",label:"التصنيف",render:V=>r?.find(U=>U.id===V)?.name||"-"},{key:"unit",label:"الوحدة"},{key:"sellingPrice",label:"سعر البيع",render:V=>V?`${V} $`:"-"},{key:"costPrice",label:"سعر التكلفة",render:V=>V?`${V} $`:"-"}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsx(Eh,{title:"المنتجات",columns:k,data:n||[],loading:e,searchKey:"name",onAdd:D,onEdit:B,onDelete:G,children:i.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>h(!0),className:"border-primary/30 text-primary hover:bg-primary/10",children:[i.jsx(wF,{className:"w-4 h-4 ml-1"})," إدارة الآلات"]})}),i.jsx(Qa,{open:d,onOpenChange:h,children:i.jsxs(Ka,{className:"bg-card border-border max-w-7xl w-[calc(100vw-2rem)] max-h-[90vh] overflow-y-auto p-0",dir:"rtl",children:[i.jsxs(Ja,{className:"px-6 pt-6 pb-4 border-b border-border",children:[i.jsx(Za,{className:"text-foreground text-xl",style:{fontFamily:"'Cairo', sans-serif"},children:"إدارة المنتجات والآلات — الآلات"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"يمكنك إنشاء وتعديل وحذف الآلات من نافذة المنتجات نفسها."})]}),i.jsx("div",{className:"p-6",children:i.jsx(jse,{})})]})}),i.jsxs(Qo,{open:l,onOpenChange:u,title:p?"تعديل منتج":"إضافة منتج",onSubmit:P,children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"اسم المنتج",children:i.jsx(Ee,{value:y.name,onChange:V=>v({...y,name:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"رمز المنتج",children:i.jsx(Ee,{value:y.code,onChange:V=>v({...y,code:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"التصنيف",children:i.jsxs(En,{value:y.categoryId?String(y.categoryId):void 0,onValueChange:V=>v({...y,categoryId:parseInt(V)}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{placeholder:"اختر التصنيف"})}),i.jsx(Rn,{dir:"rtl",children:r?.map(V=>i.jsx(bt,{value:String(V.id),children:V.name},V.id))})]})}),i.jsx(Vt,{label:"الوحدة",children:i.jsx(Ee,{value:y.unit,onChange:V=>v({...y,unit:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"سعر البيع",children:i.jsx(Ee,{type:"number",value:y.sellingPrice,onChange:V=>v({...y,sellingPrice:parseFloat(V.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"سعر التكلفة",children:i.jsx(Ee,{type:"number",value:y.costPrice,onChange:V=>v({...y,costPrice:parseFloat(V.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"سعر الموقع",children:i.jsx(Ee,{type:"number",value:y.websitePrice||0,onChange:V=>v({...y,websitePrice:parseFloat(V.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الوزن",children:i.jsx(Ee,{value:y.weight,onChange:V=>v({...y,weight:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الأبعاد",children:i.jsx(Ee,{value:y.dimensions,onChange:V=>v({...y,dimensions:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]}),i.jsx(Vt,{label:"المواصفات",children:i.jsx(ni,{value:y.specs||"",onChange:V=>v({...y,specs:V.target.value}),placeholder:"المواصفات التقنية للمنتج...",className:"bg-muted/50 border-border text-foreground min-h-[60
385px]",dir:"rtl"})}),i.jsx(Vt,{label:"المميزات",children:i.jsx(ni,{value:y.features||"",onChange:V=>v({...y,features:V.target.value}),placeholder:"مميزات المنتج (كل ميزة في سطر)...",className:"bg-muted/50 border-border text-foreground min-h-[60px]",dir:"rtl"})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"رابط فيديو 1",children:i.jsx(Ee,{value:y.videoUrl1||"",onChange:V=>v({...y,videoUrl1:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"ltr"})}),i.jsx(Vt,{label:"رابط فيديو 2",children:i.jsx(Ee,{value:y.videoUrl2||"",onChange:V=>v({...y,videoUrl2:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"ltr"})})]}),i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-primary/20 bg-primary/5 p-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-bold text-foreground",children:"إظهار في الموقع العام"}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"تظهر الآلة في كتالوج الصفحة الرئيسية ويمكن للزائر فتح تفاصيلها."})]}),i.jsx(Yo,{checked:!!y.showOnWebsite,onCheckedChange:V=>v({...y,showOnWebsite:V})})]}),i.jsx(Vt,{label:"ملاحظات",children:i.jsx(Ee,{value:y.notes,onChange:V=>v({...y,notes:V.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-muted-foreground mb-1 block",children:"صور المنتج"}),i.jsx("div",{className:"flex flex-wrap gap-3 mb-2",children:(p?A.concat(_):_).map((V,U)=>i.jsxs("div",{className:"relative",children:[i.jsx("img",{src:V.url,alt:"",className:"w-20 h-20 object-cover rounded-lg border border-border"}),i.jsx("button",{type:"button",onClick:async()=>{if(V.id)try{await C.mutateAsync({id:V.id}),_e.success("تم الحذف"),S.refetch()}catch{}else M(_.filter($=>$.url!==V.url))},className:"absolute -top-1.5 -right-1.5 bg-red-500 text-white rounded-full p-0.5",children:i.jsx(Ar,{className:"w-3 h-3"})})]},V.id||`new-${U}`))}),i.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-primary cursor-pointer border border-dashed border-primary/40 rounded-lg px-3 py-2 hover:bg-primary/5",children:[i.jsx(Nn,{className:"w-4 h-4"})," إضافة صورة",i.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:async V=>{const U=V.target.files?.[0];if(U){if(!p){const $=URL.createObjectURL(U);M([..._,{url:$,fileName:U.name,isNew:!0,file:U}]),V.target.value="";return}try{const $=await new Promise(ee=>{const z=new FileReader;z.onload=()=>ee(z.result),z.readAsDataURL(U)}),X=await I.mutateAsync({fileBase64:$,fileName:U.name,mimeType:U.type||"image/png"});if(!X?.url)throw new Error("لم يرجع الخادم رابط الصورة");await E.mutateAsync({productId:Number(p.id),url:X.url,order:A.length+1}),_e.success("تم رفع الصورة"),S.refetch()}catch($){_e.error($ instanceof Error?$.message:"فشل رفع الصورة")}V.target.value=""}}})]})]})]})]})}function WI({cashierMode:n=!1}){const{data:e,isLoading:t,refetch:r}=Pe.employees.list.useQuery(void 0,{enabled:!n}),{data:s}=Pe.employees.cashierMe.useQuery(void 0,{enabled:n}),{data:a,refetch:o}=Pe.rawMaterials.list.useQuery(),{data:l}=Pe.productionOrders.machineNames.useQuery(void 0,{enabled:n}),{data:u}=Pe.productionOrders.list.useQuery(void 0,{enabled:!n}),{data:d,refetch:h}=Pe.rawMaterials.movementsAll.useQuery(void 0,{enabled:!n}),{data:p,refetch:x}=Pe.employees.cashierMovements.useQuery(void 0,{enabled:n}),y=n?p||[]:d||[],v=(e||[]).filter(q=>String(q.position||"").includes("أمين صندوق")||String(q.position||"").includes("أمين المستودع")),_=Pe.employees.withdrawMaterial.useMutation(),M=Pe.employees.deleteWithdrawal.useMutation(),S=Pe.employees.create.useMutation(),A=Pe.employees.update.useMutation(),E=Pe.employees.delete.useMutation(),C=Pe.employees.setCredentials.useMutation(),[I,D]=T.useState(!1),[B,P]=T.useState(null),[G,k]=T.useState({name:"",position:"",department:"",phone:"",email:"",hourlyRate:0,startDate:"",notes:""}),[V,U]=T.useState({employeeId:"",rawMaterialId:"",quantity:"",productionOrderId:"",machineName:"",date:new Date().toISOString().slice(0,10),notes:""}),[$,X]=T.useState(""),[ee,z]=T.useState({username:"",password:""});T.useEffect(()=>{n&&s?.id&&U(q=>({...q,employeeId:String(s.id)}))},[n,s?.id]);const K=()=>{P(null),k({name:"",position:"",department:"",phone:"",email:"",hourlyRate:0,startDate:"",notes:""}),D(!0)},ae=q=>{P(q),k(q),D(!0)},oe=async()=>{try{let q=B?.id;if(B)await A.mutateAsync({id:B.id,data:G}),_e.success("تم التحديث");else{const ne=await S.mutateAsync(G);q=Number(ne?.insertId||ne?.id),_e.success("تم الإضافة")}const Q=String(G.position||"").includes("أمين صندوق")||String(G.position||"").includes("أمين المستودع");if(Q&&!B&&(!ee.username.trim()||!ee.password))throw new Error("يجب إدخال اسم مستخدم وكلمة سر لأمين الصندوق");if(Q&&ee.username.trim()&&ee.password){if(!q)throw new Error("تعذر تحديد الموظف الجديد لحفظ بيانات الدخول");await C.mutateAsync({employeeId:q,username:ee.username.trim(),password:ee.password})}D(!1),z({username:"",password:""}),r()}catch(q){_e.error(q?.message||"حدث خطأ")}},re=async()=>{const q=Number(V.employeeId),Q=Number(V.rawMaterialId),ne=Number(V.quantity),Z=n?s:(e||[]).find(se=>Number(se.id)===q);if(!Z||!String(Z.position||"").includes("أمين صندوق")&&!String(Z.position||"").includes("أمين المستودع")){_e.error("اختر موظفاً من نوع أمين مستودع");return}if(!Q||!Number.isFinite(ne)||ne<=0||!Number(V.productionOrderId)||!V.date){_e.error("أدخل المادة والكمية وأمر الإنتاج والتاريخ");return}try{await _.mutateAsync({employeeId:q,rawMaterialId:Q,quantity:ne,productionOrderId:Number(V.productionOrderId),machineName:V.machineName.trim(),date:V.date,notes:V.notes}),_e.success("تم سحب المادة وتسجيل الحركة باسم الموظف"),U({employeeId:String(q),rawMaterialId:"",quantity:"",productionOrderId:"",machineName:"",date:new Date().toISOString().slice(0,10),notes:""}),X(""),await Promise.all([o(),n?x():h()])}catch(se){_e.error(se?.message||"تعذر سحب المادة")}},F=async q=>{if(confirm("هل تريد حذف هذا السحب وإعادة الكمية إلى المخزون؟"))try{await M.mutateAsync({movementId:Number(q.id)}),_e.success("تم حذف السحب وإعادة الكمية إلى المخزون"),await Promise.all([o(),n?x():h()])}catch(Q){_e.error(Q?.message||"تعذر حذف السحب")}},O=async q=>{if(confirm("هل أنت متأكد؟"))try{await E.mutateAsync({id:q.id}),_e.success("تم الحذف"),r()}catch{_e.error("حدث خطأ")}},J=[{key:"name",label:"الاسم"},{key:"position",label:"المنصب"},{key:"department",label:"القسم"},{key:"phone",label:"الهاتف"},{key:"email",label:"البريد"},{key:"hourlyRate",label:"الراتب بالساعة ($)",render:q=>q?`${q} $/س`:"-"},{key:"startDate",label:"تاريخ البدء",render:q=>q?new Date(q).toLocaleDateString("ar"):"-"}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[!n&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-4 rounded-xl border border-primary/30 bg-primary/5 p-4",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-bold text-foreground",children:"أمناء المستودع"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"الموظفون المصنفون كأمين مستودع ويمكن تجهيز حساب دخولهم من تعديل الموظف."})]}),i.jsx("span",{className:"rounded-full bg-primary px-3 py-1 text-sm font-bold text-primary-foreground",children:v.length})]}),v.length===0?i.jsx("p",{className:"rounded-lg bg-white p-3 text-sm text-slate-600",children:"لا يوجد موظف مصنف كأمين مستودع حتى الآن. أضف موظفاً واختر نوع الموظف «أمين مستودع»."}):i.jsx("div",{className:"grid gap-2 md:grid-cols-2",children:v.map(q=>i.jsxs("button",{type:"button",onClick:()=>ae(q),className:"flex items-center justify-between rounded-lg border border-border bg-white px-3 py-2 text-right text-slate-900 hover:border-primary",children:[i.jsx("span",{className:"font-semibold",children:q.name}),i.jsx("span",{className:"text-xs text-primary",children:"أمين مستودع"})]},q.id))})]}
385),i.jsx(Eh,{title:"الموظفون",columns:J,data:e||[],loading:t,searchKey:"name",onAdd:K,onEdit:ae,onDelete:O}),i.jsxs(Qo,{open:I,onOpenChange:D,title:B?"تعديل موظف":"إضافة موظف",onSubmit:oe,children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Vt,{label:"الاسم",children:i.jsx(Ee,{value:G.name,onChange:q=>k({...G,name:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsxs(Vt,{label:"المنصب / نوع الموظف",children:[i.jsx(Ee,{list:"employee-position-types",value:G.position,onChange:q=>k({...G,position:q.target.value}),placeholder:"اختر أو اكتب: أمين مستودع",className:"bg-muted/50 border-border text-foreground",dir:"rtl"}),i.jsxs("datalist",{id:"employee-position-types",children:[i.jsx("option",{value:"أمين المستودع"}),i.jsx("option",{value:"مشغل"}),i.jsx("option",{value:"فني"}),i.jsx("option",{value:"مدير"})]})]}),i.jsx(Vt,{label:"القسم",children:i.jsx(Ee,{value:G.department,onChange:q=>k({...G,department:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الهاتف",children:i.jsx(Ee,{value:G.phone,onChange:q=>k({...G,phone:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"البريد الإلكتروني",children:i.jsx(Ee,{value:G.email,onChange:q=>k({...G,email:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الراتب بالساعة ($)",children:i.jsx(Ee,{type:"number",value:G.hourlyRate,onChange:q=>k({...G,hourlyRate:parseFloat(q.target.value)||0}),className:"bg-muted/50 border-border text-foreground",dir:"rtl",step:.5,placeholder:"مثال: 3"})}),i.jsx(Vt,{label:"تاريخ البدء",children:i.jsx(Ee,{type:"date",value:G.startDate,onChange:q=>k({...G,startDate:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]}),i.jsx(Vt,{label:"ملاحظات",children:i.jsx(ni,{value:G.notes,onChange:q=>k({...G,notes:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),(String(G.position||"").includes("أمين صندوق")||String(G.position||"").includes("أمين المستودع"))&&i.jsxs("div",{className:"grid grid-cols-2 gap-4 border-t border-border pt-4",children:[i.jsx(Vt,{label:"اسم مستخدم أمين المستودع",children:i.jsx(Ee,{value:ee.username,onChange:q=>z({...ee,username:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"ltr"})}),i.jsx(Vt,{label:"كلمة السر",children:i.jsx(Ee,{type:"password",minLength:4,value:ee.password,onChange:q=>z({...ee,password:q.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"ltr"})})]})]})]}),i.jsxs("div",{className:"mt-6 rounded-xl border border-border bg-card p-4",dir:"rtl",children:[i.jsx("h3",{className:"mb-1 text-lg font-bold text-foreground",children:"سحب مواد أمين المستودع"}),i.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"اختر أمين المستودع والمادة وأمر الإنتاج والكمية والتاريخ لتسجيل حركة خروج مرتبطة بالإنتاج."}),i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[n?i.jsxs("div",{className:"rounded-md border border-border bg-slate-50 px-3 py-2 text-sm text-slate-900",children:["الموظف: ",s?.name||"جاري التحميل..."]}):i.jsxs("select",{value:V.employeeId,onChange:q=>U({...V,employeeId:q.target.value}),className:"rounded-md border border-border bg-white px-3 py-2 text-sm text-slate-900",children:[i.jsx("option",{value:"",children:"اختر أمين المستودع"}),(e||[]).filter(q=>String(q.position||"").includes("أمين صندوق")||String(q.position||"").includes("أمين المستودع")).map(q=>i.jsx("option",{value:q.id,children:q.name},q.id))]}),i.jsxs(i.Fragment,{children:[i.jsx(Ee,{list:"warehouse-raw-materials",value:$,onChange:q=>{const Q=q.target.value;X(Q);const ne=(a||[]).find(Z=>String(Z.name).toLocaleLowerCase()===Q.trim().toLocaleLowerCase());U({...V,rawMaterialId:ne?String(ne.id):""})},placeholder:"ابحث عن المادة الخام",className:"bg-white border-border text-slate-900"}),i.jsx("datalist",{id:"warehouse-raw-materials",children:(a||[]).filter(q=>!$||String(q.name).toLocaleLowerCase().includes($.toLocaleLowerCase())).map(q=>i.jsx("option",{value:q.name,children:`المتاح ${q.stockQuantity||0} ${q.unit||""}`},q.id))})]}),i.jsx(Ee,{type:"number",min:"0.01",value:V.quantity,onChange:q=>U({...V,quantity:q.target.value}),placeholder:"الكمية المراد سحبها",className:"bg-white border-border text-slate-900"}),i.jsxs("select",{value:V.productionOrderId,onChange:q=>{const Q=(n?l||[]:u||[]).find(ne=>String(ne.id)===q.target.value);U({...V,productionOrderId:q.target.value,machineName:Q?.machineName||""})},className:"rounded-md border border-border bg-white px-3 py-2 text-sm text-slate-900",children:[i.jsx("option",{value:"",children:"اختر الآلة وأمر الإنتاج"}),(n?l||[]:u||[]).map(q=>i.jsxs("option",{value:q.id,children:[q.machineName," — رقم الإنتاج ",q.orderNumber]},q.id))]}),i.jsx(Ee,{type:"date",value:V.date,onChange:q=>U({...V,date:q.target.value}),className:"bg-white border-border text-slate-900"}),i.jsx(Ee,{value:V.notes,onChange:q=>U({...V,notes:q.target.value}),placeholder:"ملاحظات السحب",className:"bg-white border-border text-slate-900"})]}),i.jsx("div",{className:"mt-3 flex justify-end",children:i.jsx(ke,{onClick:re,disabled:_.isPending,className:"bg-primary text-primary-foreground",children:_.isPending?"جاري التسجيل...":"تسجيل سحب المادة"})}),i.jsx("div",{className:"mt-5 overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-right text-muted-foreground",children:[i.jsx("th",{className:"p-2",children:"التاريخ"}),i.jsx("th",{className:"p-2",children:"المادة"}),i.jsx("th",{className:"p-2",children:"الكمية"}),i.jsx("th",{className:"p-2",children:"السعر حسب هامش الإنتاج"}),i.jsx("th",{className:"p-2",children:"الموظف والآلة"}),i.jsx("th",{className:"p-2",children:"إجراء"})]})}),i.jsxs("tbody",{children:[y.filter(q=>q.referenceType==="cashier_withdrawal").slice(0,10).map(q=>i.jsxs("tr",{className:"border-b border-border/60",children:[i.jsx("td",{className:"p-2",children:q.createdAt?new Date(q.createdAt).toLocaleDateString("ar"):"-"}),i.jsx("td",{className:"p-2",children:(a||[]).find(Q=>Q.id===q.rawMaterialId)?.name||q.rawMaterialId}),i.jsx("td",{className:"p-2 text-red-500",children:Math.abs(Number(q.quantity||0))}),i.jsxs("td",{className:"p-2",children:[Number(q.unitPrice||0).toFixed(2)," $"]}),i.jsx("td",{className:"p-2",children:q.notes||"-"}),i.jsx("td",{className:"p-2",children:!n&&i.jsx(ke,{type:"button",variant:"destructive",size:"sm",disabled:M.isPending,onClick:()=>F(q),children:"حذف"})})]},q.id)),!y.some(q=>q.referenceType==="cashier_withdrawal")&&i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"p-4 text-center text-muted-foreground",children:"لا توجد سحوبات مسجلة"})})]})]})})]})]})}function Rse(){const{data:n,isLoading:e,refetch:t}=Pe.productCategories.list.useQuery(),r=Pe.productCategories.create.useMutation(),s=Pe.productCategories.update.useMutation(),a=Pe.productCategories.delete.useMutation(),[o,l]=T.useState(!1),[u,d]=T.useState(null),[h,p]=T.useState({name:"",description:""}),x=()=>{d(null),p({name:"",description:""}),l(!0)},y=S=>{d(S),p(S),l(!0)},v=async()=>{try{u?(await s.mutateAsync({id:u.id,data:h}),_e.success("تم التحديث")):(await r.mutateAsync(h),_e.success("تم الإضافة")),l(!1),t()}catch{_e.error("حدث خطأ")}},_=async S=>{if(confirm("هل أنت متأكد؟"))try{await a.mutateAsync({id:S.id}),_e.success("تم الحذف"),t()}catch{_e.error("حدث خطأ")}},M=[{key:"name",label:"اسم التصنيف"},{key:"description",label:"الوصف"}];return i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"}
385,dir:"rtl",children:[i.jsx(Eh,{title:"تصنيفات المنتجات",columns:M,data:n||[],loading:e,searchKey:"name",onAdd:x,onEdit:y,onDelete:_}),i.jsxs(Qo,{open:o,onOpenChange:l,title:u?"تعديل تصنيف":"إضافة تصنيف",onSubmit:v,children:[i.jsx(Vt,{label:"اسم التصنيف",children:i.jsx(Ee,{value:h.name,onChange:S=>p({...h,name:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})}),i.jsx(Vt,{label:"الوصف",children:i.jsx(ni,{value:h.description,onChange:S=>p({...h,description:S.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"})})]})]})}const $I={invoices:Ki,quotations:IY,"packing-lists":O2},HC={invoices:"#8b5cf6",quotations:"#0096a7","packing-lists":"#f59e0b"},XI={invoices:"الفواتير الرسمية",quotations:"عروض الأسعار","packing-lists":"بيانات التعبئة"};function Pse(n,e){if(e==="all")return n;const t=new Date,r=new Date;switch(e){case"today":r.setHours(0,0,0,0);break;case"week":r.setDate(t.getDate()-7);break;case"month":r.setMonth(t.getMonth(),1);break;case"year":r.setFullYear(t.getFullYear(),0,1);break}return n.filter(s=>new Date(s.date||s.createdAt)>=r)}function Dse(){const[n,e]=T.useState("invoices"),[t,r]=T.useState(null),[s,a]=T.useState(""),[o,l]=T.useState("all"),[u,d]=T.useState(!1),{data:h}=Pe.officialInvoices.list.useQuery(),{data:p}=Pe.priceQuotations.list.useQuery(),{data:x}=Pe.packingLists.list.useQuery(),y={invoices:h||[],quotations:p||[],"packing-lists":x||[]},v=T.useMemo(()=>({invoices:(h||[]).length,quotations:(p||[]).length,"packing-lists":(x||[]).length}),[h,p,x]),_=T.useMemo(()=>{const A=y[n]||[];let E=Pse(A,o);if(s.trim()){const C=s.toLowerCase();E=E.filter(I=>(I.customerName||"").toLowerCase().includes(C)||(I.customerPhone||"").toLowerCase().includes(C)||(I.invoiceNumber||I.quotationNumber||I.listNumber||"").toLowerCase().includes(C))}return E},[n,y,o,s]),M=A=>{r(A),d(!0)},S=A=>(A.items||[]).map(C=>({product:C.productName||C.product||"",specs:C.specs||C.description||"",quantity:C.quantity||0,unitPrice:C.unitPrice||0,total:C.totalPrice||(C.quantity||0)*(C.unitPrice||0)}));return i.jsxs("div",{dir:"rtl",children:[i.jsxs("div",{className:"mb-6",children:[i.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[i.jsx(nl,{className:"w-5 h-5 text-primary"}),"التقارير والطباعة"]}),i.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"عرض وطباعة عروض الأسعار والفواتير وبيانات التعبئة"})]}),i.jsx("div",{className:"grid grid-cols-3 gap-3 mb-5",children:["quotations","invoices","packing-lists"].map(A=>{const E=$I[A],C=HC[A];return i.jsxs("div",{className:"bg-muted/50 rounded-xl border border-border p-4 flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{background:`${C}20`},children:i.jsx(E,{className:"w-5 h-5",style:{color:C}})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:XI[A]}),i.jsx("p",{className:"text-2xl font-bold text-foreground",children:v[A]})]})]},A)})}),i.jsx("div",{className:"flex border-b border-border mb-4 overflow-x-auto",children:["invoices","quotations","packing-lists"].map(A=>i.jsxs("button",{onClick:()=>{e(A),r(null),a("")},className:`px-4 py-3 text-sm font-medium whitespace-nowrap transition-colors ${n===A?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:[XI[A]," (",v[A],")"]},A))}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-5",children:[i.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-sm",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70"}),i.jsx(Ee,{value:s,onChange:A=>a(A.target.value),placeholder:"بحث بالعميل أو رقم المستند...",className:"bg-muted/50 border-border text-foreground text-sm pr-9"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(w_,{className:"w-4 h-4 text-muted-foreground
385/70"}),i.jsxs(En,{value:o,onValueChange:A=>l(A),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground text-sm w-36",children:i.jsx(jn,{placeholder:"كل الأوقات"})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",dir:"rtl",children:[i.jsx(bt,{value:"all",children:"كل الأوقات"}),i.jsx(bt,{value:"today",children:"اليوم"}),i.jsx(bt,{value:"week",children:"هذا الأسبوع"}),i.jsx(bt,{value:"month",children:"هذا الشهر"}),i.jsx(bt,{value:"year",children:"هذا العام"})]})]})]})]}),i.jsx("div",{className:"bg-muted/50 rounded-xl border border-border overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"المستند"}),i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"رقم المستند"}),i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"العميل"}),i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"الهاتف"}),i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"المبلغ"}),i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"التاريخ"}),i.jsx("th",{className:"text-right py-3 px-4 text-muted-foreground text-xs font-medium",children:"إجراءات"})]})}),i.jsx("tbody",{children:_.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"text-center py-10 text-muted-foreground/70",children:s||o!=="all"?"لا توجد نتائج مطابقة":"لا توجد مستندات"})}):_.map(A=>{const E=A.invoiceNumber||A.quotationNumber||A.listNumber||`#${A.id}`,C=A.customerName||A.clientName||A.customer||"-",I=A.customerPhone||A.clientPhone||"-",D=A.totalAmount||A.subtotal||A.total||0,B=A.date||A.createdAt;return i.jsxs("tr",{className:"border-b border-border/50 hover:bg-accent/30",children:[i.jsx("td",{className:"py-3 px-4",children:i.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:`${HC[n]}20`},children:Ft.createElement($I[n],{className:"w-4 h-4",style:{color:HC[n]}})})}),i.jsx("td",{className:"py-3 px-4 font-medium text-foreground",children:E}),i.jsx("td",{className:"py-3 px-4 text-foreground",children:C}),i.jsx("td",{className:"py-3 px-4 text-muted-foreground",children:I}),i.jsx("td",{className:"py-3 px-4 font-bold text-primary",children:D?`$ ${D.toLocaleString("en-US",{minimumFractionDigits:2})}`:"-"}),i.jsx("td",{className:"py-3 px-4 text-muted-foreground",children:B?new Date(B).toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):"-"}),i.jsx("td",{className:"py-3 px-4",children:i.jsxs("div",{className:"flex gap-1",children:[i.jsx("button",{onClick:()=>M(A),title:"معاينة",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-primary transition-colors",children:i.jsx(jc,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>M(A),title:"طباعة",className:"p-1.5 rounded-lg hover:bg-accent text-muted-foreground hover:text-green-400 transition-colors",children:i.jsx(nl,{className:"w-4 h-4"})})]})})]},A.id)})})]})}),t&&i.jsx(a3,{open:u,onClose:()=>{d(!1),r(null)},documentType:n==="invoices"?"invoice":n==="quotations"?"quotation":"packing-list",documentNumber:t.invoiceNumber||t.quotationNumber||t.listNumber||`#${t.id}`,customerName:t.customerName||t.clientName||"-",date:t.date||t.createdAt?new Date(t.date||t.createdAt).toLocaleDateString("ar"):"-",items:S(t),subtotal:t.subtotal||0,taxAmount:t.taxAmount||0,totalAmount:t.totalAmount||0,withTax:t.withTax||!1})]})}var kse=Object.defineProperty,Ir=(n,e)=>kse(n,"name",{value:e,configurable:!0}),S6=["PageUp","PageDown"],_6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],M6={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},wv="Slider",[AT,Ise,Bse]=J2(wv),[H3,bbe]=zu(wv,[Bse]),[Lse,Sv]=H3(wv),Ose=T.forwardRef(
385Ir(function(e,t){const{name:r,min:s=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:u=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[s],value:p,onValueChange:x=Ir(()=>{},"onValueChange"),onValueCommit:y=Ir(()=>{},"onValueCommit"),inverted:v=!1,form:_,...M}=e,S=T.useRef(new Set),A=T.useRef(0),E=T.useRef(!1),I=l==="horizontal"?Fse:Use,[D,B]=T.useState(null),P=xr(t,B),[G=[],k]=cp({prop:p,defaultProp:h,onChange:Ir(K=>{[...S.current][A.current]?.focus({preventScroll:!0,focusVisible:E.current}),E.current=!1,x(K)},"onChange")}),V=T.useRef(G),U=T.useRef(G);T.useEffect(()=>{const K=_?D?.ownerDocument.getElementById(_):D?.closest("form");if(K instanceof HTMLFormElement){const ae=Ir(()=>k(U.current),"reset");return K.addEventListener("reset",ae),()=>K.removeEventListener("reset",ae)}},[D,_,k]);function $(K){const ae=P6(G,K);z(K,ae)}Ir($,"handleSlideStart");function X(K){z(K,A.current)}Ir(X,"handleSlideMove");function ee(){String(G)!==String(V.current)&&y(G)}Ir(ee,"handleSlideEnd");function z(K,ae,{commit:oe}={commit:!1}){const re=W3(o),F=gy(Math.round((K-s)/o)*o+s,re),O=Fy(F,[s,a]);k((J=[])=>{const q=T6(J,O,ae);if(I6(q,d*o)){A.current=q.indexOf(O);const Q=String(q)!==String(J);return Q&&oe&&y(q),Q?q:J}else return J})}return Ir(z,"updateValues"),i.jsx(Lse,{scope:e.__scopeSlider,name:r,disabled:u,min:s,max:a,valueIndexToChangeRef:A,thumbs:S.current,values:G,orientation:l,form:_,children:i.jsx(AT.Provider,{scope:e.__scopeSlider,children:i.jsx(AT.Slot,{scope:e.__scopeSlider,children:i.jsx(I,{"aria-disabled":u,"data-disabled":u?"":void 0,...M,ref:P,onPointerDown:Jn(M.onPointerDown,()=>{u||(V.current=G,E.current=!1)}),min:s,max:a,inverted:v,onSlideStart:u?void 0:$,onSlideMove:u?void 0:X,onSlideEnd:u?void 0:ee,onHomeKeyDown:()=>{u||(E.current=!0,z(s,0,{commit:!0}))},onEndKeyDown:()=>{u||(E.current=!0,z(a,G.length-1,{commit:!0}))},onStepKeyDown:({event:K,direction:ae})=>{if(!u){E.current=!0;const F=S6.includes(K.key)||K.shiftKey&&_6.includes(K.key)?10:1,O=A.current,J=G[O],q=B6(J,{min:s,step:o,direction:ae,multiplier:F});z(q,O,{commit:!0})}}})})})})},"Slider")),[N6,A6]=H3(wv,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Fse=T.forwardRef(Ir(function(e,t){const{min:r,max:s,dir:a,inverted:o,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:h,...p}=e,[x,y]=T.useState(null),v=xr(t,y),_=T.useRef(void 0),M=e3(a),S=M==="ltr",A=S&&!o||!S&&o;function E(C){const I=_.current||x.getBoundingClientRect(),D=[0,I.width],P=vN(D,A?[r,s]:[s,r]);return _.current=I,P(C-I.left)}return Ir(E,"getValueFromPointer"),i.jsx(N6,{scope:e.__scopeSlider,startEdge:A?"left":"right",endEdge:A?"right":"left",direction:A?1:-1,size:"width",children:i.jsx(C6,{dir:M,"data-orientation":"horizontal",...p,ref:v,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const I=E(C.clientX);l?.(I)},onSlideMove:C=>{const I=E(C.clientX);u?.(I)},onSlideEnd:()=>{_.current=void 0,d?.()},onStepKeyDown:C=>{const D=M6[A?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:D?-1:1})}})})},"SliderHorizontal")),Use=T.forwardRef(Ir(function(e,t){const{min:r,max:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:u,onStepKeyDown:d,...h}=e,p=T.useRef(null),x=xr(t,p),y=T.useRef(void 0),v=!a;function _(M){const S=y.current||p.current.getBoundingClientRect(),A=[0,S.height],C=vN(A,v?[s,r]:[r,s]);return y.current=S,C(M-S.top)}return Ir(_,"getValueFromPointer"),i.jsx(N6,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:i.jsx(C6,{"data-orientation":"vertical",...h,ref:x,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:M=>{const S=_(M.clientY);o?.(S)},onSlideMove:M=>{const S=_(M.clientY);l?.(S)},onSlideEnd:()=>{y.current=void 0,u?.()},onStepKeyDown:M=>{const A=M6[v?"from-bottom":"from-top"].includes(M.key);d?.({event:M,direction:A?-1:1})}})})},"SliderVertical")),C6=T.forwardRef(Ir(function(e,t){const{__scopeSlider:r,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:u,onStepKeyDown:d,...h}=e,p=Sv(wv,r);return i.jsx(Br.span,{...h,ref:t,onKeyDown:Jn(e.onKeyDown,x=>{x.key==="Home"?(l(x),x.preventDefault()):x.key==="End"?(u(x),x.preventDefault()):S6.concat(_6).includes(x.key)&&(d(x),x.preventDefault())}),onPointerDown:Jn(e.onPointerDown,x=>{const y=x.target;y.setPointerCapture(x.pointerId),x.preventDefault(),p.thumbs.has(y)?y.focus({preventScroll:!0,focusVisible:!1}):s(x)}),onPointerMove:Jn(e.onPointerMove,x=>{x.target.hasPointerCapture(x.pointerId)&&a(x)}),onPointerUp:Jn(e.onPointerUp,x=>{const y=x.target;y.hasPointerCapture(x.pointerId)&&(y.releasePointerCapture(x.pointerId),o(x))})})}
385,"SliderImpl")),zse="SliderTrack",Gse=T.forwardRef(Ir(function(e,t){const{__scopeSlider:r,...s}=e,a=Sv(zse,r);return i.jsx(Br.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})},"SliderTrack")),qI="SliderRange",Hse=T.forwardRef(Ir(function(e,t){const{__scopeSlider:r,...s}=e,a=Sv(qI,r),o=A6(qI,r),l=T.useRef(null),u=xr(t,l),d=a.values.length,h=a.values.map(y=>V3(y,a.min,a.max)),p=d>1?Math.min(...h):0,x=100-Math.max(...h);return i.jsx(Br.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:u,style:{...e.style,[o.startEdge]:p+"%",[o.endEdge]:x+"%"}})},"SliderRange")),Vse="SliderThumb",[Wse,E6]=H3(Vse),$se="SliderThumbProvider";function j6(n){const{__scopeSlider:e,name:t,children:r,internal_do_not_use_render:s}=n,a=Sv($se,e),o=Ise(e),[l,u]=T.useState(null),d=T.useMemo(()=>l?o().findIndex(M=>M.ref.current===l):-1,[o,l]),h=YM(l),p=l?!!a.form||!!l.closest("form"):!0,x=a.values[d],y=t??(a.name?a.name+(a.values.length>1?"[]":""):void 0),v=x===void 0?0:V3(x,a.min,a.max);T.useEffect(()=>{if(l)return a.thumbs.add(l),()=>{a.thumbs.delete(l)}},[l,a.thumbs]);const _={value:x,name:y,form:a.form,isFormControl:p,index:d,thumb:l,onThumbChange:u,percent:v,size:h};return i.jsx(Wse,{scope:e,..._,children:L6(s)?s(_):r})}Ir(j6,"SliderThumbProvider");var VC="SliderThumbTrigger",Xse=T.forwardRef(Ir(function(e,t){const{__scopeSlider:r,...s}=e,a=Sv(VC,r),o=A6(VC,r),{index:l,value:u,percent:d,size:h,onThumbChange:p}=E6(VC,r),x=xr(t,p),y=R6(l,a.values.length),v=h?.[o.size],_=v?D6(v,d,o.direction):0;return i.jsx("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${d}% + ${_}px)`},children:i.jsx(AT.ItemSlot,{scope:r,children:i.jsx(Br.span,{role:"slider","aria-label":e["aria-label"]||y,"aria-valuemin":a.min,"aria-valuenow":u,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...s,ref:x,style:u===void 0?{display:"none"}:e.style,onFocus:Jn(e.onFocus,()=>{a.valueIndexToChangeRef.current=l})})})})},"SliderThumbTrigger")),qse=T.forwardRef(Ir(function(e,t){const{__scopeSlider:r,name:s,...a}=e;return i.jsx(j6,{__scopeSlider:r,name:s,internal_do_not_use_render:({index:o,isFormControl:l})=>i.jsxs(i.Fragment,{children:[i.jsx(Xse,{...a,ref:t,__scopeSlider:r}),l?i.jsx(Qse,{__scopeSlider:r},o):null]})})},"SliderThumb")),Yse="SliderBubbleInput",Qse=T.forwardRef(Ir(function({__scopeSlider:e,...t},r){const{value:s,name:a,form:o}=E6(Yse,e),l=T.useRef(null),u=xr(l,r),d=t3(s);return T.useEffect(()=>{const h=l.current;if(!h)return;const p=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(p,"value").set;if(d!==s&&y){const v=new Event("input",{bubbles:!0});y.call(h,s),h.dispatchEvent(v)}},[d,s]),i.jsx(Br.input,{style:{display:"none"},name:a,form:o,...t,ref:u,defaultValue:s})},"SliderBubbleInput"));function T6(n=[],e,t){const r=[...n];return r[t]=e,r.sort((s,a)=>s-a)}Ir(T6,"getNextSortedValues");function V3(n,e,t){const a=100/(t-e)*(n-e);return Fy(a,[0,100])}Ir(V3,"convertValueToPercentage");function R6(n,e){return e>2?`Value ${n+1} of ${e}`:e===2?["Minimum","Maximum"][n]:void 0}Ir(R6,"getLabel");function P6(n,e){if(n.length===1)return 0;const t=n.map(s=>Math.abs(s-e)),r=Math.min(...t);return t.indexOf(r)}Ir(P6,"getClosestValueIndex");function D6(n,e,t){const r=n/2,a=vN([0,50],[0,r]);return(r-a(e)*t)*t}Ir(D6,"getThumbInBoundsOffset");function k6(n){return n.slice(0,-1).map((e,t)=>n[t+1]-e)}Ir(k6,"getStepsBetweenValues");function I6(n,e){if(e>0){const t=k6(n);return Math.min(...t)>=e}return!0}Ir(I6,"hasMinStepsBetweenValues");function vN(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}Ir(vN,"linearScale");function W3(n){if(!Number.isFinite(n))return 0;const e=n.toString();if(e.includes("e")){const[r,s]=e.split("e"),a=r.split(".")[1]||"",o=Number(s);return Math.max(0,a.length-o)}const t=e.split(".")[1];return t?t.length:0}Ir(W3,"getDecimalCount");function gy(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}Ir(gy,"roundValue");function B6(n,{min:e,step:t,direction:r,multiplier:s}){const a=W3(t),o=(n-e)/t,l=Math.round(o),u=gy(l*t+e,a)===gy(n,a);let d;return u?d=l+s*r:r>0?d=Math.ceil(o):d=Math.floor(o),gy(d*t+e,a)}Ir(B6,"getNextStepValue");function L6(n){return typeof n=="function"}Ir(L6,"isFunction");function YI({className:n,defaultValue:e,value:t,min:r=0,max:s=100,...a}){const o=T.useMemo(()=>Array.isArray(t)?t:Array.isArray(e)?e:[r,s],[t,e,r,s]);return i.jsxs(Ose,{"data-slot":"slider",defaultValue:e,value:t,min:r,max:s,className:br("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",n),...a,children:[i.jsx(Gse,{"data-slot":"slider-track",className:br("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:i.jsx(Hse,{"data-slot":"slider-range",className:br("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:o.length},(l,u)=>i.jsx(qse,{"data-slot":"slider-thumb",className:"border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},u))]})}const Ot=n=>Math.random().toString(36).slice(2,10)+n;function Kse(n){const e=t0(n),t=["quotationNumber","invoiceNumber","voucherNumber","orderNumber"].find(s=>e.some(a=>a.key===s))??"quotationNumber",r=e.some(s=>s.key==="date")?"date":e[0]?.key;return[{id:`el-${Ot(1)}`,type:"field",key:t,x:4,y:20.5,w:44,fontSize:13,fontWeight:700,zIndex:2,enabled:!0},{id:`el-${Ot(2)}`,type:"field",key:r,x:56,y:20.5,w:40,fontSize:13,fontWeight:700,align:"left",zIndex:2,enabled:!0}]}function Jse(n,e){const t=t0(n),r=d=>t.some(h=>h.key===d),s=[];let a=0;const o=["clientName","clientCompany","supplierName"].filter(d=>r(d)).slice(0,1),l=["clientPhone","clientEmail","clientTaxNumber"].filter(d=>r(d)).slice(0,1),u=["clientAddress","supplierAddress"].filter(d=>r(d)).slice(0,1);for(const d of o)s.push({id:`el-${Ot(10+a++)}`,type:"field",key:d,x:4,y:e,w:44,fontSize:13,zIndex:2,enabled:!0});for(const d of l)s.push({id:`el-${Ot(10+a++)}`,type:"field",key:d,x:56,y:e,w:40,fontSize:13,align:"left",zIndex:2,enabled:!0});return u.length&&e+3.5<30&&s.push({id:`el-${Ot(10+a++)}`,type:"field",key:u[0],x:4,y:e+3.5,w:92,fontSize:13,zIndex:2,enabled:!0}),s}function Zse(n,e){const t=t0(n),r=u=>t.some(d=>d.key===u),s=[];let a=0;const l=["validity","paymentTerms","deliveryMethod","deliveryTime","machineName","quantity","status","notes"].filter(u=>r(u)).slice(0,4);for(let u=0;u<l.length;u+=2){const d=l[u],h=l[u+1];s.push({id:`el-${Ot(40+a++)}`,type:"field",key:d,x:4,y:e+u*3.4,w:44,fontSize:12.5,zIndex:2,enabled:!0}),h&&s.push({id:`el-${Ot(40+a++)}`,type:"field",key:h,x:56,y:e+u*3.4,w:40,fontSize:12.5,align:"left",zIndex:2,enabled:!0})}return s}function eie(n,e){const t=t0(n),r=o=>t.some(l=>l.key===o),s=[];let a=0;return r("taxTotal")||r("total")?(r("taxTotal")&&s.push({id:`el-${Ot(60+a++)}`,type:"totalsBox",x:4,y:e,w:44,fontSize:13,zIndex:3,enabled:!0}),r("total")&&s.push({id:`el-${Ot(60+a++)}`,type:"field",key:"total",x:r("taxTotal")?52:4,y:e,w:r("taxTotal")?44:92,fontSize:14,fontWeight:700,align:"left",zIndex:3,enabled:!0})):r("amount")?s.push({id:`el-${Ot(60+a++)}`,type:"field",key:"amount",x:4,y:e,w:92,fontSize:15,fontWeight:700,align:"left",zIndex:3,enabled:!0}):r("totalCost")&&(s.push({id:`el-${Ot(60+a++)}`,type:"field",key:"estimatedCost",x:66,y:e,w:30,fontSize:12,align:"left",zIndex:3,enabled:!0}),s.push({id:`el-${Ot(60+a++)}`,type:"field",key:"actualCost",x:35,y:e,w:28,fontSize:12,align:"left",zIndex:3,enabled:!0}),s.push({id:`el-${Ot(60+a++)}`,type:"field",key:"totalCost",x:4,y:e,w:28,fontSize:13,fontWeight:700,align:"left",zIndex:3,enabled:!0}),s.push({id:`el-${Ot(60+a++)}`,type:"line",x:4,y:e+4.5,w:92,zIndex:2,enabled:!0})),r("amountInWords")&&s.push({id:`el-${Ot(60+a++)}`,type:"field",key:"amountInWords",x:4,y:e+4.5,w:60,fontSize:12,zIndex:3,enabled:!0}),s}function tie(){return[{id:`el-${Ot(70)}`,type:"signature",x:4,y:87,w:92,fontSize:12,zIndex:2,enabled:!0}]}function nie(){return[{id:`el-${Ot(80)}`,type:"pageInfo",x:4,y:95.5,w:92,fontSize:10,zIndex:1,enabled:!0},{id:`el-${Ot(81)}`,type:"text",text:"شكراً لتعاملكم معنا",x:4,y:97.5,w:92,fontSize:10,
385color:"#888",align:"center",zIndex:1,enabled:!0}]}function rie(n,e){const t=[];let r=0;const s=a=>t0(n).some(o=>o.key===a);switch(e){case"classic":t.push({id:`el-${Ot(r++)}`,type:"logo",x:4,y:1.5,w:22,h:14,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:s("companyName")?"companyName":"companyPhone",x:30,y:2,w:66,fontSize:18,fontWeight:800,align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:30,y:6,w:66,fontSize:11,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyAddress",x:30,y:8.5,w:66,fontSize:11,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"line",x:4,y:12,w:92,h:1,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:14,w:92,fontSize:17,fontWeight:700,align:"center",zIndex:3,enabled:!0});break;case"banner":{const a=`el-${Ot(r++)}`,o=`el-${Ot(r++)}`;t.push({id:a,type:"shape",x:0,y:0,w:100,h:17,shapeColor:"var(--primary)",shapeRadius:0,shapeOpacity:1,zIndex:1,enabled:!0},{id:o,type:"shape",x:0,y:17,w:100,h:1.5,shapeColor:"var(--accent)",shapeRadius:0,shapeOpacity:1,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:4,y:1.5,w:18,h:13,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:26,y:2.5,w:70,fontSize:17,fontWeight:800,color:"#fff",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:26,y:6.5,w:70,fontSize:10.5,color:"#e6faff",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:21,w:92,fontSize:16,fontWeight:700,align:"center",zIndex:3,enabled:!0});break}case"minimal":t.push({id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:4,y:2,w:92,fontSize:16,fontWeight:700,align:"right",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:4,y:6,w:44,fontSize:10.5,color:"#666",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyEmail",x:52,y:6,w:44,fontSize:10.5,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"line",x:4,y:9,w:92,h:1,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:80,y:1.5,w:16,h:6,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:11,w:92,fontSize:15,fontWeight:700,align:"right",zIndex:3,enabled:!0});break;case"corporate":t.push({id:`el-${Ot(r++)}`,type:"shape",x:0,y:0,w:100,h:4,shapeColor:"var(--primary)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:4,y:6,w:20,h:12,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:28,y:6.5,w:68,fontSize:16,fontWeight:800,align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:28,y:10,w:34,fontSize:10.5,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyAddress",x:64,y:10,w:32,fontSize:10.5,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:21,w:92,fontSize:16,fontWeight:700,align:"center",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"shape",x:30,y:25.5,w:40,h:.5,shapeColor:"var(--primary)",shapeRadius:0,zIndex:1,enabled:!0});break;case"elegant":t.push({id:`el-${Ot(r++)}`,type:"line",x:4,y:2,w:92,h:1,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:42,y:3.5,w:16,h:10,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:4,y:13.5,w:92,fontSize:15,fontWeight:700,align:"center",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:20,y:16.5,w:28,fontSize:10,color:"#666",align:"center",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyEmail",x:52,y:16.5,w:28,fontSize:10,color:"#666",align:"center",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"line",x:4,y:19,w:92,h:1,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:20.5,w:92,fontSize:15,fontWeight:700,align:"center",zIndex:3,enabled:!0});break;case"modern":t.push({id:`el-${Ot(r++)}`,type:"shape",x:0,y:0,w:34,h:20,shapeColor:"var(--primary)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"shape",x:34,y:0,w:66,h:20,shapeColor:"var(--secondary)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:6,y:3,w:16,h:12,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:6,y:14,w:26,fontSize:11,fontWeight:700,color:"#fff",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:44,y:5,w:52,fontSize:12,fontWeight:700,align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyAddress",x:44,y:9.5,w:52,fontSize:10.5,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyEmail",x:44,y:13,w:52,fontSize:10.5,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:22.5,w:92,fontSize:16,fontWeight:700,align:"center",zIndex:3,enabled:!0});break;case"bold":t.push({id:`el-${Ot(r++)}`,type:"shape",x:0,y:0,w:100,h:14,shapeColor:"var(--accent)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:4,y:2,w:15,h:10,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:22,y:3.5,w:74,fontSize:16,fontWeight:800,color:"#fff",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:22,y:7.5,w:74,fontSize:10.5,color:"#cde",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:16.5,w:92,fontSize:18,fontWeight:800,align:"center",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"shape",x:30,y:21.5,w:40,h:.7,shapeColor:"var(--primary)",shapeRadius:0,zIndex:1,enabled:!0});break;case"official":t.push({id:`el-${Ot(r++)}`,type:"shape",x:0,y:0,w:100,h:1,shapeColor:"var(--accent)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:4,y:2.5,w:16,h:11,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:24,y:3,w:72,fontSize:15,fontWeight:700,align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}
385`,type:"field",key:"companyAddress",x:24,y:7,w:36,fontSize:10,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:62,y:7,w:34,fontSize:10,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"line",x:4,y:13.5,w:92,h:1,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyEmail",x:4,y:14.5,w:92,fontSize:10,color:"#666",align:"center",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:17.5,w:92,fontSize:16,fontWeight:700,align:"center",zIndex:3,enabled:!0});break;case"simple":t.push({id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:4,y:2.5,w:92,fontSize:15,fontWeight:700,align:"right",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:4,y:6.5,w:44,fontSize:10.5,color:"#666",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyEmail",x:52,y:6.5,w:44,fontSize:10.5,color:"#666",align:"left",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:10.5,w:92,fontSize:15,fontWeight:700,align:"right",zIndex:3,enabled:!0},{id:`el-${Ot(r++)}`,type:"line",x:4,y:13.5,w:92,h:.7,zIndex:1,enabled:!0});break;case"premium":t.push({id:`el-${Ot(r++)}`,type:"shape",x:0,y:0,w:100,h:19,shapeColor:"var(--accent)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"shape",x:0,y:19,w:100,h:.8,shapeColor:"var(--primary)",shapeRadius:0,zIndex:1,enabled:!0},{id:`el-${Ot(r++)}`,type:"logo",x:4,y:2,w:17,h:13,manual:!0,zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyName",x:25,y:3,w:71,fontSize:16,fontWeight:800,color:"#fff",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyPhone",x:25,y:7,w:35,fontSize:10.5,color:"#d8eef5",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyEmail",x:62,y:7,w:34,fontSize:10.5,color:"#d8eef5",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"field",key:"companyAddress",x:25,y:10.5,w:71,fontSize:10.5,color:"#d8eef5",align:"left",zIndex:4,enabled:!0},{id:`el-${Ot(r++)}`,type:"text",text:"عنوان المستند",x:4,y:22,w:92,fontSize:16,fontWeight:700,align:"center",zIndex:3,enabled:!0});break}return t}function sie(n,e){return iie(e,n,33.5,62)}function iie(n,e,t,r){return[...rie(n,e),...Kse(n),...Jse(n,25),{id:`el-${Ot(30)}`,type:"itemsTable",x:4,y:t,w:92,fontSize:12,zIndex:3,enabled:!0},...Zse(n,r),...eie(n,77),...tie(),...nie()]}const aie=[{value:"Cairo",label:"Cairo (كايرو)"},{value:"Tajawal",label:"Tajawal (تجوال)"},{value:"Amiri",label:"Amiri (أميري)"},{value:"Noto Kufi Arabic",label:"Noto Kufi Arabic (كوفي)"},{value:"IBM Plex Sans Arabic",label:"IBM Plex Sans Arabic"}],oie=[{value:"right",label:"يمين",icon:MY},{value:"center",label:"وسط",icon:SY},{value:"left",label:"يسار",icon:_Y}],lie=[{id:"rect",label:"مستطيل",icon:ZD,w:34,h:6,color:"#0096a7",radius:0},{id:"rect-soft",label:"مستطيل ناعم",icon:ZD,w:34,h:8,color:"#0096a7",radius:10},{id:"square",label:"مربع",icon:M_,w:12,h:8,color:"#1a1a2e",radius:0},{id:"square-soft",label:"مربع ناعم",icon:M_,w:12,h:8,color:"#1a1a2e",radius:8},{id:"badge",label:"شارة",icon:kY,w:10,h:4.5,color:"#0f766e",radius:2}],QI=()=>Math.random().toString(36).slice(2,10);function cie(n){const e=String(n??"").trim();return e?/^(https?:|data:|blob:|\/)/i.test(e)?e:e.startsWith("manus-storage/")?`/${e}`:e.startsWith("local-storage/")?`/${e}`:`/local-storage/uploads/${e.replace(/^uploads\//,"")}`:""}function KI(n){return(n.length?Math.max(...n.map(e=>e.zIndex??1)):0)+1}function uie(){const n=Pe.templates.defaults.useQuery(),[e,t]=T.useState("quotation"),r=Pe.templates.get.useQuery({docType:e}),s=Pe.templates.save.useMutation(),a=Pe.templates.reset.useMutation(),o=Pe.useUtils(),l=Pe.templates.presets.useQuery({docType:e}),u=Pe.settings.list.useQuery(void 0,{retry:!1}),[d,h]=T.useState(null),[p,x]=T.useState(!1),[y,v]=T.useState(null),[_,M]=T.useState(""),[S,A]=T.useState(!1),[E,C]=T.useState(null);T.useEffect(()=>{if(v(null),r.isLoading||!n.data)return;const O=n.data[e];if(r.data){const J=r.data;h({...O.template,...J,docType:e})}else O&&h({...O.template,docType:e});M(cie(u.data?.company_logo??""))},[e,!!r.data,!!n.data,!!u.data]);const I=O=>d&&h({...d,...O}),D=O=>d&&h({...d,elements:O}),B=O=>{if(!d)return;const J={...O,id:`el-${QI()}`,zIndex:KI(d.elements)};D([...d.elements,J]),v(J.id)},P=(O,J)=>{d&&D(d.elements.map(q=>{if(q.id!==O)return q;const Q={...q,...J};return Q.type==="logo"&&Q.h!=null&&(Q.h=Math.max(2,Math.min(25,Q.h))),Q}))},G=O=>{d&&(D(d.elements.filter(J=>J.id!==O)),y===O&&v(null))},k=async O=>{if(d){C(O);try{const J=await o.templates.applyPreset.fetch({docType:e,templateId:O});if(!J||J.error){_e.error(J?.error??"تعذّر تطبيق القالب");return}h({...d,...J,docType:e}),_e.success("تم تطبيق القالب — يمكنك تعديله كليًا من المحرر"),A(!1)}catch{_e.error("تعذّر تطبيق القالب")}finally{C(null)}}},V=O=>{if(!d)return;const J=d.elements.find(Q=>Q.id===O);if(!J)return;
385const q={...J,id:`el-${QI()}`,x:Math.min(95,J.x+3),zIndex:KI(d.elements)};D([...d.elements,q]),v(q.id)},U=O=>{if(!d)return;const J=[...d.elements].sort((ne,Z)=>(ne.zIndex??1)-(Z.zIndex??1)),q=J.findIndex(ne=>ne.id===O);if(q<0||q>=J.length-1)return;const Q=(J[q+1].zIndex??1)+1;P(O,{zIndex:Q})},$=O=>{if(!d)return;const J=[...d.elements].sort((ne,Z)=>(ne.zIndex??1)-(Z.zIndex??1)),q=J.findIndex(ne=>ne.id===O);if(q<=0)return;const Q=Math.max(1,(J[q-1].zIndex??1)-1);P(O,{zIndex:Q})},X=async()=>{if(d){x(!0);try{const{docType:O,elements:J,...q}=d;await s.mutateAsync({docType:e,elements:J,...q,tableFlowGapPx:Math.max(0,Math.min(120,Number(d.tableFlowGapPx??0)||0))}),_e.success("تم حفظ تصميم الطباعة");const Q=await r.refetch();Q.data&&h({...d,...Q.data,docType:e,tableFlowGapPx:Number(Q.data.tableFlowGapPx??d.tableFlowGapPx??0)||0})}catch{_e.error("فشل الحفظ")}finally{x(!1)}}},ee=async()=>{try{await a.mutateAsync({docType:e}),await r.refetch(),_e.success("تمت إعادة التصميم الافتراضي"),v(null)}catch{_e.error("فشل إعادة التعيين")}},z=d?.elements.find(O=>O.id===y)??null,K=Om.find(O=>O.key===e)?.fields??[],[ae,oe]=T.useState(!1);if(!d)return i.jsx("div",{className:"text-center text-muted-foreground py-10",children:"جاري التحميل..."});const re=SC[e]??SC.quotation,F=Rx(d,re,{logoUrl:_,companyTitle:u.data?.company_name??"",deferTableFlow:!1});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-base font-bold text-foreground",children:"تصميم الطباعة — محرر حر (Canva)"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"اسحب العناصر مباشرة على المعاينة، ضع مستطيلات ملونة تحت الحقول، وسحب الاسم بجانب الهاتف — ثم احفظ ليُطبَّق التصميم على PDF"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ke,{size:"sm",variant:"outline",onClick:()=>A(!0),className:"h-9 bg-secondary hover:bg-secondary/80",children:[i.jsx(qD,{className:"w-3.5 h-3.5 ml-1"})," قوالب جاهزة"]}),i.jsxs(ke,{size:"sm",variant:"outline",onClick:()=>oe(!0),className:"h-9",children:[i.jsx(QD,{className:"w-3.5 h-3.5 ml-1"})," معاينة الطباعة"]}),i.jsxs(En,{value:e,onValueChange:O=>t(O),children:[i.jsx(Tn,{className:"w-[200px] h-9 bg-muted/50 border-border text-foreground text-sm",children:i.jsx(jn,{placeholder:"نوع المستند"})}),i.jsx(Rn,{dir:"rtl",children:Om.map(O=>i.jsx(bt,{value:O.key,children:O.label},O.key))})]}),i.jsxs(ke,{size:"sm",variant:"outline",onClick:ee,className:"text-red-500 border-red-300 hover:bg-red-50 dark:hover:bg-red-950",children:[i.jsx(gF,{className:"w-3.5 h-3.5 ml-1"})," إعادة للافتراضي"]}),i.jsxs(ke,{size:"sm",onClick:X,disabled:p,className:"bg-primary hover:bg-primary/90",children:[i.jsx(Km,{className:"w-3.5 h-3.5 ml-1"})," ",p?"جاري الحفظ...":"حفظ التصميم"]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[340px_1fr] gap-4 items-start",children:[i.jsxs("div",{className:"space-y-4 order-2 xl:order-1",children:[i.jsxs(bn,{className:"bg-card border-border p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(eQ,{className:"w-4 h-4 text-primary"}),i.jsx("h4",{className:"text-sm font-bold text-foreground",children:"الألوان والخطوط"})]}),i.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"اللون الرئيسي",key:"primaryColor"},{label:"الخلفية الفاتحة",key:"secondaryColor"},{label:"النصوص الغامقة",key:"accentColor"}].map(O=>i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:O.label}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"color",value:d[O.key]??"#0096a7",onChange:J=>I({[O.key]:J.target.value}
385),className:"w-7 h-7 rounded border border-border cursor-pointer bg-transparent"}),i.jsx(Ee,{value:d[O.key]??"",onChange:J=>I({[O.key]:J.target.value}),className:"h-7 text-[10px] bg-muted/50 border-border text-foreground"})]})]},O.key))}),i.jsxs("div",{className:"mt-3",children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"الخط"}),i.jsxs(En,{value:d.fontFamily,onValueChange:O=>I({fontFamily:O}),children:[i.jsx(Tn,{className:"h-8 bg-muted/50 border-border text-foreground text-xs",children:i.jsx(jn,{})}),i.jsx(Rn,{dir:"rtl",children:aie.map(O=>i.jsx(bt,{value:O.value,children:O.label},O.value))})]})]}),i.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-3 gap-y-2 mt-3",children:[["showLogo","الشعار"],["showWatermark","علامة مائية"],["showHeader","رأس المستند"],["showTableHeader","رؤوس الجدول"],["showTotals","الإجماليات"],["showSignature","التوقيع"],["showFooter","التذييل"]].map(([O,J])=>i.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-foreground",children:[i.jsx("span",{children:J}),i.jsx(Yo,{checked:d[O],onCheckedChange:q=>I({[O]:q})})]},O))}),i.jsxs("div",{className:"mt-4 pt-3 border-t border-border",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("label",{className:"text-xs font-semibold text-foreground",children:"هامش الأمان عند الطباعة"}),i.jsxs("span",{className:"text-[11px] text-muted-foreground font-mono",children:[d.safeMarginInPx??0,"px"]})]}),i.jsx(YI,{value:[d.safeMarginInPx??0],onValueChange:O=>I({safeMarginInPx:O[0]}),min:0,max:50,step:2,className:"mb-2"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"يبقي العناصر بعيدة عن حواف الورقة عند الطباعة. القيمة 0 تعني بدون هامش."})]}),i.jsxs("div",{className:"mt-4 pt-3 border-t border-border",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("label",{className:"text-xs font-semibold text-foreground",children:"المسافة بعد جدول البنود"}),i.jsxs("span",{className:"text-[11px] text-muted-foreground font-mono",children:[d.tableFlowGapPx??0,"px"]})]}),i.jsx(YI,{value:[d.tableFlowGapPx??0],onValueChange:O=>I({tableFlowGapPx:O[0]}),min:0,max:120,step:1,className:"mb-2"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"تحكم يدوي بالفاصل بين نهاية الجدول وأول عنصر بعده، مثل الإجماليات أو البنك."})]})]}),i.jsxs(bn,{className:"bg-card border-border p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(M_,{className:"w-4 h-4 text-primary"}),i.jsx("h4",{className:"text-sm font-bold text-foreground",children:"أشكال (مستطيل / مربع)"})]}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:lie.map(O=>i.jsxs("button",{type:"button",onClick:()=>B({type:"shape",shapeColor:O.color,shapeRadius:O.radius,x:33,y:3,w:O.w,h:O.h*4}),className:"flex flex-col items-center gap-1 p-2 rounded border border-border bg-muted/30 hover:bg-muted transition-colors text-foreground",children:[i.jsx(O.icon,{className:"w-5 h-5",style:{color:O.color}}),i.jsx("span",{className:"text-[10px]",children:O.label})]},O.id))}),i.jsx("div",{className:"flex items-center gap-1.5 mt-3 flex-wrap",children:i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs flex-1",onClick:()=>B({type:"shape",shapeColor:d.primaryColor,shapeRadius:6,x:33,y:3,w:34,h:24}),children:[i.jsx(Nn,{className:"w-3 h-3 ml-1"})," مستطيل مخصص"]})})]}),i.jsxs(bn,{className:"bg-card border-border p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(qD,{className:"w-4 h-4 text-primary"}),i.jsx("h4",{className:"text-sm font-bold text-foreground",children:"إضافة عنصر للمعاينة"})]}),i.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"field",key:K[0]?.key,fontSize:12,x:5,y:40,w:90}),children:[i.jsx(Gj,{className:"w-3 h-3 ml-1"})," حقل بيانات"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"text",text:"<b>عنوان جديد</b>",fontSize:13,x:5,y:30,w:60}),children:[i.jsx(vF,{className:"w-3 h-3 ml-1"})," نص حر"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"line",x:5,y:20,w:90,h:1}),children:[i.jsx(iN,{className:"w-3 h-3 ml-1"})," خط فاصل"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"itemsTable",x:5,y:33,w:90}),children:[i.jsx(bF,{className:"w-3 h-3 ml-1"})," جدول البنود"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"signature",x:25,y:87,w:50}),children:[i.jsx(pF,{className:"w-3 h-3 ml-1"})," توقيع"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"totalsBox",x:60,y:73,w:35}),children:[i.jsx(nN,{className:"w-3 h-3 ml-1"})," صندوق الإجماليات"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>B({type:"logo",x:5,y:3,w:24,h:10}),children:[i.jsx(tN,{className:"w-3 h-3 ml-1"})," الشعار"]})]}),i.jsxs("div",{className:"mt-3",children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"اختر الحقـل لإضافته"}),i.jsxs(En,{value:"__pick",onValueChange:O=>{O!=="__pick"&&B({type:"field",key:O,fontSize:12,x:5,y:40,w:90})},children:[i.jsx(Tn,{className:"h-8 bg-muted/50 border-border text-foreground text-xs",children:i.jsx(jn,{placeholder:"اختر الحقـل"})}),i.jsx(Rn,{dir:"rtl",children:K.map(O=>i.jsx(bt,{value:O.key,children:O.label},O.key))})]})]})]}),z&&i.jsxs(bn,{className:"bg-card border-2 border-primary p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(hF,{className:"w-4 h-4 text-primary"}),i.jsx("h4",{className:"text-sm font-bold text-foreground",children:"خصائص العنصر"}),i.jsx("span",{className:"text-[10px] text-muted-foreground mr-auto",children:JI(z)})]}),z.type==="field"&&i.jsxs("div",{className:"space-y-3 mb-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"الحقل"}),i.jsxs(En,{value:z.key??"",onValueChange:O=>P(z.id,{key:O}),children:[i.jsx(Tn,{className:"h-8 bg-muted/50 border-border text-foreground text-xs",children:i.jsx(jn,{placeholder:"اختر"})}),i.jsx(Rn,{dir:"rtl",children:K.map(O=>i.jsx(bt,{value:O.key,children:O.label},O.key))})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"اسم الحقل (اختياري — إذا فارغ يُستخدم الاسم الافتراضي)"}),i.jsx(Ee,{value:z.label??"",onChange:O=>P(z.id,{label:O.target.value}),className:"h-8 bg-muted/50 border-border text-foreground text-xs",dir:"rtl",placeholder:"مثال: اسم الزبون"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Yo,{id:`hide-label-${z.id}`,checked:!!z.hiddenLabel,onCheckedChange:O=>P(z.id,{hiddenLabel:O})}),i.jsx("label",{htmlFor:`hide-label-${z.id}`,className:"text-xs font-semibold text-foreground cursor-pointer",children:"إخفاء اسم الحقل (إظهار القيمة فقط)"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"لون اسم الحقل"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"color",value:z.labelColor??d.accentColor,onChange:O=>P(z.id,{labelColor:O.target.value}
385),className:"w-7 h-7 rounded border border-border cursor-pointer bg-transparent"}),i.jsx(Ee,{value:z.labelColor??"",onChange:O=>P(z.id,{labelColor:O.target.value}),className:"h-7 text-[10px] bg-muted/50 border-border text-foreground",placeholder:"افتراضي: لون التمييز"})]})]})]}),z.type==="text"&&i.jsxs("div",{className:"mb-3",children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"النص (يدعم HTML)"}),i.jsx(Ee,{value:z.text??"",onChange:O=>P(z.id,{text:O.target.value}),className:"h-8 bg-muted/50 border-border text-foreground text-xs",dir:"rtl"})]}),z.type==="shape"&&i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"لون التعبئة"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"color",value:z.shapeColor??d.primaryColor,onChange:O=>P(z.id,{shapeColor:O.target.value}),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent"}),i.jsx(Ee,{value:z.shapeColor??"",onChange:O=>P(z.id,{shapeColor:O.target.value}),className:"h-8 text-xs bg-muted/50 border-border text-foreground"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"استدارة الزوايا (px)"}),i.jsx(Ee,{type:"number",min:0,max:80,value:z.shapeRadius??0,onChange:O=>P(z.id,{shapeRadius:parseInt(O.target.value)||0}),className:"h-8 bg-muted/50 border-border text-foreground text-xs"})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"حجم الخط"}),i.jsx(Ee,{type:"number",min:8,max:40,value:z.fontSize??12,onChange:O=>P(z.id,{fontSize:parseInt(O.target.value)||12}),className:"h-8 bg-muted/50 border-border text-foreground text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"العرض %"}),i.jsx(Ee,{type:"number",min:2,max:100,value:z.w??0,onChange:O=>P(z.id,{w:parseFloat(O.target.value)||2}),className:"h-8 bg-muted/50 border-border text-foreground text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"الارتفاع"}),i.jsx(Ee,{type:"number",min:z.type==="logo"?2:1,max:z.type==="logo"?25:120,value:z.h??(z.type==="logo"?10:z.type==="shape"?24:18),onChange:O=>P(z.id,{h:parseFloat(O.target.value)||1}),className:"h-8 bg-muted/50 border-border text-foreground text-xs"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"لون النص"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"color",value:z.color??"#111827",onChange:O=>P(z.id,{color:O.target.value}),className:"w-7 h-7 rounded border border-border cursor-pointer bg-transparent"}),i.jsx(Ee,{value:z.color??"",onChange:O=>P(z.id,{color:O.target.value}),className:"h-7 text-[10px] bg-muted/50 border-border text-foreground"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs font-semibold text-foreground mb-1",children:"المحاذاة"}),i.jsx("div",{className:"flex items-center gap-1",children:oie.map(O=>i.jsx("button",{type:"button",onClick:()=>P(z.id,{align:O.value}),className:`p-1.5 rounded border ${z.align===O.value?"border-primary bg-secondary":"border-border bg-muted/30"}`,title:O.label,children:i.jsx(O.icon,{className:"w-3.5 h-3.5 text-foreground"})},O.value))})]})]}),i.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>U(z.id),children:[i.jsx(ZY,{className:"w-3 h-3 ml-1"})," للأمام"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>
385$(z.id),children:[i.jsx(JY,{className:"w-3 h-3 ml-1"})," للخلف"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>V(z.id),children:[i.jsx(VS,{className:"w-3 h-3 ml-1"})," نسخ"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"h-7 text-xs text-red-500",onClick:()=>G(z.id),children:[i.jsx(Ar,{className:"w-3 h-3 ml-1"})," حذف"]})]}),i.jsx("p",{className:"text-[10px] text-muted-foreground mt-2",children:"الموقع (x، y) يتغير تلقائياً عند السحب على المعاينة"})]}),i.jsxs(bn,{className:"bg-card border-border p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(QD,{className:"w-4 h-4 text-primary"}),i.jsxs("h4",{className:"text-sm font-bold text-foreground",children:["طبقات الصفحة (",d.elements.length,")"]})]}),i.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1",children:[...d.elements].sort((O,J)=>(J.zIndex??1)-(O.zIndex??1)).map(O=>i.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-1.5 rounded cursor-pointer border text-xs ${y===O.id?"border-primary bg-secondary":"border-border bg-muted/20"}`,onClick:()=>v(O.id),children:[i.jsx(fie,{kind:O.type}),i.jsx("span",{className:"flex-1 truncate text-foreground",children:JI(O)}),i.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:["z",O.zIndex??1]})]},O.id))})]})]}),i.jsx("div",{className:"xl:sticky xl:top-4 order-1 xl:order-2",children:i.jsxs(bn,{className:"bg-card border-border p-4",children:[i.jsx("h4",{className:"text-sm font-bold text-foreground mb-3",children:"معاينة مباشرة — اسحب وحرّك وأفلت"}),i.jsx(die,{tpl:d,selectedId:y,logoUrl:_,sample:re,onSelect:v,onMove:(O,J,q)=>P(O,{x:J,y:q}),onResize:(O,J)=>P(O,J)})]})})]})]}),ae&&i.jsx(a3,{open:ae,onClose:()=>oe(!1),documentType:"quotation",documentNumber:e==="quotation"?"QT-0001":e==="receipt"?"RV-0001":e==="payment"?"PV-0001":"DOC-0001",customerName:"",date:"",items:[],contentHtml:F}),i.jsx(Qa,{open:S,onOpenChange:A,children:i.jsxs(Ka,{dir:"rtl",className:"max-w-4xl max-h-[85vh] overflow-y-auto",children:[i.jsxs(Ja,{children:[i.jsxs(Za,{className:"text-foreground",children:["قوالب جاهزة — ",Om.find(O=>O.key===e)?.label??""]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"اختر قالبًا لتطبيقه على التصميم، ثم عدّل أي عنصر بحرية في المحرر."})]}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 pb-2",children:(l.data??[]).map(O=>{const J={...O.theme,title:Om.find(ne=>ne.key===e)?.label??"",elements:sie(O.headerStyle,e),safeMarginInPx:12,showWatermark:!1},q={...SC[e]},Q=Rx(J,q,{logoUrl:"",companyTitle:"",deferTableFlow:!1});return i.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-background flex flex-col",children:[i.jsx("div",{className:"h-44 overflow-hidden bg-white",children:i.jsx("iframe",{title:O.name,srcDoc:Q,className:"w-[180%] h-[180%] border-0",style:{transform:"scale(0.55)",transformOrigin:"top right",pointerEvents:"none"}})}),i.jsxs("div",{className:"p-3 flex items-center gap-2",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm font-bold text-foreground",children:O.name}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:O.description})]}),i.jsx(ke,{size:"sm",variant:E===O.id?"secondary":"outline",disabled:!!E,onClick:()=>k(O.id),className:"shrink-0",children:E===O.id?"جاري التطبيق...":"تطبيق"})]})]},O.id)})})]})})]})}function die({tpl:n,selectedId:e,logoUrl:t,sample:r,onSelect:s,onMove:a,onResize:o}){const l=T.useRef(null),u=T.useRef(a),d=T.useRef(o),h=T.useRef(s);T.useEffect(()=>{u.current=a},[a]),T.useEffect(()=>{d.current=o},[o]),T.useEffect(()=>{h.current=s},[s]);const p=(k,V,U)=>Math.min(U,Math.max(V,k)),x=T.useCallback((k,V,U)=>{const $=l.current?.getBoundingClientRect();if(!$)return;const X=(V-k.startX)/$.width*100,ee=(U-k.startY)/$.height*100;if(k.mode==="move"){const z=p(Math.round((k.origX+X)*10)/10,0,100-(k.origW??10)),K=p(Math.round((k.origY+ee)*10)/10,0,95);u.current(k.id,z,K)}else{const z=(V-$.left)/$.width*100,K=(U-$.top)/$.height*100;let ae=k.origX,oe=k.origY,re=k.origW,F=k.origH??10;const O=2,J=2;if(k.handle==="nw"||k.handle==="sw"){const q=p(z,0,k.origX+k.origW-O);re=k.origX+k.origW-q,ae=q}else(k.handle==="ne"||k.handle==="se")&&(re=p(z-k.origX,O,100-k.origX));if(k.handle==="nw"||k.handle==="ne"){const q=p(K,0,k.origY+(k.origH??10)-J);F=k.origY+(k.origH??10)-q,oe=q}else(k.handle==="sw"||k.handle==="se")&&(F=p(K-k.origY,J,100-k.origY));d.current(k.id,{x:Math.round(ae*10)/10,y:Math.round(oe*10)/10,w:Math.round(re*10)/10,h:Math.round(F*10)/10})}},[]),y=T.useCallback(k=>{_.current&&x(_.current,k.clientX,k.clientY)},[x]),v=T.useCallback(()=>{_.current=null,window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",v),document.body.style.cursor="",document.body.style.userSelect=""},[y]),_=T.useRef(null),M=T.useCallback((k,V,U,$)=>
385{k.stopPropagation(),h.current(V.id),_.current={id:V.id,mode:U,handle:$,startX:k.clientX,startY:k.clientY,origX:V.x,origY:V.y,origW:V.w,origH:V.h},document.body.style.cursor=U==="move"?"grabbing":"default",document.body.style.userSelect="none",window.addEventListener("pointermove",y),window.addEventListener("pointerup",v),x(_.current,k.clientX,k.clientY)},[x,y,v]),S=`'${n.fontFamily}', sans-serif`,A=n.safeMarginInPx??0,E=794,C=1123,I=E-A*2,D=C-A*2,B=k=>{const V=k.key??"";return V==="date"?Ak():V==="itemsTable"?"":r[V]??""},P=new Set(n.elements.filter(k=>k.enabled===!1?!1:k.type==="field"?!!B(k):k.type==="text"?!!String(k.text??"").trim():(k.type==="itemsTable",!0)).map(k=>k.id)),G=k=>k.label?k.label:k.type==="logo"?"الشعار":k.type==="signature"?"التوقيع":k.type==="text"?k.text?k.text.replace(/<[^>]+>/g,"").slice(0,28):"نص حر":k.type==="itemsTable"?"جدول البنود":k.type==="totalsBox"?"الإجماليات":k.type==="line"||k.type==="shape"?"":k.type==="pageInfo"?"التاريخ":Om.find(U=>U.key===n.docType)?.fields.find(U=>U.key===k.key)?.label||k.key||"";return i.jsxs("div",{ref:l,className:"relative w-full bg-white rounded-lg overflow-hidden",style:{aspectRatio:"210 / 297",border:"1px solid #e5e7eb",fontFamily:S,direction:"rtl",minHeight:420,cursor:_.current?"grabbing":"default",touchAction:"none"},onPointerDown:k=>{k.target===l.current&&s(null)},children:[A>0&&i.jsx("div",{className:"absolute pointer-events-none",style:{left:`${A/E*100}%`,top:`${A/C*100}%`,width:`${I/E*100}%`,height:`${D/C*100}%`,border:"1px dashed rgba(255,0,0,0.25)"}}),i.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:"linear-gradient(rgba(0,150,167,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(0,150,167,0.06) 1px, transparent 1px)",backgroundSize:"10% 5%"}}),n.showWatermark&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none opacity-[0.07]",style:{fontSize:"min(90px, 12vw)",fontWeight:800,color:n.accentColor,transform:"rotate(-35deg)"},children:"مسودة"}),i.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{direction:"rtl"},children:n.elements.slice().sort((k,V)=>(k.zIndex??1)-(V.zIndex??1)).map(k=>{if(k.enabled===!1)return null;const V=e===k.id,U=`${(A+k.x/100*I)/E*100}%`,$=TU(n.elements,k,2,D,void 0,n.tableFlowGapPx??0,P),X=`${(A+k.y/100*D+$)/C*100}%`,ee=`${k.w/100*I/E*100}%`,z=k.h!=null?`${k.h/100*D/C*100}%`:void 0,K={position:"absolute",left:U,top:X,width:ee,height:z,zIndex:(k.zIndex??1)+(V?50:0),cursor:_.current?"grabbing":"grab",touchAction:"none",pointerEvents:"auto"};if(k.type==="shape")return i.jsxs("div",{style:{...K,background:k.shapeColor??n.primaryColor,borderRadius:k.shapeRadius?`${k.shapeRadius}px`:void 0,border:k.shapeBorder??void 0,opacity:k.shapeOpacity??1},onPointerDown:Z=>M(Z,k,"move","se"),"data-el-id":k.id,children:[V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:Z=>se=>M(se,k,"resize",Z)})]},k.id);if(k.type==="logo")return n.showLogo===!1&&!k.manual?null:i.jsxs("div",{style:{...K,height:k.h==null?"8%":K.height},onPointerDown:Z=>M(Z,k,"move","se"),"data-el-id":k.id,children:[t?i.jsx("img",{src:t,alt:"شعار",className:"w-full h-full object-contain object-top",draggable:!1}):i.jsx("div",{className:"w-full h-full flex items-center justify-center border border-dashed text-primary text-[9px]",style:{borderColor:n.primaryColor},children:"الشعار"}),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:Z=>se=>M(se,k,"resize",Z)})]},k.id);if(k.type==="itemsTable"){const Z=jU(n.elements,k,2);return i.jsxs("div",{style:{...K,height:`${Z/C*100}%`},onPointerDown:se=>M(se,k,"move","se"),"data-el-id":k.id,children:[i.jsx("div",{style:{border:`1px solid ${n.primaryColor}`,borderRadius:0,overflow:"hidden",height:"100%"},children:i.jsxs("table",{style:{width:"100%",height:"100%",tableLayout:"fixed",borderCollapse:"collapse",fontSize:12},children:[i.jsx("thead",{children:i.jsx("tr",{style:{background:n.primaryColor,color:"#fff"},children:c3.map(se=>i.jsx("th",{style:{padding:"8px 6px",fontWeight:700,fontSize:12},children:se.label},se.key))})}),i.jsx("tbody",{children:[["مكنة تصنيع X-100","2","8,000.00","16,000.00"],["قطع غيار","1","9,400.00","9,400.00"]].map((se,me)=>i.jsx("tr",{style:{borderBottom:"1px solid #e5f5f7"},children:se.map((ze,Be)=>i.jsx("td",{style:{padding:"7px 6px",textAlign:"center",fontSize:12,fontWeight:Be===3?700:400},children:ze},Be))},me))})]})}),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:se=>me=>M(me,k,"resize",se)}
385)]},k.id)}if(k.type==="totalsBox"){const Z=f3(String(r.discount??""),String(r.taxTotal??""));return i.jsxs("div",{style:{...K,height:`${Z/C*100}%`},onPointerDown:se=>M(se,k,"move","se"),"data-el-id":k.id,children:[i.jsxs("div",{style:{height:"100%",boxSizing:"border-box",overflow:"hidden",background:n.secondaryColor??"#f0fbfc",border:"1px solid #cce3e6",borderRadius:6,padding:"10px 14px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"3px 0",borderBottom:"1px dashed #cce3e6"},children:[i.jsx("span",{children:"الخصم"}),i.jsx("span",{style:{fontWeight:700},children:r.discount??"0"})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"3px 0",borderBottom:"1px dashed #cce3e6"},children:[i.jsx("span",{children:"الضريبة"}),i.jsx("span",{style:{fontWeight:700},children:r.taxTotal??"0"})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"6px 0",fontSize:15},children:[i.jsx("span",{style:{fontWeight:700,color:n.accentColor},children:"الإجمالي النهائي"}),i.jsx("span",{style:{fontWeight:800,color:n.primaryColor},children:r.total??"0.00"})]})]}),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:se=>me=>M(me,k,"resize",se)})]},k.id)}if(k.type==="signature")return i.jsxs("div",{style:K,onPointerDown:Z=>M(Z,k,"move","se"),"data-el-id":k.id,children:[i.jsx("div",{style:{display:"flex",justifyContent:"space-around"},children:["المدير","المحاسب"].map(Z=>i.jsx("div",{style:{textAlign:"center"},children:i.jsx("div",{style:{borderTop:`1px solid ${n.accentColor}`,width:140,marginTop:38,paddingTop:6,fontSize:11},children:Z})},Z))}),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:Z=>se=>M(se,k,"resize",Z)})]},k.id);if(k.type==="line")return i.jsxs("div",{style:{...K,height:k.h==null?1:K.height,display:"flex",alignItems:"center"},onPointerDown:Z=>M(Z,k,"move","se"),"data-el-id":k.id,children:[i.jsx("div",{style:{width:"100%",height:1,background:n.accentColor,opacity:.25}}),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:Z=>se=>M(se,k,"resize",Z)})]},k.id);if(k.type==="pageInfo")return i.jsxs("div",{style:{...K,fontSize:10,color:"#6b7280",textAlign:"center"},onPointerDown:Z=>M(Z,k,"move","se"),"data-el-id":k.id,children:[Ak(),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:Z=>se=>M(se,k,"resize",Z)})]},k.id);const ae=k.align==="center"?{textAlign:"center"}:k.align==="left"?{textAlign:"left"}:{textAlign:"right"},oe=k.type==="text",re=k.type==="field"?AU[k.key??""]??"":"",F=k.type==="field"?k.hiddenLabel?"":k.label||re||"":k.label??"",O=k.type==="field"?k.labelColor||n.accentColor:void 0,J=!oe&&k.key==="bankInfo",q=J?B(k).split(/\r?\n/).map(Z=>Z.trim()).filter(Boolean):[],Q=k.align==="left"?"left":k.align==="center"?"center":"right",ne=oe?k.text:i.jsxs(i.Fragment,{children:[F?i.jsxs("span",{style:{fontWeight:700,color:O??k.color??"#111827"},children:[F,":"]}):null," ",B(k)]});return i.jsxs("div",{style:{...K,...ae,fontSize:k.fontSize?`${k.fontSize}px`:14,fontWeight:k.fontWeight??400,color:k.color??"#111827",lineHeight:1.5,minHeight:k.fontSize?`${k.fontSize*1.5}px`:21,whiteSpace:J?void 0:"pre-wrap",overflow:"visible",fontFamily:S},onPointerDown:Z=>M(Z,k,"move","se"),title:G(k),"data-el-id":k.id,children:[J?i.jsxs(i.Fragment,{children:[F?i.jsxs("div",{style:{fontWeight:700,color:O??k.color??"#111827",marginBottom:4},children:[F,":"]}):null,i.jsx("ul",{style:{margin:0,paddingLeft:k.align==="left"?22:0,paddingRight:k.align==="left"?0:22,listStyle:"disc",listStylePosition:"outside",lineHeight:1.8,textAlign:Q,direction:k.align==="left"?"ltr":"rtl"},children:q.map((Z,se)=>i.jsx("li",{children:Z},`${se}-${Z}`))})]}):i.jsx("span",{dangerouslySetInnerHTML:oe?{__html:ne}:void 0,style:void 0,children:oe?void 0:ne}),V&&i.jsx(Of,{}),V&&i.jsx(Ff,{onDown:Z=>se=>M(se,k,"resize",Z)})]},k.id)})}),i.jsx("div",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 text-[9px] text-muted-foreground bg-white/80 px-2 py-0.5 rounded pointer-events-none",children:"A4 — النسب مئوية (%) • الزر الأيمن على العنصر للحذف أو استخدم لوحة الخصائص"})]})}function Of(){return i.jsx("div",{className:"absolute inset-0 pointer-events-none border-2 border-primary",style:{boxShadow:"0 0 0 1px rgba(0,150,167,0.35)"}})}function Ff({onDown:n}){const e="absolute w-2.5 h-2.5 bg-primary border border-white rounded-sm pointer-events-auto",t=[{h:"nw",cls:"-top-1 -left-1 -translate-x-1/2 -translate-y-1/2 cursor-nw-resize"},{h:"ne",cls:"-top-1 -right-1 translate-x-1/2 -translate-y-1/2 cursor-ne-resize"},{h:"sw",cls:"-bottom-1 -left-1 -translate-x-1/2 translate-y-1/2 cursor-sw-resize"},{h:"se",cls:"-bottom-1 -right-1 translate-x-1/2 translate-y-1/2 cursor-se-resize"}];return i.jsx(i.Fragment,{children:t.map(r=>i.jsx("div",{className:`${e} ${r.cls}`,style:{zIndex:60},onPointerDown:s=>{s.stopPropagation(),n(r.h)(s)}},r.h))})}function fie({kind:n}){const e="w-3.5 h-3.5 text-primary shrink-0";switch(n){case"field":return i.jsx(Gj,{className:e});case"text":return i.jsx(vF,{className:e});case"shape":return i.jsx(M_,{className:e});case"logo":return i.jsx(tN,{className:e});case"itemsTable":return i.jsx(bF,{className:e});case"signature":return i.jsx(pF,{className:e});case"totalsBox":return i.jsx(nN,{className:e});case"line":return i.jsx(iN,{className:e});case"pageInfo":return i.jsx(Gj,{className:e});default:return i.jsx(hF,{className:e})}}function JI(n){return n.type==="shape"?`شكل ملون (z${n.zIndex??1})`:n.type==="field"?`حقل: ${n.key??""}`:n.type==="text"?`نص: ${(n.text??"").replace(/<[^>]+>/g,"").slice(0,20)}`:n.type==="logo"?"الشعار":n.type==="itemsTable"?"جدول البنود":n.type==="signature"?"التوقيع":n.type==="totalsBox"?"الإجماليات":n.type==="line"?"خط فاصل":n.type==="pageInfo"?"التاريخ/الصفحة":n.type}function ZI(n){const e=String(n??"").trim();return e?/^(https?:|data:|blob:|\/)/i.test(e)?e:e.startsWith("manus-storage/")?`/${e}
385`:e.startsWith("local-storage/")?`/${e}`:`/local-storage/uploads/${e.replace(/^uploads\//,"")}`:""}const hie=[{key:"company_name",label:"اسم الشركة",type:"text"},{key:"company_intro",label:"مقدمة الشركة",type:"textarea"},{key:"company_address",label:"عنوان الشركة",type:"text"},{key:"company_email",label:"البريد الإلكتروني للشركة",type:"email"},{key:"whatsapp_number",label:"رقم واتساب",type:"text"},{key:"tax_percentage",label:"نسبة الضريبة (%)",type:"text"},{key:"terms_conditions",label:"الشروط والأحكام",type:"textarea"},{key:"operational_costs",label:"التكاليف التشغيلية",type:"text"}];function mie(){const[n,e]=T.useState(!1),{data:t,isLoading:r,refetch:s}=Pe.settings.list.useQuery(),a=Pe.settings.upsert.useMutation(),[o,l]=T.useState({}),[u,d]=T.useState(null),h=Pe.settings.resetBusinessData.useMutation(),p=Pe.settings.backup.useQuery(void 0,{enabled:!1}),x=Pe.settings.restoreBackup.useMutation(),[y,v]=T.useState(""),[_,M]=T.useState(""),S=Pe.settings.technicalInfoOptions.list.useQuery(void 0,{retry:!1}),A=Pe.settings.technicalInfoOptions.upsert.useMutation(),E=Pe.settings.technicalInfoOptions.delete.useMutation(),C=Pe.settings.paymentTermsOptions.list.useQuery(void 0,{retry:!1}),I=Pe.settings.paymentTermsOptions.upsert.useMutation(),D=Pe.settings.paymentTermsOptions.delete.useMutation(),B=Pe.settings.deliveryMethodsOptions.list.useQuery(void 0,{retry:!1}),P=Pe.settings.deliveryMethodsOptions.upsert.useMutation(),G=Pe.settings.deliveryMethodsOptions.delete.useMutation(),[k,V]=T.useState({label:"",unit:""}),[U,$]=T.useState({label:""}),[X,ee]=T.useState({label:"",durationLabel:""}),z=async()=>{if(_!=="تصفير البيانات"){_e.error("اكتب عبارة التأكيد: تصفير البيانات");return}if(window.confirm("تحذير نهائي: سيتم حذف بيانات الأعمال فقط. ستبقى كلمة مرور المدير وإعدادات الشركة وقوالب المستندات محفوظة. هل تريد المتابعة؟"))try{await h.mutateAsync({password:y,confirmation:_}),_e.success("تم تصفير بيانات الأعمال بنجاح"),v(""),M(""),await s()}catch(re){_e.error(re?.message||"تعذر تصفير البيانات")}},K=async()=>{try{const re=await p.refetch();if(!re.data)throw new Error("تعذر إنشاء النسخة الاحتياطية");const F=new Blob([JSON.stringify(re.data,null,2)],{type:"application/json;charset=utf-8"}),O=URL.createObjectURL(F),J=document.createElement("a");J.href=O,J.download=`amz-backup-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,document.body.appendChild(J),J.click(),J.remove(),URL.revokeObjectURL(O),_e.success("تم إنشاء وتنزيل النسخة الاحتياطية")}catch(re){_e.error(re?.message||"تعذر إنشاء النسخة الاحتياطية")}},ae=async re=>{if(re)try{if(re.size>50*1024*1024)throw new Error("حجم النسخة أكبر من الحد المسموح 50 ميغابايت");const F=JSON.parse(await re.text()),O=window.prompt("أدخل كلمة مرور المدير لاستعادة النسخة");if(!O||!window.confirm("سيتم استبدال بيانات الأعمال الحالية بالنسخة المرفوعة. ستبقى كلمة مرور المدير وإعدادات الشركة وقوالب المستندات محفوظة. هل تريد المتابعة؟"))return;await x.mutateAsync({snapshot:F,password:O,confirmation:"استعادة النسخة"}),_e.success("تمت استعادة النسخة الاحتياطية بنجاح"),await s()}catch(F){_e.error(F?.message||"تعذر استعادة النسخة الاحتياطية")}},oe=async re=>{d(re);try{const F=o[re]??t?.[re]??"";await a.mutateAsync({key:re,value:F}),_e.success("تم حفظ الإعداد"),s()}catch{_e.error("فشل الحفظ")}finally{d(null)}};return n?i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsx("div",{className:"mb-4 flex items-center gap-3",children:i.jsx(ke,{size:"sm",variant:"outline",onClick:()=>e(!1),className:"border-border text-foreground",children:"← العودة إلى الإعدادات"})}),i.jsx(uie,{})]}):i.jsxs("div",{style:{fontFamily:"'Cairo', sans-serif"},dir:"rtl",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"الإعدادات"}),i.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"إدارة إعدادات النظام والقوائم المنسدلة"}),i.jsxs(ke,{size:"sm",onClick:()=>e(!0),className:"mt-3 bg-primary hover:bg-primary/90",children:[i.jsx(nl,{className:"w-4 h-4 ml-1"})," تصميم الطباعة (PDF)"]})]}),r?i.jsx("div",{className:"text-center text-muted-foreground py-8",children:"جاري التحميل..."}):i.jsxs("div",{className:"space-y-5",children:[i.jsxs(bn,{id:"data-reset-card",className:"bg-white border-2 border-red-400 p-5 shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Ar,{className:"w-4 h-4 text-red-600"}),i.jsx("h3",{className:"text-base font-bold text-red-700",children:"حذف وتصفير بيانات الأعمال"})]}),i.jsx("p",{className:"text-sm text-red-700 mb-3",children:"يحذف هذا الإجراء بيانات الأعمال فقط، مثل العملاء والمنتجات والمواد والفواتير والإنتاج والصناديق والحركات. لا تُحذف كلمة مرور المدير أو إعدادات الشركة أو قوالب المستندات أو مخطط قاعدة البيانات."}),i.jsxs("div",{className:"grid gap-2 max-w-md",children:[i.jsx(Ee,{type:"password",value:y,onChange:re=>v(re.target.value),placeholder:"كلمة مرور المدير",className:"bg-white border-red-200 text-slate-900",dir:"rtl"}
385),i.jsx(Ee,{value:_,onChange:re=>M(re.target.value),placeholder:"اكتب: تصفير البيانات",className:"bg-white border-red-200 text-slate-900",dir:"rtl"}),i.jsxs(ke,{type:"button",variant:"destructive",onClick:z,disabled:h.isPending||!y||_!=="تصفير البيانات",children:[i.jsx(Ar,{className:"w-4 h-4 ml-1"}),h.isPending?"جاري التصفير...":"حذف وتصفير بيانات الأعمال"]})]})]}),i.jsxs(bn,{id:"backup-restore-card",className:"bg-white border-2 border-blue-400 p-5 shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Oj,{className:"w-4 h-4 text-blue-700"}),i.jsx("h3",{className:"text-base font-bold text-blue-800",children:"النسخ الاحتياطي والاستعادة"})]}),i.jsx("p",{className:"text-sm text-slate-700 mb-3",children:"احفظ نسخة كاملة من بيانات النظام في ملف JSON، أو ارفع نسخة سابقة لاستعادة بيانات الأعمال. تبقى كلمة مرور المدير وإعدادات الشركة وقوالب المستندات محفوظة، ولا يمكن لأمين المستودع استخدام هذه الإجراءات."}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(ke,{type:"button",onClick:K,disabled:p.isFetching,className:"bg-blue-700 hover:bg-blue-800 text-white",children:[i.jsx(Oj,{className:"w-4 h-4 ml-1"}),p.isFetching?"جاري تجهيز النسخة...":"حفظ نسخة احتياطية"]}),i.jsxs("label",{className:"inline-flex items-center gap-2 rounded-md bg-slate-700 px-3 py-2 text-sm font-medium text-white cursor-pointer hover:bg-slate-800",children:[i.jsx(F2,{className:"w-4 h-4"}),x.isPending?"جاري الاستعادة...":"رفع نسخة واستعادتها",i.jsx("input",{type:"file",accept:"application/json,.json",className:"hidden",disabled:x.isPending,onChange:re=>{ae(re.target.files?.[0]),re.target.value=""}})]})]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(fh,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"شعار الشركة"})]}),i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[o.company_logo??t?.company_logo?i.jsx("img",{src:ZI(o.company_logo??t?.company_logo),alt:"شعار",className:"max-h-[70px] max-w-[160px] object-contain rounded border bg-background p-1"}):i.jsx("div",{className:"h-[70px] w-[160px] rounded border border-dashed border-border flex items-center justify-center text-muted-foreground text-xs",children:"لا يوجد شعار"}),i.jsxs("div",{className:"flex-1 min-w-[200px]",children:[i.jsx(Ee,{type:"file",accept:"image/*",onChange:async re=>{const F=re.target.files?.[0];if(!F)return;const O=new FormData;O.append("file",F,F.name.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,80));try{const q=await(await fetch("/api/upload",{method:"POST",body:O})).json();if(q.url){const Q=ZI(q.url);await a.mutateAsync({key:"company_logo",value:Q}),l(ne=>({...ne,company_logo:Q})),_e.success("تم رفع وحفظ الشعار"),s()}else _e.error("فشل رفع الصورة")}catch{_e.error("فشل رفع الصورة")}re.target.value=""},className:"bg-muted/50 border-border text-foreground text-sm"}),t?.company_logo&&i.jsxs(ke,{size:"sm",variant:"outline",onClick:async()=>{await a.mutateAsync({key:"company_logo",value:""}),_e.success("تم حذف الشعار"),s()},className:"mt-2 text-red-500 border-red-300 hover:bg-red-50 dark:hover:bg-red-950",children:[i.jsx(Mr,{className:"w-3.5 h-3.5 ml-1"})," إزالة الشعار"]})]})]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(fh,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"معلومات الشركة والضرائب"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"يظهر عنوان الشركة والبريد الإلكتروني في ترويسة عروض الأسعار عند حفظهما."})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:hie.map(re=>i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-semibold text-foreground mb-1.5",children:re.label}),re.type==="textarea"?i.jsx(ni,{value:o[re.key]??t?.[re.key]??"",onChange:F=>l({...o,[re.key]:F.target.value}),className:"bg-muted/50 border-border text-foreground min-h-[70px]",dir:"rtl"}):i.jsx(Ee,{type:re.type==="email"?"email":"text",value:o[re.key]??t?.[re.key]??"",onChange:F=>l({...o,[re.key]:F.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"}),i.jsxs(ke,{size:"sm",onClick:()=>oe(re.key),disabled:u===re.key,className:"mt-1.5 bg-primary hover:bg-primary/90 w-full",children:[i.jsx(Km,{className:"w-3.5 h-3.5 ml-1"}),u===re.key?"جاري الحفظ...":"حفظ"]})]},re.key))})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Hj,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"معلومات البنك"})]}),i.jsx(ni,{value:o.bank_info??t?.bank_info??"",onChange:re=>l({...o,bank_info:re.target.value}),className:"bg-muted/50 border-border text-foreground min-h-[110px] leading-7",dir:"rtl",placeholder:`البنك: مصرف الراجحي
386اسم الحساب: شركة أمزي
387رقم الحساب: 0000000000
388الآيبان: SA...
389SWIFT: RJHISARI`}),i.jsxs("div",{className:"mt-3 rounded-lg border border-primary/30 bg-white p-3 text-sm text-slate-800 shadow-sm",dir:"rtl",children:[i.jsxs("div",{className:"mb-2 flex items-center gap-2 font-bold text-primary",children:[i.jsx(Hj,{className:"h-4 w-4"})," معاينة معلومات البنك"]}),i.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:(o.bank_info??t?.bank_info??"").split(/\n|•/).map((re,F)=>{const[O,...J]=re.split(/[::-]/),q=J.join(":").trim();return re.trim()?i.jsxs("div",{className:"rounded border border-slate-200 bg-slate-50 px-2 py-1.5",children:[i.jsx("span",{className:"font-semibold text-primary",children:q?`${O.trim()}:`:""})," ",q||re.trim()]},`${F}-${re}`):null})})]}),i.jsxs(ke,{size:"sm",onClick:()=>oe("bank_info"),disabled:u==="bank_info",className:"mt-2 bg-primary hover:bg-primary/90 w-full",children:[i.jsx(Km,{className:"w-3.5 h-3.5 ml-1"}),u==="bank_info"?"جاري الحفظ...":"حفظ"]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"تظهر معلومات البنك في عروض الأسعار عند وجودها فقط"})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:[i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Ki,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"المعلومات الفنية"})]}),i.jsxs("div",{className:"space-y-2 mb-3 max-h-[280px] overflow-y-auto",children:[S.data?.map(re=>i.jsxs("div",{className:"flex items-center justify-between gap-2 bg-muted/50 rounded px-2.5 py-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"text-sm text-foreground block truncate",children:re.label}),re.unit?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:re.unit}):null]}),i.jsx(ke,{size:"icon",variant:"ghost",className:"w-6 h-6 shrink-0 text-red-500 hover:bg-red-50 dark:hover:bg-red-950",onClick:async()=>{try{await E.mutateAsync({id:re.id}),S.refetch(),_e.success("تم الحذف")}catch(F){_e.error(F?.message||"فشل الحذف")}},children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})]},re.id)),!S.data?.length&&i.jsx("div",{className:"text-center text-muted-foreground text-sm py-4",children:"لا توجد خيارات"})]}),i.jsxs("div",{className:"border-t pt-3 space-y-2",children:[i.jsx(Ee,{placeholder:"اسم الخيار (مثال: الكهرباء)",value:k.label,onChange:re=>V({...k,label:re.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ee,{placeholder:"الوحدة (اختياري)",value:k.unit,onChange:re=>V({...k,unit:re.target.value}),className:"bg-muted/50 border-border text-foreground text-sm flex-1",dir:"rtl"}),i.jsxs(ke,{size:"sm",className:"shrink-0 bg-primary hover:bg-primary/90",onClick:async()=>
389{if(!k.label.trim()){_e.error("أدخل اسم الخيار");return}try{await A.mutateAsync({label:k.label.trim(),unit:k.unit.trim()}),V({label:"",unit:""}),S.refetch(),_e.success("تمت الإضافة")}catch(re){_e.error(re?.message||"فشل الإضافة")}},children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة"]})]}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"تظهر هذه الخيارات في نموذج عرض الأسعار لاختيارها (لا يمكن الكتابة عليها في الإعدادات)"})]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(fF,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"شروط الدفع"})]}),i.jsxs("div",{className:"space-y-2 mb-3 max-h-[280px] overflow-y-auto",children:[C.data?.map(re=>i.jsxs("div",{className:"flex items-center justify-between gap-2 bg-muted/50 rounded px-2.5 py-1.5",children:[i.jsx("span",{className:"text-sm text-foreground block truncate",children:re.label}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[re.isDefault&&i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/15 text-primary font-semibold ml-1",children:"افتراضي"}),i.jsx(ke,{size:"icon",variant:"ghost",className:"w-6 h-6 text-red-500 hover:bg-red-50 dark:hover:bg-red-950",onClick:async()=>{try{await D.mutateAsync({id:re.id}),C.refetch(),_e.success("تم الحذف")}catch(F){_e.error(F?.message||"فشل الحذف")}},children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})]})]},re.id)),!C.data?.length&&i.jsx("div",{className:"text-center text-muted-foreground text-sm py-4",children:"لا توجد خيارات"})]}),i.jsxs("div",{className:"border-t pt-3",children:[i.jsx(Ee,{placeholder:"مثال: دفع 30% مقدماً",value:U.label,onChange:re=>$({label:re.target.value}),className:"bg-muted/50 border-border text-foreground text-sm mb-2",dir:"rtl"}),i.jsxs(ke,{size:"sm",className:"w-full bg-primary hover:bg-primary/90",onClick:async()=>{if(!U.label.trim()){_e.error("أدخل شرط الدفع");return}try{await I.mutateAsync({label:U.label.trim(),isDefault:!C.data?.length}),$({label:""}),C.refetch(),_e.success("تمت الإضافة")}catch{_e.error("فشل الإضافة")}},children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة"]}),i.jsx("p",{className:"text-[11px] text-muted-foreground mt-2",children:"الخيار الأول يصبح افتراضيًا في عروض الأسعار"})]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(O2,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"طرق التسليم"})]}),i.jsxs("div",{className:"space-y-2 mb-3 max-h-[280px] overflow-y-auto",children:[B.data?.map(re=>i.jsxs("div",{className:"flex items-center justify-between gap-2 bg-muted/50 rounded px-2.5 py-1.5",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"text-sm text-foreground block truncate",children:re.label}),re.durationLabel?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:re.durationLabel}):null]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[re.isDefault&&i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-primary/15 text-primary font-semibold ml-1",children:"افتراضي"}),i.jsx(ke,{size:"icon",variant:"ghost",className:"w-6 h-6 text-red-500 hover:bg-red-50 dark:hover:bg-red-950",onClick:async()=>{try{await G.mutateAsync({id:re.id}),B.refetch(),_e.success("تم الحذف")}catch(F){_e.error(F?.message||"فشل الحذف")}},children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})]})]},re.id)),!B.data?.length&&i.jsx("div",{className:"text-center text-muted-foreground text-sm py-4",children:"لا توجد خيارات"})]}),i.jsxs("div",{className:"border-t pt-3 space-y-2",children:[i.jsx(Ee,{placeholder:"مثال: شحن بحري",value:X.label,onChange:re=>ee({...X,label:re.target.value}),className:"bg-muted/50 border-border text-foreground text-sm",dir:"rtl"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ee,{placeholder:"المدة (اختياري)",value:X.durationLabel,onChange:re=>ee({...X,durationLabel:re.target.value}),className:"bg-muted/50 border-border text-foreground text-sm flex-1",dir:"rtl"}),i.jsxs(ke,{size:"sm",className:"shrink-0 bg-primary hover:bg-primary/90",onClick:async()=>
389{if(!X.label.trim()){_e.error("أدخل طريقة التسليم");return}try{await P.mutateAsync({label:X.label.trim(),durationLabel:X.durationLabel.trim(),isDefault:!B.data?.length}),ee({label:"",durationLabel:""}),B.refetch(),_e.success("تمت الإضافة")}catch(re){_e.error(re?.message||"فشل الإضافة")}},children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة"]})]}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"الخيار الأول يصبح افتراضيًا في عروض الأسعار"})]})]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(VY,{className:"w-4 h-4 text-primary"}),i.jsx("h3",{className:"text-base font-bold text-foreground",children:"الأمان"})]}),i.jsxs("div",{className:"max-w-md",children:[i.jsx("label",{className:"block text-sm font-semibold text-foreground mb-1.5",children:"كلمة المرور (لوحة الإدارة)"}),i.jsx(Ee,{type:"password",value:o.admin_password??"",onChange:re=>l({...o,admin_password:re.target.value}),className:"bg-muted/50 border-border text-foreground",dir:"rtl"}),i.jsxs(ke,{size:"sm",onClick:()=>oe("admin_password"),disabled:u==="admin_password",className:"mt-1.5 bg-primary hover:bg-primary/90 w-full",children:[i.jsx(Km,{className:"w-3.5 h-3.5 ml-1"}),u==="admin_password"?"جاري الحفظ...":"حفظ"]})]})]})]})]})}const ep=[{id:"hero",type:"hero",enabled:!0,title:"حلول الآلات الصناعية المتكاملة",subtitle:"اكتشف مجموعتنا الواسعة من الآلات الصناعية عالية الجودة",body:"مع إمكانية الحصول على عروض أسعار فورية عبر واتساب",imageUrl:"",buttonText:"تصفح الكتالوج",buttonUrl:"#catalog",background:"#1a1a2e",items:[]},{id:"stats",type:"stats",enabled:!0,title:"خبرة تثق بها الصناعات",subtitle:"",body:"",imageUrl:"",buttonText:"",buttonUrl:"",background:"#f8fafc",items:[{id:"machines",title:"آلة صناعية",value:"50+"},{id:"experience",title:"سنوات خبرة",value:"10+"},{id:"clients",title:"عميل",value:"500+"},{id:"support",title:"دعم فني",value:"24/7"}]},{id:"features",type:"features",enabled:!0,title:"لماذا AMZ؟",subtitle:"حلول عملية تبدأ من الفكرة وتصل إلى خط الإنتاج",body:"",imageUrl:"",buttonText:"",buttonUrl:"",background:"#ffffff",items:[{id:"quality",title:"جودة موثوقة",text:"نختار ونصمم حلولاً عملية للاستخدام الصناعي."},{id:"speed",title:"استجابة سريعة",text:"فريقنا قريب منك قبل البيع وبعده."},{id:"support",title:"دعم مستمر",text:"نساعدك في الاختيار والتشغيل والصيانة."}]},{id:"catalog",type:"catalog",enabled:!0,title:"كتالوج الآلات",subtitle:"تصفح المنتجات المتاحة واطلب عرض سعر",body:"",imageUrl:"",buttonText:"",buttonUrl:"",background:"#ffffff",items:[]},{id:"contact",type:"contact",enabled:!0,title:"تواصل معنا",subtitle:"نحن جاهزون لمساعدتك في اختيار الحل المناسب",body:"أرسل طلبك وسيتواصل معك فريق AMZ قريباً.",imageUrl:"",buttonText:"اطلب عرض سعر",buttonUrl:"#catalog",background:"#1a1a2e",items:[]},{id:"footer",type:"custom",enabled:!0,title:"AMZ MAKiNA",subtitle:"حلول الآلات الصناعية",body:"© جميع الحقوق محفوظة",imageUrl:"",buttonText:"",buttonUrl:"",background:"#0f0f1a",items:[]}];function O6(n){return Array.isArray(n)?n.map((e,t)=>{const r=e||{};return{...ep[t%ep.length],...r,id:String(r.id||`section-${t+1}`),type:r.type||"custom",enabled:r.enabled!==!1,title:String(r.title||""),subtitle:String(r.subtitle||""),body:String(r.body||""),imageUrl:String(r.imageUrl||""),buttonText:String(r.buttonText||""),buttonUrl:String(r.buttonUrl||""),background:String(r.background||"#ffffff"),items:Array.isArray(r.items)?r.items.map((s,a)=>({id:String(s?.id||`${r.id||t}-item-${a+1}`),title:String(s?.title||""),value:String(s?.value||""),text:String(s?.text||""),imageUrl:String(s?.imageUrl||""),url:String(s?.url||"")})):[]}}):ep}const WC={hero:"البطل الرئيسي",stats:"الإحصائيات",features:"المميزات",catalog:"الكتالوج",contact:"التواصل",custom:"قسم مخصص"};function pie(n){const e=ep.find(t=>t.type===n)||ep[0];return{...e,id:`section-${Date.now()}`,type:n,enabled:!0,items:e.items.map(t=>({...t,id:`${t.id}-${Date.now()}`}))}}function gie(){const{data:n,isLoading:e,refetch:t}=Pe.settings.list.useQuery(),r=Pe.settings.upsert.useMutation(),[s,a]=T.useState(null),[o,l]=T.useState(null),u=T.useMemo(()=>
389{if(n?.public_home_sections)try{return JSON.parse(n.public_home_sections)}catch{return}},[n?.public_home_sections]),d=T.useMemo(()=>s??O6(u),[s,u]),h=(S,A)=>a(d.map(E=>E.id===S?{...E,...A}:E)),p=(S,A)=>{const E=S+A;if(E<0||E>=d.length)return;const C=[...d];[C[S],C[E]]=[C[E],C[S]],a(C)},x=S=>h(S.id,{items:[...S.items,{id:`${S.id}-item-${Date.now()}`,title:"عنصر جديد",value:"",text:"",imageUrl:"",url:""}]}),y=(S,A,E)=>h(S.id,{items:S.items.map(C=>C.id===A?{...C,...E}:C)}),v=(S,A)=>h(S.id,{items:S.items.filter(E=>E.id!==A)}),_=async(S,A)=>{if(!A)return;const E=new FormData;E.append("file",A,A.name.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,80));try{const I=await(await fetch("/api/upload",{method:"POST",body:E})).json();if(!I.url)throw new Error("فشل رفع الصورة");S(I.url),_e.success("تم رفع الصورة")}catch(C){_e.error(C?.message||"فشل رفع الصورة")}},M=async()=>{try{await r.mutateAsync({key:"public_home_sections",value:JSON.stringify(d)}),a(d),await t(),_e.success("تم حفظ الصفحة العامة")}catch(S){_e.error(S?.message||"فشل حفظ الصفحة العامة")}};return e?i.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"جاري تحميل محرر الصفحة العامة..."}):i.jsxs("div",{className:"space-y-5",dir:"rtl",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"إدارة الصفحة العامة"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"عدّل كل قسم، أضف أقساماً جديدة، غيّر ترتيبها أو أخفها عن الزوار."})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("select",{className:"h-10 rounded-md border border-border bg-background px-3 text-sm",value:"",onChange:S=>{S.target.value&&(a([...d,pie(S.target.value)]),S.target.value="")},children:[i.jsx("option",{value:"",children:"إضافة قسم..."}),Object.entries(WC).map(([S,A])=>i.jsx("option",{value:S,children:A},S))]}),i.jsxs(ke,{onClick:M,disabled:r.isPending,className:"bg-primary text-primary-foreground",children:[i.jsx(Km,{className:"ml-2 h-4 w-4"}),r.isPending?"جاري الحفظ...":"حفظ الصفحة"]})]})]}),d.map((S,A)=>{const E=o===S.id;return i.jsxs(bn,{className:"overflow-hidden border-border bg-card",children:[i.jsxs("div",{className:"flex items-center gap-2 p-4",children:[i.jsxs("button",{type:"button",className:"flex-1 text-right",onClick:()=>l(E?null:S.id),children:[i.jsx("span",{className:"text-xs text-primary font-semibold",children:WC[S.type]}),i.jsx("h2",{className:"font-bold text-foreground",children:S.title||"قسم بلا عنوان"})]}),i.jsx(ke,{size:"icon",variant:"ghost",title:"تحريك للأعلى",onClick:()=>p(A,-1),disabled:A===0,children:i.jsx(AY,{className:"h-4 w-4"})}),i.jsx(ke,{size:"icon",variant:"ghost",title:"تحريك للأسفل",onClick:()=>p(A,1),disabled:A===d.length-1,children:i.jsx(NY,{className:"h-4 w-4"})}),i.jsx(ke,{size:"icon",variant:"ghost",title:S.enabled?"إخفاء":"إظهار",onClick:()=>h(S.id,{enabled:!S.enabled}),children:S.enabled?i.jsx(jc,{className:"h-4 w-4 text-primary"}):i.jsx(Fj,{className:"h-4 w-4 text-muted-foreground"})}),i.jsx(ke,{size:"icon",variant:"ghost",title:"حذف القسم",onClick:()=>a(d.filter(C=>C.id!==S.id)),children:i.jsx(Ar,{className:"h-4 w-4 text-red-500"})})]}),E&&i.jsxs("div",{className:"border-t border-border p-4 space-y-4",children:[i.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[i.jsxs("label",{className:"text-sm text-foreground",children:["نوع القسم",i.jsx("select",{className:"mt-1 h-10 w-full rounded-md border border-border bg-background px-3",value:S.type,onChange:C=>h(S.id,{type:C.target.value}),children:Object.entries(WC).map(([C,I])=>i.jsx("option",{value:C,children:I},C))})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["معرّف الرابط",i.jsx(Ee,{value:S.id,onChange:C=>h(S.id,{id:C.target.value.replace(/\s+/g,"-")})})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["العنوان",i.jsx(Ee,{value:S.title,onChange:C=>h(S.id,{title:C.target.value})})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["العنوان الفرعي",i.jsx(Ee,{value:S.subtitle,onChange:C=>h(S.id,{subtitle:C.target.value})})]}),i.jsxs("label",{className:"text-sm text-foreground md:col-span-2",children:["النص أو الوصف",i.jsx(ni,{value:S.body,onChange:C=>h(S.id,{body:C.target.value}),rows:3})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["نص الزر",i.jsx(Ee,{value:S.buttonText,onChange:C=>h(S.id,{buttonText:C.target.value})})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["رابط الزر",i.jsx(Ee,{value:S.buttonUrl,onChange:C=>h(S.id,{buttonUrl:C.target.value}),placeholder:"#catalog أو https://..."})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["لون الخلفية",i.jsx(Ee,{type:"color",value:S.background||"#ffffff",onChange:C=>h(S.id,{background:C.target.value}),className:"h-10 p-1"})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["رابط صورة القسم",i.jsx(Ee,{value:S.imageUrl,onChange:C=>h(S.id,{imageUrl:C.target.value})})]}),i.jsxs("label",{className:"text-sm text-foreground",children:["رفع صورة القسم",i.jsx("input",{type:"file",accept:"image/*",className:"mt-1 block w-full text-sm",onChange:C=>_(I=>h(S.id,{imageUrl:I}),C.target.files?.[0])})]})]}),i.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"font-semibold text-foreground",children:"العناصر داخل القسم"}),i.jsxs(ke,{size:"sm",variant:"outline",onClick:()=>x(S),children:[i.jsx(Nn,{className:"ml-1 h-4 w-4"}),"إضافة عنصر"]})]}),S.items.map(C=>i.jsxs("div",{className:"grid gap-2 rounded-md bg-muted/40 p-3 md:grid-cols-5",children:[i.jsx(Ee,{placeholder:"العنوان",value:C.title,onChange:I=>y(S,C.id,{title:I.target.value})}),i.jsx(Ee,{placeholder:"القيمة",value:C.value||"",onChange:I=>
389y(S,C.id,{value:I.target.value})}),i.jsx(Ee,{placeholder:"النص",value:C.text||"",onChange:I=>y(S,C.id,{text:I.target.value})}),i.jsx(Ee,{placeholder:"الرابط أو الصورة",value:C.imageUrl||"",onChange:I=>y(S,C.id,{imageUrl:I.target.value})}),i.jsx(ke,{variant:"ghost",onClick:()=>v(S,C.id),children:i.jsx(Ar,{className:"h-4 w-4 text-red-500"})})]},C.id)),!S.items.length&&i.jsx("p",{className:"text-sm text-muted-foreground",children:"لا توجد عناصر. أضف عناصر للإحصائيات أو المميزات أو أي قائمة مخصصة."})]})]})]},S.id)})]})}var xie=Object.defineProperty,bie=(n,e)=>xie(n,"name",{value:e,configurable:!0}),yie=T.forwardRef(bie(function(e,t){return i.jsx(Br.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),vie=yie;function kb({className:n,...e}){return i.jsx(vie,{"data-slot":"label",className:br("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...e})}var wie=Object.defineProperty,Xd=(n,e)=>wie(n,"name",{value:e,configurable:!0}),Sie="AlertDialog",[_ie,ybe]=zu(Sie,[KF]),qd=KF(),Mie=Xd(n=>{const{__scopeAlertDialog:e,...t}=n,r=qd(e);return i.jsx(JF,{...r,...t,modal:!0})},"AlertDialog");T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,...s}=e,a=qd(r);return i.jsx(TK,{...a,...s,ref:t})},"AlertDialogTrigger"));var Nie=Xd(n=>{const{__scopeAlertDialog:e,...t}=n,r=qd(e);return i.jsx(tU,{...r,...t})},"AlertDialogPortal"),Aie=T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,...s}=e,a=qd(r);return i.jsx(nU,{...a,...s,ref:t})},"AlertDialogOverlay")),Cie="AlertDialogContent",[Eie,jie]=_ie(Cie),Tie=T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,children:s,...a}=e,o=qd(r),l=T.useRef(null),u=xr(t,l),d=T.useRef(null);return i.jsx(Eie,{scope:r,cancelRef:d,children:i.jsx(rU,{role:"alertdialog",...o,...a,ref:u,onOpenAutoFocus:Jn(a.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:s})})},"AlertDialogContent")),Rie=T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,...s}=e,a=qd(r);return i.jsx(iU,{...a,...s,ref:t})},"AlertDialogTitle")),Pie=T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,...s}=e,a=qd(r);return i.jsx(aU,{...a,...s,ref:t})},"AlertDialogDescription")),Die=T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,...s}=e,a=qd(r);return i.jsx(X2,{...a,...s,ref:t})},"AlertDialogAction")),kie="AlertDialogCancel",Iie=T.forwardRef(Xd(function(e,t){const{__scopeAlertDialog:r,...s}=e,{cancelRef:a}=jie(kie,r),o=qd(r),l=xr(t,a);return i.jsx(X2,{...o,...s,ref:l})},"AlertDialogCancel")),Bie=Mie,Lie=Nie,Oie=Aie,Fie=Tie,Uie=Die,zie=Iie,Gie=Rie,Hie=Pie;function Vie({...n}){return i.jsx(Bie,{"data-slot":"alert-dialog",...n})}function Wie({...n}){return i.jsx(Lie,{"data-slot":"alert-dialog-portal",...n})}function $ie({className:n,...e}){return i.jsx(Oie,{"data-slot":"alert-dialog-overlay",className:br("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...e})}function Xie({className:n,...e}){return i.jsxs(Wie,{children:[i.jsx($ie,{}),i.jsx(Fie,{"data-slot":"alert-dialog-content",className:br("!bg-white !text-slate-900 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",n),...e})]})}function qie({className:n,...e}){return i.jsx("div",{"data-slot":"alert-dialog-header",className:br("flex flex-col gap-2 text-center sm:text-left",n),...e})}function Yie({className:n,...e}){return i.jsx("div",{"data-slot":"alert-dialog-footer",className:br("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...e})}function Qie({className:n,...e}){return i.jsx(Gie,{"data-slot":"alert-dialog-title",className:br("text-lg font-semibold",n),...e})}function Kie({className:n,...e}){return i.jsx(Hie,{"data-slot":"alert-dialog-description",className:br("text-muted-foreground text-sm",n),...e})}function Jie({className:n,...e}){return i.jsx(Uie,{className:br(P2(),n),...e})}function Zie({className:n,...e}){return i.jsx(zie,{className:br(P2({variant:"outline"}),n),...e})}function eae(){const{data:n,isLoading:e,refetch:t}=Pe.websiteQuotes.list.useQuery(),r=Pe.websiteQuotes.delete.useMutation({onSuccess:()=>{_e.success("تم الحذف بنجاح"),t()},onError:()=>_e.error("خطأ في الحذف")}),[s,a]=T.useState(null),[o,l]=T.useState(null),[u,d]=T.useState(""),[h,p]=T.useState("all"),x=v=>{const _=`مرحباً ${v.name}، شكراً لطلبكم. نحن نتواصل معكم قريباً بخصوص "${v.productName}"`,M=v.phone?.replace(/[^0-9]/g,"")||"";M&&window.open(`https://wa.me/${M}?text=${encodeURIComponent(_)}`,"_blank")},y=(n||[]).filter(v=>{const _=u===""||(v.name||"").toLowerCase().includes(u.toLowerCase())||(v.productName||"").toLowerCase().includes(u.toLowerCase())||(v.phone||"").includes(u),M=h==="all"||v.status===h;return _&&M});return e?i.jsx("div",{className:"p-4 text-center",children:"جاري التحميل..."}):i.jsxs("div",{children:[i.jsx("div",{className:"flex items-center justify-between mb-6",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold",children:"طلبات الأسعار"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"طلبات الأسعار الواردة من الموقع الإلكتروني"})]})}),i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(si,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground
389/70"}),i.jsx("input",{value:u,onChange:v=>d(v.target.value),placeholder:"بحث بالاسم أو المنتج أو الهاتف...",className:"w-full bg-muted/50 border border-border rounded-lg pr-10 pl-3 py-2 text-foreground text-sm focus:border-primary focus:outline-none"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(eN,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/70 pointer-events-none"}),i.jsxs("select",{value:h,onChange:v=>p(v.target.value),className:"bg-muted/50 border border-border rounded-lg pr-9 pl-3 py-2 text-foreground text-sm appearance-none focus:border-primary focus:outline-none cursor-pointer",children:[i.jsx("option",{value:"all",children:"كل الحالات"}),i.jsx("option",{value:"new",children:"جديد"}),i.jsx("option",{value:"responded",children:"تم الرد"})]})]})]}),y.length===0?i.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[i.jsx(Cu,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),i.jsx("p",{children:"لا توجد طلبات"})]}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(v=>i.jsx(bn,{className:"bg-muted/50 border-border hover:border-primary/30 transition-all cursor-pointer",onClick:()=>a(v),children:i.jsxs("div",{className:"p-4",children:[i.jsx("div",{className:"flex items-start justify-between mb-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ul,{variant:"outline",className:"text-xs border-primary/30 text-primary",children:v.status==="new"?"جديد":"تم الرد"}),i.jsx("span",{className:"text-xs text-muted-foreground/70",children:new Date(v.createdAt).toLocaleDateString("ar-SA")})]})}),i.jsx("h3",{className:"font-bold text-lg mb-1",children:v.name}),i.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:v.productName}),i.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:i.jsx("span",{children:v.phone})}),i.jsx("p",{className:"text-xs text-muted-foreground/70 mt-2 line-clamp-2",children:v.message}),i.jsxs("div",{className:"flex gap-2 mt-3",children:[i.jsxs(ke,{size:"sm",variant:"outline",className:"flex-1 text-xs border-primary/30 text-primary hover:bg-primary/10",onClick:_=>{_.stopPropagation(),x(v)},children:[i.jsx(Cu,{className:"w-3 h-3 ml-1"}),"واتساب"]}),i.jsx(ke,{size:"sm",variant:"destructive",className:"text-xs",onClick:_=>{_.stopPropagation(),l(v.id)},children:i.jsx(Ar,{className:"w-3 h-3"})})]})]})},v.id))}),i.jsx(Qa,{open:!!s,onOpenChange:()=>a(null),children:i.jsxs(Ka,{className:"bg-card border-border text-foreground max-w-lg",children:[i.jsxs(Ja,{children:[i.jsx(Za,{children:"تفاصيل طلب السعر"}),i.jsx(UK,{className:"text-muted-foreground",children:s&&new Date(s.createdAt).toLocaleString("ar-SA")})]}),s&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx(kb,{className:"text-muted-foreground text-sm",children:"الاسم"}),i.jsx("p",{className:"font-medium",children:s.name})]}),i.jsxs("div",{children:[i.jsx(kb,{className:"text-muted-foreground text-sm",children:"رقم الهاتف"}),i.jsx("p",{className:"font-medium",children:s.phone})]})]}),i.jsxs("div",{children:[i.jsx(kb,{className:"text-muted-foreground text-sm",children:"البريد الإلكتروني"}),i.jsx("p",{className:"font-medium",children:s.email||"غير محدد"})]}),i.jsxs("div",{children:[i.jsx(kb,{className:"text-muted-foreground text-sm",children:"المنتج"}),i.jsx("p",{className:"font-medium",children:s.productName})]}),i.jsxs("div",{children:[i.jsx(kb,{className:"text-muted-foreground text-sm",children:"الرسالة"}),i.jsx("p",{className:"font-medium whitespace-pre-wrap",children:s.message})]})]}),i.jsxs(Qf,{children:[i.jsxs(ke,{variant:"outline",onClick:()=>{s&&x(s)},children:[i.jsx(Cu,{className:"w-4 h-4 ml-2"}),"إرسال واتساب"]}),i.jsx(ke,{onClick:()=>a(null),children:"إغلاق"})]})]})}),i.jsx(Vie,{open:!!o,onOpenChange:()=>l(null),children:i.jsxs(Xie,{className:"bg-card border-border text-foreground",children:[i.jsxs(qie,{children:[i.jsx(Qie,{children:"تأكيد الحذف"}),i.jsx(Kie,{className:"text-muted-foreground",children:"هل أنت متأكد من حذف هذا الطلب؟"})]}),i.jsxs(Yie,{children:[i.jsx(Zie,{className:"bg-muted text-foreground",children:"إلغاء"}),i.jsx(Jie,{className:"bg-red-600",onClick:()=>{o&&r.mutate({id:o}),l(null)},children:"حذف"})]})]})})]})}const i0="185",Su={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Pm={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},F6=0,CT=1,U6=2,tae=3,z6=0,Sx=1,xy=2,Gm=3,Bu=0,Da=1,Ll=2,Tu=0,tp=1,ET=2,jT=3,TT=4,G6=5,nae=6,Kf=100,H6=101,V6=102,W6=103,$6=104,X6=200,q6=201,Y6=202,Q6=203,L_=204,O_=205,K6=206,J6=207,Z6=208,e8=209,t8=210,n8=211,r8=212,s8=213,i8=214,F_=0,U_=1,z_=2,hp=3,G_=4,H_=5,V_=6,W_=7,_v=0,a8=1,o8=2,Gl=0,$3=1,X3=2,q3=3,wN=4,Y3=5,Q3=6,K3=7,RT="attached",l8="detached",SN=300,Lu=301,xh=302,by=303,yy=304,a0=306,bh=1e3,io=1001,kx=1002,ri=1003,_N=1004,rae=1004,Hm=1005,sae=1005,qr=1006,_x=1007,iae=1007,Fl=1008,aae=1008,eo=1009,J3=1010,Z3=1011,Ix=1012,MN=1013,Wl=1014,ao=1015,Ou=1016,NN=1017,AN=1018,Bx=1020,eR=35902,tR=35899,nR=1021,rR=1022,Pa=1023,Fu=1026,rh=1027,CN=1028,Mv=1029,yh=1030,EN=1031,oae=1032,jN=1033,vy=33776,wy=33777,Sy=33778,_y=33779,$_=35840,X_=35841,q_=35842,Y_=35843,Q_=36196,K_=37492,J_=37496,Z_=37488,eM=37489,Wy=37490,tM=37491,nM=37808,rM=37809,sM=37810,iM=37811,aM=37812,oM=37813,lM=37814,cM=37815,uM=37816,dM=37817,fM=37818,hM=37819,mM=37820,pM=37821,gM=36492,xM=36494,bM=36495,yM=36283,vM=36284,$y=36285,wM=36286,c8=2200,u8=2201,d8=2202,Lx=2300,Ox=2301,o_=2302,PT=2303,Vm=2400,Wm=2401,Xy=2402,TN=2500,sR=2501,f8=0,iR=1,SM=2,h8=3200,m8=3201,lae=3202,cae=3203,Hd=0,p8=1,Td="",Ra="srgb",Fx="srgb-linear",qy="linear",$r="srgb",uae="",dae="rg",fae="ga",hae=0,Dm=7680,mae=7681,pae=7682,gae=7683,xae=34055,bae=34056,yae=5386,vae=512,wae=513,Sae=514,_ae=515,Mae=516,Nae=517,Aae=518,DT=519,g8=512,x8=513,b8=514,RN=515,y8=516,v8=517,PN=518,w8=519,Yy=35044,Cae=35048,Eae=35040,jae=35045,Tae=35049,Rae=35041,Pae=35046,Dae=35050,kae=35042,Iae="100",kT="300 es",Ko=2e3,mp=2001,Bae={COMPUTE:"compute",RENDER:"render"},Lae={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Oae={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Fae={TEXTURE_COMPARE:"depthTextureCompare"};function Uae(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const zae={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function bx(n,e){return new zae[n](e)}function S8(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Qy(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function _8(){const n=Qy("canvas");return n.style.display="block",n}const e5={};let vh=null;function Gae(n){vh=n}function Hae(){return vh}function Ky(...n){const e="THREE."+n.shift();vh?vh("log",e,...n):console.log(e,...n)}function M8(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function $t(...n){n=M8(n);const e="THREE."+n.shift();if(vh)vh("warn",e,...n);else{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function fn(...n){n=M8(n);const e="THREE."+n.shift();if(vh)vh("error",e,...n);else{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ah(...n){const e=n.join(" ");e in e5||(e5[e]=!0,$t(...n))}function Vae(n,e,t){return new Promise(function(r,s){function a(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:s();break;case n.TIMEOUT_EXPIRED:setTimeout(a,t);break;default:r()}}setTimeout(a,t)})}const Wae={[F_]:U_,[z_]:V_,[G_]:W_,[hp]:H_,[U_]:F_,[V_]:z_,[W_]:G_,[H_]:hp};let Rc=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners;if(r===void 0)return;const s=r[e];if(s!==void 0){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const r=t[e.type];if(r!==void 0){e.target=this;const s=r.slice(0);for(let a=0,o=s.length;a<o;a++)s[a].call(this,e);e.target=null}}};const Ea=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
3895","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let t5=1234567;const np=Math.PI/180,Ux=180/Math.PI;function Zo(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Ea[n&255]+Ea[n>>8&255]+Ea[n>>16&255]+Ea[n>>24&255]+"-"+Ea[e&255]+Ea[e>>8&255]+"-"+Ea[e>>16&15|64]+Ea[e>>24&255]+"-"+Ea[t&63|128]+Ea[t>>8&255]+"-"+Ea[t>>16&255]+Ea[t>>24&255]+Ea[r&255]+Ea[r>>8&255]+Ea[r>>16&255]+Ea[r>>24&255]).toLowerCase()}function Pn(n,e,t){return Math.max(e,Math.min(t,n))}function aR(n,e){return(n%e+e)%e}function $ae(n,e,t,r,s){return r+(n-e)*(s-r)/(t-e)}function Xae(n,e,t){return n!==e?(t-n)/(e-n):0}function My(n,e,t){return(1-t)*n+t*e}function qae(n,e,t,r){return My(n,e,1-Math.exp(-t*r))}function Yae(n,e=1){return e-Math.abs(aR(n,e*2)-e)}function Qae(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Kae(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Jae(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Zae(n,e){return n+Math.random()*(e-n)}function eoe(n){return n*(.5-Math.random())}function toe(n){n!==void 0&&(t5=n);let e=t5+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function noe(n){return n*np}function roe(n){return n*Ux}function soe(n){return(n&n-1)===0&&n!==0}function ioe(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function aoe(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function ooe(n,e,t,r,s){const a=Math.cos,o=Math.sin,l=a(t/2),u=o(t/2),d=a((e+r)/2),h=o((e+r)/2),p=a((e-r)/2),x=o((e-r)/2),y=a((r-e)/2),v=o((r-e)/2);switch(s){case"XYX":n.set(l*h,u*p,u*x,l*d);break;case"YZY":n.set(u*x,l*h,u*p,l*d);break;case"ZXZ":n.set(u*p,u*x,l*h,l*d);break;case"XZX":n.set(l*h,u*v,u*y,l*d);break;case"YXY":n.set(u*y,l*h,u*v,l*d);break;case"ZYZ":n.set(u*v,u*y,l*h,l*d);break;default:$t("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function to(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Qn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const DN={DEG2RAD:np,RAD2DEG:Ux,generateUUID:Zo,clamp:Pn,euclideanModulo:aR,mapLinear:$ae,inverseLerp:Xae,lerp:My,damp:qae,pingpong:Yae,smoothstep:Qae,smootherstep:Kae,randInt:Jae,randFloat:Zae,randFloatSpread:eoe,seededRandom:toe,degToRad:noe,radToDeg:roe,isPowerOfTwo:soe,ceilPowerOfTwo:ioe,floorPowerOfTwo:aoe,setQuaternionFromProperEuler:ooe,normalize:Qn,denormalize:to},QR=class QR{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 28,066 bytes, line 389
389sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6],this.y=s[1]*t+s[4]*r+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Pn(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(Pn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),s=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*r-o*s+e.x,this.y=a*s+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};QR.prototype.isVector2=!0;let wt=QR;class Oi{constructor(e=0,t=0,r=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=s}static slerpFlat(e,t,r,s,a,o,l){let u=r[s+0],d=r[s+1],h=r[s+2],p=r[s+3],x=a[o+0],y=a[o+1],v=a[o+2],_=a[o+3];if(p!==_||u!==x||d!==y||h!==v){let M=u*x+d*y+h*v+p*_;M<0&&(x=-x,y=-y,v=-v,_=-_,M=-M);let S=1-l;if(M<.9995){const A=Math.acos(M),E=Math.sin(A);S=Math.sin(S*A)/E,l=Math.sin(l*A)/E,u=u*S+x*l,d=d*S+y*l,h=h*S+v*l,p=p*S+_*l}else{u=u*S+x*l,d=d*S+y*l,h=h*S+v*l,p=p*S+_*l;const A=1/Math.sqrt(u*u+d*d+h*h+p*p);u*=A,d*=A,h*=A,p*=A}}e[t]=u,e[t+1]=d,e[t+2]=h,e[t+3]=p}static multiplyQuaternionsFlat(e,t,r,s,a,o){const l=r[s],u=r[s+1],d=r[s+2],h=r[s+3],p=a[o],x=a[o+1],y=a[o+2],v=a[o+3];return e[t]=l*v+h*p+u*y-d*x,e[t+1]=u*v+h*x+d*p-l*y,e[t+2]=d*v+h*y+l*x-u*p,e[t+3]=h*v-l*p-u*x-d*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,s){return this._x=e,this._y=t,this._z=r,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,s=e._y,a=e._z,o=e._order,l=Math.cos,u=Math.sin,d=l(r/2),h=l(s/2),p=l(a/2),x=u(r/2),y=u(s/2),v=u(a/2);switch(o){case"XYZ":this._x=x*h*p+d*y*v,this._y=d*y*p-x*h*v,this._z=d*h*v+x*y*p,this._w=d*h*p-x*y*v;break;case"YXZ":this._x=x*h*p+d*y*v,this._y=d*y*p-x*h*v,this._z=d*h*v-x*y*p,this._w=d*h*p+x*y*v;break;case"ZXY":this._x=x*h*p-d*y*v,this._y=d*y*p+x*h*v,this._z=d*h*v+x*y*p,this._w=d*h*p-x*y*v;break;case"ZYX":this._x=x*h*p-d*y*v,this._y=d*y*p+x*h*v,this._z=d*h*v-x*y*p,this._w=d*h*p+x*y*v;break;case"YZX":this._x=x*h*p+d*y*v,this._y=d*y*p+x*h*v,this._z=d*h*v-x*y*p,this._w=d*h*p-x*y*v;break;case"XZY":this._x=x*h*p-d*y*v,this._y=d*y*p-x*h*v,this._z=d*h*v+x*y*p,this._w=d*h*p+x*y*v;break;default:$t("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,s=Math.sin(r);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],s=t[4],a=t[8],o=t[1],l=t[5],u=t[9],d=t[2],h=t[6],p=t[10],x=r+l+p;if(x>0){const y=.5/Math.sqrt(x+1);this._w=.25/y,this._x=(h-u)*y,this._y=(a-d)*y,this._z=(o-s)*y}else if(r>l&&r>p){const y=2*Math.sqrt(1+r-l-p);this._w=(h-u)/y,this._x=.25*y,this._y=(s+o)/y,this._z=(a+d)/y}else if(l>p){const y=2*Math.sqrt(1+l-r-p);this._w=(a-d)/y,this._x=(s+o)/y,this._y=.25*y,this._z=(u+h)/y}else{const y=2*Math.sqrt(1+p-r-l);this._w=(o-s)/y,this._x=(a+d)/y,this._y=(u+h)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Pn(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const s=Math.min(1,t/r);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,s=e._y,a=e._z,o=e._w,l=t._x,u=t._y,d=t._z,h=t._w;return this._x=r*h+o*l+s*d-a*u,this._y=s*h+o*u+a*l-r*d,this._z=a*h+o*d+r*u-s*l,this._w=o*h-r*l-s*u-a*d,this._onChangeCallback(),this}slerp(e,t){let r=e._x,s=e._y,a=e._z,o=e._w,l=this.dot(e);l<0&&(r=-r,s=-s,a=-a,o=-o,l=-l);let u=1-t;if(l<.9995){const d=Math.acos(l),h=Math.sin(d);u=Math.sin(u*d)/h,t=Math.sin(t*d)/h,this._x=this._x*u+r*t,this._y=this._y*u+s*t,this._z=this._z*u+a*t,this._w=this._w*u+o*t,this._onChangeCallback()}else this._x=this._x*u+r*t,this._y=this._y*u+s*t,this._z=this._z*u+a*t,this._w=this._w*u+o*t,this.normalize();return this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),s=Math.sqrt(1-r),a=Math.sqrt(r);return this.set(s*Math.sin(e),s*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const KR=class KR{constructor(e=0,t=0,r=0){this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(n5.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(n5.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,s=this.z,a=e.elements;return this.x=a[0]*t+a[3]*r+a[6]*s,this.y=a[1]*t+a[4]*r+a[7]*s,this.z=a[2]*t+a[5]*r+a[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,s=this.z,a=e.elements,o=1/(a[3]*t+a[7]*r+a[11]*s+a[15]);return this.x=(a[0]*t+a[4]*r+a[8]*s+a[12])*o,this.y=(a[1]*t+a[5]*r+a[9]*s+a[13])*o,this.z=(a[2]*t+a[6]*r+a[10]*s+a[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,s=this.z,a=e.x,o=e.y,l=e.z,u=e.w,d=2*(o*s-l*r),h=2*(l*t-a*s),p=2*(a*r-o*t);return this.x=t+u*d+o*p-l*h,this.y=r+u*h+l*d-a*p,this.z=s+u*p+a*h-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,s=this.z,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*s,this.y=a[1]*t+a[5]*r+a[9]*s,this.z=a[2]*t+a[6]*r+a[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Pn(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,s=e.y,a=e.z,o=t.x,l=t.y,u=t.z;return this.x=s*u-a*l,this.y=a*o-r*u,this.z=r*l-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return $C.copy(this).projectOnVector(e),this.sub($C)}reflect(e){return this.sub($C.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(Pn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,s=this.z-e.z;return t*t+r*r+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const s=Math.sin(t)*e;return this.x=s*Math.sin(r),this.y=Math.cos(t)*e,this.z=s*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};KR.prototype.isVector3=!0;let we=KR;const $C=new we,n5=new Oi,JR=class JR{constructor(e,t,r,s,a,o,l,u,d){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,s,a,o,l,u,d)}set(e,t,r,s,a,o,l,u,d){const h=this.elements;return h[0]=e,h[1]=s,h[2]=l,h[3]=t,h[4]=a,h[5]=u,h[6]=r,h[7]=o,h[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,s=t.elements,a=this.elements,o=r[0],l=r[3],u=r[6],d=r[1],h=r[4],p=r[7],x=r[2],y=r[5],v=r[8],_=s[0],M=s[3],S=s[6],A=s[1],E=s[4],C=s[7],I=s[2],D=s[5],B=s[8];return a[0]=o*_+l*A+u*I,a[3]=o*M+l*E+u*D,a[6]=o*S+l*C+u*B,a[1]=d*_+h*A+p*I,a[4]=d*M+h*E+p*D,a[7]=d*S+h*C+p*B,a[2]=x*_+y*A+v*I,a[5]=x*M+y*E+v*D,a[8]=x*S+y*C+v*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],d=e[7],h=e[8];return t*o*h-t*l*d-r*a*h+r*l*u+s*a*d-s*o*u}invert(){const e=this.elements,t=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],d=e[7],h=e[8],p=h*o-l*d,x=l*u-h*a,y=d*a-o*u,v=t*p+r*x+s*y;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/v;return e[0]=p*_,e[1]=(s*d-h*r)*_,e[2]=(l*r-s*o)*_,e[3]=x*_,e[4]=(h*t-s*u)*_,e[5]=(s*a-l*t)*_,e[6]=y*_,e[7]=(r*u-d*t)*_,e[8]=(o*t-r*a)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,s,a,o,l){const u=Math.cos(a),d=Math.sin(a);return this.set(r*u,r*d,-r*(u*o+d*l)+o+e,-s*d,s*u,-s*(-d*o+u*l)+l+t,0,0,1),this}scale(e,t){return ah("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(XC.makeScale(e,t)),this}rotate(e){return ah("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(XC.makeRotation(-e)),this}translate(e,t){return ah("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(XC.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let s=0;s<9;s++)if(t[s]!==r[s])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}};JR.prototype.isMatrix3=!0;let Ln=JR;const XC=new Ln,r5=new Ln().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),s5=new Ln().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function loe(){const n={enabled:!0,workingColorSpace:Fx,spaces:{},convert:function(s,a,o){return this.enabled===!1||a===o||!a||!o||(this.spaces[a].transfer===$r&&(s.r=Ld(s.r),s.g=Ld(s.g),s.b=Ld(s.b)),this.spaces[a].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[a].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===$r&&(s.r=Mx(s.r),s.g=Mx(s.g),s.b=Mx(s.b))),s},workingToColorSpace:function(s,a){return this.convert(s,this.workingColorSpace,a)},colorSpaceToWorking:function(s,a){return this.convert(s,a,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Td?qy:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,a=this.workingColorSpace){return s.fromArray(this.spaces[a].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,a,o){return s.copy(this.spaces[a].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,a){return ah("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(s,a)},toWorkingColorSpace:function(s,a){return ah("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(s,a)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],r=[.3127,.329];return n.define({[Fx]:{primaries:e,whitePoint:r,transfer:qy,toXYZ:r5,fromXYZ:s5,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ra},outputColorSpaceConfig:{drawingBufferColorSpace:Ra}},[Ra]:{primaries:e,whitePoint:r,transfer:$r,toXYZ:r5,fromXYZ:s5,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ra}}}),n}const ur=loe();function Ld(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Mx(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Og;class N8{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Og===void 0&&(Og=Qy("canvas")),Og.width=e.width,Og.height=e.height;const s=Og.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),r=Og}return r.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Qy("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),a=s.data;for(let o=0;o<a.length;o++)a[o]=Ld(a[o]/255)*255;return r.putImageData(s,0,0),t}else if(e.data){const t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(Ld(t[r]/255)*255):t[r]=Ld(t[r]);return{data:t,width:e.width,height:e.height}}else return $t("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let coe=0;class sh{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:coe++}),this.uuid=Zo(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},s=this.data;if(s!==null){let a;if(Array.isArray(s)){a=[];for(let o=0,l=s.length;o<l;o++)s[o].isDataTexture?a.push(qC(s[o].image)):a.push(qC(s[o]))}else a=qC(s);r.url=a}return t||(e.images[this.uuid]=r),r}}function qC(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?N8.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:($t("Texture: Unable to serialize Texture."),{})}let uoe=0;const YC=new we;class ms extends Rc{constructor(e=ms.DEFAULT_IMAGE,t=ms.DEFAULT_MAPPING,r=io,s=io,a=qr,o=Fl,l=Pa,u=eo,d=ms.DEFAULT_ANISOTROPY,h=Td){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:uoe++}),this.uuid=Zo(),this.name="",this.source=new sh(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=s,this.magFilter=a,this.minFilter=o,this.anisotropy=d,this.format=l,this.internalFormat=null,this.type=u,this.offset=new wt(0,0),this.repeat=new wt(1,1),this.center=new wt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ln,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(YC).x}get height(){return this.source.getSize(YC).y}get depth(){return this.source.getSize(YC).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const r=e[t];if(r===void 0){$t(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){$t(`Texture.setValues(): property '${t}' does not exist.`);continue}s&&r&&s.isVector2&&r.isVector2||s&&r&&s.isVector3&&r.isVector3||s&&r&&s.isMatrix3&&r.isMatrix3?s.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==SN)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bh:e.x=e.x-Math.floor(e.x);break;case io:e.x=e.x<0?0:1;break;case kx:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case bh:e.y=e.y-Math.floor(e.y);break;case io:e.y=e.y<0?0:1;break;case kx:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ms.DEFAULT_IMAGE=null;ms.DEFAULT_MAPPING=SN;ms.DEFAULT_ANISOTROPY=1;const ZR=class ZR{constructor(e=0,t=0,r=0,s=1){this.x=e,this.y=t,this.z=r,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,s){return this.x=e,this.y=t,this.z=r,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}
vendor: 1,268 bytes, line 389
389sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,s=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*s+o[12]*a,this.y=o[1]*t+o[5]*r+o[9]*s+o[13]*a,this.z=o[2]*t+o[6]*r+o[10]*s+o[14]*a,this.w=o[3]*t+o[7]*r+o[11]*s+o[15]*a,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,s,a;const u=e.elements,d=u[0],h=u[4],p=u[8],x=u[1],y=u[5],v=u[9],_=u[2],M=u[6],S=u[10];if(Math.abs(h-x)<.01&&Math.abs(p-_)<.01&&Math.abs(v-M)<.01){if(Math.abs(h+x)<.1&&Math.abs(p+_)<.1&&Math.abs(v+M)<.1&&Math.abs(d+y+S-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(d+1)/2,C=(y+1)/2,I=(S+1)/2,D=(h+x)/4,B=(p+_)/4,P=(v+M)/4;return E>C&&E>
vendor: 24,666 bytes, line 389
389I?E<.01?(r=0,s=.707106781,a=.707106781):(r=Math.sqrt(E),s=D/r,a=B/r):C>I?C<.01?(r=.707106781,s=0,a=.707106781):(s=Math.sqrt(C),r=D/s,a=P/s):I<.01?(r=.707106781,s=.707106781,a=0):(a=Math.sqrt(I),r=B/a,s=P/a),this.set(r,s,a,t),this}let A=Math.sqrt((M-v)*(M-v)+(p-_)*(p-_)+(x-h)*(x-h));return Math.abs(A)<.001&&(A=1),this.x=(M-v)/A,this.y=(p-_)/A,this.z=(x-h)/A,this.w=Math.acos((d+y+S-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this.w=Pn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this.w=Pn(this.w,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Pn(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};ZR.prototype.isVector4=!0;let mr=ZR;class oR extends Rc{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},r),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=r.depth,this.scissor=new mr(0,0,e,t),this.scissorTest=!1,this.viewport=new mr(0,0,e,t),this.textures=[];const s={width:e,height:t,depth:r.depth},a=new ms(s),o=r.count;for(let l=0;l<o;l++)this.textures[l]=a.clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview,this.useArrayDepthTexture=r.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:qr,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let s=0,a=this.textures.length;s<a;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=r,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,r=e.textures.length;t<r;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const s=Object.assign({},e.textures[t].image);this.textures[t].source=new sh(s)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class el extends oR{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class kN extends ms{constructor(e=null,t=1,r=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:s},this.magFilter=ri,this.minFilter=ri,this.wrapR=io,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class doe extends el{constructor(e=1,t=1,r=1,s={}){super(e,t,s),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new kN(null,e,t,r),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class IN extends ms{constructor(e=null,t=1,r=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:s},this.magFilter=ri,this.minFilter=ri,this.wrapR=io,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class foe extends el{constructor(e=1,t=1,r=1,s={}){super(e,t,s),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new IN(null,e,t,r),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}const BM=class BM{constructor(e,t,r,s,a,o,l,u,d,h,p,x,y,v,_,M){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,s,a,o,l,u,d,h,p,x,y,v,_,M)}set(e,t,r,s,a,o,l,u,d,h,p,x,y,v,_,M){const S=this.elements;return S[0]=e,S[4]=t,S[8]=r,S[12]=s,S[1]=a,S[5]=o,S[9]=l,S[13]=u,S[2]=d,S[6]=h,S[10]=p,S[14]=x,S[3]=y,S[7]=v,S[11]=_,S[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new BM().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),r.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this)}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,r=e.elements,s=1/Fg.setFromMatrixColumn(e,0).length(),a=1/Fg.setFromMatrixColumn(e,1).length(),o=1/Fg.setFromMatrixColumn(e,2).length();return t[0]=r[0]*s,t[1]=r[1]*s,t[2]=r[2]*s,t[3]=0,t[4]=r[4]*a,t[5]=r[5]*a,t[6]=r[6]*a,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,s=e.y,a=e.z,o=Math.cos(r),l=Math.sin(r),u=Math.cos(s),d=Math.sin(s),h=Math.cos(a),p=Math.sin(a);if(e.order==="XYZ"){const x=o*h,y=o*p,v=l*h,_=l*p;t[0]=u*h,t[4]=-u*p,t[8]=d,t[1]=y+v*d,t[5]=x-_*d,t[9]=-l*u,t[2]=_-x*d,t[6]=v+y*d,t[10]=o*u}else if(e.order==="YXZ"){const x=u*h,y=u*p,v=d*h,_=d*p;t[0]=x+_*l,t[4]=v*l-y,t[8]=o*d,t[1]=o*p,t[5]=o*h,t[9]=-l,t[2]=y*l-v,t[6]=_+x*l,t[10]=o*u}else if(e.order==="ZXY"){const x=u*h,y=u*p,v=d*h,_=d*p;t[0]=x-_*l,t[4]=-o*p,t[8]=v+y*l,t[1]=y+v*l,t[5]=o*h,t[9]=_-x*l,t[2]=-o*d,t[6]=l,t[10]=o*u}else if(e.order==="ZYX"){const x=o*h,y=o*p,v=l*h,_=l*p;t[0]=u*h,t[4]=v*d-y,t[8]=x*d+_,t[1]=u*p,t[5]=_*d+x,t[9]=y*d-v,t[2]=-d,t[6]=l*u,t[10]=o*u}else if(e.order==="YZX"){const x=o*u,y=o*d,v=l*u,_=l*d;t[0]=u*h,t[4]=_-x*p,t[8]=v*p+y,t[1]=p,t[5]=o*h,t[9]=-l*h,t[2]=-d*h,t[6]=y*p+v,t[10]=x-_*p}else if(e.order==="XZY"){const x=o*u,y=o*d,v=l*u,_=l*d;t[0]=u*h,t[4]=-p,t[8]=d*h,t[1]=x*p+_,t[5]=o*h,t[9]=y*p-v,t[2]=v*p-y,t[6]=l*h,t[10]=_*p+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(hoe,e,moe)}lookAt(e,t,r){const s=this.elements;return Vo.subVectors(e,t),Vo.lengthSq()===0&&(Vo.z=1),Vo.normalize(),Uf.crossVectors(r,Vo),Uf.lengthSq()===0&&(Math.abs(r.z)===1?Vo.x+=1e-4:Vo.z+=1e-4,Vo.normalize(),Uf.crossVectors(r,Vo)),Uf.normalize(),Lw.crossVectors(Vo,Uf),s[0]=Uf.x,s[4]=Lw.x,s[8]=Vo.x,s[1]=Uf.y,s[5]=Lw.y,s[9]=Vo.y,s[2]=Uf.z,s[6]=Lw.z,s[10]=Vo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,s=t.elements,a=this.elements,o=r[0],l=r[4],u=r[8],d=r[12],h=r[1],p=r[5],x=r[9],y=r[13],v=r[2],_=r[6],M=r[10],S=r[14],A=r[3],E=r[7],C=r[11],I=r[15],D=s[0],B=s[4],P=s[8],G=s[12],k=s[1],V=s[5],U=s[9],$=s[13],X=s[2],ee=s[6],z=s[10],K=s[14],ae=s[3],oe=s[7],re=s[11],F=s[15];return a[0]=o*D+l*k+u*X+d*ae,a[4]=o*B+l*V+u*ee+d*oe,a[8]=o*P+l*U+u*z+d*re,a[12]=o*G+l*$+u*K+d*F,a[1]=h*D+p*k+x*X+y*ae,a[5]=h*B+p*V+x*ee+y*oe,a[9]=h*P+p*U+x*z+y*re,a[13]=h*G+p*$+x*K+y*F,a[2]=v*D+_*k+M*X+S*ae,a[6]=v*B+_*V+M*ee+S*oe,a[10]=v*P+_*U+M*z+S*re,a[14]=v*G+_*$+M*K+S*F,a[3]=A*D+E*k+C*X+I*ae,a[7]=A*B+E*V+C*ee+I*oe,a[11]=A*P+E*U+C*z+I*re,a[15]=A*G+E*$+C*K+I*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],s=e[8],a=e[12],o=e[1],l=e[5],u=e[9],d=e[13],h=e[2],p=e[6],x=e[10],y=e[14],v=e[3],_=e[7],M=e[11],S=e[15],A=u*y-d*x,E=l*y-d*p,C=l*x-u*p,I=o*y-d*h,D=o*x-u*h,B=o*p-l*h;return t*(_*A-M*E+S*C)-r*(v*A-M*I+S*D)+s*(v*E-_*I+S*B)-a*(v*C-_*D+M*B)}determinantAffine(){const e=this.elements,t=e[0],r=e[4],s=e[8],a=e[1],o=e[5],l=e[9],u=e[2],d=e[6],h=e[10];return t*(o*h-l*d)-r*(a*h-l*u)+s*(a*d-o*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],d=e[7],h=e[8],p=e[9],x=e[10],y=e[11],v=e[12],_=e[13],M=e[14],S=e[15],A=t*l-r*o,E=t*u-s*o,C=t*d-a*o,I=r*u-s*l,D=r*d-a*l,B=s*d-a*u,P=h*_-p*v,G=h*M-x*v,k=h*S-y*v,V=p*M-x*_,U=p*S-y*_,$=x*S-y*M,X=A*$-E*U+C*V+I*k-D*G+B*P;if(X===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const ee=1/X;return e[0]=(l*$-u*U+d*V)*ee,e[1]=(s*U-r*$-a*V)*ee,e[2]=(_*B-M*D+S*I)*ee,e[3]=(x*D-p*B-y*I)*ee,e[4]=(u*k-o*$-d*G)*ee,e[5]=(t*$-s*k+a*G)*ee,e[6]=(M*C-v*B-S*E)*ee,e[7]=(h*B-x*C+y*E)*ee,e[8]=(o*U-l*k+d*P)*ee,e[9]=(r*k-t*U-a*P)*ee,e[10]=(v*D-_*C+S*A)*ee,e[11]=(p*C-h*D-y*A)*ee,e[12]=(l*G-o*V-u*P)*ee,e[13]=(t*V-r*G+s*P)*ee,e[14]=(_*E-v*I-M*A)*ee,e[15]=(h*I-p*E+x*A)*ee,this}scale(e){const t=this.elements,r=e.x,s=e.y,a=e.z;return t[0]*=r,t[4]*=s,t[8]*=a,t[1]*=r,t[5]*=s,t[9]*=a,t[2]*=r,t[6]*=s,t[10]*=a,t[3]*=r,t[7]*=s,t[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,s))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),s=Math.sin(t),a=1-r,o=e.x,l=e.y,u=e.z,d=a*o,h=a*l;return this.set(d*o+r,d*l-s*u,d*u+s*l,0,d*l+s*u,h*l+r,h*u-s*o,0,d*u-s*l,h*u+s*o,a*u*u+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,s,a,o){return this.set(1,r,a,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,r){const s=this.elements,a=t._x,o=t._y,l=t._z,u=t._w,d=a+a,h=o+o,p=l+l,x=a*d,y=a*h,v=a*p,_=o*h,M=o*p,S=l*p,A=u*d,E=u*h,C=u*p,I=r.x,D=r.y,B=r.z;return s[0]=(1-(_+S))*I,s[1]=(y+C)*I,s[2]=(v-E)*I,s[3]=0,s[4]=(y-C)*D,s[5]=(1-(x+S))*D,s[6]=(M+A)*D,s[7]=0,s[8]=(v+E)*B,s[9]=(M-A)*B,s[10]=(1-(x+_))*B,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,r){const s=this.elements;e.x=s[12],e.y=s[13],e.z=s[14];const a=this.determinantAffine();if(a===0)return r.set(1,1,1),t.identity(),this;let o=Fg.set(s[0],s[1],s[2]).length();const l=Fg.set(s[4],s[5],s[6]).length(),u=Fg.set(s[8],s[9],s[10]).length();a<0&&(o=-o),hc.copy(this);const d=1/o,h=1/l,p=1/u;return hc.elements[0]*=d,hc.elements[1]*=d,hc.elements[2]*=d,hc.elements[4]*=h,hc.elements[5]*=h,hc.elements[6]*=h,hc.elements[8]*=p,hc.elements[9]*=p,hc.elements[10]*=p,t.setFromRotationMatrix(hc),r.x=o,r.y=l,r.z=u,this}makePerspective(e,t,r,s,a,o,l=Ko,u=!1){const d=this.elements,h=2*a/(t-e),p=2*a/(r-s),x=(t+e)/(t-e),y=(r+s)/(r-s);let v,_;if(u)v=a/(o-a),_=o*a/(o-a);else if(l===Ko)v=-(o+a)/(o-a),_=-2*o*a/(o-a);else if(l===mp)v=-o/(o-a),_=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return d[0]=h,d[4]=0,d[8]=x,d[12]=0,d[1]=0,d[5]=p,d[9]=y,d[13]=0,d[2]=0,d[6]=0,d[10]=v,d[14]=_,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,t,r,s,a,o,l=Ko,u=!1){const d=this.elements,h=2/(t-e),p=2/(r-s),x=-(t+e)/(t-e),y=-(r+s)/(r-s);let v,_;if(u)v=1/(o-a),_=o/(o-a);else if(l===Ko)v=-2/(o-a),_=-(o+a)/(o-a);else if(l===mp)v=-1/(o-a),_=-a/(o-a);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return d[0]=h,d[4]=0,d[8]=0,d[12]=x,d[1]=0,d[5]=p,d[9]=0,d[13]=y,d[2]=0,d[6]=0,d[10]=v,d[14]=_,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let s=0;s<16;s++)if(t[s]!==r[s])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}};BM.prototype.isMatrix4=!0;let yn=BM;const Fg=new we,hc=new yn,hoe=new we(0,0,0),moe=new we(1,1,1),Uf=new we,Lw=new we,Vo=new we,i5=new yn,a5=new Oi;class Ac{constructor(e=0,t=0,r=0,s=Ac.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,s=this._order){return this._x=e,this._y=t,this._z=r,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const s=e.elements,a=s[0],o=s[4],l=s[8],u=s[1],d=s[5],h=s[9],p=s[2],x=s[6],y=s[10];switch(t){case"XYZ":this._y=Math.asin(Pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,y),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(x,d),this._z=0);break;case"YXZ":this._x=Math.asin(-Pn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(l,y),this._z=Math.atan2(u,d)):(this._y=Math.atan2(-p,a),this._z=0);break;case"ZXY":this._x=Math.asin(Pn(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(-p,y),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(u,a));break;case"ZYX":this._y=Math.asin(-Pn(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(x,y),this._z=Math.atan2(u,a)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(Pn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-h,d),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(l,y));break;case"XZY":this._z=Math.asin(-Pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(x,d),this._y=Math.atan2(l,a)):(this._x=Math.atan2(-h,y),this._y=0);break;default:$t("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return i5.makeRotationFromQuaternion(e),this.setFromRotationMatrix(i5,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return a5.setFromEuler(this),this.setFromQuaternion(a5,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ac.DEFAULT_ORDER="XYZ";class zx{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let poe=0;const o5=new we,Ug=new Oi,bd=new yn,Ow=new we,Ib=new we,goe=new we,xoe=new Oi,l5=new we(1,0,0),c5=new we(0,1,0),u5=new we(0,0,1),d5={type:"added"},boe={type:"removed"},zg={type:"childadded",child:null},QC={type:"childremoved",child:null};class vr extends Rc{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:poe++}),this.uuid=Zo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=vr.DEFAULT_UP.clone();const e=new we,t=new Ac,r=new Oi,s=new we(1,1,1);function a(){r.setFromEuler(t,!1)}function o(){t.setFromQuaternion(r,void 0,!1)}t._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new yn},normalMatrix:{value:new Ln}}),this.matrix=new yn,this.matrixWorld=new yn,this.matrixAutoUpdate=vr.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=vr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zx,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ug.setFromAxisAngle(e,t),this.quaternion.multiply(Ug),this}rotateOnWorldAxis(e,t){return Ug.setFromAxisAngle(e,t),this.quaternion.premultiply(Ug),this}rotateX(e){return this.rotateOnAxis(l5,e)}rotateY(e){return this.rotateOnAxis(c5,e)}rotateZ(e){return this.rotateOnAxis(u5,e)}translateOnAxis(e,t){return o5.copy(e).applyQuaternion(this.quaternion),this.position.add(o5.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(l5,e)}translateY(e){return this.translateOnAxis(c5,e)}translateZ(e){return this.translateOnAxis(u5,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(bd.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?Ow.copy(e):Ow.set(e,t,r);const s=this.parent;this.updateWorldMatrix(!0,!1),Ib.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bd.lookAt(Ib,Ow,this.up):bd.lookAt(Ow,Ib,this.up),this.quaternion.setFromRotationMatrix(bd),s&&(bd.extractRotation(s.matrixWorld),Ug.setFromRotationMatrix(bd),this.quaternion.premultiply(Ug.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(fn("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(d5),zg.child=e,this.dispatchEvent(zg),zg.child=null):fn("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(boe),QC.child=e,this.dispatchEvent(QC),QC.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),bd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),bd.multiply(e.parent.matrixWorld)),e.applyMatrix4(bd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(d5),zg.child=e,this.dispatchEvent(zg),zg.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,s=this.children.length;r<s;r++){const o=this.children[r].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,r=[]){this[e]===t&&r.push(this);const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].getObjectsByProperty(e,t,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ib,e,goe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ib,xoe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,s=t.length;r<s;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let r=0,s=t.length;r<s;r++)t[r].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,r=e.y,s=e.z,a=this.matrix.elements;
389a[12]+=t-a[0]*t-a[4]*r-a[8]*s,a[13]+=r-a[1]*t-a[5]*r-a[9]*s,a[14]+=s-a[2]*t-a[6]*r-a[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let r=0,s=t.length;r<s;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t,r=!1){const s=this.parent;if(e===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0),t===!0){const a=this.children;for(let o=0,l=a.length;o<l;o++)a[o].updateWorldMatrix(!1,!0,r)}}toJSON(e){const t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const s={};
vendor: 14,000 bytes, line 389
389s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),this.static!==!1&&(s.static=this.static),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(l=>({...l,boundingBox:l.boundingBox?l.boundingBox.toJSON():void 0,boundingSphere:l.boundingSphere?l.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(l=>({...l})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function a(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=a(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let d=0,h=u.length;d<h;d++){const p=u[d];a(e.shapes,p)}else a(e.shapes,u)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let u=0,d=this.material.length;u<d;u++)l.push(a(e.materials,this.material[u]));s.material=l}else s.material=a(e.materials,this.material);if(this.children.length>0){s.children=[];for(let l=0;l<this.children.length;l++)s.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let l=0;l<this.animations.length;l++){const u=this.animations[l];s.animations.push(a(e.animations,u))}}if(t){const l=o(e.geometries),u=o(e.materials),d=o(e.textures),h=o(e.images),p=o(e.shapes),x=o(e.skeletons),y=o(e.animations),v=o(e.nodes);l.length>0&&(r.geometries=l),u.length>0&&(r.materials=u),d.length>0&&(r.textures=d),h.length>0&&(r.images=h),p.length>0&&(r.shapes=p),x.length>0&&(r.skeletons=x),y.length>0&&(r.animations=y),v.length>0&&(r.nodes=v)}return r.object=s,r;function o(l){const u=[];for(const d in l){const h=l[d];delete h.metadata,u.push(h)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r<e.children.length;r++){const s=e.children[r];this.add(s.clone())}return this}}vr.DEFAULT_UP=new we(0,1,0);vr.DEFAULT_MATRIX_AUTO_UPDATE=!0;vr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Dd extends vr{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yoe={type:"move"};class l_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Dd,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Dd,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new we,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new we),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Dd,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new we,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new we,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let s=null,a=null,o=null;const l=this._targetRay,u=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const _ of e.hand.values()){const M=t.getJointPose(_,r),S=this._getHandJoint(d,_);M!==null&&(S.matrix.fromArray(M.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=M.radius),S.visible=M!==null}const h=d.joints["index-finger-tip"],p=d.joints["thumb-tip"],x=h.position.distanceTo(p.position),y=.02,v=.005;d.inputState.pinching&&x>y+v?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&x<=y-v&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,r),a!==null&&(u.matrix.fromArray(a.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,a.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(a.linearVelocity)):u.hasLinearVelocity=!1,a.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(a.angularVelocity)):u.hasAngularVelocity=!1,u.eventsEnabled&&u.dispatchEvent({type:"gripUpdated",data:e,target:this})));l!==null&&(s=t.getPose(e.targetRaySpace,r),s===null&&a!==null&&(s=a),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(yoe)))}return l!==null&&(l.visible=s!==null),u!==null&&(u.visible=a!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Dd;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}const A8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},zf={h:0,s:0,l:0},Fw={h:0,s:0,l:0};function KC(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ut{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ra){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ur.colorSpaceToWorking(this,t),this}setRGB(e,t,r,s=ur.workingColorSpace){return this.r=e,this.g=t,this.b=r,ur.colorSpaceToWorking(this,s),this}setHSL(e,t,r,s=ur.workingColorSpace){if(e=aR(e,1),t=Pn(t,0,1),r=Pn(r,0,1),t===0)this.r=this.g=this.b=r;else{const a=r<=.5?r*(1+t):r+t-r*t,o=2*r-a;this.r=KC(o,a,e+1/3),this.g=KC(o,a,e),this.b=KC(o,a,e-1/3)}return ur.colorSpaceToWorking(this,s),this}setStyle(e,t=Ra){function r(a){a!==void 0&&parseFloat(a)<1&&$t("Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const o=s[1],l=s[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:$t("Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=s[1],o=a.length;if(o===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(a,16),t);$t("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ra){const r=A8[e.toLowerCase()];return r!==void 0?this.setHex(r,t):$t("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ld(e.r),this.g=Ld(e.g),this.b=Ld(e.b),this}copyLinearToSRGB(e){return this.r=Mx(e.r),this.g=Mx(e.g),this.b=Mx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ra){return ur.workingToColorSpace(ja.copy(this),e),Math.round(Pn(ja.r*255,0,255))*65536+Math.round(Pn(ja.g*255,0,255))*256+Math.round(Pn(ja.b*255,0,255))}getHexString(e=Ra){return("000000"+this.getHex(e).toString(16)).slice(-6)}
vendor: 6,864 bytes, line 389
389getHSL(e,t=ur.workingColorSpace){ur.workingToColorSpace(ja.copy(this),t);const r=ja.r,s=ja.g,a=ja.b,o=Math.max(r,s,a),l=Math.min(r,s,a);let u,d;const h=(l+o)/2;if(l===o)u=0,d=0;else{const p=o-l;switch(d=h<=.5?p/(o+l):p/(2-o-l),o){case r:u=(s-a)/p+(s<a?6:0);break;case s:u=(a-r)/p+2;break;case a:u=(r-s)/p+4;break}u/=6}return e.h=u,e.s=d,e.l=h,e}getRGB(e,t=ur.workingColorSpace){return ur.workingToColorSpace(ja.copy(this),t),e.r=ja.r,e.g=ja.g,e.b=ja.b,e}getStyle(e=Ra){ur.workingToColorSpace(ja.copy(this),e);const t=ja.r,r=ja.g,s=ja.b;return e!==Ra?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(s*255)})`}offsetHSL(e,t,r){return this.getHSL(zf),this.setHSL(zf.h+e,zf.s+t,zf.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(zf),e.getHSL(Fw);const r=My(zf.h,Fw.h,t),s=My(zf.s,Fw.s,t),a=My(zf.l,Fw.l,t);return this.setHSL(r,s,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,r=this.g,s=this.b,a=e.elements;return this.r=a[0]*t+a[3]*r+a[6]*s,this.g=a[1]*t+a[4]*r+a[7]*s,this.b=a[2]*t+a[5]*r+a[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ja=new Ut;Ut.NAMES=A8;class BN{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ut(e),this.density=t}clone(){return new BN(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class LN{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Ut(e),this.near=t,this.far=r}clone(){return new LN(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class lR extends vr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ac,this.environmentIntensity=1,this.environmentRotation=new Ac,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const mc=new we,yd=new we,JC=new we,vd=new we,Gg=new we,Hg=new we,f5=new we,ZC=new we,eE=new we,tE=new we,nE=new mr,rE=new mr,sE=new mr;class Po{constructor(e=new we,t=new we,r=new we){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,s){s.subVectors(r,t),mc.subVectors(e,t),s.cross(mc);const a=s.lengthSq();return a>0?s.multiplyScalar(1/Math.sqrt(a)):s.set(0,0,0)}static getBarycoord(e,t,r,s,a){mc.subVectors(s,t),yd.subVectors(r,t),JC.subVectors(e,t);const o=mc.dot(mc),l=mc.dot(yd),u=mc.dot(JC),d=yd.dot(yd),h=yd.dot(JC),p=o*d-l*l;if(p===0)return a.set(0,0,0),null;const x=1/p,y=(d*u-l*h)*x,v=(o*h-l*u)*x;return a.set(1-y-v,v,y)}static containsPoint(e,t,r,s){return this.getBarycoord(e,t,r,s,vd)===null?!1:vd.x>=0&&vd.y>=0&&vd.x+vd.y<=1}static getInterpolation(e,t,r,s,a,o,l,u){return this.getBarycoord(e,t,r,s,vd)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(a,vd.x),u.addScaledVector(o,vd.y),u.addScaledVector(l,vd.z),u)}static getInterpolatedAttribute(e,t,r,s,a,o){return nE.setScalar(0),rE.setScalar(0),sE.setScalar(0),nE.fromBufferAttribute(e,t),rE.fromBufferAttribute(e,r),sE.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(nE,a.x),o.addScaledVector(rE,a.y),o.addScaledVector(sE,a.z),o}static isFrontFacing(e,t,r,s){return mc.subVectors(r,t),yd.subVectors(e,t),mc.cross(yd).dot(s)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,s){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,r,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mc.subVectors(this.c,this.b),yd.subVectors(this.a,this.b),mc.cross(yd).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Po.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Po.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,s,a){return Po.getInterpolation(e,this.a,this.b,this.c,t,r,s,a)}containsPoint(e){return Po.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Po.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,s=this.b,a=this.c;let o,l;Gg.subVectors(s,r),Hg.subVectors(a,r),ZC.subVectors(e,r);const u=Gg.dot(ZC),d=Hg.dot(ZC);if(u<=0&&d<=0)return t.copy(r);eE.subVectors(e,s);const h=Gg.dot(eE),p=Hg.dot(eE);if(h>=0&&p<=h)return t.copy(s);const x=u*p-h*d;if(x<=0&&u>=0&&h<=0)return o=u/(u-h),t.copy(r).addScaledVector(Gg,o);tE.subVectors(e,a);
vendor: 10,309 bytes, line 389
389const y=Gg.dot(tE),v=Hg.dot(tE);if(v>=0&&y<=v)return t.copy(a);const _=y*d-u*v;if(_<=0&&d>=0&&v<=0)return l=d/(d-v),t.copy(r).addScaledVector(Hg,l);const M=h*v-y*p;if(M<=0&&p-h>=0&&y-v>=0)return f5.subVectors(a,s),l=(p-h)/(p-h+(y-v)),t.copy(s).addScaledVector(f5,l);const S=1/(M+_+x);return o=_*S,l=x*S,t.copy(r).addScaledVector(Gg,o).addScaledVector(Hg,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class hi{constructor(e=new we(1/0,1/0,1/0),t=new we(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(pc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(pc.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=pc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const a=r.getAttribute("position");if(t===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let o=0,l=a.count;o<l;o++)e.isMesh===!0?e.getVertexPosition(o,pc):pc.fromBufferAttribute(a,o),pc.applyMatrix4(e.matrixWorld),this.expandByPoint(pc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Uw.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Uw.copy(r.boundingBox)),Uw.applyMatrix4(e.matrixWorld),this.union(Uw)}const s=e.children;for(let a=0,o=s.length;a<o;a++)this.expandByObject(s[a],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,pc),pc.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bb),zw.subVectors(this.max,Bb),Vg.subVectors(e.a,Bb),Wg.subVectors(e.b,Bb),$g.subVectors(e.c,Bb),Gf.subVectors(Wg,Vg),Hf.subVectors($g,Wg),pm.subVectors(Vg,$g);let t=[0,-Gf.z,Gf.y,0,-Hf.z,Hf.y,0,-pm.z,pm.y,Gf.z,0,-Gf.x,Hf.z,0,-Hf.x,pm.z,0,-pm.x,-Gf.y,Gf.x,0,-Hf.y,Hf.x,0,-pm.y,pm.x,0];return!iE(t,Vg,Wg,$g,zw)||(t=[1,0,0,0,1,0,0,0,1],!iE(t,Vg,Wg,$g,zw))?!1:(Gw.crossVectors(Gf,Hf),t=[Gw.x,Gw.y,Gw.z],iE(t,Vg,Wg,$g,zw))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,pc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(pc).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(wd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wd),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const wd=[new we,new we,new we,new we,new we,new we,new we,new we],pc=new we,Uw=new hi,Vg=new we,Wg=new we,$g=new we,Gf=new we,Hf=new we,pm=new we,Bb=new we,zw=new we,Gw=new we,gm=new we;function iE(n,e,t,r,s){for(let a=0,o=n.length-3;a<=o;a+=3){gm.fromArray(n,a);const l=s.x*Math.abs(gm.x)+s.y*Math.abs(gm.y)+s.z*Math.abs(gm.z),u=e.dot(gm),d=t.dot(gm),h=r.dot(gm);if(Math.max(-Math.max(u,d,h),Math.min(u,d,h))>l)return!1}return!0}const Rd=voe();function voe(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),r=new Uint32Array(512),s=new Uint32Array(512);for(let u=0;u<256;++u){const d=u-127;d<-27?(r[u]=0,r[u|256]=32768,s[u]=24,s[u|256]=24):d<-14?(r[u]=1024>>-d-14,r[u|256]=1024>>-d-14|32768,s[u]=-d-1,s[u|256]=-d-1):d<=15?(r[u]=d+15<<10,r[u|256]=d+15<<10|32768,s[u]=13,s[u|256]=13):d<128?(r[u]=31744,r[u|256]=64512,s[u]=24,s[u|256]=24):(r[u]=31744,r[u|256]=64512,s[u]=13,s[u|256]=13)}const a=new Uint32Array(2048),o=new Uint32Array(64),l=new Uint32Array(64);for(let u=1;u<1024;++u){let d=u<<13,h=0;for(;(d&8388608)===0;)d<<=1,h-=8388608;d&=-8388609,h+=947912704,a[u]=d|h}for(let u=1024;u<2048;++u)a[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)o[u]=u<<23;o[31]=1199570944,o[32]=2147483648;for(let u=33;u<63;++u)o[u]=2147483648+(u-32<<23);o[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(l[u]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:s,mantissaTable:a,exponentTable:o,offsetTable:l}}function To(n){Math.abs(n)>65504&&$t("DataUtils.toHalfFloat(): Value out of range."),n=Pn(n,-65504,65504),Rd.floatView[0]=n;const e=Rd.uint32View[0],t=e>>23&511;return Rd.baseTable[t]+((e&8388607)>>Rd.shiftTable[t])}function ey(n){const e=n>>10;return Rd.uint32View[0]=Rd.mantissaTable[Rd.offsetTable[e]+(n&1023)]+Rd.exponentTable[e],Rd.floatView[0]}class woe{static toHalfFloat(e){return To(e)}static fromHalfFloat(e){return ey(e)}}const Mi=new we,Hw=new wt;let Soe=0;class Er extends Rc{constructor(e,t,r=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Soe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=Yy,this.updateRanges=[],this.gpuType=ao,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let s=0,a=this.itemSize;s<a;s++)this.array[e+s]=t.array[r+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)Hw.fromBufferAttribute(this,t),Hw.applyMatrix3(e),this.setXY(t,Hw.x,Hw.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)Mi.fromBufferAttribute(this,t),Mi.applyMatrix3(e),this.setXYZ(t,Mi.x,Mi.y,Mi.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)Mi.fromBufferAttribute(this,t),Mi.applyMatrix4(e),this.setXYZ(t,Mi.x,Mi.y,Mi.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Mi.fromBufferAttribute(this,t),Mi.applyNormalMatrix(e),this.setXYZ(t,Mi.x,Mi.y,Mi.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Mi.fromBufferAttribute(this,t),Mi.transformDirection(e),this.setXYZ(t,Mi.x,Mi.y,Mi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=to(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=Qn(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=to(t,this.array)),t}setX(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=to(t,this.array)),t}setY(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=to(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=to(t,this.array)),t}setW(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,s){return e*=this.itemSize,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array),s=Qn(s,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=s,this}setXYZW(e,t,r,s,a){return e*=this.itemSize,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array),s=Qn(s,this.array),a=Qn(a,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=s,this.array[e+3]=a,this}
vendor: 5,508 bytes, line 389
389onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Yy&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class _oe extends Er{constructor(e,t,r){super(new Int8Array(e),t,r)}}class Moe extends Er{constructor(e,t,r){super(new Uint8Array(e),t,r)}}class Noe extends Er{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}}class Aoe extends Er{constructor(e,t,r){super(new Int16Array(e),t,r)}}class cR extends Er{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class Coe extends Er{constructor(e,t,r){super(new Int32Array(e),t,r)}}class uR extends Er{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class Eoe extends Er{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}getX(e){let t=ey(this.array[e*this.itemSize]);return this.normalized&&(t=to(t,this.array)),t}setX(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize]=To(t),this}getY(e){let t=ey(this.array[e*this.itemSize+1]);return this.normalized&&(t=to(t,this.array)),t}setY(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize+1]=To(t),this}getZ(e){let t=ey(this.array[e*this.itemSize+2]);return this.normalized&&(t=to(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize+2]=To(t),this}getW(e){let t=ey(this.array[e*this.itemSize+3]);return this.normalized&&(t=to(t,this.array)),t}setW(e,t){return this.normalized&&(t=Qn(t,this.array)),this.array[e*this.itemSize+3]=To(t),this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array)),this.array[e+0]=To(t),this.array[e+1]=To(r),this}setXYZ(e,t,r,s){return e*=this.itemSize,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array),s=Qn(s,this.array)),this.array[e+0]=To(t),this.array[e+1]=To(r),this.array[e+2]=To(s),this}setXYZW(e,t,r,s,a){return e*=this.itemSize,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array),s=Qn(s,this.array),a=Qn(a,this.array)),this.array[e+0]=To(t),this.array[e+1]=To(r),this.array[e+2]=To(s),this.array[e+3]=To(a),this}}class tn extends Er{constructor(e,t,r){super(new Float32Array(e),t,r)}}const joe=new hi,Lb=new we,aE=new we;class mi{constructor(e=new we,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):joe.setFromPoints(e).getCenter(r);let s=0;for(let a=0,o=e.length;a<o;a++)s=Math.max(s,r.distanceToSquared(e[a]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Lb.subVectors(e,this.center);const t=Lb.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),s=(r-this.radius)*.5;this.center.addScaledVector(Lb,s/r),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(aE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Lb.copy(e.center).add(aE)),this.expandByPoint(Lb.copy(e.center).sub(aE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let Toe=0;const Pl=new yn,oE=new vr,Xg=new we,Wo=new hi,Ob=new hi,Xi=new we;class Bn extends Rc{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Toe++}),this.uuid=Zo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Uae(e)?uR:cR)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}
vendor: 16,630 bytes, line 389
389addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const a=new Ln().getNormalMatrix(e);r.applyNormalMatrix(a),r.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Pl.makeRotationFromQuaternion(e),this.applyMatrix4(Pl),this}rotateX(e){return Pl.makeRotationX(e),this.applyMatrix4(Pl),this}rotateY(e){return Pl.makeRotationY(e),this.applyMatrix4(Pl),this}rotateZ(e){return Pl.makeRotationZ(e),this.applyMatrix4(Pl),this}translate(e,t,r){return Pl.makeTranslation(e,t,r),this.applyMatrix4(Pl),this}scale(e,t,r){return Pl.makeScale(e,t,r),this.applyMatrix4(Pl),this}lookAt(e){return oE.lookAt(e),oE.updateMatrix(),this.applyMatrix4(oE.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xg).negate(),this.translate(Xg.x,Xg.y,Xg.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const r=[];for(let s=0,a=e.length;s<a;s++){const o=e[s];r.push(o.x,o.y,o.z||0)}this.setAttribute("position",new tn(r,3))}else{const r=Math.min(e.length,t.count);for(let s=0;s<r;s++){const a=e[s];t.setXYZ(s,a.x,a.y,a.z||0)}e.length>t.count&&$t("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){fn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new we(-1/0,-1/0,-1/0),new we(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){const a=t[r];Wo.setFromBufferAttribute(a),this.morphTargetsRelative?(Xi.addVectors(this.boundingBox.min,Wo.min),this.boundingBox.expandByPoint(Xi),Xi.addVectors(this.boundingBox.max,Wo.max),this.boundingBox.expandByPoint(Xi)):(this.boundingBox.expandByPoint(Wo.min),this.boundingBox.expandByPoint(Wo.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&fn('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new mi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){fn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new we,1/0);return}if(e){const r=this.boundingSphere.center;if(Wo.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){const l=t[a];Ob.setFromBufferAttribute(l),this.morphTargetsRelative?(Xi.addVectors(Wo.min,Ob.min),Wo.expandByPoint(Xi),Xi.addVectors(Wo.max,Ob.max),Wo.expandByPoint(Xi)):(Wo.expandByPoint(Ob.min),Wo.expandByPoint(Ob.max))}Wo.getCenter(r);let s=0;for(let a=0,o=e.count;a<o;a++)Xi.fromBufferAttribute(e,a),s=Math.max(s,r.distanceToSquared(Xi));if(t)for(let a=0,o=t.length;a<o;a++){const l=t[a],u=this.morphTargetsRelative;for(let d=0,h=l.count;d<h;d++)Xi.fromBufferAttribute(l,d),u&&(Xg.fromBufferAttribute(e,d),Xi.add(Xg)),s=Math.max(s,r.distanceToSquared(Xi))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&fn('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){fn("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=t.position,s=t.normal,a=t.uv;let o=this.getAttribute("tangent");(o===void 0||o.count!==r.count)&&(o=new Er(new Float32Array(4*r.count),4),this.setAttribute("tangent",o));const l=[],u=[];for(let P=0;P<r.count;P++)l[P]=new we,u[P]=new we;const d=new we,h=new we,p=new we,x=new wt,y=new wt,v=new wt,_=new we,M=new we;function S(P,G,k){d.fromBufferAttribute(r,P),h.fromBufferAttribute(r,G),p.fromBufferAttribute(r,k),x.fromBufferAttribute(a,P),y.fromBufferAttribute(a,G),v.fromBufferAttribute(a,k),h.sub(d),p.sub(d),y.sub(x),v.sub(x);const V=1/(y.x*v.y-v.x*y.y);isFinite(V)&&(_.copy(h).multiplyScalar(v.y).addScaledVector(p,-y.y).multiplyScalar(V),M.copy(p).multiplyScalar(y.x).addScaledVector(h,-v.x).multiplyScalar(V),l[P].add(_),l[G].add(_),l[k].add(_),u[P].add(M),u[G].add(M),u[k].add(M))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let P=0,G=A.length;P<G;++P){const k=A[P],V=k.start,U=k.count;for(let $=V,X=V+U;$<X;$+=3)S(e.getX($+0),e.getX($+1),e.getX($+2))}const E=new we,C=new we,I=new we,D=new we;function B(P){I.fromBufferAttribute(s,P),D.copy(I);const G=l[P];E.copy(G),E.sub(I.multiplyScalar(I.dot(G))).normalize(),C.crossVectors(D,G);const V=C.dot(u[P])<0?-1:1;o.setXYZW(P,E.x,E.y,E.z,V)}for(let P=0,G=A.length;P<G;++P){const k=A[P],V=k.start,U=k.count;for(let $=V,X=V+U;$<X;$+=3)B(e.getX($+0)),B(e.getX($+1)),B(e.getX($+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0||r.count!==t.count)r=new Er(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let x=0,y=r.count;x<y;x++)r.setXYZ(x,0,0,0);const s=new we,a=new we,o=new we,l=new we,u=new we,d=new we,h=new we,p=new we;if(e)for(let x=0,y=e.count;x<y;x+=3){const v=e.getX(x+0),_=e.getX(x+1),M=e.getX(x+2);s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,_),o.fromBufferAttribute(t,M),h.subVectors(o,a),p.subVectors(s,a),h.cross(p),l.fromBufferAttribute(r,v),u.fromBufferAttribute(r,_),d.fromBufferAttribute(r,M),l.add(h),u.add(h),d.add(h),r.setXYZ(v,l.x,l.y,l.z),r.setXYZ(_,u.x,u.y,u.z),r.setXYZ(M,d.x,d.y,d.z)}else for(let x=0,y=t.count;x<y;x+=3)s.fromBufferAttribute(t,x+0),a.fromBufferAttribute(t,x+1),o.fromBufferAttribute(t,x+2),h.subVectors(o,a),p.subVectors(s,a),h.cross(p),r.setXYZ(x+0,h.x,h.y,h.z),r.setXYZ(x+1,h.x,h.y,h.z),r.setXYZ(x+2,h.x,h.y,h.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)Xi.fromBufferAttribute(e,t),Xi.normalize(),e.setXYZ(t,Xi.x,Xi.y,Xi.z)}toNonIndexed(){function e(l,u){const d=l.array,h=l.itemSize,p=l.normalized,x=new d.constructor(u.length*h);let y=0,v=0;for(let _=0,M=u.length;_<M;_++){l.isInterleavedBufferAttribute?y=u[_]*l.data.stride+l.offset:y=u[_]*h;for(let S=0;S<h;S++)x[v++]=d[y++]}return new Er(x,h,p)}if(this.index===null)return $t("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Bn,r=this.index.array,s=this.attributes;for(const l in s){const u=s[l],d=e(u,r);t.setAttribute(l,d)}const a=this.morphAttributes;for(const l in a){const u=[],d=a[l];for(let h=0,p=d.length;h<p;h++){const x=d[h],y=e(x,r);u.push(y)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let l=0,u=o.length;l<u;l++){const d=o[l];t.addGroup(d.start,d.count,d.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const u=this.parameters;for(const d in u)u[d]!==void 0&&(e[d]=u[d]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const u in r){const d=r[u];e.data.attributes[u]=d.toJSON(e.data)}const s={};let a=!1;for(const u in this.morphAttributes){const d=this.morphAttributes[u],h=[];for(let p=0,x=d.length;p<x;p++){const y=d[p];h.push(y.toJSON(e.data))}h.length>0&&(s[u]=h,a=!0)}a&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const s=e.attributes;for(const d in s){const h=s[d];this.setAttribute(d,h.clone(t))}const a=e.morphAttributes;for(const d in a){const h=[],p=a[d];for(let x=0,y=p.length;x<y;x++)h.push(p[x].clone(t));this.morphAttributes[d]=h}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,h=o.length;d<h;d++){const p=o[d];this.addGroup(p.start,p.count,p.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Nv{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Yy,this.updateRanges=[],this.version=0,this.uuid=Zo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let s=0,a=this.stride;s<a;s++)this.array[e+s]=t.array[r+s];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const $a=new we;class Do{constructor(e,t,r,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)$a.fromBufferAttribute(this,t),$a.applyMatrix4(e),this.setXYZ(t,$a.x,$a.y,$a.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)$a.fromBufferAttribute(this,t),$a.applyNormalMatrix(e),this.setXYZ(t,$a.x,$a.y,$a.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)$a.fromBufferAttribute(this,t),$a.transformDirection(e),this.setXYZ(t,$a.x,$a.y,$a.z);return this}getComponent(e,t){let r=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(r=to(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=Qn(r,this.array)),this.data.array[e*this.data.stride+this.offset+t]=r,this}setX(e,t){return this.normalized&&(t=Qn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=to(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=to(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=to(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=to(t,this.array)),t}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array),s=Qn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=s,this}setXYZW(e,t,r,s,a){return e=e*this.data.stride+this.offset,this.normalized&&(t=Qn(t,this.array),r=Qn(r,this.array),s=Qn(s,this.array),a=Qn(a,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=s,this.data.array[e+3]=a,this}clone(e){if(e===void 0){Ky("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let r=0;r<this.count;r++){const s=r*this.data.stride+this.offset;for(let a=0;a<this.itemSize;a++)t.push(this.data.array[s+a])}return new Er(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Do(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Ky("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let r=0;r<this.count;r++){const s=r*this.data.stride+this.offset;for(let a=0;a<this.itemSize;a++)t.push(this.data.array[s+a])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let Roe=0;class Ci extends Rc{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Roe++}),this.uuid=Zo(),this.name="",this.type="Material",this.blending=tp,this.side=Bu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=L_,this.blendDst=O_,this.blendEquation=Kf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=hp,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=DT,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Dm,this.stencilZFail=Dm,this.stencilZPass=Dm,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){$t(`Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){$t(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(r):s&&s.isVector2&&r&&r.isVector2||s&&s.isEuler&&r&&r.isEuler||s&&s.isVector3&&r&&r.isVector3?s.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 16,661 bytes, line 389
389r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==tp&&(r.blending=this.blending),this.side!==Bu&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==L_&&(r.blendSrc=this.blendSrc),this.blendDst!==O_&&(r.blendDst=this.blendDst),this.blendEquation!==Kf&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==hp&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==DT&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Dm&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Dm&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Dm&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.allowOverride===!1&&(r.allowOverride=!1),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function s(a){const o=[];for(const l in a){const u=a[l];delete u.metadata,o.push(u)}return o}if(t){const a=s(e.textures),o=s(e.images);a.length>0&&(r.textures=a),o.length>0&&(r.images=o)}return r}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),this.normalScale=new wt().fromArray(r)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new wt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const s=t.length;r=new Array(s);for(let a=0;a!==s;++a)r[a]=t[a].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 6,578 bytes, line 389
389adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class dR extends Ci{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let qg;const Fb=new we,Yg=new we,Qg=new we,Kg=new wt,Ub=new wt,C8=new yn,Vw=new we,zb=new we,Ww=new we,h5=new wt,lE=new wt,m5=new wt;class E8 extends vr{constructor(e=new dR){if(super(),this.isSprite=!0,this.type="Sprite",qg===void 0){qg=new Bn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new Nv(t,5);qg.setIndex([0,1,2,0,2,3]),qg.setAttribute("position",new Do(r,3,0,!1)),qg.setAttribute("uv",new Do(r,2,3,!1))}this.geometry=qg,this.material=e,this.center=new wt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&fn('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Yg.setFromMatrixScale(this.matrixWorld),C8.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qg.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Yg.multiplyScalar(-Qg.z);const r=this.material.rotation;let s,a;r!==0&&(a=Math.cos(r),s=Math.sin(r));const o=this.center;$w(Vw.set(-.5,-.5,0),Qg,o,Yg,s,a),$w(zb.set(.5,-.5,0),Qg,o,Yg,s,a),$w(Ww.set(.5,.5,0),Qg,o,Yg,s,a),h5.set(0,0),lE.set(1,0),m5.set(1,1);let l=e.ray.intersectTriangle(Vw,zb,Ww,!1,Fb);if(l===null&&($w(zb.set(-.5,.5,0),Qg,o,Yg,s,a),lE.set(0,1),l=e.ray.intersectTriangle(Vw,Ww,zb,!1,Fb),l===null))return;const u=e.ray.origin.distanceTo(Fb);u<e.near||u>e.far||t.push({distance:u,point:Fb.clone(),uv:Po.getInterpolation(Fb,Vw,zb,Ww,h5,lE,m5,new wt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function $w(n,e,t,r,s,a){Kg.subVectors(n,t).addScalar(.5).multiply(r),s!==void 0?(Ub.x=a*Kg.x-s*Kg.y,Ub.y=s*Kg.x+a*Kg.y):Ub.copy(Kg),n.copy(e),n.x+=Ub.x,n.y+=Ub.y,n.applyMatrix4(C8)}const Xw=new we,p5=new we;class j8 extends vr{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let r=0,s=t.length;r<s;r++){const a=t[r];this.addLevel(a.object.clone(),a.distance,a.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,r=0){t=Math.abs(t);const s=this.levels;let a;for(a=0;a<s.length&&!(t<s[a].distance);a++);return s.splice(a,0,{distance:t,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let r=0;r<t.length;r++)if(t[r].distance===e){const s=t.splice(r,1);return this.remove(s[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let r,s;for(r=1,s=t.length;r<s;r++){let a=t[r].distance;if(t[r].object.visible&&(a-=a*t[r].hysteresis),e<a)break}return t[r-1].object}return null}raycast(e,t){if(this.levels.length>0){Xw.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(Xw);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Xw.setFromMatrixPosition(e.matrixWorld),p5.setFromMatrixPosition(this.matrixWorld);const r=Xw.distanceTo(p5)/e.zoom;t[0].object.visible=!0;let s,a;for(s=1,a=t.length;s<a;s++){let o=t[s].distance;if(t[s].object.visible&&(o-=o*t[s].hysteresis),r>=o)t[s-1].object.visible=!1,t[s].object.visible=!0;else break}for(this._currentLevel=s-1;s<a;s++)t[s].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const r=this.levels;for(let s=0,a=r.length;s<a;s++){const o=r[s];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Sd=new we,cE=new we,qw=new we,Vf=new we,uE=new we,Yw=new we,dE=new we;class Cp{constructor(e=new we,t=new we(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Sd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Sd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sd.copy(this.origin).addScaledVector(this.direction,t),Sd.distanceToSquared(e))}distanceSqToSegment(e,t,r,s){cE.copy(e).add(t).multiplyScalar(.5),qw.copy(t).sub(e).normalize(),Vf.copy(this.origin).sub(cE);const a=e.distanceTo(t)*.5,o=-this.direction.dot(qw),l=Vf.dot(this.direction),u=-Vf.dot(qw),d=Vf.lengthSq(),h=Math.abs(1-o*o);let p,x,y,v;if(h>0)if(p=o*u-l,x=o*l-u,v=a*h,p>=0)if(x>=-v)if(x<=v){const _=1/h;p*=_,x*=_,y=p*(p+o*x+2*l)+x*(o*p+x+2*u)+d}else x=a,p=Math.max(0,-(o*x+l)),y=-p*p+x*(x+2*u)+d;else x=-a,p=Math.max(0,-(o*x+l)),y=-p*p+x*(x+2*u)+d;else x<=-v?(p=Math.max(0,-(-o*a+l)),x=p>0?-a:Math.min(Math.max(-a,-u),a),y=-p*p+x*(x+2*u)+d):x<=v?(p=0,x=Math.min(Math.max(-a,-u),a),y=x*(x+2*u)+d):(p=Math.max(0,-(o*a+l)),x=p>0?a:Math.min(Math.max(-a,-u),a),y=-p*p+x*(x+2*u)+d);else x=o>0?-a:a,p=Math.max(0,-(o*x+l)),y=-p*p+x*(x+2*u)+d;return r&&r.copy(this.origin).addScaledVector(this.direction,p),s&&s.copy(cE).addScaledVector(qw,x),y}intersectSphere(e,t){Sd.subVectors(e.center,this.origin);const r=Sd.dot(this.direction),s=Sd.dot(Sd)-r*r,a=e.radius*e.radiu
vendor: 13,498 bytes, line 389
389s;if(s>a)return null;const o=Math.sqrt(a-s),l=r-o,u=r+o;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,s,a,o,l,u;const d=1/this.direction.x,h=1/this.direction.y,p=1/this.direction.z,x=this.origin;return d>=0?(r=(e.min.x-x.x)*d,s=(e.max.x-x.x)*d):(r=(e.max.x-x.x)*d,s=(e.min.x-x.x)*d),h>=0?(a=(e.min.y-x.y)*h,o=(e.max.y-x.y)*h):(a=(e.max.y-x.y)*h,o=(e.min.y-x.y)*h),r>o||a>s||((a>r||isNaN(r))&&(r=a),(o<s||isNaN(s))&&(s=o),p>=0?(l=(e.min.z-x.z)*p,u=(e.max.z-x.z)*p):(l=(e.max.z-x.z)*p,u=(e.min.z-x.z)*p),r>u||l>s)||((l>r||r!==r)&&(r=l),(u<s||s!==s)&&(s=u),s<0)?null:this.at(r>=0?r:s,t)}intersectsBox(e){return this.intersectBox(e,Sd)!==null}intersectTriangle(e,t,r,s,a){uE.subVectors(t,e),Yw.subVectors(r,e),dE.crossVectors(uE,Yw);let o=this.direction.dot(dE),l;if(o>0){if(s)return null;l=1}else if(o<0)l=-1,o=-o;else return null;Vf.subVectors(this.origin,e);const u=l*this.direction.dot(Yw.crossVectors(Vf,Yw));if(u<0)return null;const d=l*this.direction.dot(uE.cross(Vf));if(d<0||u+d>o)return null;const h=-l*Vf.dot(dE);return h<0?null:this.at(h/o,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ko extends Ci{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ac,this.combine=_v,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const g5=new yn,xm=new Cp,Qw=new mi,x5=new we,Kw=new we,Jw=new we,Zw=new we,fE=new we,eS=new we,b5=new we,tS=new we;class Ns extends vr{constructor(e=new Bn,t=new ko){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const s=t[r[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=s.length;a<o;a++){const l=s[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}getVertexPosition(e,t){const r=this.geometry,s=r.attributes.position,a=r.morphAttributes.position,o=r.morphTargetsRelative;t.fromBufferAttribute(s,e);const l=this.morphTargetInfluences;if(a&&l){eS.set(0,0,0);for(let u=0,d=a.length;u<d;u++){const h=l[u],p=a[u];h!==0&&(fE.fromBufferAttribute(p,e),o?eS.addScaledVector(fE,h):eS.addScaledVector(fE.sub(t),h))}t.add(eS)}return t}raycast(e,t){const r=this.geometry,s=this.material,a=this.matrixWorld;s!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Qw.copy(r.boundingSphere),Qw.applyMatrix4(a),xm.copy(e.ray).recast(e.near),!(Qw.containsPoint(xm.origin)===!1&&(xm.intersectSphere(Qw,x5)===null||xm.origin.distanceToSquared(x5)>(e.far-e.near)**2))&&(g5.copy(a).invert(),xm.copy(e.ray).applyMatrix4(g5),!(r.boundingBox!==null&&xm.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,xm)))}_computeIntersections(e,t,r){let s;const a=this.geometry,o=this.material,l=a.index,u=a.attributes.position,d=a.attributes.uv,h=a.attributes.uv1,p=a.attributes.normal,x=a.groups,y=a.drawRange;if(l!==null)if(Array.isArray(o))for(let v=0,_=x.length;v<_;v++){const M=x[v],S=o[M.materialIndex],A=Math.max(M.start,y.start),E=Math.min(l.count,Math.min(M.start+M.count,y.start+y.count));for(let C=A,I=E;C<I;C+=3){const D=l.getX(C),B=l.getX(C+1),P=l.getX(C+2);s=nS(this,S,e,r,d,h,p,D,B,P),s&&(s.faceIndex=Math.floor(C/3),s.face.materialIndex=M.materialIndex,t.push(s))}}else{const v=Math.max(0,y.start),_=Math.min(l.count,y.start+y.count);for(let M=v,S=_;M<S;M+=3){const A=l.getX(M),E=l.getX(M+1),C=l.getX(M+2);s=nS(this,o,e,r,d,h,p,A,E,C),s&&(s.faceIndex=Math.floor(M/3),t.push(s))}}else if(u!==void 0)if(Array.isArray(o))for(let v=0,_=x.length;v<_;v++){const M=x[v],S=o[M.materialIndex],A=Math.max(M.start,y.start),E=Math.min(u.count,Math.min(M.start+M.count,y.start+y.count));for(let C=A,I=E;C<I;C+=3){const D=C,B=C+1,P=C+2;s=nS(this,S,e,r,d,h,p,D,B,P),s&&(s.faceIndex=Math.floor(C/3),s.face.materialIndex=M.materialIndex,t.push(s))}}else{const v=Math.max(0,y.start),_=Math.min(u.count,y.start+y.count);for(let M=v,S=_;M<S;M+=3){const A=M,E=M+1,C=M+2;s=nS(this,o,e,r,d,h,p,A,E,C),s&&(s.faceIndex=Math.floor(M/3),t.push(s))}}}}function Poe(n,e,t,r,s,a,o,l){let u;if(e.side===Da?u=r.intersectTriangle(o,a,s,!0,l):u=r.intersectTriangle(s,a,o,e.side===Bu,l),u===null)return null;tS.copy(l),tS.applyMatrix4(n.matrixWorld);const d=t.ray.origin.distanceTo(tS);return d<t.near||d>t.far?null:{distance:d,point:tS.clone(),object:n}}function nS(n,e,t,r,s,a,o,l,u,d){n.getVertexPosition(l,Kw),n.getVertexPosition(u,Jw),n.getVertexPosition(d,Zw);const h=Poe(n,e,t,r,Kw,Jw,Zw,b5);if(h){const p=new we;Po.getBarycoord(b5,Kw,Jw,Zw,p),s&&(h.uv=Po.getInterpolatedAttribute(s,l,u,d,p,new wt)),a&&(h.uv1=Po.getInterpolatedAttribute(a,l,u,d,p,new wt)),o&&(h.normal=Po.getInterpolatedAttribute(o,l,u,d,p,new we),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));const x={a:l,b:u,c:d,normal:new we,materialIndex:0};Po.getNormal(Kw,Jw,Zw,x.normal),h.face=x,h.barycoord=p}return h}const Gb=new mr,y5=new mr,v5=new mr,Doe=new mr,w5=new yn,rS=new we,hE=new mi,S5=new yn,mE=new Cp;class fR extends Ns{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=RT,this.bindMatrix=new yn,this.bindMatrixInverse=new yn,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new hi),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let r=0;r<t.count;r++)this.getVertexPosition(r,rS),this.boundingBox.expandByPoint(rS)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new mi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let r=0;r<t.count;r++)this.getVertexPosition(r,rS),this.boundingSphere.expandByPoint(rS)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const r=this.material,s=this.matrixWorld;r!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),hE.copy(this.boundingSphere),hE.applyMatrix4(s),e.ray.intersectsSphere(hE)!==!1&&(S5.copy(s).invert(),mE.copy(e.ray).applyMatrix4(S5),!(this.boundingBox!==null&&mE.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,mE)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new mr,t=this.geometry.attributes.skinWeight;for(let r=0,s=t.count;r<s;r++){e.fromBufferAttribute(t,r);const a=1/e.manhattanLength();a!==1/0?e.multiplyScalar(a):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===RT?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===l8?this.bindMatrixInverse.copy(this.bindMatrix).invert():$t("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const r=this.skeleton,s=this.geometry;y5.fromBufferAttribute(s.attributes.skinIndex,e),v5.fromBufferAttribute(s.attributes.skinWeight,e),t.isVector4?(Gb.copy(t),t.set(0,0,0,0)):(Gb.set(...t,1),t.set(0,0,0)),Gb.applyMatrix4(this.bindMatrix);for(let a=0;a<4;a++){const o=v5.getComponent(a);if(o!==0){const l=y5.getComponent(a);w5.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),t.addScaledVector(Doe.copy(Gb).applyMatrix4(w5),o)}}return t.isVector4&&(t.w=Gb.w),t.applyMatrix4(this.bindMatrixInverse)}}class ON extends vr{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Hl extends ms{constructor(e=null,t=1,r=1,s,a,o,l,u,d=ri,h=ri,p,x){super(null,o,l,u,d,h,s,a,p,x),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _5=new yn,koe=new yn;class Av{constructor(e=[],t=[]){this.uuid=Zo(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){$t("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,s=this.bones.length;r<s;r++)this.boneInverses.push(new yn)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const r=new yn;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,t=this.boneInverses,r=this.boneMatrices,s=this.boneTexture;for(let a=0,o=e.length;a<o;a++){const l=e[a]?e[a].matrixWorld:koe;_5.multiplyMatrices(l,t[a]),_5.toArray(r,a*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new Av(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const r=new Hl(t,e,e,Pa,ao);return r.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=r,this}getBoneByName(e){for(let t=0,r=this.bones.length;t<r;t++){const s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let r=0,s=e.bones.length;r<s;r++){const a=e.bones[r];let o=t[a];o===void 0&&($t("Skeleton: No bone found with UUID:",a),o=new ON),this.bones.push(o),this.boneInverses.push(new yn().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,r=this.boneInverses;for(let s=0,a=t.length;s<a;s++){const o=t[s];e.bones.push(o.uuid);const l=r[s];e.boneInverses.push(l.toArray())}return e}}class wh extends Er{constructor(e,t,r,s=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Jg=new yn,M5=new yn,sS=[],N5=new hi,Ioe=new yn,Hb=new Ns,Vb=new mi;class hR extends Ns{constructor(e,t,r){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new wh(new Float32Array(r*16),16),this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<r;s++)this.setMatrixAt(s,Ioe)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new hi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<t;r++)this.getMatrixAt(r,Jg),N5.copy(e.boundingBox).applyMatrix4(Jg),this.boundingBox.union(N5)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new mi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<t;
389r++)this.getMatrixAt(r,Jg),Vb.copy(e.boundingSphere).applyMatrix4(Jg),this.boundingSphere.union(Vb)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const r=t.morphTargetInfluences,s=this.morphTexture.source.data.data,a=r.length+1,o=e*a+1;for(let l=0;l<r.length;l++)r[l]=s[o+l]}raycast(e,t){const r=this.matrixWorld,s=this.count;if(Hb.geometry=this.geometry,Hb.material=this.material,Hb.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Vb.copy(this.boundingSphere),Vb.applyMatrix4(r),e.ray.intersectsSphere(Vb)!==!1))for(let a=0;a<s;a++){this.getMatrixAt(a,Jg),M5.multiplyMatrices(r,Jg),Hb.matrixWorld=M5,Hb.raycast(e,sS);for(let o=0,l=sS.length;o<l;o++){const u=sS[o];u.instanceId=a,u.object=this,t.push(u)}sS.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new wh(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const r=t.morphTargetInfluences,s=r.length+1;this.morphTexture===null&&(this.morphTexture=new Hl(new Float32Array(s*this.count),s,this.count,CN,ao));const a=this.morphTexture.source.data.data;let o=0;for(let d=0;d<r.length;d++)o+=r[d];const l=this.geometry.morphTargetsRelative?1:1-o,u=s*e;return a[u]=l,a.set(r,u+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const pE=new we,Boe=new we,Loe=new Ln;class _u{constructor(e=new we(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,s){return this.normal.set(e,t,r),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const s=pE.subVectors(r,t).cross(Boe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,r=!0){const s=e.delta(pE),a=this.normal.dot(s);if(a===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/a;return r===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(s,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||Loe.getNormalMatrix(e),s=this.coplanarPoint(pE).applyMatrix4(e),a=this.normal.applyMatrix3(r).normalize();return this.constant=-s.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const bm=new mi,Ooe=new wt(.5,.5),iS=new we;class pp{constructor(e=new _u,t=new _u,r=new _u,s=new _u,a=new _u,o=new _u){this.planes=[e,t,r,s,a,o]}set(e,t,r,s,a,o){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(r),l[3].copy(s),l[4].copy(a),l[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;
389r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=Ko,r=!1){const s=this.planes,a=e.elements,o=a[0],l=a[1],u=a[2],d=a[3],h=a[4],p=a[5],x=a[6],y=a[7],v=a[8],_=a[9],M=a[10],S=a[11],A=a[12],E=a[13],C=a[14],I=a[15];if(s[0].setComponents(d-o,y-h,S-v,I-A).normalize(),s[1].setComponents(d+o,y+h,S+v,I+A).normalize(),s[2].setComponents(d+l,y+p,S+_,I+E).normalize(),s[3].setComponents(d-l,y-p,S-_,I-E).normalize(),r)s[4].setComponents(u,x,M,C).normalize(),s[5].setComponents(d-u,y-x,S-M,I-C).normalize();else if(s[4].setComponents(d-u,y-x,S-M,I-C).normalize(),t===Ko)s[5].setComponents(d+u,y+x,S+M,I+C).normalize();else if(t===mp)s[5].setComponents(u,x,M,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),bm.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),bm.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bm)}intersectsSprite(e){bm.center.set(0,0,0);const t=Ooe.distanceTo(e.center);return bm.radius=.7071067811865476+t,bm.applyMatrix4(e.matrixWorld),this.intersectsSphere(bm)}intersectsSphere(e){const t=this.planes,r=e.center,s=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(r)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const s=t[r];if(iS.x=s.normal.x>0?e.max.x:e.min.x,iS.y=s.normal.y>0?e.max.y:e.min.y,iS.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(iS)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const A5=new yn;class FN{constructor(){this.coordinateSystem=Ko,this._frustums=[],this._count=0}setFromArrayCamera(e){const t=e.cameras,r=this._frustums;for(let s=0;s<t.length;s++){const a=t[s];A5.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),r[s]===void 0&&(r[s]=new pp),r[s].setFromProjectionMatrix(A5,a.coordinateSystem,a.reversedDepth)}return this._count=t.length,this}intersectsObject(e){const t=this._frustums;for(let r=0;r<this._count;r++)if(t[r].intersectsObject(e))return!0;return!1}intersectsSprite(e){const t=this._frustums;for(let r=0;r<this._count;r++)if(t[r].intersectsSprite(e))return!0;return!1}intersectsSphere(e){const t=this._frustums;for(let r=0;r<this._count;r++)if(t[r].intersectsSphere(e))return!0;return!1}intersectsBox(e){const t=this._frustums;for(let r=0;r<this._count;r++)if(t[r].intersectsBox(e))return!0;return!1}containsPoint(e){const t=this._frustums;for(let r=0;r<this._count;r++)if(t[r].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;const t=this._frustums,r=e._frustums;for(let s=0;s<e._count;s++)t[s]===void 0&&(t[s]=new pp),t[s].copy(r[s]);return this._count=e._count,this}clone(){return new FN().copy(this)}}function gE(n,e){return n-e}function Foe(n,e){return n.z-e.z}function Uoe(n,e){return e.z-n.z}class zoe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,r,s){const a=this.pool,o=this.list;this.index>=a.length&&a.push({start:-1,count:-1,z:-1,index:-1});const l=a[this.index];o.push(l),this.index++,l.start=e,l.count=t,l.z=r,l.index=s}reset(){this.list.length=0,this.index=0}}const jo=new yn,Goe=new Ut(1,1,1),Hoe=new pp,Voe=new FN,aS=new hi,ym=new mi,Wb=new we,C5=new we,Woe=new we,xE=new zoe,Ta=new Ns,oS=[];function $oe(n,e,t=0){const r=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const s=n.count;for(let a=0;a<s;a++)for(let o=0;o<r;o++)e.setComponent(a+t,o,n.getComponent(a,o))}else e.array.set(n.array,t*r);e.needsUpdate=!0}function vm(n,e){if(n.constructor!==e.constructor){const t=Math.min(n.length,e.length);for(let r=0;r<t;r++)e[r]=n[r]}else{const t=Math.min(n.length,e.length);e.set(new n.constructor(n.buffer,0,t))}}class T8 extends Ns{constructor(e,t,r=t*2,s){super(new Bn,s),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=r,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),r=new Hl(t,e,e,Pa,ao);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),r=new Hl(t,e,e,Mv,Wl);this._indirectTexture=r}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),r=new Hl(t,e,e,Pa,ao);
389r.colorSpace=ur.workingColorSpace,this._colorsTexture=r}_initializeGeometry(e){const t=this.geometry,r=this._maxVertexCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const a in e.attributes){const o=e.getAttribute(a),{array:l,itemSize:u,normalized:d}=o,h=new l.constructor(r*u),p=new Er(h,u,d);t.setAttribute(a,p)}if(e.getIndex()!==null){const a=r>65535?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Er(a,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const r in t.attributes){if(!e.hasAttribute(r))throw new Error(`THREE.BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const s=e.getAttribute(r),a=t.getAttribute(r);if(s.itemSize!==a.itemSize||s.normalized!==a.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hi);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let r=0,s=t.length;r<s;r++){if(t[r].active===!1)continue;const a=t[r].geometryIndex;this.getMatrixAt(r,jo),this.getBoundingBoxAt(a,aS).applyMatrix4(jo),e.union(aS)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new mi);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let r=0,s=t.length;r<s;r++){if(t[r].active===!1)continue;const a=t[r].geometryIndex;this.getMatrixAt(r,jo),this.getBoundingSphereAt(a,ym).applyMatrix4(jo),e.union(ym)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(gE),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=r):(s=this._instanceInfo.length,this._instanceInfo.push(r));const a=this._matricesTexture;jo.identity().toArray(a.image.data,s*16),a.needsUpdate=!0;const o=this._colorsTexture;return o&&(Goe.toArray(o.image.data,s*4),o.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(e,t=-1,r=-1){this._initializeGeometry(e),this._validateGeometry(e);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=r===-1?o.count:r),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(gE),u=this._availableGeometryIds.shift(),a[u]=s):(u=this._geometryCount,this._geometryCount++,a.push(s)),this.setGeometryAt(u,e),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const r=this.geometry,s=r.getIndex()!==null,a=r.getIndex(),o=t.getIndex(),l=this._geometryInfo[e];if(s&&o.count>l.reservedIndexCount||t.attributes.position.count>l.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=l.vertexStart,d=l.reservedVertexCount;l.vertexCount=t.getAttribute("position").count;for(const h in r.attributes){const p=t.getAttribute(h),x=r.getAttribute(h);$oe(p,x,u);const y=p.itemSize;
389for(let v=p.count,_=d;v<_;v++){const M=u+v;for(let S=0;S<y;S++)x.setComponent(M,S,0)}x.needsUpdate=!0,x.addUpdateRange(u*y,d*y)}if(s){const h=l.indexStart,p=l.reservedIndexCount;l.indexCount=t.getIndex().count;for(let x=0;x<o.count;x++)a.setX(h+x,u+o.getX(x));for(let x=o.count,y=p;x<y;x++)a.setX(h+x,u);a.needsUpdate=!0,a.addUpdateRange(h,l.reservedIndexCount)}return l.start=s?l.indexStart:l.vertexStart,l.count=s?l.indexCount:l.vertexCount,l.boundingBox=null,t.boundingBox!==null&&(l.boundingBox=t.boundingBox.clone()),l.boundingSphere=null,t.boundingSphere!==null&&(l.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const r=this._instanceInfo;for(let s=0,a=r.length;s<a;s++)r[s].active&&r[s].geometryIndex===e&&this.deleteInstance(s);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const r=this._geometryInfo,s=r.map((o,l)=>l).sort((o,l)=>r[o].vertexStart-r[l].vertexStart),a=this.geometry;for(let o=0,l=r.length;o<l;o++){const u=s[o],d=r[u];if(d.active!==!1){if(a.index!==null){if(d.indexStart!==t){const{indexStart:h,vertexStart:p,reservedIndexCount:x}=d,y=a.index,v=y.array,_=e-p;for(let M=h;M<h+x;M++)v[M]=v[M]+_;y.array.copyWithin(t,h,h+x),y.addUpdateRange(t,x),y.needsUpdate=!0,d.indexStart=t}t+=d.reservedIndexCount}if(d.vertexStart!==e){const{vertexStart:h,reservedVertexCount:p}=d,x=a.attributes;for(const y in x){const v=x[y],{array:_,itemSize:M}=v;_.copyWithin(e*M,h*M,(h+p)*M),v.addUpdateRange(e*M,p*M),v.needsUpdate=!0}d.vertexStart=e}e+=d.reservedVertexCount,d.start=a.index?d.indexStart:d.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const r=this.geometry,s=this._geometryInfo[e];if(s.boundingBox===null){const a=new hi,o=r.index,l=r.attributes.position;for(let u=s.start,d=s.start+s.count;u<d;u++){let h=u;o&&(h=o.getX(h)),a.expandByPoint(Wb.fromBufferAttribute(l,h))}s.boundingBox=a}return t.copy(s.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const r=this.geometry,s=this._geometryInfo[e];if(s.boundingSphere===null){const a=new mi;this.getBoundingBoxAt(e,aS),aS.getCenter(a.center);const o=r.index,l=r.attributes.position;let u=0;for(let d=s.start,h=s.start+s.count;d<h;d++){let p=d;o&&(p=o.getX(p)),Wb.fromBufferAttribute(l,p),u=Math.max(u,a.center.distanceToSquared(Wb))}a.radius=Math.sqrt(u),s.boundingSphere=a}return t.copy(s.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const r=this._matricesTexture,s=this._matricesTexture.image.data;return t.toArray(s,e*16),r.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const r=this._geometryInfo[e];return t.vertexStart=r.vertexStart,t.vertexCount=r.vertexCount,t.reservedVertexCount=r.reservedVertexCount,t.indexStart=r.indexStart,t.indexCount=r.indexCount,t.reservedIndexCount=r.reservedIndexCount,t.start=r.start,t.count=r.count,t}setInstanceCount(e){const t=this._availableInstanceIds,r=this._instanceInfo;for(t.sort(gE);t[t.length-1]===r.length-1;)r.pop(),t.pop();if(e<r.length)throw new Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const s=new Int32Array(e),a=new Int32Array(e);vm(this._multiDrawCounts,s),vm(this._multiDrawStarts,a),this._multiDrawCounts=s,this._multiDrawStarts=a,this._maxInstanceCount=e;const o=this._indirectTexture,l=this._matricesTexture,u=this._colorsTexture;o.dispose(),this._initIndirectTexture(),vm(o.image.data,this._indirectTexture.image.data),l.dispose(),this._initMatricesTexture(),vm(l.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),vm(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const r=[...this._geometryInfo].filter(l=>l.active);if(Math.max(...r.map(l=>l.vertexStart+l.reservedVertexCount))>e)throw new Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...r.map(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const a=this.geometry;a.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Bn,this._initializeGeometry(a));const o=this.geometry;a.index&&vm(a.index.array,o.index.array);
389for(const l in a.attributes)vm(a.attributes[l].array,o.attributes[l].array)}raycast(e,t){const r=this._instanceInfo,s=this._geometryInfo,a=this.matrixWorld,o=this.geometry;Ta.material=this.material,Ta.geometry.index=o.index,Ta.geometry.attributes=o.attributes,Ta.geometry.boundingBox===null&&(Ta.geometry.boundingBox=new hi),Ta.geometry.boundingSphere===null&&(Ta.geometry.boundingSphere=new mi);for(let l=0,u=r.length;l<u;l++){if(!r[l].visible||!r[l].active)continue;const d=r[l].geometryIndex,h=s[d];Ta.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(l,Ta.matrixWorld).premultiply(a),this.getBoundingBoxAt(d,Ta.geometry.boundingBox),this.getBoundingSphereAt(d,Ta.geometry.boundingSphere),Ta.raycast(e,oS);for(let p=0,x=oS.length;p<x;p++){const y=oS[p];y.object=this,y.batchId=l,t.push(y)}oS.length=0}Ta.material=null,Ta.geometry.index=null,Ta.geometry.attributes={},Ta.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,r,s,a){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=s.getIndex();let l=o===null?1:o.array.BYTES_PER_ELEMENT,u=1;a.wireframe&&(u=2,l=s.attributes.position.count>65535?4:2);const d=this._instanceInfo,h=this._multiDrawStarts,p=this._multiDrawCounts,x=this._geometryInfo,y=this.perObjectFrustumCulled,v=this._indirectTexture,_=v.image.data,M=r.isArrayCamera?Voe:Hoe;y&&(r.isArrayCamera?M.setFromArrayCamera(r):(jo.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),M.setFromProjectionMatrix(jo,r.coordinateSystem,r.reversedDepth)));let S=0;if(this.sortObjects){jo.copy(this.matrixWorld).invert(),Wb.setFromMatrixPosition(r.matrixWorld).applyMatrix4(jo),C5.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(jo);for(let C=0,I=d.length;C<I;C++)if(d[C].visible&&d[C].active){const D=d[C].geometryIndex;this.getMatrixAt(C,jo),this.getBoundingSphereAt(D,ym).applyMatrix4(jo);let B=!1;if(y&&(B=!M.intersectsSphere(ym)),!B){const P=x[D],G=Woe.subVectors(ym.center,Wb).dot(C5);xE.push(P.start,P.count,G,C)}}const A=xE.list,E=this.customSort;E===null?A.sort(a.transparent?Uoe:Foe):E.call(this,A,r);for(let C=0,I=A.length;C<I;C++){const D=A[C];h[S]=D.start*l*u,p[S]=D.count*u,_[S]=D.index,S++}xE.reset()}else for(let A=0,E=d.length;A<E;A++)if(d[A].visible&&d[A].active){const C=d[A].geometryIndex;let I=!1;if(y&&(this.getMatrixAt(A,jo),this.getBoundingSphereAt(C,ym).applyMatrix4(jo),I=!M.intersectsSphere(ym)),!I){const D=x[C];h[S]=D.start*l*u,p[S]=D.count*u,_[S]=A,S++}}v.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,t,r,s,a,o){this.onBeforeRender(e,null,s,a,o)}}class ka extends Ci{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const _M=new we,MM=new we,E5=new yn,$b=new Cp,lS=new mi,bE=new we,j5=new we;let Vd=class extends vr{constructor(e=new Bn,t=new ka){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[0];for(let s=1,a=t.count;s<a;s++)_M.fromBufferAttribute(t,s-1),MM.fromBufferAttribute(t,s),r[s]=r[s-1],r[s]+=_M.distanceTo(MM);e.setAttribute("lineDistance",new tn(r,1))}else $t("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const r=this.geometry,s=this.matrixWorld,a=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),lS.copy(r.boun
vendor: 4,430 bytes, line 389
389dingSphere),lS.applyMatrix4(s),lS.radius+=a,e.ray.intersectsSphere(lS)===!1)return;E5.copy(s).invert(),$b.copy(e.ray).applyMatrix4(E5);const l=a/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,d=this.isLineSegments?2:1,h=r.index,x=r.attributes.position;if(h!==null){const y=Math.max(0,o.start),v=Math.min(h.count,o.start+o.count);for(let _=y,M=v-1;_<M;_+=d){const S=h.getX(_),A=h.getX(_+1),E=cS(this,e,$b,u,S,A,_);E&&t.push(E)}if(this.isLineLoop){const _=h.getX(v-1),M=h.getX(y),S=cS(this,e,$b,u,_,M,v-1);S&&t.push(S)}}else{const y=Math.max(0,o.start),v=Math.min(x.count,o.start+o.count);for(let _=y,M=v-1;_<M;_+=d){const S=cS(this,e,$b,u,_,_+1,_);S&&t.push(S)}if(this.isLineLoop){const _=cS(this,e,$b,u,v-1,y,v-1);_&&t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const s=t[r[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=s.length;a<o;a++){const l=s[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}};function cS(n,e,t,r,s,a,o){const l=n.geometry.attributes.position;if(_M.fromBufferAttribute(l,s),MM.fromBufferAttribute(l,a),t.distanceSqToSegment(_M,MM,bE,j5)>r)return;bE.applyMatrix4(n.matrixWorld);const d=e.ray.origin.distanceTo(bE);if(!(d<e.near||d>e.far))return{distance:d,point:j5.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const T5=new we,R5=new we;class Pc extends Vd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let s=0,a=t.count;s<a;s+=2)T5.fromBufferAttribute(t,s),R5.fromBufferAttribute(t,s+1),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+T5.distanceTo(R5);e.setAttribute("lineDistance",new tn(r,1))}else $t("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class mR extends Vd{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class UN extends Ci{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const P5=new yn,IT=new Cp,uS=new mi,dS=new we;class pR extends vr{constructor(e=new Bn,t=new UN){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const r=this.geometry,s=this.matrixWorld,a=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),uS.copy(r.boundingSphere),uS.applyMatrix4(s),uS.radius+=a,e.ray.intersectsSphere(uS)===!1)return;P5.copy(s).invert(),IT.copy(e.ray).applyMatrix4(P5);const l=a/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,d=r.index,p=r.attributes.position;if(d!==null){const x=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let v=x,_=y;v<_;v++){const M=d.getX(v);dS.fromBufferAttribute(p,M),D5(dS,M,u,s,e,t,this)}}else{const x=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let v=x,_=y;v<_;v++)dS.fromBufferAttribute(p,v),D5(dS,v,u,s,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const s=t[r[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=s.length;a<o;a++){const l=s[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}}function D5(n,e,t,r,s,a,o){const l=IT.distanceSqToPoint(n);if(l<t){const u=new we;IT.closestPointToPoint(n,u),u.applyMatrix4(r);const d=s.ray.origin.distanceTo(u);if(d<s.near||d>s.far)return;a.push({distance:d,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class R8 extends ms{constructor(e,t,r,s,a=qr,o=qr,l,u,d){super(e,t,r,s,a,o,l,u,d),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function p(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(p
389)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(p))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Xoe extends R8{constructor(e,t,r,s,a,o,l,u){super({},e,t,r,s,a,o,l,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class qoe extends ms{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class zN extends ms{constructor(e,t,r,s,a,o,l,u,d,h,p,x){super(null,o,l,u,d,h,s,a,p,x),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Yoe extends zN{constructor(e,t,r,s,a,o){super(e,t,r,a,o),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=io,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Qoe extends zN{constructor(e,t,r){super(void 0,e[0].width,e[0].height,t,r,Lu),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Cv extends ms{constructor(e=[],t=Lu,r,s,a,o,l,u,d,h){super(e,t,r,s,a,o,l,u,d,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Koe extends ms{constructor(e,t,r,s,a,o,l,u,d){super(e,t,r,s,a,o,l,u,d),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Joe extends ms{constructor(e,t,r,s,a,o,l,u,d){super(e,t,r,s,a,o,l,u,d),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const h=e?e.parentNode:null;h!==null&&"requestPaint"in h&&(h.onpaint=()=>{this.needsUpdate=!0},h.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class gp extends ms{constructor(e,t,r=Wl,s,a,o,l=ri,u=ri,d,h=Fu,p=1){if(h!==Fu&&h!==rh)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const x={width:e,height:t,depth:p};super(x,s,a,o,l,u,h,r,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new sh(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class P8 extends gp{constructor(e,t=Wl,r=Lu,s,a,o=ri,l=ri,u,d=Fu){const h={width:e,height:e,depth:1},p=[h,h,h,h,h,h];super(e,e,t,r,s,a,o,l,u,d),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class gR extends ms{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ep extends Bn{constructor(e=1,t=1,r=1,s=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:s,heightSegments:a,depthSegments:o};const l=this;s=Math.floor(s),a=Math.floor(a),o=Math.floor(o);const u=[],d=[],h=[],p=[];let x=0,y=0;v("z","y","x",-1,-1,r,t,e,o,a,0),v("z","y","x",1,-1,r,t,-e,o,a,1),v("x","z","y",1,1,e,r,t,s,o,2),v("x","z","y",1,-1,e,r,-t,s,o,3),v("x","y","z",1,-1,e,t,r,s,a,4),v("x","y","z",-1,-1,e,t,-r,s,a,5),this.setIndex(u),this.setAttribute("position",new tn(d,3)),this.setAttribute("normal",new tn(h,3)),this.setAttribute("uv",new tn(p,2));function v(_,M,S,A,E,C,I,D,B,P,G){const k=C/B,V=I/P,U=C/2,$=I/2,X=D/2,ee=B+1,z=P+1;let K=0,ae=0;const oe=new we;for(let re=0;re<z;re++){const F=re*V-$;for(let O=0;O<ee;O++){const J=O*k-U;oe[_]=J*A,oe[M]=F*E,oe[S]=X,d.push(oe.x,oe.y,oe.z),oe[_]=0,oe[M]=0,oe[S]=D>0?1:-1,h.push(oe.x,oe.y,oe.z),p.push(O/B),p.push(1-re/P),K+=1}}for(let re=0;re<P;re++)for(let F=0;F<B;F++){const O=x+F+ee*re,J=x+F+ee*(re+1),q=x+(F+1)+ee*(re+1),Q=x+(F+1)+ee*re;u.push(O,J,Q),u.push(J,q,Q),ae+=6}l.addGroup(y,ae,G),y+=ae,x+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ep(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class GN extends Bn{constructor(e=1,t=1,r=4,s=8,a=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
389s:e,height:t,capSegments:r,radialSegments:s,heightSegments:a},t=Math.max(0,t),r=Math.max(1,Math.floor(r)),s=Math.max(3,Math.floor(s)),a=Math.max(1,Math.floor(a));const o=[],l=[],u=[],d=[],h=t/2,p=Math.PI/2*e,x=t,y=2*p+x,v=r*2+a,_=s+1,M=new we,S=new we;for(let A=0;A<=v;A++){let E=0,C=0,I=0,D=0;if(A<=r){const G=A/r,k=G*Math.PI/2;C=-h-e*Math.cos(k),I=e*Math.sin(k),D=-e*Math.cos(k),E=G*p}else if(A<=r+a){const G=(A-r)/a;C=-h+G*t,I=e,D=0,E=p+G*x}else{const G=(A-r-a)/r,k=G*Math.PI/2;C=h+e*Math.sin(k),I=e*Math.cos(k),D=e*Math.sin(k),E=p+x+G*p}const B=Math.max(0,Math.min(1,E/y));let P=0;A===0?P=.5/s:A===v&&(P=-.5/s);for(let G=0;G<=s;G++){const k=G/s,V=k*Math.PI*2,U=Math.sin(V),$=Math.cos(V);S.x=-I*$,S.y=C,S.z=I*U,l.push(S.x,S.y,S.z),M.set(-I*$,D,I*U),M.normalize(),u.push(M.x,M.y,M.z),d.push(k+P,B)}if(A>0){const G=(A-1)*_;for(let k=0;k<s;k++){const V=G+k,U=G+k+1,$=A*_+k,X=A*_+k+1;o.push(V,U,$),o.push(U,X,$)}}}this.setIndex(o),this.setAttribute("position",new tn(l,3)),this.setAttribute("normal",new tn(u,3)),this.setAttribute("uv",new tn(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new GN(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class HN extends Bn{constructor(e=1,t=32,r=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:s},t=Math.max(3,t);const a=[],o=[],l=[],u=[],d=new we,h=new wt;o.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(let p=0,x=3;p<=t;p++,x+=3){const y=r+p/t*s;d.x=e*Math.cos(y),d.y=e*Math.sin(y),o.push(d.x,d.y,d.z),l.push(0,0,1),h.x=(o[x]/e+1)/2,h.y=(o[x+1]/e+1)/2,u.push(h.x,h.y)}for(let p=1;p<=t;p++)a.push(p,p+1,0);this.setIndex(a),this.setAttribute("position",new tn(o,3)),this.setAttribute("normal",new tn(l,3)),this.setAttribute("uv",new tn(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new HN(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ev extends Bn{constructor(e=1,t=1,r=1,s=32,a=1,o=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:u};const d=this;s=Math.floor(s),a=Math.floor(a);const h=[],p=[],x=[],y=[];let v=0;const _=[],M=r/2;let S=0;A(),o===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(h),this.setAttribute("position",new tn(p,3)),this.setAttribute("normal",new tn(x,3)),this.setAttribute("uv",new tn(y,2));function A(){const C=new we,I=new we;let D=0;const B=(t-e)/r;for(let P=0;P<=a;P++){const G=[],k=P/a,V=k*(t-e)+e;for(let U=0;U<=s;U++){const $=U/s,X=$*u+l,ee=Math.sin(X),z=Math.cos(X);I.x=V*ee,I.y=-k*r+M,I.z=V*z,p.push(I.x,I.y,I.z),C.set(ee,B,z).normalize(),x.push(C.x,C.y,C.z),y.push($,1-k),G.push(v++)}_.push(G)}for(let P=0;P<s;P++)for(let G=0;G<a;G++){const k=_[G][P],V=_[G+1][P],U=_[G+1][P+1],$=_[G][P+1];(e>0||G!==0)&&(h.push(k,V,$),D+=3),(t>0||G!==a-1)&&(h.push(V,U,$),D+=3)}d.addGroup(S,D,0),S+=D}function E(C){const I=v,D=new wt,B=new we;let P=0;const G=C===!0?e:t,k=C===!0?1:-1;for(let U=1;U<=s;U++)p.push(0,M*k,0),x.push(0,k,0),y.push(.5,.5),v++;const V=v;for(let U=0;U<=s;U++){const X=U/s*u+l,ee=Math.cos(X),z=Math.sin(X);B.x=G*z,B.y=M*k,B.z=G*ee,p.push(B.x,B.y,B.z),x.push(0,k,0),D.x=ee*.5+.5,D.y=z*.5*k+.5,y.push(D.x,D.y),v++}for(let U=0;U<s;U++){const $=I+U,X=V+U;C===!0?h.push(X,X+1,$):h.push(X+1,X,$),P+=3}d.addGroup(S,P,C===!0?1:2),S+=P}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ev(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class jv extends Ev{constructor(e=1,t=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(0,e,t,r,s,a,o,l),this.type="C
389oneGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l}}static fromJSON(e){return new jv(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Th extends Bn{constructor(e=[],t=[],r=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:s};const a=[],o=[];l(s),d(r),h(),this.setAttribute("position",new tn(a,3)),this.setAttribute("normal",new tn(a.slice(),3)),this.setAttribute("uv",new tn(o,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function l(A){const E=new we,C=new we,I=new we;for(let D=0;D<t.length;D+=3)y(t[D+0],E),y(t[D+1],C),y(t[D+2],I),u(E,C,I,A)}function u(A,E,C,I){const D=I+1,B=[];for(let P=0;P<=D;P++){B[P]=[];const G=A.clone().lerp(C,P/D),k=E.clone().lerp(C,P/D),V=D-P;for(let U=0;U<=V;U++)U===0&&P===D?B[P][U]=G:B[P][U]=G.clone().lerp(k,U/V)}for(let P=0;P<D;P++)for(let G=0;G<2*(D-P)-1;G++){const k=Math.floor(G/2);G%2===0?(x(B[P][k+1]),x(B[P+1][k]),x(B[P][k])):(x(B[P][k+1]),x(B[P+1][k+1]),x(B[P+1][k]))}}function d(A){const E=new we;for(let C=0;C<a.length;C+=3)E.x=a[C+0],E.y=a[C+1],E.z=a[C+2],E.normalize().multiplyScalar(A),a[C+0]=E.x,a[C+1]=E.y,a[C+2]=E.z}function h(){const A=new we;for(let E=0;E<a.length;E+=3){A.x=a[E+0],A.y=a[E+1],A.z=a[E+2];const C=M(A)/2/Math.PI+.5,I=S(A)/Math.PI+.5;o.push(C,1-I)}v(),p()}function p(){for(let A=0;A<o.length;A+=6){const E=o[A+0],C=o[A+2],I=o[A+4],D=Math.max(E,C,I),B=Math.min(E,C,I);D>.9&&B<.1&&(E<.2&&(o[A+0]+=1),C<.2&&(o[A+2]+=1),I<.2&&(o[A+4]+=1))}}function x(A){a.push(A.x,A.y,A.z)}function y(A,E){const C=A*3;E.x=e[C+0],E.y=e[C+1],E.z=e[C+2]}function v(){const A=new we,E=new we,C=new we,I=new we,D=new wt,B=new wt,P=new wt;for(let G=0,k=0;G<a.length;G+=9,k+=6){A.set(a[G+0],a[G+1],a[G+2]),E.set(a[G+3],a[G+4],a[G+5]),C.set(a[G+6],a[G+7],a[G+8]),D.set(o[k+0],o[k+1]),B.set(o[k+2],o[k+3]),P.set(o[k+4],o[k+5]),I.copy(A).add(E).add(C).divideScalar(3);const V=M(I);_(D,k+0,A,V),_(B,k+2,E,V),_(P,k+4,C,V)}}function _(A,E,C,I){I<0&&A.x===1&&(o[E]=A.x-1),C.x===0&&C.z===0&&(o[E]=I/2/Math.PI+.5)}function M(A){return Math.atan2(A.z,-A.x)}function S(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Th(e.vertices,e.indices,e.radius,e.detail)}}class VN extends Th{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,s=1/r,a=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 10,153 bytes, line 389
38919,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(a,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new VN(e.radius,e.detail)}}const fS=new we,hS=new we,yE=new we,mS=new Po;class D8 extends Bn{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const s=Math.pow(10,4),a=Math.cos(np*t),o=e.getIndex(),l=e.getAttribute("position"),u=o?o.count:l.count,d=[0,0,0],h=["a","b","c"],p=new Array(3),x={},y=[];for(let v=0;v<u;v+=3){o?(d[0]=o.getX(v),d[1]=o.getX(v+1),d[2]=o.getX(v+2)):(d[0]=v,d[1]=v+1,d[2]=v+2);const{a:_,b:M,c:S}=mS;if(_.fromBufferAttribute(l,d[0]),M.fromBufferAttribute(l,d[1]),S.fromBufferAttribute(l,d[2]),mS.getNormal(yE),p[0]=`${Math.round(_.x*s)},${Math.round(_.y*s)},${Math.round(_.z*s)}`,p[1]=`${Math.round(M.x*s)},${Math.round(M.y*s)},${Math.round(M.z*s)}`,p[2]=`${Math.round(S.x*s)},${Math.round(S.y*s)},${Math.round(S.z*s)}`,!(p[0]===p[1]||p[1]===p[2]||p[2]===p[0]))for(let A=0;A<3;A++){const E=(A+1)%3,C=p[A],I=p[E],D=mS[h[A]],B=mS[h[E]],P=`${C}_${I}`,G=`${I}_${C}`;G in x&&x[G]?(yE.dot(x[G].normal)<=a&&(y.push(D.x,D.y,D.z),y.push(B.x,B.y,B.z)),x[G]=null):P in x||(x[P]={index0:d[A],index1:d[E],normal:yE.clone()})}}for(const v in x)if(x[v]){const{index0:_,index1:M}=x[v];fS.fromBufferAttribute(l,_),hS.fromBufferAttribute(l,M),y.push(fS.x,fS.y,fS.z),y.push(hS.x,hS.y,hS.z)}this.setAttribute("position",new tn(y,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Dc{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){$t("Curve: .getPoint() not implemented.")}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,s=this.getPoint(0),a=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),a+=r.distanceTo(s),t.push(a),s=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const r=this.getLengths();let s=0;const a=r.length;let o;t?o=t:o=e*r[a-1];let l=0,u=a-1,d;for(;l<=u;)if(s=Math.floor(l+(u-l)/2),d=r[s]-o,d<0)l=s+1;else if(d>0)u=s-1;else{u=s;break}if(s=u,r[s]===o)return s/(a-1);const h=r[s],x=r[s+1]-h,y=(o-h)/x;return(s+y)/(a-1)}getTangent(e,t){let s=e-1e-4,a=e+1e-4;s<0&&(s=0),a>1&&(a=1);const o=this.getPoint(s),l=this.getPoint(a),u=t||(o.isVector2?new wt:new we);return u.copy(l).sub(o).normalize(),u}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t=!1){const r=new we,s=[],a=[],o=[],l=new we,u=new yn;for(let y=0;y<=e;y++){const v=y/e;s[y]=this.getTangentAt(v,new we)}a[0]=new we,o[0]=new we;let d=Number.MAX_VALUE;const h=Math.abs(s[0].x),p=Math.abs(s[0].y),x=Math.abs(s[0].z);h<=d&&(d=h,r.set(1,0,0)),p<=d&&(d=p,r.set(0,1,0)),x<=d&&r.set(0,0,1),l.crossVectors(s[0],r).normalize(),a[0].crossVectors(s[0],l),o[0].crossVectors(s[0],a[0]);for(let y=1;y<=e;y++){if(a[y]=a[y-1].clone(),o[y]=o[y-1].clone(),l.crossVectors(s[y-1],s[y]),l.length()>Number.EPSILON){l.normalize();const v=Math.acos(Pn(s[y-1].dot(s[y]),-1,1));a[y].applyMatrix4(u.makeRotationAxis(l,v))}o[y].crossVectors(s[y],a[y])}if(t===!0){let y=Math.acos(Pn(a[0].dot(a[e]),-1,1));y/=e,s[0].dot(l.crossVectors(a[0],a[e]))>0&&(y=-y);for(let v=1;v<=e;v++)a[v].applyMatrix4(u.makeRotationAxis(s[v],y*v)),o[v].crossVectors(s[v],a[v])}return{tangents:s,normals:a,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class WN extends Dc{constructor(e=0,t=0,r=1,s=1,a=0,o=Math.PI*2,l=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=s,this.aStartAngle=a,this.aEndAngle=o,this.aClockwise=l,this.aRotation=u}getPoint(e,t=new wt){const r=t,s=Math.PI*2;let a=this.aEndAngle-this.aStartAngle;const o=Math.abs(a)<Number.EPSILON;for(;a<0;)a+=s;for(;a>s;)a-=s;a<Number.EPSILON&&(o?a=0:a=s),this.aClockwise===!0&&!o&&(a===s?a=-s:a=a-s);const l=this.aStartAngle+e*a;let u=this.aX+this.xRadius*Math.cos(l),d=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const h=Math.cos(this.aRotation),p=Math.sin(this.aRotation),x=u-this.aX,y=d-this.aY;u=x*h-y*p+this.aX,d=x*p+y*h+this.aY}return r.set(u,d)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class k8 extends WN{constructor(e,t,r,s,a,o){super(e,t,r,r,s,a,o),this.isArcCurve=!0,this.type="ArcCurve"}}function xR(){let n=0,e=0,t=0,r=0;function s(a,o,l,u){n=a,e=l,t=-3*a+3*o-2*l-u,r=2*a-2*o+l+u}return{initCatmullRom:function(a,o,l,u,d){s(o,l,d*(l-a),d*(u-o))},initNonuniformCatmullRom:function(a,o,l,u,d,h,p){let x=(o-a)/d-(l-a)/(d+h)+(l-o)/h,y=(l-o)/h-(u-o)/(h+p)+(u-l)/p;x*=h,y*=h,s(o,l,x,y)},calc:function(a){const o=a*a,l=o*a;return n+e*a+t*o+r*l}}}const k5=new we,I5=new we,vE=new xR,wE=new xR,SE=new xR;class $N extends Dc{constructor(e=[],t=!1,r="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=s}getPoint(e,t=new we){const r=t,s=this.points,a=s.length,o=(a-(this.closed?0:1))*e;let l=Math.floor(o),u=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/a)+1)*a:u===0&&l===a-1&&(l=a-2,u=1);let d,h;this.closed||l>0?d=s[(l-1)%a]:(I5.subVectors(s[0],s[1]).add(s[0]),d=I5);const p=s[l%a],x=s[(l+1)%a];if(this.closed||l+2<a?h=s[(l+2)%a]:(k5.subVectors(s[a-1],s[a-2]).add(s[a-1]),h=k5),this.curveType==="centripetal"||this.curveType==="chordal"){const y=this.curveType==="chordal"?.5:.25;let v=Math.pow(d.distanceToSquared(p),y),_=Math.pow(p.distanceToSquared(x),y),M=Math.pow(x.distanceToSquared(h),y);_<1e-4&&(_=1),v<1e-4&&(v=_),M<1e-4&&(M=_),vE.initNonuniformCatmullRom(d.x,p.x,x.x,h.x,v,_,M),wE.initNonuniformCatmullRom(d.y,p.y,x.y,h.y,v,_,M),SE.initNonuniformCatmullRom(d.z,p.z,x.z,h.z,v,_,M)}else this.curveType==="catmullrom"&&(vE.initCatmullRom(d.x,p.x,x.x,h.x,this.tension),wE.initCatmullRom(d.y,p.y,x.y,h.y,this.tension),SE.initCatmullRom(d.z,p.z,x.z,h.z,this.tension));return r.set(vE.calc(u),wE.calc(u),SE.calc(u)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const s=e.points[t];this.points.push(s.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const s=this.points[t];e.points.push(s.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const s=e.points[t];this.points.push(new we().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function B5(n,e,t,r,s){const a=(r-e)*.5,o=(s-t)*.5,l=n*n,u=n*l;return(2*t-2*r+a+o)*u+(-3*t+3*r-2*a-o)*l+a*n+t}function Zoe(n,e){const t=1-n;return t*t*e}function ele(n,e){return 2*(1-n)*n*e}function tle(n,e){return n*n*e}function Ny(n,e,t,r){return Zoe(n,e)+ele(n,t)+tle(n,r)}function nle(n,e){const t=1-n;return t*t*t*e}function rle(n,e){const t=1-n;return 3*t*t*n*e}function sle(n,e){return 3*(1-n)*n*n*e}function ile(n,e){return n*n*n*e}function Ay(n,e,t,r,s){return nle(n,e)+rle(n,t)+sle(n,r)+ile(n,s)}class bR extends Dc{constructor(e=new wt,t=new wt,r=new wt,s=new wt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=s}getPoint(e,t=new wt){const r=t,s=this.v0,a=this.v1,o=this.v2,l=this.v3;return r.set(Ay(e,s.x,a.x,o.x,l.x),Ay(e,s.y,a.y,o.y,l.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class I8 extends Dc{constructor(e=new we,t=new we,r=new we,s=new we){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=s}getPoint(e,t=new we){const r=t,s=this.v0,a=this.v1,o=this.v2,l=this.v3;return r.set(Ay(e,s.x,a.x,o.x,l.x),Ay(e,s.y,a.y,o.y,l.y),Ay(e,s.z,a.z,o.z,l.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class yR extends Dc{constructor(e=new wt,t=new wt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new wt){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 8,800 bytes, line 389
389getTangent(e,t=new wt){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class B8 extends Dc{constructor(e=new we,t=new we){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new we){const r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new we){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class vR extends Dc{constructor(e=new wt,t=new wt,r=new wt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new wt){const r=t,s=this.v0,a=this.v1,o=this.v2;return r.set(Ny(e,s.x,a.x,o.x),Ny(e,s.y,a.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class wR extends Dc{constructor(e=new we,t=new we,r=new we){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new we){const r=t,s=this.v0,a=this.v1,o=this.v2;return r.set(Ny(e,s.x,a.x,o.x),Ny(e,s.y,a.y,o.y),Ny(e,s.z,a.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class SR extends Dc{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new wt){const r=t,s=this.points,a=(s.length-1)*e,o=Math.floor(a),l=a-o,u=s[o===0?o:o-1],d=s[o],h=s[o>s.length-2?s.length-1:o+1],p=s[o>s.length-3?s.length-1:o+2];return r.set(B5(l,u.x,d.x,h.x,p.x),B5(l,u.y,d.y,h.y,p.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const s=e.points[t];this.points.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){const s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){const s=e.points[t];this.points.push(new wt().fromArray(s))}return this}}var NM=Object.freeze({__proto__:null,ArcCurve:k8,CatmullRomCurve3:$N,CubicBezierCurve:bR,CubicBezierCurve3:I8,EllipseCurve:WN,LineCurve:yR,LineCurve3:B8,QuadraticBezierCurve:vR,QuadraticBezierCurve3:wR,SplineCurve:SR});class L8 extends Dc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new NM[r](t,e))}return this}getPoint(e,t){const r=e*this.getLength(),s=this.getCurveLengths();let a=0;for(;a<s.length;){if(s[a]>=r){const o=s[a]-r,l=this.curves[a],u=l.getLength(),d=u===0?0:1-o/u;return l.getPointAt(d,t)}a++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let r=0,s=this.curves.length;r<s;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let r;for(let s=0,a=this.curves;s<a.length;s++){const o=a[s],l=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,u=o.getPoints(l);for(let d=0;d<u.length;d++){const h=u[d];r&&r.equals(h)||(t.push(h),r=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const s=e.curves[t];this.curves.push(s.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){const s=this.curves[t];e.curves.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){const s=e.curves[t];this.curves.push(new NM[s.type]().fromJSON(s))}return this}}class Jy extends L8{constructor(e){super(),this.type="Path",this.currentPoint=new wt,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const r=new yR(this.currentPoint.clone(),new wt(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,s){const a=new vR(this.currentPoint.clone(),new wt(e,t),new wt(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}bezierCurveTo(e,t,r,s,a,o){const l=new bR(this.currentPoint.clone(),new wt(e,t),new wt(r,s),new wt(a,o));return this.curves.push(l),this.currentPoint.set(a,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),r=new SR(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,s,a,o){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+l,t+u,r,s,a,o),this}absarc(e,t,r,s,a,o){return this.absellipse(e,t,r,r,s,a,o),this}ellipse(e,t,r,s,a,o,l,u){const d=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+d,t+h,r,s,a,o,l,u),this}absellipse(e,t,r,s,a,o,l,u){const d=new WN(e,t,r,s,a,o,l,u);if(this.curves.length>0){const p=d.getPoint(0);p.equals(this.currentPoint)||this.lineTo(p.x,p.y)}this.curves.push(d);const h=d.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Tv extends Jy{constructor(e){super(e),this.uuid=Zo(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let r=0,s=this.holes.length;r<s;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const s=e.holes[t];this.holes.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){const s=this.holes[t];e.holes.push(s.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){const s=e.holes[t];this.holes.push(new Jy().fromJSON(s))}return this}}function ale(n,e,t=2){const r=e&&e.length,s=r?e[0]*t:n.length;let a=O8(n,0,s,t,!0);const o=[];if(!a||a.next===a.prev)return o;let l,u,d;if(r&&(a=dle(n,e,a,t)),n.length>80*t){l=n[0],u=n[1];let h=l,p=u;for(let x=t;x<s;x+=t){const y=n[x],v=n[x+1];y<l&&(l=y),v<u&&(u=v),y>h&&(h=y),v>p&&(p=v)}d=Math.max(h-l,p-u),d=d!==0?32767/d:0}return Zy(a,o,t,l,u,d,0),o}function O8(n,e,t,r,s){let a;if(s===Sle(n,e,t,r)>0)for(let o=e;o<t;o+=r)a=L5(o/r|0,n[o],n[o+1],a);else for(let o=t-r;o>=e;o-=r)a=L5(o/r|0,n[o],n[o+1],a);return a&&Gx(a,a.next)&&(tv(a),a=a.next),a}function xp(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(Gx(t,t.next)||Hs(t.prev,t,t.next)===0)){if(tv(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Zy(n,e,t,r,s,a,o){if(!n)return;!o&&a&&gle(n,r,s,a);let l=n;for(;n.prev!==n.next;){const u=n.prev,d=n.next;if(a?lle(n,r,s,a):ole(n)){e.push(u.i,n.i,d.i),tv(n),n=d.next,l=d.next;continue}if(n=d,n===l){o?o===1?(n=cle(xp(n),e),Zy(n,e,t,r,s,a,2)):o===2&&ule(n,e,t,r,s,a):Zy(xp(n),e,t,r,s,a,1);break}}}function ole(n){const e=n.prev,t=n,r=n.next;if(Hs(e,t,r)>=0)return!1;const s=e.x,a=t.x,o=r.x,l=e.y,u=t.y,d=r.y,h=Math.min(s,a,o),p=Math.min(l,u,d),x=Math.max(s,a,o),y=Math.max(l,u,d);let v=r.next;for(;v!==e;){if(v.x>=h&&v.x<=x&&v.y>
vendor: 4,160 bytes, line 389
389=p&&v.y<=y&&ty(s,l,a,u,o,d,v.x,v.y)&&Hs(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function lle(n,e,t,r){const s=n.prev,a=n,o=n.next;if(Hs(s,a,o)>=0)return!1;const l=s.x,u=a.x,d=o.x,h=s.y,p=a.y,x=o.y,y=Math.min(l,u,d),v=Math.min(h,p,x),_=Math.max(l,u,d),M=Math.max(h,p,x),S=BT(y,v,e,t,r),A=BT(_,M,e,t,r);let E=n.prevZ,C=n.nextZ;for(;E&&E.z>=S&&C&&C.z<=A;){if(E.x>=y&&E.x<=_&&E.y>=v&&E.y<=M&&E!==s&&E!==o&&ty(l,h,u,p,d,x,E.x,E.y)&&Hs(E.prev,E,E.next)>=0||(E=E.prevZ,C.x>=y&&C.x<=_&&C.y>=v&&C.y<=M&&C!==s&&C!==o&&ty(l,h,u,p,d,x,C.x,C.y)&&Hs(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;E&&E.z>=S;){if(E.x>=y&&E.x<=_&&E.y>=v&&E.y<=M&&E!==s&&E!==o&&ty(l,h,u,p,d,x,E.x,E.y)&&Hs(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;C&&C.z<=A;){if(C.x>=y&&C.x<=_&&C.y>=v&&C.y<=M&&C!==s&&C!==o&&ty(l,h,u,p,d,x,C.x,C.y)&&Hs(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function cle(n,e){let t=n;do{const r=t.prev,s=t.next.next;!Gx(r,s)&&U8(r,t,t.next,s)&&ev(r,s)&&ev(s,r)&&(e.push(r.i,t.i,s.i),tv(t),tv(t.next),t=n=s),t=t.next}while(t!==n);return xp(t)}function ule(n,e,t,r,s,a){let o=n;do{let l=o.next.next;for(;l!==o.prev;){if(o.i!==l.i&&yle(o,l)){let u=z8(o,l);o=xp(o,o.next),u=xp(u,u.next),Zy(o,e,t,r,s,a,0),Zy(u,e,t,r,s,a,0);return}l=l.next}o=o.next}while(o!==n)}function dle(n,e,t,r){const s=[];for(let a=0,o=e.length;a<o;a++){const l=e[a]*r,u=a<o-1?e[a+1]*r:n.length,d=O8(n,l,u,r,!1);d===d.next&&(d.steiner=!0),s.push(ble(d))}s.sort(fle);for(let a=0;a<s.length;a++)t=hle(s[a],t);return t}function fle(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),s=(e.next.y-e.y)/(e.next.x-e.x);t=r-s}return t}function hle(n,e){const t=mle(n,e);if(!t)return e;const r=z8(t,n);return xp(r,r.next),xp(t,t.next)}function mle(n,e){let t=e;const r=n.x,s=n.y;let a=-1/0,o;if(Gx(n,t))return t;do{if(Gx(n,t.next))return t.next;if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const p=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=r&&p>a&&(a=p,o=t.x<t.next.x?t:t.next,p===r))return o}t=t.next}while(t!==e);if(!o)return null;const l=o,u=o.x,d=o.y;let h=1/0;t=o;do{if(r>=t.x&&t.x>=u&&r!==t.x&&F8(s<d?r:a,s,u,d,s<d?a:r,s,t.x,t.y)){const p=Math.abs(s-t.y)/(r-t.x);ev(t,n)&&(p<h||p===h&&(t.x>o.x||t.x===o.x&&ple(o,t)))&&(o=t,h=p)}t=t.next}while(t!==l);return o}function ple(n,e){return Hs(n.prev,n,e.prev)<0&&Hs(e.next,n,n.next)<0}function gle(n,e,t,r){let s=n;do s.z===0&&(s.z=BT(s.x,s.y,e,t,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,xle(s)}function xle(n){let e,t=1;do{let r=n,s;n=null;let a=null;for(e=0;r;){e++;let o=r,l=0;for(let d=0;d<t&&(l++,o=o.nextZ,!!o);d++);let u=t;for(;l>0||u>0&&o;)l!==0&&(u===0||!o||r.z<=o.z)?(s=r,r=r.nextZ,l--):(s=o,o=o.nextZ,u--),a?a.nextZ=s:n=s,s.prevZ=a,a=s;r=o}a.nextZ=null,t*=2}while(e>1);return n}function BT(n,e,t,r,s){return n=(n-t)*s|0,e=(e-r)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function ble(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function F8(n,e,t,r,s,a,o,l){return(s-o)*(e-l)>=(n-o)*(a-l)&&(n-o)*(r-l)>=(t-o)*(e-l)&&(t-o)*(a-l)>=(s-o)*(r-l)}function ty(n,e,t,r,s,a,o,l){return!(n===o&&e===l)&&F8(n,e,t,r,s,a,o,l)}function yle(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!vle(n,e)&&(ev(n,e)&&ev(e,n)&&wle(n,e)&&(Hs(n.prev,n,e.prev)||Hs(n,e.prev,e))||Gx(n,e)&&Hs(n.prev,n,n.next)>0&&Hs(e.prev,e,e.next)>0)}function Hs(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Gx(n,e){return n.x===e.x&&n.y===e.y}function U8(n,e,t,r){const s=gS(Hs(n,e,t)),a=gS(Hs(n,e,r)),o=gS(Hs(t,r,n)),l=gS(Hs(t,r,e));return!!(s!==a&&o!==l||s===0&&pS(n,t,e)||a===0&&pS(n,r,e)||o===0&&pS(t,n,r)||l===0&&pS(t,e,r))}function pS(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function gS(n){return n>0?1:n<0?-1:0}function vle(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&U8(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function ev(n,e){return Hs(n.prev,n,n.next)<0?Hs(n,e,n.next)>=0&&Hs(n,n.prev,e)>
389=0:Hs(n,e,n.prev)<0||Hs(n,n.next,e)<0}function wle(n,e){let t=n,r=!1;const s=(n.x+e.x)/2,a=(n.y+e.y)/2;do t.y>a!=t.next.y>a&&t.next.y!==t.y&&s<(t.next.x-t.x)*(a-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function z8(n,e){const t=LT(n.i,n.x,n.y),r=LT(e.i,e.x,e.y),s=n.next,a=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,r.next=t,t.prev=r,a.next=r,r.prev=a,r}function L5(n,e,t,r){const s=LT(n,e,t);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function tv(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function LT(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Sle(n,e,t,r){let s=0;for(let a=e,o=t-r;a<t;a+=r)s+=(n[o]-n[a])*(n[a+1]+n[o+1]),o=a;return s}class _le{static triangulate(e,t,r=2){return ale(e,t,r)}}class Sc{static area(e){const t=e.length;let r=0;for(let s=t-1,a=0;a<t;s=a++)r+=e[s].x*e[a].y-e[a].x*e[s].y;return r*.5}static isClockWise(e){return Sc.area(e)<0}static triangulateShape(e,t){const r=[],s=[],a=[];O5(e),F5(r,e);let o=e.length;t.forEach(O5);for(let u=0;u<t.length;u++)s.push(o),o+=t[u].length,F5(r,t[u]);const l=_le.triangulate(r,s);for(let u=0;u<l.length;u+=3)a.push(l.slice(u,u+3));return a}}function O5(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function F5(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class XN extends Bn{constructor(e=new Tv([new wt(.5,.5),new wt(-.5,.5),new wt(-.5,-.5),new wt(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const r=this,s=[],a=[];for(let l=0,u=e.length;l<u;l++){const d=e[l];o(d)}this.setAttribute("position",new tn(s,3)),this.setAttribute("uv",new tn(a,2)),this.computeVertexNormals();function o(l){const u=[],d=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,p=t.depth!==void 0?t.depth:1;let x=t.bevelEnabled!==void 0?t.bevelEnabled:!0,y=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:y-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,M=t.bevelSegments!==void 0?t.bevelSegments:3;const S=t.extrudePath,A=t.UVGenerator!==void 0?t.UVGenerator:Mle;let E,C=!1,I,D,B,P;if(S){E=S.getSpacedPoints(h),C=!0,x=!1;const Ce=S.isCatmullRomCurve3?S.closed:!1;I=S.computeFrenetFrames(h,Ce),D=new we,B=new we,P=new we}x||(M=0,y=0,v=0,_=0);const G=l.extractPoints(d);let k=G.shape;const V=G.holes;if(!Sc.isClockWise(k)){k=k.reverse();for(let Ce=0,Re=V.length;Ce<Re;Ce++){const De=V[Ce];Sc.isClockWise(De)&&(V[Ce]=De.reverse())}}function $(Ce){const De=10000000000000001e-36;let he=Ce[0];for(let le=1;le<=Ce.length;le++){const Xe=le%Ce.length,qe=Ce[Xe],Ge=qe.x-he.x,ot=qe.y-he.y,ve=Ge*Ge+ot*ot,mt=Math.max(Math.abs(qe.x),Math.abs(qe.y),Math.abs(he.x),Math.abs(he.y)),xt=De*mt*mt;if(ve<=xt){Ce.splice(Xe,1),le--;continue}he=qe}}$(k),V.forEach($);const X=V.length,ee=k;for(let Ce=0;Ce<X;Ce++){const Re=V[Ce];k=k.concat(Re)}function z(Ce,Re,De){return Re||fn("ExtrudeGeometry: vec does not exist"),Ce.clone().addScaledVector(Re,De)}const K=k.length;function ae(Ce,Re,De){let he,le,Xe;const qe=Ce.x-Re.x,Ge=Ce.y-Re.y,ot=De.x-Ce.x,ve=De.y-Ce.y,mt=qe*qe+Ge*Ge,xt=qe*ve-Ge*ot;if(Math.abs(xt)>Number.EPSILON){const ge=Math.sqrt(mt),Y=Math.sqrt(ot*ot+ve*ve),je=Re.x-Ge/ge,Ie=Re.y+qe/ge,Ve=De.x-ve/Y,ft=De.y+ot/Y,vt=((Ve-je)*ve-(ft-Ie)*ot)/(qe*ve-Ge*ot);he=je+qe*vt-Ce.x,le=Ie+Ge*vt-Ce.y;const ce=he*he+le*le;if(ce<=2)return new wt(he,le);Xe=Math.sqrt(ce/2)}else{let ge=!1;qe>Number.EPSILON?ot>Number.EPSILON&&(ge=!0):qe<-Number.EPSILON?ot<-Number.EPSILON&&(ge=!0):Math.sign(Ge)===Math.sign(ve)&&(ge=!0),ge?(he=-Ge,le=qe,Xe=Math.sqrt(mt)):(he=qe,le=Ge,Xe=Math.sqrt(mt/2))}return new wt(he/Xe,le/Xe)}const oe=[];for(let Ce=0,Re=ee.length,De=Re-1,he=Ce+1;Ce<Re;Ce++,De++,he++)De===Re&&(De=0),he===Re&&(he=0),oe[Ce]=ae(ee[Ce],ee[De],ee[he]);const re=[];let F,O=oe.concat();for(let Ce=0,Re=X;Ce<Re;Ce++){const De=V[Ce];F=[];for(let he=0,le=De.length,Xe=le-1,qe=he+1;he<le;he++,Xe++,qe++)Xe===le&&(Xe=0),qe===le&&(qe=0),F[he]=ae(De[he],De[Xe],De[qe]);re.push(F),O=O.concat(F)}let J;if(M===0)J=Sc.triangulateShape(ee,V);else{const Ce=[],Re=[];for(let De=0;De<M;De++){const he=De/M,le=y*Math.cos(he*Math.PI/2),Xe=v*Math.sin(he*Math.PI/2)+_;for(let qe=0,Ge=ee.length;qe<Ge;qe++){const ot=z(ee[qe],oe[qe],Xe);me(ot.x,ot.y,-le),he===0&&Ce.push(ot)}for(let qe=0,Ge=X;qe<Ge;qe++){const ot=V[qe];F=re[qe];const ve=[];for(let mt=0,xt=ot.length;mt<xt;mt++){const ge=z(ot[mt],F[mt],Xe);me(ge.x,ge.y,-le),he===0&&ve.push(ge)}he===0&&Re.push(ve)}}J=Sc.triangulateShape(Ce,Re)}const q=J.length,Q=v+_;for(let Ce=0;Ce<K;Ce++){const Re=x?z(k[Ce],O[Ce],Q):k[Ce];C?(B.copy(I.normals[0]).multiplyScalar(Re.x),D.copy(I.binormals[0]).multiplyScalar(Re.y),P.copy(E[0]).add(B).add(D),me(P.x,P.y,P.z)):me(Re.x,Re.y,0)}for(let Ce=1;Ce<=h;Ce++)for(let Re=0;Re<K;Re++){const De=x?z(k[Re],O[Re],Q):k[Re];C?(B.copy(I.normals[Ce]).multiplyScalar(De.x),D.copy(I.binormals[Ce]).multiplyScalar(De.y),P.copy(E[Ce]).add(B).add(D),me(P.x,P.y,P.z)):me(De.x,De.y,p/h*Ce)}for(let Ce=M-1;Ce>=0;Ce--){const Re=Ce/M,De=y*Math.cos(Re*Math.PI/2),he=v*Math.sin(Re*Math.PI/2)+_;for(let le=0,Xe=ee.length;le<Xe;le++){const qe=z(ee[le],oe[le],he);me(qe.x,qe.y,p+De)}for(let le=0,Xe=V.length;le<Xe;le++){const qe=V[le];F=re[le];for(let Ge=0,ot=qe.length;Ge<ot;Ge++){const ve=z(qe[Ge],F[Ge],he);C?me(ve.x,ve.y+E[h-1].y,E[h-1].x+De):me(ve.x,ve.y,p+De)}}}ne(),Z();function ne(){const Ce=s.length/3;if(x){let Re=0,De=K*Re;for(let he=0;he<q;he++){const le=J[he];ze(le[2]+De,le[1]+De,le[0]+De)}Re=h+M*2,De=K*Re;for(let he=0;he<q;he++){const le=J[he];ze(le[0]+De,le[1]+De,le[2]+De)}}else{for(let Re=0;Re<q;Re++){const De=J[Re];ze(De[2],De[1],De[0])}for(let Re=0;Re<q;Re++){const De=J[Re];ze(De[0]+K*h,De[1]+K*h,De[2]+K*h)}}r.addGroup(Ce,s.length/3-Ce,0)}function Z(){const Ce=s.length/3;let Re=0;
vendor: 15,001 bytes, line 389
389se(ee,Re),Re+=ee.length;for(let De=0,he=V.length;De<he;De++){const le=V[De];se(le,Re),Re+=le.length}r.addGroup(Ce,s.length/3-Ce,1)}function se(Ce,Re){let De=Ce.length;for(;--De>=0;){const he=De;let le=De-1;le<0&&(le=Ce.length-1);for(let Xe=0,qe=h+M*2;Xe<qe;Xe++){const Ge=K*Xe,ot=K*(Xe+1),ve=Re+he+Ge,mt=Re+le+Ge,xt=Re+le+ot,ge=Re+he+ot;Be(ve,mt,xt,ge)}}}function me(Ce,Re,De){u.push(Ce),u.push(Re),u.push(De)}function ze(Ce,Re,De){ye(Ce),ye(Re),ye(De);const he=s.length/3,le=A.generateTopUV(r,s,he-3,he-2,he-1);Le(le[0]),Le(le[1]),Le(le[2])}function Be(Ce,Re,De,he){ye(Ce),ye(Re),ye(he),ye(Re),ye(De),ye(he);const le=s.length/3,Xe=A.generateSideWallUV(r,s,le-6,le-3,le-2,le-1);Le(Xe[0]),Le(Xe[1]),Le(Xe[3]),Le(Xe[1]),Le(Xe[2]),Le(Xe[3])}function ye(Ce){s.push(u[Ce*3+0]),s.push(u[Ce*3+1]),s.push(u[Ce*3+2])}function Le(Ce){a.push(Ce.x),a.push(Ce.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return Nle(t,r,e)}static fromJSON(e,t){const r=[];for(let a=0,o=e.shapes.length;a<o;a++){const l=t[e.shapes[a]];r.push(l)}const s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new NM[s.type]().fromJSON(s)),new XN(r,e.options)}}const Mle={generateTopUV:function(n,e,t,r,s){const a=e[t*3],o=e[t*3+1],l=e[r*3],u=e[r*3+1],d=e[s*3],h=e[s*3+1];return[new wt(a,o),new wt(l,u),new wt(d,h)]},generateSideWallUV:function(n,e,t,r,s,a){const o=e[t*3],l=e[t*3+1],u=e[t*3+2],d=e[r*3],h=e[r*3+1],p=e[r*3+2],x=e[s*3],y=e[s*3+1],v=e[s*3+2],_=e[a*3],M=e[a*3+1],S=e[a*3+2];return Math.abs(l-h)<Math.abs(o-d)?[new wt(o,1-u),new wt(d,1-p),new wt(x,1-v),new wt(_,1-S)]:[new wt(l,1-u),new wt(h,1-p),new wt(y,1-v),new wt(M,1-S)]}};function Nle(n,e,t){if(t.shapes=[],Array.isArray(n))for(let r=0,s=n.length;r<s;r++){const a=n[r];t.shapes.push(a.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class qN extends Th{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,s=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],a=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(s,a,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new qN(e.radius,e.detail)}}class YN extends Bn{constructor(e=[new wt(0,-.5),new wt(.5,0),new wt(0,.5)],t=12,r=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:s},t=Math.floor(t),s=Pn(s,0,Math.PI*2);const a=[],o=[],l=[],u=[],d=[],h=1/t,p=new we,x=new wt,y=new we,v=new we,_=new we;let M=0,S=0;for(let A=0;A<=e.length-1;A++)switch(A){case 0:M=e[A+1].x-e[A].x,S=e[A+1].y-e[A].y,y.x=S*1,y.y=-M,y.z=S*0,_.copy(y),y.normalize(),u.push(y.x,y.y,y.z);break;case e.length-1:u.push(_.x,_.y,_.z);break;default:M=e[A+1].x-e[A].x,S=e[A+1].y-e[A].y,y.x=S*1,y.y=-M,y.z=S*0,v.copy(y),y.x+=_.x,y.y+=_.y,y.z+=_.z,y.normalize(),u.push(y.x,y.y,y.z),_.copy(v)}for(let A=0;A<=t;A++){const E=r+A*h*s,C=Math.sin(E),I=Math.cos(E);for(let D=0;D<=e.length-1;D++){p.x=e[D].x*C,p.y=e[D].y,p.z=e[D].x*I,o.push(p.x,p.y,p.z),x.x=A/t,x.y=D/(e.length-1),l.push(x.x,x.y);const B=u[3*D+0]*C,P=u[3*D+1],G=u[3*D+0]*I;d.push(B,P,G)}}for(let A=0;A<t;A++)for(let E=0;E<e.length-1;E++){const C=E+A*e.length,I=C,D=C+e.length,B=C+e.length+1,P=C+1;a.push(I,D,P),a.push(B,P,D)}this.setIndex(a),this.setAttribute("position",new tn(o,3)),this.setAttribute("uv",new tn(l,2)),this.setAttribute("normal",new tn(d,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new YN(e.points,e.segments,e.phiStart,e.phiLength)}}class Rv extends Th{constructor(e=1,t=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,s,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Rv(e.radius,e.detail)}}class Yd extends Bn{constructor(e=1,t=1,r=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:s};const a=e/2,o=t/2,l=Math.floor(r),u=Math.floor(s),d=l+1,h=u+1,p=e/l,x=t/u,y=[],v=[],_=[],M=[];for(let S=0;S<h;S++){const A=S*x-o;for(let E=0;E<d;E++){const C=E*p-a;v.push(C,-A,0),_.push(0,0,1),M.push(E/l),M.push(1-S/u)}}for(let S=0;S<u;S++)for(let A=0;A<l;A++){const E=A+d*S,C=A+d*(S+1),I=A+1+d*(S+1),D=A+1+d*S;y.push(E,C,D),y.push(C,I,D)}this.setIndex(y),this.setAttribute("position",new tn(v,3)),this.setAttribute("normal",new tn(_,3)),this.setAttribute("uv",new tn(M,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yd(e.width,e.height,e.widthSegments,e.heightSegments)}}class QN extends Bn{constructor(e=.5,t=1,r=32,s=1,a=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:s,thetaStart:a,thetaLength:o},r=Math.max(3,r),s=Math.max(1,s);const l=[],u=[],d=[],h=[];let p=e;const x=(t-e)/s,y=new we,v=new wt;for(let _=0;_<=s;_++){for(let M=0;M<=r;M++){const S=a+M/r*o;y.x=p*Math.cos(S),y.y=p*Math.sin(S),u.push(y.x,y.y,y.z),d.push(0,0,1),v.x=(y.x/t+1)/2,v.y=(y.y/t+1)/2,h.push(v.x,v.y)}p+=x}for(let _=0;_<s;_++){const M=_*(r+1);for(let S=0;S<r;S++){const A=S+M,E=A,C=A+r+1,I=A+r+2,D=A+1;l.push(E,C,D),l.push(C,I,D)}}this.setIndex(l),this.setAttribute("position",new tn(u,3)),this.setAttribute("normal",new tn(d,3)),this.setAttribute("uv",new tn(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new QN(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class KN extends Bn{constructor(e=new Tv([new wt(0,.5),new wt(-.5,-.5),new wt(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const r=[],s=[],a=[],o=[];let l=0,u=0;if(Array.isArray(e)===!1)d(e);else for(let h=0;h<e.length;h++)d(e[h]),this.addGroup(l,u,h),l+=u,u=0;this.setIndex(r),this.setAttribute("position",new tn(s,3)),this.setAttribute("normal",new tn(a,3)),this.setAttribute("uv",new tn(o,2));function d(h){const p=s.length/3,x=h.extractPoints(t);let y=x.shape;const v=x.holes;Sc.isClockWise(y)===!1&&(y=y.reverse());for(let M=0,S=v.length;M<S;M++){const A=v[M];Sc.isClockWise(A)===!0&&(v[M]=A.reverse())}const _=Sc.triangulateShape(y,v);for(let M=0,S=v.length;M<S;M++){const A=v[M];y=y.concat(A)}for(let M=0,S=y.length;M<S;M++){const A=y[M];s.push(A.x,A.y,0),a.push(0,0,1),o.push(A.x,A.y)}for(let M=0,S=_.length;M<S;M++){const A=_[M],E=A[0]+p,C=A[1]+p,I=A[2]+p;r.push(E,C,I),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Ale(t,e)}static fromJSON(e,t){const r=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];r.push(o)}return new KN(r,e.curveSegments)}}function Ale(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const s=n[t];e.shapes.push(s.uuid)}else e.shapes.push(n.uuid);return e}class Pv extends Bn{constructor(e=1,t=32,r=16,s=0,a=Math.PI*2,o=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:s,phiLength:a,thetaStart:o,thetaLength:l},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));const u=Math.min(o+l,Math.PI);let d=0;const h=[],p=new we,x=new we,y=[],v=[],_=[],M=[];for(let S=0;S<=r;S++){const A=[],E=S/r,C=o+E*l,I=e*Math.cos(C),D=Math.sqrt(e*e-I*I);let B=0;S===0&&o===0?B=.5/t:S===r&&u===Math.PI&&(B=-.5/t);for(let P=0;P<=t;P++){const G=P/t,k=s+G*a;p.x=-D*Math.cos(k),p.y=I,p.z=D*Math.sin(k),v.push(p.x,p.y,p.z),x.copy(p).normalize(),_.push(x.x,x.y,x.z),M.push(G+B,1-E),A.push(d++)}h.push(A)}for(let S=0;S<r;S++)for(let A=0;A<t;A++){const E=h[S][A+1],C=h[S][A],I=h[S+1][A],D=h[S+1][A+1];(S!==0||o>0)&&y.push(E,C,D),(S!==r-1||u<Math.PI)&&y.push(C,I,D)}this.setIndex(y),this.setAttribute("position",new tn(v,3)),this.setAttribute("normal",new tn(_,3)),this.setAttribute("uv",new tn(M,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pv(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class JN extends Th{constructor(e=1,t=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,s,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new JN(e.radius,e.detail)}}class ZN extends Bn{constructor(e=1,t=.4,r=12,s=48,a=Math.PI*2,o=0,l=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:s,arc:a,thetaStart:o,thetaLength:l},r=Math.floor(r),s=Math.floor(s);const u=[],d=[],h=[],p=[],x=new we,y=new we,v=new we;for(let _=0;_<=r;_++){const M=o+_/r*l;for(let S=0;S<=s;S++){const A=S/s*a;y.x=(e+t*Math.cos(M))*Math.cos(A),y.y=(e+t*Math.cos(M))*Math.sin(A),y.z=t*Math.sin(M),d.push(y.x,y.y,y.z),x.x=e*Math.cos(A),x.y=e*Math.sin(A),v.subVectors(y,x).normalize(),h.push(v.x,v.y,v.z),p.push(S/s),p.push(_/r)}}for(let _=1;_<=r;_++)for(let M=1;M<=s;M++){const S=(s+1)*_+M-1,A=(s+1)*(_-1)+M-1,E=(s+1)*(_-1)+M,C=(s+1)*_+M;u.push(S,A,C),u.push(A,E,C)}this.setIndex(u),this.setAttribute("position",new tn(d,3)),this.setAttribute("normal",new tn(h,3)),this.setAttribute("uv",new tn(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ZN(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class eA extends Bn{constructor(e=1,t=.4,r=64,s=8,a=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:s,p:a,q:o},r=Math.floor(r),s=Math.floor(s);const l=[],u=[],d=[],h=[],p=new we,x=new we,y=new we,v=new we,_=new we,M=new we,S=new we;for(let E=0;E<=r;++E){const C=E/r*a*Math.PI*2;A(C,a,o,e,y),A(C+.01,a,o,e,v),M.subVectors(v,y),S.addVectors(v,y),_.crossVectors(M,S),S.crossVectors(_,M),_.normalize(),S.normalize();for(let I=0;I<=s;++I){const D=I/s*Math.PI*2,B=-t*Math.cos(D),P=t*Math.sin(D);p.x=y.x+(B*S.x+P*_.x),p.y=y.y+(B*S.y+P*_.y),p.z=y.z+(B*S.z+P*_.z),u.push(p.x,p.y,p.z),x.subVectors(p,y).normalize(),d.push(x.x,x.y,x.z),h.push(E/r),h.push(I/s)}}for(let E=1;E<=r;E++)for(let C=1;C<=s;C++){const I=(s+1)*(E-1)+(C-1),D=(s+1)*E+(C-1),B=(s+1)*E+C,P=(s+1)*(E-1)+C;l.push(I,D,P),l.push(D,B,P)}this.setIndex(l),this.setAttribute("position",new tn(u,3)),this.setAttribute("normal",new tn(d,3)),this.setAttribute("uv",new tn(h,2));function A(E,C,I,D,B){const P=Math.cos(E),G=Math.sin(E),k=I/C*E,V=Math.cos(k);B.x=D*(2+V)*.5*P,B.y=D*(2+V)*G*.5,B.z=D*Math.sin(k)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new eA(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class bp extends Bn{constructor(e=new wR(new we(-1,-1,0),new we(-1,1,0),new we(1,1,0)),t=64,r=1,s=8,a=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:s,closed:a};const o=e.computeFrenetFrames(t,a);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const l=new we,u=new we,d=new wt;let h=new we;const p=[],x=[],y=[],v=[];_(),this.setIndex(v),this.setAttribute("position",new tn(p,3)),this.setAttribute("normal",new tn(x,3)),this.setAttribute("uv",new tn(y,2));function _(){for(let E=0;E<t;E++)M(E);M(a===!1?t:0),A(),S()}function M(E){h=e.getPointAt(E/t,h);const C=o.normals[E],I=o.binormals[E];for(let D=0;D<=s;D++){const B=D/s*Math.PI*2,P=Math.sin(B),G=-Math.cos(B);u.x=G*C.x+P*I.x,u.y=G*C.y+P*I.y,u.z=G*C.z+P*I.z,u.normalize(),x.push(u.x,u.y,u.z),l.x=h.x+r*u.x,l.y=h.y+r*u.y,l.z=h.z+r*u.z,p.push(l.x,l.y,l.z)}}function S(){for(let E=1;E<=t;E++)for(let C=1;C<=s;C++){const I=(s+1)*(E-1)+(C-1),D=(s+1)*E+(C-1),B=(s+1)*E+C,P=(s+1)*(E-1)+C;v.push(I,D,P),v.push(D,B,P)}}function A(){for(let E=0;E<=t;E++)for(let C=0;C<=s;C++)d.x=E/t,d.y=C/s,y.push(d.x,d.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new bp(new NM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class _R extends Bn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],r=new Set,s=new we,a=new we;if(e.index!==null){const o=e.attributes.position,l=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:l.count,materialIndex:0}]);for(let d=0,h=u.length;d<h;++d){const p=u[d],x=p.start,y=p.count;for(let v=x,_=x+y;v<_;v+=3)for(let M=0;M<3;M++){const S=l.getX(v+M),A=l.getX(v+(M+1)%3);s.fromBufferAttribute(o,S),a.fromBufferAttribute(o,A),U5(s,a,r)===!0&&(t.push(s.x,s.y,s.z),t.push(a.x,a.y,a.z))}}}else{const o=e.attributes.position;for(let l=0,u=o.count/3;l<u;l++)for(let d=0;d<3;d++){const h=3*l+d,p=3*l+(d+1)%3;s.fromBufferAttribute(o,h),a.fromBufferAttribute(o,p),U5(s,a,r)===!0&&(t.push(s.x,s.y,s.z),t.push(a.x,a.y,a.z))}}this.setAttribute("position",new tn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function U5(n,e,t){const r=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,s=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(r)===!0||t.has(s)===!0?!1:(t.add(r),t.add(s),!0)}var z5=Object.freeze({__proto__:null,BoxGeometry:Ep,CapsuleGeometry:GN,CircleGeometry:HN,ConeGeometry:jv,CylinderGeometry:Ev,DodecahedronGeometry:VN,EdgesGeometry:D8,ExtrudeGeometry:XN,IcosahedronGeometry:qN,LatheGeometry:YN,OctahedronGeometry:Rv,PlaneGeometry:Yd,PolyhedronGeometry:Th,RingGeometry:QN,ShapeGeometry:KN,SphereGeometry:Pv,TetrahedronGeometry:JN,TorusGeometry:ZN,TorusKnotGeometry:eA,TubeGeometry:bp,WireframeGeometry:_R});class G8 extends Ci{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function Hx(n){const e={};for(const t in n){e[t]={};for(const r in n[t]){const s=n[t][r];if(G5(s))s.isRenderTargetTexture?($t("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][r]=null):e[t][r]=s.clone();else if(Array.isArray(s))if(G5(s[0])){const a=[];for(let o=0,l=s.length;o<l;o++)a[o]=s[o].clone();e[t][r]=a}else e[t][r]=s.slice();else e[t][r]=s}}return e}function Xa(n){const e={};for(let t=0;t<n.length;t++){const r=Hx(n[t]);for(const s in r)e[s]=r[s]}return e}function G5(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function Cle(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function H8(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ur.w
389orkingColorSpace}const Vx={clone:Hx,merge:Xa};var Ele=`void main() {
390	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
391}`,jle=`void main() {
392	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
393}`;class oo extends Ci{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ele,this.fragmentShader=jle,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Hx(e.uniforms),this.uniformsGroups=Cle(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const s in this.extensions)this.extensions[s]===!0&&(r[s]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const r in e.uniforms){const s=e.uniforms[r];switch(this.uniforms[r]={},s.type){case"t":this.uniforms[r].value=t[s.value]||null;break;case"c":this.uniforms[r].value=new Ut().setHex(s.value);break;case"v2":this.uniforms[r].value=new wt().fromArray(s.value);break;case"v3":this.uniforms[r].value=new we().fromArray(s.value);break;case"v4":this.uniforms[r].value=new mr().fromArray(s.value);break;case"m3":this.uniforms[r].value=new Ln().fromArray(s.value);break;
vendor: 12,643 bytes, line 393
393case"m4":this.uniforms[r].value=new yn().fromArray(s.value);break;default:this.uniforms[r].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)this.extensions[r]=e.extensions[r];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class MR extends oo{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Dv extends Ci{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hd,this.normalScale=new wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ac,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class $l extends Dv{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new wt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class V8 extends Ci{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hd,this.normalScale=new wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ac,this.combine=_v,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class W8 extends Ci{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hd,this.normalScale=new wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class $8 extends Ci{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hd,this.normalScale=new wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class X8 extends Ci{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hd,this.normalScale=new wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ac,this.combine=_v,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tA extends Ci{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=h8,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class nA extends Ci{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}
393class q8 extends Ci{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hd,this.normalScale=new wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Y8 extends ka{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function $m(n,e){return!n||n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Q8(n){function e(s,a){return n[s]-n[a]}const t=n.length,r=new Array(t);for(let s=0;s!==t;++s)r[s]=s;return r.sort(e),r}function OT(n,e,t){const r=n.length,s=new n.constructor(r);for(let a=0,o=0;o!==r;++a){const l=t[a]*e;for(let u=0;u!==e;++u)s[o++]=n[l+u]}return s}function K8(n,e,t,r){let s=1,a=n[0];for(;a!==void 0&&a[r]===void 0;)a=n[s++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(e.push(a.time),t.push(...o)),a=n[s++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(e.push(a.time),o.toArray(t,t.length)),a=n[s++];while(a!==void 0);else do o=a[r],o!==void 0&&(e.push(a.time),t.push(o)),a=n[s++];while(a!==void 0)}function Tle(n,e,t,r,s=30){const a=n.clone();a.name=e;const o=[];for(let u=0;u<a.tracks.length;++u){const d=a.tracks[u],h=d.getValueSize(),p=[],x=[];for(let y=0;y<d.times.length;++y){const v=d.times[y]*s;if(!(v<t||v>=r)){p.push(d.times[y]);for(let _=0;_<h;++_)x.push(d.values[y*h+_])}}p.length!==0&&(d.times=$m(p,d.times.constructor),d.values=$m(x,d.values.constructor),o.push(d))}a.tracks=o;let l=1/0;for(let u=0;u<a.tracks.length;++u)l>a.tracks[u].times[0]&&(l=a.tracks[u].times[0]);for(let u=0;u<a.tracks.length;++u)a.tracks[u].shift(-1*l);return a.resetDuration(),a}function Rle(n,e=0,t=n,r=30){r<=0&&(r=30);const s=t.tracks.length,a=e/r;for(let o=0;o<s;++o){const l=t.tracks[o],u=l.ValueTypeName;if(u==="bool"||u==="string")continue;const d=n.tracks.find(function(S){return S.name===l.name&&S.ValueTypeName===u});if(d===void 0)continue;let h=0;const p=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=p/3);let x=0;const y=d.getValueSize();d.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(x=y/3);const v=l.times.length-1;let _;if(a<=l.times[0]){const S=h,A=p-h;_=l.values.slice(S,A)}else if(a>=l.times[v]){const S=v*p+h,A=S+p-h;_=l.values.slice(S,A)}else{const S=l.createInterpolant(),A=h,E=p-h;S.evaluate(a),_=S.resultBuffer.slice(A,E)}u==="quaternion"&&new Oi().fromArray(_).normalize().conjugate().toArray(_);const M=d.times.length;for(let S=0;S<M;++S){const A=S*y+x;if(u==="quaternion")Oi.multiplyQuaternionsFlat(d.values,A,_,0,d.values,A);else{const E=y-x*2;for(let C=0;C<E;++C)d.values[A+C]-=_[C]}}}return n.blendMode=sR,n}class Ple{static convertArray(e,t){return $m(e,t)}static isTypedArray(e){return S8(e)}static getKeyframeOrder(e){return Q8(e)}static sortedArray(e,t,r){return OT(e,t,r)}static flattenJSON(e,t,r,s){K8(e,t,r,s)}static subclip(e,t,r,s,a=30){return Tle(e,t,r,s,a)}static makeClipAdditive(e,t=0,r=e,s=30){return Rle(e,t,r,s)}}class jp{constructor(e,t,r,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,s=t[r],a=t[r-1];e:{t:{let o;n:{r:if(!(e<s)){for(let l=r+2;;){if(s===void 0){if(e<a)break r;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===l)break;if(a=s,s=t[++r],e<s)break t}o=t.length;break n}if(!(e>=a)){const l=t[1];e<l&&(r=2,a=l);for(let u=r-2;;){if(a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===u)break;if(s=a,a=t[--r-1],e>=a)break t}o=r,r=0;break n}break e}for(;r<o;){const l=r+o>>>1;e<t[l]?o=l:r=l+1}if(s=t[r],a=t[r-1],a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,a,s)}return this.interpolate_(r,a,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,a=e*s;for(let o=0;o!==s;++o)t[o]=r[a+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class J8 extends jp{constructor(e,t,r,s){super(e,t,r,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Vm,endingEnd:Vm}}intervalChanged_(e,t,r){const s=this.parameterPositions;let a=e-2,o=e+1,l=s[a],u=s[o];if(l===void 0)switch(this.getSettings_().endingStart){case Wm:a=e,l=2*t-r;break;case Xy:a=s.length-2,l=t+s[a]-s[a+1];break;default:a=e,l=r}if(u===void 0)switch(this.getSettings_().endingEnd){case Wm:o=e,u=2*r-t;break;case Xy:o=1,u=r+s[1]-s[0];break;default:o=e-1,u=t}const d=(r-t)*.5,h=this.valueSize;this._weightPrev=d/(t-l),this._weightNext=d/(u-r),this._offsetPrev=a*h,this._offsetNext=o*h}interpolate_(e,t,r,s){const a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=e*l,d=u-l,h=this._offsetPrev,p=this._offsetNext,x=this._weightPrev,y=this._weightNext,v=(r-t)/(s-t),_=v*v,M=_*v,S=-x*M+2*x*_-x*v,A=(1+x)*M+(-1.5-2*x)*_+(-.5+x)*v+1,E=(-1-y)*M+(1.5+y)*_+.5*v,C=y*M-y*_;for(let I=0;I!==l;++I)a[I]=S*o[h+I]+A*o[d+I]+E*o[u+I]+C*o[p+I];return a}}class NR extends jp{constructor(e,t,r,s){super(e,t,r,s)}interpolate_(e,t,r,s){const a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=e*l,d=u-l,h=(r-t)/(s-t),p=1-h;for(let x=0;x!==l;++x)a[x]=o[d+x]*p+o[u+x]*h;return a}}class Z8 extends jp{constructor(e,t,r,s){super(e,t,r,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class e9 extends jp{interpolate_(e,t,r,s){const a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=e*l,d=u-l,h=this.inTangents,p=this.outTangents;if(!h||!p){const v=(r-t)/(s-t),_=1-v;for(let M=0;M!==l;++M)a[M]=o[d+M]*_+o[u+M]*v;return a}const x=l*2,y=e-1;for(let v=0;v!==l;++v){const _=o[d+v],M=o[u+v],S=y*x+v*2,A=p[S],E=p[S+1],C=e*x+v*2,I=h[C],D=h[C+1];let B=(r-t)/(s-t),P,G,k,V,U;for(let $=0;$<8;$++){P=B*B,G=P*B,k=1-B,V=k*k,U=V*k;const ee=U*t+3*V*B*A+3*k*P*I+G*s-r;if(Math.abs(ee)<1e-10)break;const z=3*V*(A-t)+6*k*B*(I-A)+3*P*(s-I);if(Math.abs(z)<1e-10)break;B=B-ee/z,B=Math.max(0,Math.min(1,B))}a[v]=U*_+3*V*B*E+3*k*P*D+G*M}return a}}class Xl{constructor(e,t,r,s){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=$m(t,this.TimeBufferType),this.values=$m(r,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);
vendor: 9,585 bytes, line 393
393else{r={name:e.name,times:$m(e.times,Array),values:$m(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(r.interpolation=s)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new Z8(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new NR(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new J8(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new e9(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case Lx:t=this.InterpolantFactoryMethodDiscrete;break;case Ox:t=this.InterpolantFactoryMethodLinear;break;case o_:t=this.InterpolantFactoryMethodSmooth;break;case PT:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return $t("KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Lx;case this.InterpolantFactoryMethodLinear:return Ox;case this.InterpolantFactoryMethodSmooth:return o_;case this.InterpolantFactoryMethodBezier:return PT}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let r=0,s=t.length;r!==s;++r)t[r]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let r=0,s=t.length;r!==s;++r)t[r]*=e}return this}trim(e,t){const r=this.times,s=r.length;let a=0,o=s-1;for(;a!==s&&r[a]<e;)++a;for(;o!==-1&&r[o]>t;)--o;if(++o,a!==0||o!==s){a>=o&&(o=Math.max(o,1),a=o-1);const l=this.getValueSize();this.times=r.slice(a,o),this.values=this.values.slice(a*l,o*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(fn("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,s=this.values,a=r.length;a===0&&(fn("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let l=0;l!==a;l++){const u=r[l];if(typeof u=="number"&&isNaN(u)){fn("KeyframeTrack: Time is not a valid number.",this,l,u),e=!1;break}if(o!==null&&o>u){fn("KeyframeTrack: Out of order keys.",this,l,u,o),e=!1;break}o=u}if(s!==void 0&&S8(s))for(let l=0,u=s.length;l!==u;++l){const d=s[l];if(isNaN(d)){fn("KeyframeTrack: Value is not a valid number.",this,l,d),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),s=this.getInterpolation()===o_,a=e.length-1;let o=1;for(let l=1;l<a;++l){let u=!1;const d=e[l],h=e[l+1];if(d!==h&&(l!==1||d!==e[0]))if(s)u=!0;else{const p=l*r,x=p-r,y=p+r;for(let v=0;v!==r;++v){const _=t[p+v];if(_!==t[x+v]||_!==t[y+v]){u=!0;break}}}if(u){if(l!==o){e[o]=e[l];const p=l*r,x=o*r;for(let y=0;y!==r;++y)t[x+y]=t[p+y]}++o}}if(a>0){e[o]=e[a];for(let l=a*r,u=o*r,d=0;d!==r;++d)t[u+d]=t[l+d];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=this.constructor,s=new r(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}Xl.prototype.ValueTypeName="";Xl.prototype.TimeBufferType=Float32Array;Xl.prototype.ValueBufferType=Float32Array;Xl.prototype.DefaultInterpolation=Ox;class Tp extends Xl{constructor(e,t,r){super(e,t,r)}}Tp.prototype.ValueTypeName="bool";Tp.prototype.ValueBufferType=Array;Tp.prototype.DefaultInterpolation=Lx;Tp.prototype.InterpolantFactoryMethodLinear=void 0;Tp.prototype.InterpolantFactoryMethodSmooth=void 0;class AR extends Xl{constructor(e,t,r,s){super(e,t,r,s)}}AR.prototype.ValueTypeName="color";class Wx extends Xl{constructor(e,t,r,s){super(e,t,r,s)}}Wx.prototype.ValueTypeName="number";class t9 extends jp{constructor(e,t,r,s){super(e,t,r,s)}interpolate_(e,t,r,s){const a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=(r-t)/(s-t);let d=e*l;for(let h=d+l;d!==h;d+=4)Oi.slerpFlat(a,0,o,d-l,o,d,u);return a}}class $x extends Xl{constructor(e,t,r,s){super(e,t,r,s)}InterpolantFactoryMethodLinear(e){return new t9(this.times,this.values,this.getValueSize(),e)}}$x.prototype.ValueTypeName="quaternion";$x.prototype.InterpolantFactoryMethodSmooth=void 0;class Rp extends Xl{constructor(e,t,r){super(e,t,r)}}Rp.prototype.ValueTypeName="string";Rp.prototype.ValueBufferType=Array;Rp.prototype.DefaultInterpolation=Lx;Rp.prototype.InterpolantFactoryMethodLinear=void 0;Rp.prototype.InterpolantFactoryMethodSmooth=void 0;class nv extends Xl{constructor(e,t,r,s){super(e,t,r,s)}}nv.prototype.ValueTypeName="vector";class Xx{constructor(e="",t=-1,r=[],s=TN){this.name=e,this.tracks=r,this.duration=t,this.blendMode=s,this.uuid=Zo(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,s=1/(e.fps||1);for(let o=0,l=r.length;o!==l;++o)t.push(kle(r[o]).scale(s));const a=new this(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a.userData=JSON.parse(e.userData||"{}"),a}static toJSON(e){const t=[],r=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let a=0,o=r.length;a!==o;++a)t.push(Xl.toJSON(r[a]));return s}static CreateFromMorphTargetSequence(e,t,r,s){const a=t.length,o=[];for(let l=0;l<a;l++){let u=[],d=[];u.push((l+a-1)%a,l,(l+1)%a),d.push(0,1,0);const h=Q8(u);u=OT(u,1,h),d=OT(d,1,h),!s&&u[0]===0&&(u.push(a),d.push(d[0])),o.push(new Wx(".morphTargetInfluences["+t[l].name+"]",u,d).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){const s=e;r=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<r.length;s++)if(r[s].name===t)return r[s];return null}static CreateClipsFromMorphTargetSequences(e,t,r){const s={},a=/^([\w-]*?)([\d]+)$/;for(let l=0,u=e.length;l<u;l++){const d=e[l],h=d.name.match(a);if(h&&h.length>1){const p=h[1];let x=s[p];x||(s[p]=x=[]),x.push(d)}}const o=[];for(const l in s)o.push(this.CreateFromMorphTargetSequence(l,s[l],t,r));return o}resetDuration(){const e=this.tracks;let t=0;for(let r=0,s=e.length;r!==s;++r){const a=this.tracks[r];t=Math.max(t,a.times[a.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let r=0;r<this.tracks.length;r++)e.push(this.tracks[r].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Dle(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wx;case"vector":case"vector2":case"vector3":case"vector4":return nv;case"color":return AR;case"quaternion":return $x;case"bool":case"boolean":return Tp;case"string":return Rp}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function kle(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Dle(n.type);if(n.times===void 0){const t=[],r=[];K8(n.keys,t,r,"value"),n.times=t,n.values=r}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const Eu={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(H5(n)||(this.files[n]=e))},get:function(n){if(this.enabled!==!1&&!H5(n))return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};function H5(n){try{const e=n.slice(n.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class CR{constructor(e,t,r){const s=this;let a=!1,o=0,l=0,u;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this._abortController=null,this.itemStart=function(h){l++,a===!1&&s.onStart!==void 0&&s.onStart(h,o,l),a=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,l),o===l&&(a=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return h=h.normalize("NFC"),u?u(h):h},this.setURLModifier=function(h){return u=h,this},this.addHandler=function(h,p){return d.push(h,p),this},this.removeHandler=function(h){const p=d.indexOf(h);return p!==-1&&d.splice(p,2),this},this.getHandler=function(h){for(let p=0,x=d.length;p<x;p+=2){const y=d[p],v=d[p+1];if(y.global&&(y.lastIndex=0),y.test(h))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const n9=new CR;class Ia{constructor(e){this.manager=e!==void 0?e:n9,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const r=this;return new Promise(function(s,a){r.load(e,s,t,a)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}
393Ia.DEFAULT_MATERIAL_NAME="__DEFAULT";const _d={};class Ile extends Error{constructor(e,t){super(e),this.response=t}}class rl extends Ia{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,r,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=Eu.get(`file:${e}`);if(a!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0);return}if(_d[e]!==void 0){_d[e].push({onLoad:t,onProgress:r,onError:s});return}_d[e]=[],_d[e].push({onLoad:t,onProgress:r,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),l=this.mimeType,u=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&$t("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const h=_d[e],p=d.body.getReader(),x=d.headers.get("X-File-Size")||d.headers.get("Content-Length"),y=x?parseInt(x):0,v=y!==0;let _=0;const M=new ReadableStream({start(S){A();function A(){p.read().then(({done:E,value:C})=>{if(E)S.close();else{_+=C.byteLength;const I=new ProgressEvent("progress",{lengthComputable:v,loaded:_,total:y});for(let D=0,B=h.length;D<B;D++){const P=h[D];P.onProgress&&P.onProgress(I)}S.enqueue(C),A()}},E=>{S.error(E)})}}});return new Response(M)}else throw new Ile(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`,d)}).then(d=>{switch(u){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(h=>new DOMParser().parseFromString(h,l));case"json":return d.json();default:if(l==="")return d.text();{const p=/charset="?([^;"\s]*)"?/i.exec(l),x=p&&p[1]?p[1].toLowerCase():void 0,y=new TextDecoder(x);return d.arrayBuffer().then(v=>y.decode(v))}}}).then(d=>{Eu.add(`file:${e}`,d);const h=_d[e];delete _d[e];for(let p=0,x=h.length;p<x;p++){const y=h[p];y.onLoad&&y.onLoad(d)}}).catch(d=>{const h=_d[e];if(h===void 0)throw this.manager.itemError(e),d;delete _d[e];for(let p=0,x=h.length;p<x;p++){const y=h[p];y.onError&&y.onError(d)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Ble extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=this,o=new rl(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(a.parse(JSON.parse(l)))}catch(u){s?s(u):fn(u),a.manager.itemError(e)}},r,s)}parse(e){const t=[];for(let r=0;r<e.length;r++){const s=Xx.parse(e[r]);t.push(s)}return t}}class Lle extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=this,o=[],l=new zN,u=new rl(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(a.withCredentials);let d=0;function h(p){u.load(e[p],function(x){const y=a.parse(x,!0);o[p]={width:y.width,height:y.height,format:y.format,mipmaps:y.mipmaps},d+=1,d===6&&(y.mipmapCount===1&&(l.minFilter=qr),l.image=o,l.format=y.format,l.needsUpdate=!0,t&&t(l))},r,s)}if(Array.isArray(e))for(let p=0,x=e.length;p<x;++p)h(p);else u.load(e,function(p){const x=a.parse(p,!0);if(x.isCubemap){const y=x.mipmaps.length/x.mipmapCount;for(let v=0;v<y;v++){o[v]={mipmaps:[]};for(let _=0;_<x.mipmapCount;_++)o[v].mipmaps.push(x.mipmaps[v*x.mipmapCount+_]),o[v].format=x.format,o[v].width=x.width,o[v].height=x.height}l.image=o}else l.image.width=x.width,l.image.height=x.height,l.mipmaps=x.mipmaps;x.mipmapCount===1&&(l.minFilter=qr),l.format=x.format,l.needsUpdate=!0,t&&t(l)},r,s);return l}}const Zg=new WeakMap;class rv extends Ia{constructor(e){super(e)}load(e,t,r,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,o=Eu.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)a.manager.itemStart(e),setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0);else{let p=Zg.get(o);p===void 0&&(p=[],Zg.set(o,p)),p.push({onLoad:t,onError:s})}return o}const l=Qy("img");function u(){h(),t&&t(this);const p=Zg.get(this)||[];for(let x=0;x<p.length;x++){const y=p[x];y.onLoad&&y.onLoad(this)}Zg.delete(this),a.manager.itemEnd(e)}function d(p){h(),s&&s(p),Eu.remove(`image:${e}`);const x=Zg.get(this)||[];for(let y=0;y<x.length;
393y++){const v=x[y];v.onError&&v.onError(p)}Zg.delete(this),a.manager.itemError(e),a.manager.itemEnd(e)}function h(){l.removeEventListener("load",u,!1),l.removeEventListener("error",d,!1)}return l.addEventListener("load",u,!1),l.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),Eu.add(`image:${e}`,l),a.manager.itemStart(e),l.src=e,l}}class Ole extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=new Cv;a.colorSpace=Ra;const o=new rv(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let l=0;function u(d){o.load(e[d],function(h){a.images[d]=h,l++,l===6&&(a.needsUpdate=!0,t&&t(a))},void 0,s)}for(let d=0;d<e.length;++d)u(d);return a}}class Fle extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=this,o=new Hl,l=new rl(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(a.withCredentials),l.load(e,function(u){let d;try{d=a.parse(u)}catch(h){s!==void 0?s(h):fn(h);return}a._applyTexData(o,d),t&&t(o,d)},r,s),o}createDataTexture(e){const t=new Hl;return this._applyTexData(t,this.parse(e)),t}_applyTexData(e,t){t.image!==void 0?e.image=t.image:t.data!==void 0&&(e.image.width=t.width,e.image.height=t.height,e.image.data=t.data),e.wrapS=t.wrapS!==void 0?t.wrapS:io,e.wrapT=t.wrapT!==void 0?t.wrapT:io,e.magFilter=t.magFilter!==void 0?t.magFilter:qr,e.minFilter=t.minFilter!==void 0?t.minFilter:qr,e.anisotropy=t.anisotropy!==void 0?t.anisotropy:1,t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.mipmaps!==void 0&&(e.mipmaps=t.mipmaps,e.minFilter=Fl),t.mipmapCount===1&&(e.minFilter=qr),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),e.needsUpdate=!0}}class r9 extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=new ms,o=new rv(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(l){a.image=l,a.needsUpdate=!0,t!==void 0&&t(a)},r,s),a}}class Rh extends vr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class s9 extends Rh{constructor(e,t,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(vr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const _E=new yn,V5=new we,W5=new we;class ER{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new wt(512,512),this.mapType=eo,this.map=null,this.mapPass=null,this.matrix=new yn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new pp,this._frameExtents=new wt(1,1),this._viewportCount=1,this._viewports=[new mr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;V5.setFromMatrixPosition(e.matrixWorld),t.position.copy(V5),W5.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(W5),t.updateMatrixWorld(),_E.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_E,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===mp||t.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(_E)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.n
vendor: 4,106 bytes, line 393
393ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const xS=new we,bS=new Oi,mu=new we;class rA extends vr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new yn,this.projectionMatrix=new yn,this.projectionMatrixInverse=new yn,this.coordinateSystem=Ko,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(xS,bS,mu),mu.x===1&&mu.y===1&&mu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(xS,bS,mu.set(1,1,1)).invert()}updateWorldMatrix(e,t,r=!1){super.updateWorldMatrix(e,t,r),this.matrixWorld.decompose(xS,bS,mu),mu.x===1&&mu.y===1&&mu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(xS,bS,mu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Wf=new we,$5=new wt,X5=new wt;class ti extends rA{constructor(e=50,t=1,r=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ux*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(np*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ux*2*Math.atan(Math.tan(np*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){Wf.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Wf.x,Wf.y).multiplyScalar(-e/Wf.z),Wf.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Wf.x,Wf.y).multiplyScalar(-e/Wf.z)}getViewSize(e,t){return this.getViewBounds(e,$5,X5),t.subVectors(X5,$5)}setViewOffset(e,t,r,s,a,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=s,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(np*.5*this.fov)/this.zoom,r=2*t,s=this.aspect*r,a=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const u=o.fullWidth,d=o.fullHeight;a+=o.offsetX*s/u,t-=o.offsetY*r/d,s*=o.width/u,r*=o.height/d}const l=this.filmOffset;l!==0&&(a+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+s,t,t-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}
vendor: 5,401 bytes, line 393
393class Ule extends ER{constructor(){super(new ti(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,r=Ux*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,a=e.distance||t.far;(r!==t.fov||s!==t.aspect||a!==t.far)&&(t.fov=r,t.aspect=s,t.far=a,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class jR extends Rh{constructor(e,t,r=0,s=Math.PI/3,a=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(vr.DEFAULT_UP),this.updateMatrix(),this.target=new vr,this.distance=r,this.angle=s,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new Ule}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class zle extends ER{constructor(){super(new ti(90,1,.5,500)),this.isPointLightShadow=!0}}class TR extends Rh{constructor(e,t,r=0,s=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=s,this.shadow=new zle}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Ru extends rA{constructor(e=-1,t=1,r=1,s=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=s,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,s,a,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=s,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let a=r-e,o=r+e,l=s+t,u=s-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=d*this.view.offsetX,o=a+d*this.view.width,l-=h*this.view.offsetY,u=l-h*this.view.height}this.projectionMatrix.makeOrthographic(a,o,l,u,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Gle extends ER{constructor(){super(new Ru(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class RR extends Rh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(vr.DEFAULT_UP),this.updateMatrix(),this.target=new vr,this.shadow=new Gle}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class i9 extends Rh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class a9 extends Rh{constructor(e,t,r=10,s=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class PR{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new we)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const r=e.x,s=e.y,a=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*s),t.addScaledVector(o[2],.488603*a),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*s)),t.addScaledVector(o[5],1.092548*(s*a)),t.addScaledVector(o[6],.315392*(3*a*a-1)),t.addScaledVector(o[7
vendor: 4,412 bytes, line 393
393],1.092548*(r*a)),t.addScaledVector(o[8],.546274*(r*r-s*s)),t}getIrradianceAt(e,t){const r=e.x,s=e.y,a=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*s),t.addScaledVector(o[2],2*.511664*a),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*s),t.addScaledVector(o[5],2*.429043*s*a),t.addScaledVector(o[6],.743125*a*a-.247708),t.addScaledVector(o[7],2*.429043*r*a),t.addScaledVector(o[8],.429043*(r*r-s*s)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const r=this.coefficients;for(let s=0;s<9;s++)r[s].fromArray(e,t+s*3);return this}toArray(e=[],t=0){const r=this.coefficients;for(let s=0;s<9;s++)r[s].toArray(e,t+s*3);return e}static getBasisAt(e,t){const r=e.x,s=e.y,a=e.z;t[0]=.282095,t[1]=.488603*s,t[2]=.488603*a,t[3]=.488603*r,t[4]=1.092548*r*s,t[5]=1.092548*s*a,t[6]=.315392*(3*a*a-1),t[7]=1.092548*r*a,t[8]=.546274*(r*r-s*s)}}class o9 extends Rh{constructor(e=new PR,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}const q5={};class sA extends Ia{constructor(e){super(e),this.textures={}}load(e,t,r,s){const a=this,o=new rl(a.manager);o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(l){try{t(a.parse(JSON.parse(l)))}catch(u){s?s(u):fn(u),a.manager.itemError(e)}},r,s)}parse(e){const t=this.createMaterialFromType(e.type);return t.fromJSON(e,this.textures),t}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return sA.createMaterialFromType(e)}static createMaterialFromType(e){const r={ShadowMaterial:G8,SpriteMaterial:dR,RawShaderMaterial:MR,ShaderMaterial:oo,PointsMaterial:UN,MeshPhysicalMaterial:$l,MeshStandardMaterial:Dv,MeshPhongMaterial:V8,MeshToonMaterial:W8,MeshNormalMaterial:$8,MeshLambertMaterial:X8,MeshDepthMaterial:tA,MeshDistanceMaterial:nA,MeshBasicMaterial:ko,MeshMatcapMaterial:q8,LineDashedMaterial:Y8,LineBasicMaterial:ka,Material:Ci,...q5}[e];let s;return r===void 0?(ah(`MaterialLoader: Unknown material type "${e}". Use .registerMaterial() before starting the deserialization process.`),s=new Ci):s=new r,s}static registerMaterial(e,t){q5[e]=t}}class oh{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class iA extends Bn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class l9 extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=this,o=new rl(a.manager);o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(l){try{t(a.parse(JSON.parse(l)))}catch(u){s?s(u):fn(u),a.manager.itemError(e)}},r,s)}parse(e){const t={},r={};function s(y,v){if(t[v]!==void 0)return t[v];const M=y.interleavedBuffers[v],S=a(y,M.buffer),A=bx(M.type,S),E=new Nv(A,M.stride);return E.uuid=M.uuid,t[v]=E,E}function a(y,v){if(r[v]!==void 0)return r[v];const M=y.arrayBuffers[v],S=new Uint32Array(M).buffer;return r[v]=S,S}const o=e.isInstancedBufferGeometry?new iA:new Bn,l=e.data.index;if(l!==void 0){const y=bx(l.type,l.array);o.setIndex(new Er(y,1))}const u=e.data.attributes;for(const y in u){const v=u[y];let _;if(v.isInterleavedBufferAttribute){const M=s(e.data,v.data);_=new Do(M,v.itemSize,v.offset,v.normalized)}else{const M=bx(v.type,v.array),S=v.isInstancedBufferAttribute?wh:Er;_=new S(M,v.itemSize,v.normalized)}
393v.name!==void 0&&(_.name=v.name),v.usage!==void 0&&_.setUsage(v.usage),o.setAttribute(y,_)}const d=e.data.morphAttributes;if(d)for(const y in d){const v=d[y],_=[];for(let M=0,S=v.length;M<S;M++){const A=v[M];let E;if(A.isInterleavedBufferAttribute){const C=s(e.data,A.data);E=new Do(C,A.itemSize,A.offset,A.normalized)}else{const C=bx(A.type,A.array);E=new Er(C,A.itemSize,A.normalized)}A.name!==void 0&&(E.name=A.name),_.push(E)}o.morphAttributes[y]=_}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(let y=0,v=p.length;y!==v;++y){const _=p[y];o.addGroup(_.start,_.count,_.materialIndex)}const x=e.data.boundingSphere;return x!==void 0&&(o.boundingSphere=new mi().fromJSON(x)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}const ME={};class Hle extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=this,o=this.path===""?oh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const l=new rl(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){let d=null;try{d=JSON.parse(u)}catch(p){s!==void 0&&s(p),fn("ObjectLoader: Can't parse "+e+".",p.message);return}const h=d.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){s!==void 0&&s(new Error("THREE.ObjectLoader: Can't load "+e)),fn("ObjectLoader: Can't load "+e);return}a.parse(d,t)},r,s)}async loadAsync(e,t){const r=this,s=this.path===""?oh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const a=new rl(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials);const o=await a.loadAsync(e,t);let l;try{l=JSON.parse(o)}catch(d){throw new Error("THREE.ObjectLoader: Can't parse "+e+". "+d.message)}const u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(l)}parse(e,t){const r=this.parseAnimations(e.animations),s=this.parseShapes(e.shapes),a=this.parseGeometries(e.geometries,s),o=this.parseImages(e.images,function(){t!==void 0&&t(d)}),l=this.parseTextures(e.textures,o),u=this.parseMaterials(e.materials,l),d=this.parseObject(e.object,a,u,l,r),h=this.parseSkeletons(e.skeletons,d);if(this.bindSkeletons(d,h),this.bindLightTargets(d),t!==void 0){let p=!1;for(const x in o)if(o[x].data instanceof HTMLImageElement){p=!0;break}p===!1&&t(d)}return d}async parseAsync(e){const t=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),a=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),u=this.parseObject(e.object,s,l,o,t),d=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,d),this.bindLightTargets(u),u}static registerGeometry(e,t){ME[e]=t}parseShapes(e){const t={};if(e!==void 0)for(let r=0,s=e.length;r<s;r++){const a=new Tv().fromJSON(e[r]);t[a.uuid]=a}return t}parseSkeletons(e,t){const r={},s={};if(t.traverse(function(a){a.isBone&&(s[a.uuid]=a)}),e!==void 0)for(let a=0,o=e.length;a<o;a++){const l=new Av().fromJSON(e[a],s);r[l.uuid]=l}return r}parseGeometries(e,t){const r={};if(e!==void 0){const s=new l9;for(let a=0,o=e.length;a<o;a++){let l;const u=e[a];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":l=s.parse(u);break;default:u.type in z5?l=z5[u.type].fromJSON(u,t):u.type in ME?l=ME[u.type].fromJSON(u,t):$t(`ObjectLoader: Unknown geometry type "${u.type}". Use .registerGeometry() before starting the deserialization process.`)}l.uuid=u.uuid,u.name!==void 0&&(l.name=u.name),u.userData!==void 0&&(l.userData=u.userData),r[u.uuid]=l}}return r}parseMaterials(e,t){const r={},s={};if(e!==void 0){const a=new sA;a.setTextures(t);for(let o=0,l=e.length;o<l;o++){const u=e[o];r[u.uuid]===void 0&&(r[u.uuid]=a.parse(u)),s[u.uuid]=r[u.uuid]}}return s}parseAnimations(e){const t={};if(e!==void 0)for(let r=0;r<e.length;r++){const s=e[r],a=Xx.parse(s);t[a.uuid]=a}return t}parseImages(e,t){const r=this,s={};let a;function o(u){return u=r.manager.resolveURL(u),r.manager.itemStart(u),a.load(u,function(){r.manager.itemEnd(u)},void 0,function(){r.manager.itemError(u),r.manager.itemEnd(u)})}function l(u){if(typeof u=="string"){const d=u,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:r.resourcePath+d;return o(h)}else return u.data?{data:bx(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new CR(t);a=new rv(u),a.setCrossOrigin(this.crossOrigin);for(let d=0,h=e.length;d<h;d++){const p=e[d],x=p.url;if(Array.isArray(x)){const y=[];for(let v=0,_=x.length;v<_;v++){const M=x[v],S=l(M);S!==null&&(S instanceof HTMLImageElement?y.push(S):y.push(new Hl(S.data,S.width,S.height)))}s[p.uuid]=new sh(y)}else{const y=l(p.url);s[p.uuid]=new sh(y)}}}return s}async parseImagesAsync(e){const t=this,r={};let s;
393async function a(o){if(typeof o=="string"){const l=o,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:t.resourcePath+l;return await s.loadAsync(u)}else return o.data?{data:bx(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){s=new rv(this.manager),s.setCrossOrigin(this.crossOrigin);for(let o=0,l=e.length;o<l;o++){const u=e[o],d=u.url;if(Array.isArray(d)){const h=[];for(let p=0,x=d.length;p<x;p++){const y=d[p],v=await a(y);v!==null&&(v instanceof HTMLImageElement?h.push(v):h.push(new Hl(v.data,v.width,v.height)))}r[u.uuid]=new sh(h)}else{const h=await a(u.url);r[u.uuid]=new sh(h)}}}return r}parseTextures(e,t){function r(a,o){return typeof a=="number"?a:($t("ObjectLoader.parseTexture: Constant should be in numeric form.",a),o[a])}const s={};if(e!==void 0)for(let a=0,o=e.length;a<o;a++){const l=e[a];l.image===void 0&&$t('ObjectLoader: No "image" specified for',l.uuid),t[l.image]===void 0&&$t("ObjectLoader: Undefined image",l.image);const u=t[l.image],d=u.data;let h;Array.isArray(d)?(h=new Cv,d.length===6&&(h.needsUpdate=!0)):(d&&d.data?h=new Hl:h=new ms,d&&(h.needsUpdate=!0)),h.source=u,h.uuid=l.uuid,l.name!==void 0&&(h.name=l.name),l.mapping!==void 0&&(h.mapping=r(l.mapping,Vle)),l.channel!==void 0&&(h.channel=l.channel),l.offset!==void 0&&h.offset.fromArray(l.offset),l.repeat!==void 0&&h.repeat.fromArray(l.repeat),l.center!==void 0&&h.center.fromArray(l.center),l.rotation!==void 0&&(h.rotation=l.rotation),l.wrap!==void 0&&(h.wrapS=r(l.wrap[0],Y5),h.wrapT=r(l.wrap[1],Y5)),l.format!==void 0&&(h.format=l.format),l.internalFormat!==void 0&&(h.internalFormat=l.internalFormat),l.type!==void 0&&(h.type=l.type),l.colorSpace!==void 0&&(h.colorSpace
vendor: 6,549 bytes, line 393
393=l.colorSpace),l.minFilter!==void 0&&(h.minFilter=r(l.minFilter,Q5)),l.magFilter!==void 0&&(h.magFilter=r(l.magFilter,Q5)),l.anisotropy!==void 0&&(h.anisotropy=l.anisotropy),l.flipY!==void 0&&(h.flipY=l.flipY),l.generateMipmaps!==void 0&&(h.generateMipmaps=l.generateMipmaps),l.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=l.premultiplyAlpha),l.unpackAlignment!==void 0&&(h.unpackAlignment=l.unpackAlignment),l.compareFunction!==void 0&&(h.compareFunction=l.compareFunction),l.normalized!==void 0&&(h.normalized=l.normalized),l.userData!==void 0&&(h.userData=l.userData),s[l.uuid]=h}return s}parseObject(e,t,r,s,a){let o;function l(x){return t[x]===void 0&&$t("ObjectLoader: Undefined geometry",x),t[x]}function u(x){if(x!==void 0){if(Array.isArray(x)){const y=[];for(let v=0,_=x.length;v<_;v++){const M=x[v];r[M]===void 0&&$t("ObjectLoader: Undefined material",M),y.push(r[M])}return y}return r[x]===void 0&&$t("ObjectLoader: Undefined material",x),r[x]}}function d(x){return s[x]===void 0&&$t("ObjectLoader: Undefined texture",x),s[x]}let h,p;switch(e.type){case"Scene":o=new lR,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Ut(e.background):o.background=d(e.background)),e.environment!==void 0&&(o.environment=d(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new LN(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new BN(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new ti(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Ru(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new i9(e.color,e.intensity);break;case"DirectionalLight":o=new RR(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new TR(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new a9(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new jR(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new s9(e.color,e.groundColor,e.intensity);break;case"LightProbe":const x=new PR().fromArray(e.sh);o=new o9(x,e.intensity);break;case"SkinnedMesh":h=l(e.geometry),p=u(e.material),o=new fR(h,p),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":h=l(e.geometry),p=u(e.material),o=new Ns(h,p);break;case"InstancedMesh":h=l(e.geometry),p=u(e.material);const y=e.count,v=e.instanceMatrix,_=e.instanceColor;o=new hR(h,p,y),o.instanceMatrix=new wh(new Float32Array(v.array),16),_!==void 0&&(o.instanceColor=new wh(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":h=l(e.geometry),p=u(e.material),o=new T8(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,p),o.geometry=h,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(M=>{let S=null,A=null;return M.boundingBox!==void 0&&(S=new hi().fromJSON(M.boundingBox)),M.boundingSphere!==void 0&&(A=new mi().fromJSON(M.boundingSphere)),{...M,boundingBox:S,boundingSphere:A}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=d(e.matricesTexture.uuid),o._indirectTexture=d(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=d(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new mi().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new hi().fromJSON(e.boundingBox));break;case"LOD":o=new j8;break;case"Line":o=new Vd(l(e.geometry),u(e.material));break;case"LineLoop":o=new mR(l(e.geometry),u(e.material));break;case"LineSegments":o=new Pc(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":o=new pR(l(e.geometry),u(e.material));break;case"Sprite":o=new E8(u(e.material));break;case"Group":o=new Dd;break;case"Bone":o=new ON;break;default:o=new vr}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.pivot!==void 0&&(o.pivot=new we().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(o.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(o.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.static!==void 0&&(o.static=e.static),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers
393),e.children!==void 0){const x=e.children;for(let y=0;y<x.length;y++)o.add(this.parseObject(x[y],t,r,s,a))}if(e.animations!==void 0){const x=e.animations;for(let y=0;y<x.length;y++){const v=x[y];o.animations.push(a[v])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const x=e.levels;for(let y=0;y<x.length;y++){const v=x[y],_=o.getObjectByProperty("uuid",v.object);_!==void 0&&o.addLevel(_,v.distance,v.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const s=t[r.skeleton];s===void 0?$t("ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(s,r.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const r=t.target,s=e.getObjectByProperty("uuid",r);s!==void 0?t.target=s:t.target=new vr}})}}const Vle={UVMapping:SN,CubeReflectionMapping:Lu,CubeRefractionMapping:xh,EquirectangularReflectionMapping:by,EquirectangularRefractionMapping:yy,CubeUVReflectionMapping:a0},Y5={RepeatWrapping:bh,ClampToEdgeWrapping:io,MirroredRepeatWrapping:kx},Q5={NearestFilter:ri,NearestMipmapNearestFilter:_N,NearestMipmapLinearFilter:Hm,LinearFilter:qr,LinearMipmapNearestFilter:_x,LinearMipmapLinearFilter:Fl},NE=new WeakMap;class c9 extends Ia{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&$t("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&$t("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,r,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,o=Eu.get(`image-bitmap:${e}`);if(o!==void 0){if(a.manager.itemStart(e),o.then){o.then(d=>{NE.has(o)===!0?(s&&s(NE.get(o)),a.manager.itemError(e),a.manager.itemEnd(e)):(t&&t(d),a.manager.itemEnd(e))});return}setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0);return}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,l.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const u=fetch(e,l).then(function(d){return d.blob()}).then(function(d){return createImageBitmap(d,Object.assign(a.options,{colorSpaceConversion:"none"}))}).then(function(d){Eu.add(`image-bitmap:${e}`,d),t&&t(d),a.manager.itemEnd(e)}).catch(function(d){s&&s(d),NE.set(u,d),Eu.remove(`image-bitmap:${e}`),a.manager.itemError(e),a.manager.itemEnd(e)});Eu.add(`image-bitmap:${e}`,u),a.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let yS;class DR{static getContext(){return yS===void 0&&(yS=new(window.AudioContext||window.webkitAudioContext)),yS}static setContext(e){yS=e}}class Wle extends Ia{constructor(e){super(e)}load(e,t,r,s){const a=this,o=new rl(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{const d=u.slice(0),h=DR.getContext(),p=e+"#decode";a.manager.itemStart(p),h.decodeAudioData(d,function(x){t(x),a.manager.itemEnd(p)}).catch(function(x){l(x),a.manager.itemEnd(p)})}catch(d){l(d)}},r,s);function l(u){s?s(u):fn(u),a.manager.itemError(e)}}}const K5=new yn,J5=new yn,wm=new yn;class $le{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ti,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ti,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,wm.copy(e.projectionMatrix);const s=t.eyeSep/2,a=s*t.near/t.focus,o=t.near*Math.tan(np*t.fov*.5)/t.zoom;let l,u;J5.elements[12]=-s,K5.elements[12]=s,l=-o*t.aspect+a,u=o*t.aspect+a,wm.elements[0]=2*t.near/(u-l),wm.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(wm),l=-o*t.aspect-a,u=o*t.aspect-a,wm.elements[0]=2*t.near/(u-l),wm.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(wm)}this.cameraL.matrix.copy(e.matrixWorld).multiply(J5),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(e.matrixWorld).multiply(K5),this.cameraR.matrixWorldNeedsUpdate=!0}}const ex=-90,tx=1;class u9 extends vr{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new ti(ex,tx,e,t);s.layers=this.layers,this.add(s);const a=new ti(ex,tx,e,t);a.layers=this.layers,this.add(a);const o=new ti(ex,tx,e,t);o.layers=this.layers,this.add(o);const l=new ti(ex,tx,e,t);l.layers=this.layers,this.add(l);const u=new ti(ex,tx,e,t);u.layers=this.layers,this.add(u);const d=new ti(ex,tx,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,s,a,o,l,u]=t;for(const d of t)this.remove(d);if(e===Ko)r.up.set(0,1,0),r.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===mp)r.up.set(0,-1,0),r.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,o,l,u,d,h]=this.children,p=e.getRenderTarget(),x=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let M=!1;e.isWebGLRenderer===!0?M=e.state.buffers.depth.getReversed():M=e.reversedDepthBuffer,e.setRenderTarget(r,0,s),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(r,1,s),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(r,2,s),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(r,3,s),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(r,4,s),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,s),M&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(p,x,y),e.xr.enabled=v,r.texture.needsPMREMUpdate=!0}}class d9 extends ti{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class f9{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Xle.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Xle(){this._document.hidden===!1&&this.reset()}const Sm=new we,AE=new Oi,qle=new we,_m=new we,Mm=new we;class Yle extends vr{constructor(){super(),this.type="AudioListener",this.context=DR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new f9}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update(
vendor: 4,319 bytes, line 393
393);const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Sm,AE,qle),_m.set(0,0,-1).applyQuaternion(AE),Mm.set(0,1,0).applyQuaternion(AE),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Sm.x,r),t.positionY.linearRampToValueAtTime(Sm.y,r),t.positionZ.linearRampToValueAtTime(Sm.z,r),t.forwardX.linearRampToValueAtTime(_m.x,r),t.forwardY.linearRampToValueAtTime(_m.y,r),t.forwardZ.linearRampToValueAtTime(_m.z,r),t.upX.linearRampToValueAtTime(Mm.x,r),t.upY.linearRampToValueAtTime(Mm.y,r),t.upZ.linearRampToValueAtTime(Mm.z,r)}else t.setPosition(Sm.x,Sm.y,Sm.z),t.setOrientation(_m.x,_m.y,_m.z,Mm.x,Mm.y,Mm.z)}}class h9 extends vr{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){$t("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){$t("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){$t("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){$t("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){$t("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}
vendor: 8,656 bytes, line 393
393getLoop(){return this.hasPlaybackControl===!1?($t("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){$t("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?($t("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Nm=new we,Z5=new Oi,Qle=new we,Am=new we;class Kle extends h9{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Nm,Z5,Qle),Am.set(0,0,1).applyQuaternion(Z5);const t=this.panner;if(t.positionX){const r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Nm.x,r),t.positionY.linearRampToValueAtTime(Nm.y,r),t.positionZ.linearRampToValueAtTime(Nm.z,r),t.orientationX.linearRampToValueAtTime(Am.x,r),t.orientationY.linearRampToValueAtTime(Am.y,r),t.orientationZ.linearRampToValueAtTime(Am.z,r)}else t.setPosition(Nm.x,Nm.y,Nm.z),t.setOrientation(Am.x,Am.y,Am.z)}}class Jle{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}}class m9{constructor(e,t,r){this.binding=e,this.valueSize=r;let s,a,o;switch(t){case"quaternion":s=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":s=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:s=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,s=this.valueSize,a=e*s+s;let o=this.cumulativeWeight;if(o===0){for(let l=0;l!==s;++l)r[a+l]=r[l];o=t}else{o+=t;const l=t/o;this._mixBufferRegion(r,a,0,l,s)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,s=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,s=e*t+t,a=this.cumulativeWeight,o=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,a<1){const u=t*this._origIndex;this._mixBufferRegion(r,s,u,1-a,t)}o>0&&this._mixBufferRegionAdditive(r,s,this._addIndex*t,1,t);for(let u=t,d=t+t;u!==d;++u)if(r[u]!==r[u+t]){l.setValue(r,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,s=r*this._origIndex;e.getValue(t,s);for(let a=r,o=s;a!==o;++a)t[a]=t[s+a%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,s,a){if(s>=.5)for(let o=0;o!==a;++o)e[t+o]=e[r+o]}_slerp(e,t,r,s){Oi.slerpFlat(e,t,e,t,e,r,s)}_slerpAdditive(e,t,r,s,a){const o=this._workIndex*a;Oi.multiplyQuaternionsFlat(e,o,e,t,e,r),Oi.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,r,s,a){const o=1-s;for(let l=0;l!==a;++l){const u=t+l;e[u]=e[u]*o+e[r+l]*s}}_lerpAdditive(e,t,r,s,a){for(let o=0;o!==a;++o){const l=t+o;e[l]=e[l]+e[r+o]*s}}}const kR="\\[\\]\\.:\\/",Zle=new RegExp("["+kR+"]","g"),IR="[^"+kR+"]",ece="[^"+kR.replace("\\.","")+"]",tce=/((?:WC+[\/:])*)/.source.replace("WC",IR),nce=/(WCOD+)?/.source.replace("WCOD",ece),rce=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",IR),sce=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",IR),ice=new RegExp("^"+tce+nce+rce+sce+"$"),ace=["material","materials","bones","map"];class oce{constructor(e,t,r){const s=r||_r.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,s=this._bindings[r];s!==void 0&&s.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let s=this._targetGroup.nCachedObjects_,a=r.length;s!==a;++s)r[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class _r{constructor(e,t,r){this.path=t,this.parsedPath=r||_r.parseTrackName(t),this.node=_r.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new _r.Composite(e,t,r):new _r(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Zle,"")}static parseTrackName(e){const t=ice.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=r.nodeName&&r.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const a=r.nodeName.substring(s+1);ace.indexOf(a)!==-1&&(r.nodeName=r.nodeName.substring(0,s),r.objectName=a)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(a){for(let o=0;o<a.length;o++){const l=a[o];if(l.name===t||l.uuid===t)return l;const u=r(l.children);if(u)return u}return null},s=r(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const r=this.resolvedProperty;for(let s=0,a=r.length;s!==a;++s)e[t++]=r[s]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const r=this.resolvedProperty;for(let s=0,a=r.length;s!==a;++s)r[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const r=this.resolvedProperty;for(let s=0,a=r.length;s!==a;++s)r[s]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 4,166 bytes, line 393
393_setValue_array_setMatrixWorldNeedsUpdate(e,t){const r=this.resolvedProperty;for(let s=0,a=r.length;s!==a;++s)r[s]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,r=t.objectName,s=t.propertyName;let a=t.propertyIndex;if(e||(e=_r.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){$t("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let d=t.objectIndex;switch(r){case"materials":if(!e.material){fn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){fn("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){fn("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===d){d=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){fn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){fn("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){fn("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(d!==void 0){if(e[d]===void 0){fn("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[d]}}const o=e[s];if(o===void 0){const d=t.nodeName;fn("PropertyBinding: Trying to update property for track: "+d+"."+s+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?l=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(a!==void 0){if(s==="morphTargetInfluences"){if(!e.geometry){fn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){fn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[a]!==void 0&&(a=e.morphTargetDictionary[a])}u=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(u=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=s;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}_r.Composite=oce;_r.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};_r.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};_r.prototype.GetterByBindingType=[_r.prototype._getValue_direct,_r.prototype._getValue_array,_r.prototype._getValue_arrayElement,_r.prototype._getValue_toArray];_r.prototype.SetterByBindingTypeAndVersioning=[[_r.prototype._setValue_direct,_r.prototype._setValue_direct_setNeedsUpdate,_r.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[_r.prototype._setValue_array,_r.prototype._setValue_array_setNeedsUpdate,_r.prototype._setValue_array_setMatr
vendor: 4,385 bytes, line 393
393ixWorldNeedsUpdate],[_r.prototype._setValue_arrayElement,_r.prototype._setValue_arrayElement_setNeedsUpdate,_r.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[_r.prototype._setValue_fromArray,_r.prototype._setValue_fromArray_setNeedsUpdate,_r.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class lce{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Zo(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,s=arguments.length;r!==s;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length;let l,u=e.length,d=this.nCachedObjects_;for(let h=0,p=arguments.length;h!==p;++h){const x=arguments[h],y=x.uuid;let v=t[y];if(v===void 0){v=u++,t[y]=v,e.push(x);for(let _=0,M=o;_!==M;++_)a[_].push(new _r(x,r[_],s[_]))}else if(v<d){l=e[v];const _=--d,M=e[_];t[M.uuid]=v,e[v]=M,t[y]=_,e[_]=x;for(let S=0,A=o;S!==A;++S){const E=a[S],C=E[_];let I=E[v];E[v]=C,I===void 0&&(I=new _r(x,r[S],s[S])),E[_]=I}}else e[v]!==l&&fn("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=d}remove(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,s=r.length;let a=this.nCachedObjects_;for(let o=0,l=arguments.length;o!==l;++o){const u=arguments[o],d=u.uuid,h=t[d];if(h!==void 0&&h>=a){const p=a++,x=e[p];t[x.uuid]=h,e[h]=x,t[d]=p,e[p]=u;for(let y=0,v=s;y!==v;++y){const _=r[y],M=_[p],S=_[h];_[h]=M,_[p]=S}}}this.nCachedObjects_=a}uncache(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,s=r.length;let a=this.nCachedObjects_,o=e.length;for(let l=0,u=arguments.length;l!==u;++l){const d=arguments[l],h=d.uuid,p=t[h];if(p!==void 0)if(delete t[h],p<a){const x=--a,y=e[x],v=--o,_=e[v];t[y.uuid]=p,e[p]=y,t[_.uuid]=x,e[x]=_,e.pop();for(let M=0,S=s;M!==S;++M){const A=r[M],E=A[x],C=A[v];A[p]=E,A[x]=C,A.pop()}}else{const x=--o,y=e[x];x>0&&(t[y.uuid]=p),e[p]=y,e.pop();for(let v=0,_=s;v!==_;++v){const M=r[v];M[p]=M[x],M.pop()}}}this.nCachedObjects_=a}subscribe_(e,t){const r=this._bindingsIndicesByPath;let s=r[e];const a=this._bindings;if(s!==void 0)return a[s];const o=this._paths,l=this._parsedPaths,u=this._objects,d=u.length,h=this.nCachedObjects_,p=new Array(d);s=a.length,r[e]=s,o.push(e),l.push(t),a.push(p);for(let x=h,y=u.length;x!==y;++x){const v=u[x];p[x]=new _r(v,e,t)}return p}unsubscribe_(e){const t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){const s=this._paths,a=this._parsedPaths,o=this._bindings,l=o.length-1,u=o[l],d=e[l];t[d]=r,o[r]=u,o.pop(),a[r]=a[l],a.pop(),s[r]=s[l],s.pop()}}}class p9{constructor(e,t,r=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=s;const a=t.tracks,o=a.length,l=new Array(o),u={endingStart:Vm,endingEnd:Vm};for(let d=0;d!==o;++d){const h=a[d].createInterpolant(null);l[d]=h,h.settings=u}this._interpolantSettings=u,this._interpolants=l,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=null,this._weightInterpolant=null,this.loop=u8,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}
vendor: 6,153 bytes, line 393
393fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r=!1){if(e.fadeOut(t),this.fadeIn(t),r===!0){const s=this._clip.duration,a=e._clip.duration,o=a/s,l=s/a;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,o,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,r=!1){return e.crossFadeFrom(this,t,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){const s=this._mixer,a=s.time,o=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=s._lendControlInterpolant(),this._timeScaleInterpolant=l);const u=l.parameterPositions,d=l.sampleValues;return u[0]=a,u[1]=a+r,d[0]=e/o,d[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,s){if(!this.enabled){this._updateWeight(e);return}const a=this._startTime;if(a!==null){const u=(e-a)*r;u<0||r===0?t=0:(this._startTime=null,t=r*u)}t*=this._updateTimeScale(e);const o=this._updateTime(t),l=this._updateWeight(e);if(l>0){const u=this._interpolants,d=this._propertyBindings;switch(this.blendMode){case sR:for(let h=0,p=u.length;h!==p;++h)u[h].evaluate(o),d[h].accumulateAdditive(l);break;case TN:default:for(let h=0,p=u.length;h!==p;++h)u[h].evaluate(o),d[h].accumulate(s,l)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const s=r.evaluate(e)[0];t*=s,e>r.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const s=r.evaluate(e)[0];t*=s,e>r.parameterPositions[1]&&(t===0?this.paused=!0:(this._restoreTimeScale!==null&&(t=this._restoreTimeScale),this.timeScale=t),this.stopWarping())}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let s=this.time+e,a=this._loopCount;const o=r===d8;if(e===0)return a===-1?s:o&&(a&1)===1?t-s:s;if(r===c8){a===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(a===-1&&(e>=0?(a=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const l=Math.floor(s/t);s-=t*l,a+=Math.abs(l);const u=this.repetitions-a;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const d=e<0;this._setEndings(d,!d,o)}else this._setEndings(!1,!1,o);this._loopCount=a,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this._loopCount=a,this.time=s;if(o&&(a&1)===1)return t-s}return s}_setEndings(e,t,r){const s=this._interpolantSettings;r?(s.endingStart=Wm,s.endingEnd=Wm):(e?s.endingStart=this.zeroSlopeAtStart?Wm:Vm:s.endingStart=Xy,t?s.endingEnd=this.zeroSlopeAtEnd?Wm:Vm:s.endingEnd=Xy)}_scheduleFading(e,t,r){const s=this._mixer,a=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const l=o.parameterPositions,u=o.sampleValues;return l[0]=a,u[0]=t,l[1]=a+e,u[1]=r,this}}const cce=new Float32Array(1);class uce extends Rc{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const r=e._localRoot||this._root,s=e._clip.tracks,a=s.length,o=e._propertyBindings,l=e._interpolants,u=r.uuid,d=this._bindingsByRootAndName;let h=d[u];h===void 0&&(h={},d[u]=h);for(let p=0;p!==a;++p){const x=s[p],y=x.name;let v=h[y];if(v!==void 0)++v.referenceCount,o[p]=v;else{if(v=o[p],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,u,y));continue}const _=t&&t._propertyBindings[p].binding.parsedPath;v=new m9(_r.create(r,y,_),x.ValueTypeName,x.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,u,y),o[p]=v}l[p].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,s=e._clip.uuid,a=this._actionsByClip[s];this._bindAction(e,a&&a.knownActions[0]),this._addInactiveAction(e,s,r)}const t=e._propertyBindings;for(let r=0,s=t.length;r!==s;++r){const a=t[r];a.useCount++===0&&(this._lendBinding(a),a.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,s=t.length;r!==s;++r){const a=t[r];--a.useCount===0&&(a.restoreOriginalState(),this._takeBackBinding(a))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){const s=this._actions,a=this._actionsByClip;let o=a[t];
vendor: 5,040 bytes, line 393
393if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,a[t]=o;else{const l=o.knownActions;e._byClipCacheIndex=l.length,l.push(e)}e._cacheIndex=s.length,s.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){const t=this._actions,r=t[t.length-1],s=e._cacheIndex;r._cacheIndex=s,t[s]=r,t.pop(),e._cacheIndex=null;const a=e._clip.uuid,o=this._actionsByClip,l=o[a],u=l.knownActions,d=u[u.length-1],h=e._byClipCacheIndex;d._byClipCacheIndex=h,u[h]=d,u.pop(),e._byClipCacheIndex=null;const p=l.actionByRoot,x=(e._localRoot||this._root).uuid;delete p[x],u.length===0&&delete o[a],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let r=0,s=t.length;r!==s;++r){const a=t[r];--a.referenceCount===0&&this._removeInactiveBinding(a)}}_lendAction(e){const t=this._actions,r=e._cacheIndex,s=this._nActiveActions++,a=t[s];e._cacheIndex=s,t[s]=e,a._cacheIndex=r,t[r]=a}_takeBackAction(e){const t=this._actions,r=e._cacheIndex,s=--this._nActiveActions,a=t[s];e._cacheIndex=s,t[s]=e,a._cacheIndex=r,t[r]=a}_addInactiveBinding(e,t,r){const s=this._bindingsByRootAndName,a=this._bindings;let o=s[t];o===void 0&&(o={},s[t]=o),o[r]=e,e._cacheIndex=a.length,a.push(e)}_removeInactiveBinding(e){const t=this._bindings,r=e.binding,s=r.rootNode.uuid,a=r.path,o=this._bindingsByRootAndName,l=o[s],u=t[t.length-1],d=e._cacheIndex;u._cacheIndex=d,t[d]=u,t.pop(),delete l[a],Object.keys(l).length===0&&delete o[s]}_lendBinding(e){const t=this._bindings,r=e._cacheIndex,s=this._nActiveBindings++,a=t[s];e._cacheIndex=s,t[s]=e,a._cacheIndex=r,t[r]=a}_takeBackBinding(e){const t=this._bindings,r=e._cacheIndex,s=--this._nActiveBindings,a=t[s];e._cacheIndex=s,t[s]=e,a._cacheIndex=r,t[r]=a}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let r=e[t];return r===void 0&&(r=new NR(new Float32Array(2),new Float32Array(2),1,cce),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){const t=this._controlInterpolants,r=e.__cacheIndex,s=--this._nActiveControlInterpolants,a=t[s];e.__cacheIndex=s,t[s]=e,a.__cacheIndex=r,t[r]=a}clipAction(e,t,r){const s=t||this._root,a=s.uuid;let o=typeof e=="string"?Xx.findByName(s,e):e;const l=o!==null?o.uuid:e,u=this._actionsByClip[l];let d=null;if(r===void 0&&(o!==null?r=o.blendMode:r=TN),u!==void 0){const p=u.actionByRoot[a];if(p!==void 0&&p.blendMode===r)return p;d=u.knownActions[0],o===null&&(o=d._clip)}if(o===null)return null;const h=new p9(this,o,t,r);return this._bindAction(h,d),this._addInactiveAction(h,l,a),h}existingAction(e,t){const r=t||this._root,s=r.uuid,a=typeof e=="string"?Xx.findByName(r,e):e,o=a?a.uuid:e,l=this._actionsByClip[o];return l!==void 0&&l.actionByRoot[s]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,s=this.time+=e,a=Math.sign(e),o=this._accuIndex^=1;for(let d=0;d!==r;++d)t[d]._update(s,e,a,o);const l=this._bindings,u=this._nActiveBindings;for(let d=0;d!==u;++d)l[d].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,r=e.uuid,s=this._actionsByClip,a=s[r];if(a!==void 0){const o=a.knownActions;for(let l=0,u=o.length;l!==u;++l){const d=o[l];this._deactivateAction(d);const h=d._cacheIndex,p=t[t.length-1];d._cacheIndex=null,d._byClipCacheIndex=null,p._cacheIndex=h,t[h]=p,t.pop(),this._removeInactiveBindingsForAction(d)}delete s[r]}}uncacheRoot(e){const t=e.uuid,r=this._actionsByClip;for(const o in r){const l=r[o].actionByRoot,u=l[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const s=this._bindingsByRootAndName,a=s[t];if(a!==void 0)for(const o in a){const l=a[o];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(e,t){const r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class dce extends oR{constructor(e=1,t=1,r=1,s={}){super(e,t,s),this.isRenderTarget3D=!0,this.depth=r,this.texture=new IN(null,e,t,r),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class aA{constructor(e){this.value=e}clone(){return new aA(this.value.clone===void 0?this.value:this.value.clone())}}let fce=0;class hce extends Rc{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:fce++}),this.name="",this.usage=Yy,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let r=0,s=t.length;r<s;r++){const a=Array.isArray(t[r])?t[r]:[t[r]];for(let o=0;o<a.length;o++)this.uniforms.push(a[o].clone())}return this}clone(){return new this.constructor().copy(this)}}
vendor: 6,633 bytes, line 393
393class AM extends Nv{constructor(e,t,r=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class mce{constructor(e,t,r,s,a,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=s,this.count=a,this.normalized=o,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const e4=new yn;class g9{constructor(e,t,r=0,s=1/0){this.ray=new Cp(e,t),this.near=r,this.far=s,this.camera=null,this.layers=new zx,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):fn("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return e4.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(e4),this}intersectObject(e,t=!0,r=[]){return FT(e,this,r,t),r.sort(t4),r}intersectObjects(e,t=!0,r=[]){for(let s=0,a=e.length;s<a;s++)FT(e[s],this,r,t);return r.sort(t4),r}}function t4(n,e){return n.distance-e.distance}function FT(n,e,t,r){let s=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(s=!1),s===!0&&r===!0){const a=n.children;for(let o=0,l=a.length;o<l;o++)FT(a[o],e,t,!0)}}class x9{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,$t("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class UT{constructor(e=1,t=0,r=0){this.radius=e,this.phi=t,this.theta=r}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Pn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Pn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class pce{constructor(e=1,t=0,r=0){this.radius=e,this.theta=t,this.y=r}set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return new this.constructor().copy(this)}}const eP=class eP{constructor(e,t,r,s){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,r,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let r=0;r<4;r++)this.elements[r]=e[r+t];return this}set(e,t,r,s){const a=this.elements;return a[0]=e,a[2]=t,a[1]=r,a[3]=s,this}};eP.prototype.isMatrix2=!0;let zT=eP;const n4=new wt;class b9{constructor(e=new wt(1/0,1/0),t=new wt(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const r=n4.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,n4).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const r4=new we,vS=new we,nx=new we,rx=new we,CE=new we,gce=new we,xce=new we;class y9{constructor(e=new we,t=new we){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){r4.subVectors(e,this.start),vS.subVectors(this.end,this.start);const r=vS.dot(vS);if(r===0)return 0;let a=vS.dot(r4)/r;return t&&(a=Pn(a,0,1)),a}closestPointToPoint(e,t,r){const s=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(s).add(this.start)}
393distanceSqToLine3(e,t=gce,r=xce){const s=10000000000000001e-32;let a,o;const l=this.start,u=e.start,d=this.end,h=e.end;nx.subVectors(d,l),rx.subVectors(h,u),CE.subVectors(l,u);const p=nx.dot(nx),x=rx.dot(rx),y=rx.dot(CE);if(p<=s&&x<=s)return t.copy(l),r.copy(u),t.sub(r),t.dot(t);if(p<=s)a=0,o=y/x,o=Pn(o,0,1);else{const v=nx.dot(CE);if(x<=s)o=0,a=Pn(-v/p,0,1);else{const _=nx.dot(rx),M=p*x-_*_;M!==0?a=Pn((_*y-v*x)/M,0,1):a=0,o=(_*a+y)/x,o<0?(o=0,a=Pn(-v/p,0,1)):o>1&&(o=1,a=Pn((_-v)/p,0,1))}}return t.copy(l).addScaledVector(nx,a),r.copy(u).addScaledVector(rx,o),t.distanceToSquared(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const s4=new we;class bce extends vr{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new Bn,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,l=1,u=32;o<u;o++,l++){const d=o/u*Math.PI*2,h=l/u*Math.PI*2;s.push(Math.cos(d),Math.sin(d),1,Math.cos(h),Math.sin(h),1)}r.setAttribute("position",new tn(s,3));const a=new ka({fog:!1,toneMapped:!1});this.cone=new Pc(r,a),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorldNeedsUpdate=!0;const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),s4.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(s4),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const $f=new we,wS=new yn,EE=new yn;class yce extends Pc{constructor(e){const t=v9(e),r=new Bn,s=[],a=[];for(let d=0;d<t.length;d++){const h=t[d];h.parent&&h.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),a.push(0,0,0),a.push(0,0,0))}r.setAttribute("position",new tn(s,3)),r.setAttribute("color",new tn(a,3));const o=new ka({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const l=new Ut(255),u=new Ut(65280);this.setColors(l,u)}updateMatrixWorld(e){const t=this.bones,r=this.geometry,s=r.getAttribute("position");EE.copy(this.root.matrixWorld).invert();for(let a=0,o=0;a<t.length;a++){const l=t[a];l.parent&&l.parent.isBone&&(wS.multiplyMatrices(EE,l.matrixWorld),$f.setFromMatrixPosition(wS),s.setXYZ(o,$f.x,$f.y,$f.z),wS.multiplyMatrices(EE,l.parent.matrixWorld),$f.setFromMatrixPosition(wS),s.setXYZ(o+1,$f.x,$f.y,$f.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const s=this.geometry.getAttribute("color");for(let a=0;a<s.count;a+=2)s.setXYZ(a,e.r,e.g,e.b),s.setXYZ(a+1,t.r,t.g,t.b);return s.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function v9(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push(...v9(n.children[t]));return e}class vce extends Ns{constructor(e,t,r){const s=new Pv(t,4,2),a=new ko({wireframe:!0,fog:!1,toneMapped:!1});super(s,a),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const wce=new we,i4=new Ut,a4=new Ut;class Sce extends vr{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const s=new Rv(t);s.rotateY(Math.PI*.5),this.material=new ko({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const a=s.getAttribute("position"),o=new Float32Array(a.count*3);s.setAttribute("color",new Er(o,3)),this.add(new Ns(s,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");i4.copy(this.light.color),a4.copy(this.light.groundColor);for(let r=0,s=t.count;r<s;r++){const a=r<s/2?i4:a4;t.setXYZ(r,a.r,a.g,a.b)}t.needsUpdate=!0}this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),e.lookAt(wce.setFromMatrixPosition(this.light.matrixWorld).negate())}}class _ce extends Pc{constructor(e=10,t=10,r=4473924,s=8947848){r=new Ut(r),s=new Ut(s);const a=t/2,o=e/t,l=e/2,u=[],d=[];for(let x=0,y=0,v=-l;x<=t;x++,v+=o){u.push(-l,0,v,l,0,v),u.push(v,0,-l,v,0,l);const _=x===a?r:s;_.toArray(d,y),y+=3,_.toArray(d,y),y+=3,_.toArray(d,y),y+=3,_.toArray(d,y),y+=3}const h=new Bn;h.setAttribute("position",new tn(u,3)),h.setAttribute("color",new tn(d,3));const p=new ka({vertexColors:!0,toneMapped:!1});super(h,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Mce extends Pc{constructor(e=10,t=16,r=8,s=64,a=4473924,o=8947848){a=new Ut(a),o=new Ut(o);const l=[],u=[];
vendor: 4,485 bytes, line 393
393if(t>1)for(let p=0;p<t;p++){const x=p/t*(Math.PI*2),y=Math.sin(x)*e,v=Math.cos(x)*e;l.push(0,0,0),l.push(y,0,v);const _=p&1?a:o;u.push(_.r,_.g,_.b),u.push(_.r,_.g,_.b)}for(let p=0;p<r;p++){const x=p&1?a:o,y=e-e/r*p;for(let v=0;v<s;v++){let _=v/s*(Math.PI*2),M=Math.sin(_)*y,S=Math.cos(_)*y;l.push(M,0,S),u.push(x.r,x.g,x.b),_=(v+1)/s*(Math.PI*2),M=Math.sin(_)*y,S=Math.cos(_)*y,l.push(M,0,S),u.push(x.r,x.g,x.b)}}const d=new Bn;d.setAttribute("position",new tn(l,3)),d.setAttribute("color",new tn(u,3));const h=new ka({vertexColors:!0,toneMapped:!1});super(d,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const o4=new we,SS=new we,l4=new we;class Nce extends vr{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",t===void 0&&(t=1);let s=new Bn;s.setAttribute("position",new tn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const a=new ka({fog:!1,toneMapped:!1});this.lightPlane=new Vd(s,a),this.add(this.lightPlane),s=new Bn,s.setAttribute("position",new tn([0,0,0,0,0,1],3)),this.targetLine=new Vd(s,a),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),o4.setFromMatrixPosition(this.light.matrixWorld),SS.setFromMatrixPosition(this.light.target.matrixWorld),l4.subVectors(SS,o4),this.lightPlane.lookAt(SS),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(SS),this.targetLine.scale.z=l4.length()}}const _S=new we,Qs=new rA;class Ace extends Pc{constructor(e){const t=new Bn,r=new ka({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],a=[],o={};l("n1","n2"),l("n2","n4"),l("n4","n3"),l("n3","n1"),l("f1","f2"),l("f2","f4"),l("f4","f3"),l("f3","f1"),l("n1","f1"),l("n2","f2"),l("n3","f3"),l("n4","f4"),l("p","n1"),l("p","n2"),l("p","n3"),l("p","n4"),l("u1","u2"),l("u2","u3"),l("u3","u1"),l("c","t"),l("p","c"),l("cn1","cn2"),l("cn3","cn4"),l("cf1","cf2"),l("cf3","cf4");function l(v,_){u(v),u(_)}function u(v){s.push(0,0,0),a.push(0,0,0),o[v]===void 0&&(o[v]=[]),o[v].push(s.length/3-1)}t.setAttribute("position",new tn(s,3)),t.setAttribute("color",new tn(a,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const d=new Ut(16755200),h=new Ut(16711680),p=new Ut(43775),x=new Ut(16777215),y=new Ut(3355443);this.setColors(d,h,p,x,y)}setColors(e,t,r,s,a){const l=this.geometry.getAttribute("color");return l.setXYZ(0,e.r,e.g,e.b),l.setXYZ(1,e.r,e.g,e.b),l.setXYZ(2,e.r,e.g,e.b),l.setXYZ(3,e.r,e.g,e.b),l.setXYZ(4,e.r,e.g,e.b),l.setXYZ(5,e.r,e.g,e.b),l.setXYZ(6,e.r,e.g,e.b),l.setXYZ(7,e.r,e.g,e.b),l.setXYZ(8,e.r,e.g,e.b),l.setXYZ(9,e.r,e.g,e.b),l.setXYZ(10,e.r,e.g,e.b),l.setXYZ(11,e.r,e.g,e.b),l.setXYZ(12,e.r,e.g,e.b),l.setXYZ(13,e.r,e.g,e.b),l.setXYZ(14,e.r,e.g,e.b),l.setXYZ(15,e.r,e.g,e.b),l.setXYZ(16,e.r,e.g,e.b),l.setXYZ(17,e.r,e.g,e.b),l.setXYZ(18,e.r,e.g,e.b),l.setXYZ(19,e.r,e.g,e.b),l.setXYZ(20,e.r,e.g,e.b),l.setXYZ(21,e.r,e.g,e.b),l.setXYZ(22,e.r,e.g,e.b),l.setXYZ(23,e.r,e.g,e.b),l.setXYZ(24,t.r,t.g,t.b),l.setXYZ(25,t.r,t.g,t.b),l.setXYZ(26,t.r,t.g,t.b),l.setXYZ(27,t.r,t.g,t.b),l.setXYZ(28,t.r,t.g,t.b),l.setXYZ(29,t.r,t.g,t.b),l.setXYZ(30,t.r,t.g,t.b),l.setXYZ(31,t.r,t.g,t.b),l.setXYZ(32,r.r,r.g,r.b),l.setXYZ(33,r.r,r.g,r.b),l.setXYZ(34,r.r,r.g,r.b),l.setXYZ(35,r.r,r.g,r.b),l.setXYZ(36,r.r,r.g,r.b),l.setXYZ(37,r.r,r.g,r.b),l.setXYZ(38,s.r,s.g,s.b),l.setXYZ(39,s.r,s.g,s.b),l.setXYZ(40,a.r,a.g,a.b),l.setXYZ(41,a.r,a.g,a.b),l.setXYZ(42,a.r,a.g,a.b),l.setXYZ(43,a.r,a.g,a.b),l.setXYZ(44,a.r,a.g,a.b),l.setXYZ(45,a.r,a.g,a.b),l.setXYZ(46,a.r,a.g,a.b),l.setXYZ(47,a.r,a.g,a.b),l.setXYZ(48,a.r,a.g,a.b),l.setXYZ(49,a.r,a.g,a.b),l.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,r=1,s=1;let a,o;if(Qs.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)a=1,o=0;else if(this.camera.coordinateSystem===Ko)a=-1,o=1;else if(this.camera.coordinateSystem===mp)a=0,o=1;
393else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);di("c",t,e,Qs,0,0,a),di("t",t,e,Qs,0,0,o),di("n1",t,e,Qs,-r,-s,a),di("n2",t,e,Qs,r,-s,a),di("n3",t,e,Qs,-r,s,a),di("n4",t,e,Qs,r,s,a),di("f1",t,e,Qs,-r,-s,o),di("f2",t,e,Qs,r,-s,o),di("f3",t,e,Qs,-r,s,o),di("f4",t,e,Qs,r,s,o),di("u1",t,e,Qs,r*.7,s*1.1,a),di("u2",t,e,Qs,-r*.7,s*1.1,a),di("u3",t,e,Qs,0,s*2,a),di("cf1",t,e,Qs,-r,0,o),di("cf2",t,e,Qs,r,0,o),di("cf3",t,e,Qs,0,-s,o),di("cf4",t,e,Qs,0,s,o),di("cn1",t,e,Qs,-r,0,a),di("cn2",t,e,Qs,r,0,a),di("cn3",t,e,Qs,0,-s,a),di("cn4",t,e,Qs,0,s,a),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function di(n,e,t,r,s,a,o){_S.set(s,a,o).unproject(r);const l=e[n];if(l!==void 0){const u=t.getAttribute("position");for(let d=0,h=l.length;d<h;d++)u.setXYZ(l[d],_S.x,_S.y,_S.z)}}const MS=new hi;class Cce extends Pc{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),a=new Bn;a.setIndex(new Er(r,1)),a.setAttribute("position",new Er(s,3)),super(a,new ka({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&MS.setFromObject(this.object),MS.isEmpty())return;const e=MS.min,t=MS.max,r=this.geometry.attributes.position,s=r.array;s[0]=t.x,s[1]=t.y,s[2]=t.z,s[3]=e.x,s[4]=t.y,s[5]=t.z,s[6]=e.x,s[7]=e.y,s[8]=t.z,s[9]=t.x,s[10]=e.y,s[11]=t.z,s[12]=t.x,s[13]=t.y,s[14]=e.z,s[15]=e.x,s[16]=t.y,s[17]=e.z,s[18]=e.x,s[19]=e.y,s[20]=e.z,s[21]=t.x,s[22]=e.y,s[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ece extends Pc{constructor(e,t=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],a=new Bn;a.setIndex(new Er(r,1)),a.setAttribute("position",new tn(s,3)),super(a,new ka({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class jce extends Vd{constructor(e,t=1,r=16776960){const s=r,a=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Bn;o.setAttribute("position",new tn(a,3)),o.computeBoundingSphere(),super(o,new ka({color:s,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const l=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new Bn;u.setAttribute("position",new tn(l,3)),u.computeBoundingSphere(),this.add(new Ns(u,new ko({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const c4=new we;let NS,jE;class Tce extends vr{constructor(e=new we(0,0,1),t=new we(0,0,0),r=1,s=16776960,a=r*.2,o=a*.2){super(),this.type="ArrowHelper",NS===void 0&&(NS=new Bn,NS.setAttribute("position",new tn([0,0,0,0,1,0],3)),jE=new jv(.5,1,5,1),jE.translate(0,-.5,0)),this.position.copy(t),this.line=new Vd(NS,new ka({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ns(jE,new ko({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,a,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{c4.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(c4,t)}}setLength(e,t=e*.2,r=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Rce extends Pc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Bn;s.setAttribute("position",new tn(t,3)),s.setAttribute("color",new tn(r,3));const a=new ka({vertexColors:!0,toneMapped:!1});super(s,a),this.type="AxesHelper"}setColors(e,t,r){const s=new Ut,a=this.geometry.attributes.color.array;return s.set(e),s.toArray(a,0),s.toArray(a,3),s.set(t),s.toArray(a,6),s.toArray(a,9),s.set(r),s.toArray(a,12),s.toArray(a,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Pce{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new Jy,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,s){return this.currentPath.quadraticCurveTo(e,t,r,s),this}bezierCurveTo(e,t,r,s,a,o){return this.currentPath.bezierCurveTo(e,t,r,s,a,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(u,d){let h=!1;const p=d.length;for(let x=0,y=p-1;x<p;y=x++){const v=d[x],_=d[y];v.y>u.y!=_.y>u.y&&u.x<(_.x-v.x)*(u.y-v.y)/(_.y-v.y)+v.x&&(h=!h)}return h}function t(u,d){const h=d.getCenter(new wt);if(e(h,u))return h;const p=h.y,x=[],y=u.length;for(let v=0;v<y;v++){const _=u[v],M=u[(v+1)%y];if(_.y>p!=M.y>p){const S=_.x+(p-_.y)*(M.x-_.x)/(M.y-_.y);x.push(S)}}return x.length>1&&(x.sort((v,_)=>v-_),h.x=(x[0]+x[1])/2),h}let r=this.userData.style&&this.userData.style.fillRule||"nonzero";r!=="nonzero"&&r!=="evenodd"&&($t('Fill-rule "'+r+'" is not supported, falling back to "nonzero".'),r="nonzero");const s=r==="nonzero"?(u=>u!==0):(u=>(u&1)!==0),a=[];for(const u of this.subPaths){const d=u.getPoints();if(d.length<3)continue;const h=Sc.area(d);if(h===0)continue;const p=new b9;for(let x=0;x<d.length;x++)p.expandByPoint(d[x]);a.push({subPath:u,points:d,boundingBox:p,interiorPoint:t(d,p),absArea:Math.abs(h),winding:h<0?-1:1,container:null,exclude:!1,role:null})}a.sort((u,d)=>d.absArea-u.absArea);for(let u=0;u<a.length;u++){const d=a[u];let h=0;for(let p=u-1;p>=0;p--){const x=a[p];if(x.boundingBox.containsBox(d.boundingBox)&&e(d.interiorPoint,x.points)){d.container=x.exclude?x.container:x,h=x.winding,d.winding+=h;break}}s(d.winding)===s(h)&&(d.exclude=!0)}for(const u of a)u.exclude||(u.role=u.container===null||u.container.role==="hole"?"outer":"hole");const o=[],l=new Map;for(const u of a){if(u.exclude||u.role!=="outer")continue;const d=new Tv;d.curves=u.subPath.curves,o.push(d),l.set(u,d)}for(const u of a){if(u.exclude||u.role!=="hole")continue;const d=l.get(u.container);if(!d)continue;const h=new Jy;h.curves=u.subPath.curves,d.holes.push(h)}return o}}class Dce extends Rc{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){$t("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function kce(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function Ice(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function Bce(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function GT(n,e,t,r){const s=Lce(r);switch(t){case nR:return n*e;case CN:return n*e/s.components*s.byteLength;case Mv:return n*e/s.components*s.byteLength;case yh:return n*e*2/s.components*s.byteLength;case EN:return n*e*2/s.components*s.byteLength;case rR:return n*e*3/s.components*s.byteLength;case Pa:return n*e*4/s.components*s.byteLength;case jN:return n*e*4/s.components*s.byteLength;case vy:case wy:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Sy:case _y:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case X_:case Y_:return Math.max(n,16)*Math.max(e,8)/4;case $_:case q_:return Math.max(n,8)*Math.max(e,8)/2;
vendor: 6,501 bytes, lines 393-452
393case Q_:case K_:case Z_:case eM:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case J_:case Wy:case tM:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case nM:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case rM:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case sM:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case iM:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case aM:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case oM:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case lM:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case cM:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case uM:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case dM:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case fM:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case hM:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case mM:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case pM:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case gM:case xM:case bM:return Math.ceil(n/4)*Math.ceil(e/4)*16;case yM:case vM:return Math.ceil(n/4)*Math.ceil(e/4)*8;case $y:case wM:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Lce(n){switch(n){case eo:case J3:return{byteLength:1,components:1};case Ix:case Z3:case Ou:return{byteLength:2,components:1};case NN:case AN:return{byteLength:2,components:4};case Wl:case MN:case ao:return{byteLength:4,components:1};case eR:case tR:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${n}.`)}class Oce{static contain(e,t){return kce(e,t)}static cover(e,t){return Ice(e,t)}static fill(e){return Bce(e)}static getByteLength(e,t,r,s){return GT(e,t,r,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i0}}));typeof window<"u"&&(window.__THREE__?$t("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=i0);function w9(){let n=null,e=!1,t=null,r=null;function s(a,o){t(a,o),r=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&n!==null&&(r=n.requestAnimationFrame(s),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){n=a}}}function Fce(n){const e=new WeakMap;function t(l,u){const d=l.array,h=l.usage,p=d.byteLength,x=n.createBuffer();n.bindBuffer(u,x),n.bufferData(u,d,h),l.onUploadCallback();let y;if(d instanceof Float32Array)y=n.FLOAT;else if(typeof Float16Array<"u"&&d instanceof Float16Array)y=n.HALF_FLOAT;else if(d instanceof Uint16Array)l.isFloat16BufferAttribute?y=n.HALF_FLOAT:y=n.UNSIGNED_SHORT;else if(d instanceof Int16Array)y=n.SHORT;else if(d instanceof Uint32Array)y=n.UNSIGNED_INT;else if(d instanceof Int32Array)y=n.INT;else if(d instanceof Int8Array)y=n.BYTE;else if(d instanceof Uint8Array)y=n.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)y=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:x,type:y,bytesPerElement:d.BYTES_PER_ELEMENT,version:l.version,size:p}}function r(l,u,d){const h=u.array,p=u.updateRanges;if(n.bindBuffer(d,l),p.length===0)n.bufferSubData(d,0,h);else{p.sort((y,v)=>y.start-v.start);let x=0;for(let y=1;y<p.length;y++){const v=p[x],_=p[y];_.start<=v.start+v.count+1?v.count=Math.max(v.count,_.start+_.count-v.start):(++x,p[x]=_)}p.length=x+1;for(let y=0,v=p.length;y<v;y++){const _=p[y];n.bufferSubData(d,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}u.clearUpdateRanges()}u.onUploadCallback()}function s(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=e.get(l);u&&(n.deleteBuffer(u.buffer),e.delete(l))}function o(l,u){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const h=e.get(l);(!h||h.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}const d=e.get(l);if(d===void 0)e.set(l,t(l,u));else if(d.version<l.version){if(d.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(d.buffer,l,u),d.version=l.version}}return{get:s,remove:a,update:o}}var Uce=`#ifdef USE_ALPHAHASH
394	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
395#endif`,zce=`#ifdef USE_ALPHAHASH
396	const float ALPHA_HASH_SCALE = 0.05;
397	float hash2D( vec2 value ) {
398		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
399	}
400	float hash3D( vec3 value ) {
401		return hash2D( vec2( hash2D( value.xy ), value.z ) );
402	}
403	float getAlphaHashThreshold( vec3 position ) {
404		float maxDeriv = max(
405			length( dFdx( position.xyz ) ),
406			length( dFdy( position.xyz ) )
407		);
408		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
409		vec2 pixScales = vec2(
410			exp2( floor( log2( pixScale ) ) ),
411			exp2( ceil( log2( pixScale ) ) )
412		);
413		vec2 alpha = vec2(
414			hash3D( floor( pixScales.x * position.xyz ) ),
415			hash3D( floor( pixScales.y * position.xyz ) )
416		);
417		float lerpFactor = fract( log2( pixScale ) );
418		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
419		float a = min( lerpFactor, 1.0 - lerpFactor );
420		vec3 cases = vec3(
421			x * x / ( 2.0 * a * ( 1.0 - a ) ),
422			( x - 0.5 * a ) / ( 1.0 - a ),
423			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
424		);
425		float threshold = ( x < ( 1.0 - a ) )
426			? ( ( x < a ) ? cases.x : cases.y )
427			: cases.z;
428		return clamp( threshold , 1.0e-6, 1.0 );
429	}
430#endif`,Gce=`#ifdef USE_ALPHAMAP
431	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
432#endif`,Hce=`#ifdef USE_ALPHAMAP
433	uniform sampler2D alphaMap;
434#endif`,Vce=`#ifdef USE_ALPHATEST
435	#ifdef ALPHA_TO_COVERAGE
436	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
437	if ( diffuseColor.a == 0.0 ) discard;
438	#else
439	if ( diffuseColor.a < alphaTest ) discard;
440	#endif
441#endif`,Wce=`#ifdef USE_ALPHATEST
442	uniform float alphaTest;
443#endif`,$ce=`#ifdef USE_AOMAP
444	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
445	reflectedLight.indirectDiffuse *= ambientOcclusion;
446	#if defined( USE_CLEARCOAT ) 
447		clearcoatSpecularIndirect *= ambientOcclusion;
448	#endif
449	#if defined( USE_SHEEN ) 
450		sheenSpecularIndirect *= ambientOcclusion;
451	#endif
452	#if defined( USE_ENVMAP ) && defined( STANDARD )
453		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
454		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
455	#endif
456#endif`,Xce=`#ifdef USE_AOMAP
457	uniform sampler2D aoMap;
458	uniform float aoMapIntensity;
459#endif`,qce=`#ifdef USE_BATCHING
460	#if ! defined( GL_ANGLE_multi_draw )
461	#define gl_DrawID _gl_DrawID
462	uniform int _gl_DrawID;
463	#endif
464	uniform highp sampler2D batchingTexture;
465	uniform highp usampler2D batchingIdTexture;
466	mat4 getBatchingMatrix( const in float i ) {
467		int size = textureSize( batchingTexture, 0 ).x;
468		int j = int( i ) * 4;
469		int x = j % size;
470		int y = j / size;
471		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
472		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
473		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
474		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
475		return mat4( v1, v2, v3, v4 );
476	}
477	float getIndirectIndex( const in int i ) {
478		int size = textureSize( batchingIdTexture, 0 ).x;
479		int x = i % size;
480		int y = i / size;
481		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
482	}
483#endif
484#ifdef USE_BATCHING_COLOR
485	uniform sampler2D batchingColorTexture;
486	vec4 getBatchingColor( const in float i ) {
487		int size = textureSize( batchingColorTexture, 0 ).x;
488		int j = int( i );
489		int x = j % size;
490		int y = j / size;
491		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
492	}
493#endif`,Yce=`#ifdef USE_BATCHING
494	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
495#endif`,Qce=`vec3 transformed = vec3( position );
496#ifdef USE_ALPHAHASH
497	vPosition = vec3( position );
498#endif`,Kce=`vec3 objectNormal = vec3( normal );
499#ifdef USE_TANGENT
500	vec3 objectTangent = vec3( tangent.xyz );
501#endif`,Jce=`float G_BlinnPhong_Implicit( ) {
502	return 0.25;
503}
504float D_BlinnPhong( const in float shininess, const in float dotNH ) {
505	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
506}
507vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
508	vec3 halfDir = normalize( lightDir + viewDir );
509	float dotNH = saturate( dot( normal, halfDir ) );
510	float dotVH = saturate( dot( viewDir, halfDir ) );
511	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
512	float G = G_BlinnPhong_Implicit( );
513	float D = D_BlinnPhong( shininess, dotNH );
514	return F * ( G * D );
515} // validated`,Zce=`#ifdef USE_IRIDESCENCE
516	const mat3 XYZ_TO_REC709 = mat3(
517		 3.2404542, -0.9692660,  0.0556434,
518		-1.5371385,  1.8760108, -0.2040259,
519		-0.4985314,  0.0415560,  1.0572252
520	);
521	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
522		vec3 sqrtF0 = sqrt( fresnel0 );
523		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
524	}
525	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
526		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
527	}
528	float IorToFresnel0( float transmittedIor, float incidentIor ) {
529		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
530	}
531	vec3 evalSensitivity( float OPD, vec3 shift ) {
532		float phase = 2.0 * PI * OPD * 1.0e-9;
533		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
534		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
535		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
536		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
537		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
538		xyz /= 1.0685e-7;
539		vec3 rgb = XYZ_TO_REC709 * xyz;
540		return rgb;
541	}
542	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
543		vec3 I;
544		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
545		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
546		float cosTheta2Sq = 1.0 - sinTheta2Sq;
547		if ( cosTheta2Sq < 0.0 ) {
548			return vec3( 1.0 );
549		}
550		float cosTheta2 = sqrt( cosTheta2Sq );
551		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
552		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
553		float T121 = 1.0 - R12;
554		float phi12 = 0.0;
555		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
556		float phi21 = PI - phi12;
557		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
558		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
559		vec3 phi23 = vec3( 0.0 );
560		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
561		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
562		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
563		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
564		vec3 phi = vec3( phi21 ) + phi23;
565		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
566		vec3 r123 = sqrt( R123 );
567		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
568		vec3 C0 = R12 + Rs;
569		I = C0;
570		vec3 Cm = Rs - T121;
571		for ( int m = 1; m <= 2; ++ m ) {
572			Cm *= r123;
573			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
574			I += Cm * Sm;
575		}
576		return max( I, vec3( 0.0 ) );
577	}
578#endif`,eue=`#ifdef USE_BUMPMAP
579	uniform sampler2D bumpMap;
580	uniform float bumpScale;
581	vec2 dHdxy_fwd() {
582		vec2 dSTdx = dFdx( vBumpMapUv );
583		vec2 dSTdy = dFdy( vBumpMapUv );
584		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
585		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
586		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
587		return vec2( dBx, dBy );
588	}
589	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
590		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
591		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
592		vec3 vN = surf_norm;
593		vec3 R1 = cross( vSigmaY, vN );
594		vec3 R2 = cross( vN, vSigmaX );
595		float fDet = dot( vSigmaX, R1 ) * faceDirection;
596		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
597		return normalize( abs( fDet ) * surf_norm - vGrad );
598	}
599#endif`,tue=`#if NUM_CLIPPING_PLANES > 0
600	vec4 plane;
601	#ifdef ALPHA_TO_COVERAGE
602		float distanceToPlane, distanceGradient;
603		float clipOpacity = 1.0;
604		#pragma unroll_loop_start
605		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
606			plane = clippingPlanes[ i ];
607			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
608			distanceGradient = fwidth( distanceToPlane ) / 2.0;
609			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
610			if ( clipOpacity == 0.0 ) discard;
611		}
612		#pragma unroll_loop_end
613		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
614			float unionClipOpacity = 1.0;
615			#pragma unroll_loop_start
616			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
617				plane = clippingPlanes[ i ];
618				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
619				distanceGradient = fwidth( distanceToPlane ) / 2.0;
620				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
621			}
622			#pragma unroll_loop_end
623			clipOpacity *= 1.0 - unionClipOpacity;
624		#endif
625		diffuseColor.a *= clipOpacity;
626		if ( diffuseColor.a == 0.0 ) discard;
627	#else
628		#pragma unroll_loop_start
629		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
630			plane = clippingPlanes[ i ];
631			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
632		}
633		#pragma unroll_loop_end
634		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
635			bool clipped = true;
636			#pragma unroll_loop_start
637			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
638				plane = clippingPlanes[ i ];
639				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
640			}
641			#pragma unroll_loop_end
642			if ( clipped ) discard;
643		#endif
644	#endif
645#endif`,nue=`#if NUM_CLIPPING_PLANES > 0
646	varying vec3 vClipPosition;
647	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
648#endif`,rue=`#if NUM_CLIPPING_PLANES > 0
649	varying vec3 vClipPosition;
650#endif`,sue=`#if NUM_CLIPPING_PLANES > 0
651	vClipPosition = - mvPosition.xyz;
652#endif`,iue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
653	diffuseColor *= vColor;
654#endif`,aue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
655	varying vec4 vColor;
656#endif`,oue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
657	varying vec4 vColor;
658#endif`,lue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
659	vColor = vec4( 1.0 );
660#endif
661#ifdef USE_COLOR_ALPHA
662	vColor *= color;
663#elif defined( USE_COLOR )
664	vColor.rgb *= color;
665#endif
666#ifdef USE_INSTANCING_COLOR
667	vColor.rgb *= instanceColor.rgb;
668#endif
669#ifdef USE_BATCHING_COLOR
670	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
671#endif`,cue=`#define PI 3.141592653589793
672#define PI2 6.283185307179586
673#define PI_HALF 1.5707963267948966
674#define RECIPROCAL_PI 0.3183098861837907
675#define RECIPROCAL_PI2 0.15915494309189535
676#define EPSILON 1e-6
677#ifndef saturate
678#define saturate( a ) clamp( a, 0.0, 1.0 )
679#endif
680#define whiteComplement( a ) ( 1.0 - saturate( a ) )
681float pow2( const in float x ) { return x*x; }
682vec3 pow2( const in vec3 x ) { return x*x; }
683float pow3( const in float x ) { return x*x*x; }
684float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
685float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
686float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
687highp float rand( const in vec2 uv ) {
688	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
689	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
690	return fract( sin( sn ) * c );
691}
692#ifdef HIGH_PRECISION
693	float precisionSafeLength( vec3 v ) { return length( v ); }
694#else
695	float precisionSafeLength( vec3 v ) {
696		float maxComponent = max3( abs( v ) );
697		return length( v / maxComponent ) * maxComponent;
698	}
699#endif
700struct IncidentLight {
701	vec3 color;
702	vec3 direction;
703	bool visible;
704};
705struct ReflectedLight {
706	vec3 directDiffuse;
707	vec3 directSpecular;
708	vec3 indirectDiffuse;
709	vec3 indirectSpecular;
710};
711#ifdef USE_ALPHAHASH
712	varying vec3 vPosition;
713#endif
714vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
715	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
716}
717#define inverseTransformDirection transformDirectionByInverseViewMatrix
718vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
719	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
720}
721vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
722	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
723}
724bool isPerspectiveMatrix( mat4 m ) {
725	return m[ 2 ][ 3 ] == - 1.0;
726}
727vec2 equirectUv( in vec3 dir ) {
728	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
729	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
730	return vec2( u, v );
731}
732vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
733	return RECIPROCAL_PI * diffuseColor;
734}
735vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
736	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
737	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
738}
739float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
740	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
741	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
742} // validated`,uue=`#ifdef ENVMAP_TYPE_CUBE_UV
743	#define cubeUV_minMipLevel 4.0
744	#define cubeUV_minTileSize 16.0
745	float getFace( vec3 direction ) {
746		vec3 absDirection = abs( direction );
747		float face = - 1.0;
748		if ( absDirection.x > absDirection.z ) {
749			if ( absDirection.x > absDirection.y )
750				face = direction.x > 0.0 ? 0.0 : 3.0;
751			else
752				face = direction.y > 0.0 ? 1.0 : 4.0;
753		} else {
754			if ( absDirection.z > absDirection.y )
755				face = direction.z > 0.0 ? 2.0 : 5.0;
756			else
757				face = direction.y > 0.0 ? 1.0 : 4.0;
758		}
759		return face;
760	}
761	vec2 getUV( vec3 direction, float face ) {
762		vec2 uv;
763		if ( face == 0.0 ) {
764			uv = vec2( direction.z, direction.y ) / abs( direction.x );
765		} else if ( face == 1.0 ) {
766			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
767		} else if ( face == 2.0 ) {
768			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
769		} else if ( face == 3.0 ) {
770			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
771		} else if ( face == 4.0 ) {
772			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
773		} else {
774			uv = vec2( direction.x, direction.y ) / abs( direction.z );
775		}
776		return 0.5 * ( uv + 1.0 );
777	}
778	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
779		float face = getFace( direction );
780		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
781		mipInt = max( mipInt, cubeUV_minMipLevel );
782		float faceSize = exp2( mipInt );
783		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
784		if ( face > 2.0 ) {
785			uv.y += faceSize;
786			face -= 3.0;
787		}
788		uv.x += face * faceSize;
789		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
790		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
791		uv.x *= CUBEUV_TEXEL_WIDTH;
792		uv.y *= CUBEUV_TEXEL_HEIGHT;
793		#ifdef texture2DGradEXT
794			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
795		#else
796			return texture2D( envMap, uv ).rgb;
797		#endif
798	}
799	#define cubeUV_r0 1.0
800	#define cubeUV_m0 - 2.0
801	#define cubeUV_r1 0.8
802	#define cubeUV_m1 - 1.0
803	#define cubeUV_r4 0.4
804	#define cubeUV_m4 2.0
805	#define cubeUV_r5 0.305
806	#define cubeUV_m5 3.0
807	#define cubeUV_r6 0.21
808	#define cubeUV_m6 4.0
809	float roughnessToMip( float roughness ) {
810		float mip = 0.0;
811		if ( roughness >= cubeUV_r1 ) {
812			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
813		} else if ( roughness >= cubeUV_r4 ) {
814			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
815		} else if ( roughness >= cubeUV_r5 ) {
816			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
817		} else if ( roughness >= cubeUV_r6 ) {
818			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
819		} else {
820			mip = - 2.0 * log2( 1.16 * roughness );		}
821		return mip;
822	}
823	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
824		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
825		float mipF = fract( mip );
826		float mipInt = floor( mip );
827		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
828		if ( mipF == 0.0 ) {
829			return vec4( color0, 1.0 );
830		} else {
831			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
832			return vec4( mix( color0, color1, mipF ), 1.0 );
833		}
834	}
835#endif`,due=`vec3 transformedNormal = objectNormal;
836#ifdef USE_TANGENT
837	vec3 transformedTangent = objectTangent;
838#endif
839#ifdef USE_BATCHING
840	mat3 bm = mat3( batchingMatrix );
841	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
842	transformedNormal = bm * transformedNormal;
843	#ifdef USE_TANGENT
844		transformedTangent = bm * transformedTangent;
845	#endif
846#endif
847#ifdef USE_INSTANCING
848	mat3 im = mat3( instanceMatrix );
849	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
850	transformedNormal = im * transformedNormal;
851	#ifdef USE_TANGENT
852		transformedTangent = im * transformedTangent;
853	#endif
854#endif
855transformedNormal = normalMatrix * transformedNormal;
856#ifdef FLIP_SIDED
857	transformedNormal = - transformedNormal;
858#endif
859#ifdef USE_TANGENT
860	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
861#endif`,fue=`#ifdef USE_DISPLACEMENTMAP
862	uniform sampler2D displacementMap;
863	uniform float displacementScale;
864	uniform float displacementBias;
865#endif`,hue=`#ifdef USE_DISPLACEMENTMAP
866	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
866placementBias );
867#endif`,mue=`#ifdef USE_EMISSIVEMAP
868	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
869	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
870		emissiveColor = sRGBTransferEOTF( emissiveColor );
871	#endif
872	totalEmissiveRadiance *= emissiveColor.rgb;
873#endif`,pue=`#ifdef USE_EMISSIVEMAP
874	uniform sampler2D emissiveMap;
875#endif`,gue="gl_FragColor = linearToOutputTexel( gl_FragColor );",xue=`vec4 LinearTransferOETF( in vec4 value ) {
876	return value;
877}
878vec4 sRGBTransferEOTF( in vec4 value ) {
879	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
880}
881vec4 sRGBTransferOETF( in vec4 value ) {
882	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
883}`,bue=`#ifdef USE_ENVMAP
884	#ifdef ENV_WORLDPOS
885		vec3 cameraToFrag;
886		if ( isOrthographic ) {
887			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
888		} else {
889			cameraToFrag = normalize( vWorldPosition - cameraPosition );
890		}
891		vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
892		#ifdef ENVMAP_MODE_REFLECTION
893			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
894		#else
895			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
896		#endif
897	#else
898		vec3 reflectVec = vReflect;
899	#endif
900	#ifdef ENVMAP_TYPE_CUBE
901		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
902		#ifdef ENVMAP_BLENDING_MULTIPLY
903			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
904		#elif defined( ENVMAP_BLENDING_MIX )
905			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
906		#elif defined( ENVMAP_BLENDING_ADD )
907			outgoingLight += envColor.xyz * specularStrength * reflectivity;
908		#endif
909	#endif
910#endif`,yue=`#ifdef USE_ENVMAP
911	uniform float envMapIntensity;
912	uniform mat3 envMapRotation;
913	#ifdef ENVMAP_TYPE_CUBE
914		uniform samplerCube envMap;
915	#else
916		uniform sampler2D envMap;
917	#endif
918#endif`,vue=`#ifdef USE_ENVMAP
919	uniform float reflectivity;
920	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
921		#define ENV_WORLDPOS
922	#endif
923	#ifdef ENV_WORLDPOS
924		varying vec3 vWorldPosition;
925		uniform float refractionRatio;
926	#else
927		varying vec3 vReflect;
928	#endif
929#endif`,wue=`#ifdef USE_ENVMAP
930	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
931		#define ENV_WORLDPOS
932	#endif
933	#ifdef ENV_WORLDPOS
934		
935		varying vec3 vWorldPosition;
936	#else
937		varying vec3 vReflect;
938		uniform float refractionRatio;
939	#endif
940#endif`,Sue=`#ifdef USE_ENVMAP
941	#ifdef ENV_WORLDPOS
942		vWorldPosition = worldPosition.xyz;
943	#else
944		vec3 cameraToVertex;
945		if ( isOrthographic ) {
946			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
947		} else {
948			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
949		}
950		vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
951		#ifdef ENVMAP_MODE_REFLECTION
952			vReflect = reflect( cameraToVertex, worldNormal );
953		#else
954			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
955		#endif
956	#endif
957#endif`,_ue=`#ifdef USE_FOG
958	vFogDepth = - mvPosition.z;
959#endif`,Mue=`#ifdef USE_FOG
960	varying float vFogDepth;
961#endif`,Nue=`#ifdef USE_FOG
962	#ifdef FOG_EXP2
963		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
964	#else
965		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
966	#endif
967	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
968#endif`,Aue=`#ifdef USE_FOG
969	uniform vec3 fogColor;
970	varying float vFogDepth;
971	#ifdef FOG_EXP2
972		uniform float fogDensity;
973	#else
974		uniform float fogNear;
975		uniform float fogFar;
976	#endif
977#endif`,Cue=`#ifdef USE_GRADIENTMAP
978	uniform sampler2D gradientMap;
979#endif
980vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
981	float dotNL = dot( normal, lightDirection );
982	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
983	#ifdef USE_GRADIENTMAP
984		return vec3( texture2D( gradientMap, coord ).r );
985	#else
986		vec2 fw = fwidth( coord ) * 0.5;
987		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
988	#endif
989}`,Eue=`#ifdef USE_LIGHTMAP
990	uniform sampler2D lightMap;
991	uniform float lightMapIntensity;
992#endif`,jue=`LambertMaterial material;
993material.diffuseColor = diffuseColor.rgb;
994material.specularStrength = specularStrength;`,Tue=`varying vec3 vViewPosition;
995struct LambertMaterial {
996	vec3 diffuseColor;
997	float specularStrength;
998};
999void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
1000	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1001	vec3 irradiance = dotNL * directLight.color;
1002	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1003}
1004void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
1005	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1006}
1007#define RE_Direct				RE_Direct_Lambert
1008#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,Rue=`uniform bool receiveShadow;
1009uniform vec3 ambientLightColor;
1010#if defined( USE_LIGHT_PROBES )
1011	uniform vec3 lightProbe[ 9 ];
1012#endif
1013vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
1014	float x = normal.x, y = normal.y, z = normal.z;
1015	vec3 result = shCoefficients[ 0 ] * 0.886227;
1016	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
1017	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
1018	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
1019	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
1020	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
1021	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
1022	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
1023	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
1024	return result;
1025}
1026vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
1027	vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
1028	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
1029	return irradiance;
1030}
1031vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
1032	vec3 irradiance = ambientLightColor;
1033	return irradiance;
1034}
1035float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
1036	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
1037	if ( cutoffDistance > 0.0 ) {
1038		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
1039	}
1040	return distanceFalloff;
1041}
1042float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
1043	return smoothstep( coneCosine, penumbraCosine, angleCosine );
1044}
1045#if NUM_DIR_LIGHTS > 0
1046	struct DirectionalLight {
1047		vec3 direction;
1048		vec3 color;
1049	};
1050	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
1051	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
1052		light.color = directionalLight.color;
1053		light.direction = directionalLight.direction;
1054		light.visible = true;
1055	}
1056#endif
1057#if NUM_POINT_LIGHTS > 0
1058	struct PointLight {
1059		vec3 position;
1060		vec3 color;
1061		float distance;
1062		float decay;
1063	};
1064	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
1065	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
1066		vec3 lVector = pointLight.position - geometryPosition;
1067		light.direction = normalize( lVector );
1068		float lightDistance = length( lVector );
1069		light.color = pointLight.color;
1070		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
1071		light.visible = ( light.color != vec3( 0.0 ) );
1072	}
1073#endif
1074#if NUM_SPOT_LIGHTS > 0
1075	struct SpotLight {
1076		vec3 position;
1077		vec3 direction;
1078		vec3 color;
1079		float distance;
1080		float decay;
1081		float coneCos;
1082		float penumbraCos;
1083	};
1084	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
1085	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
1086		vec3 lVector = spotLight.position - geometryPosition;
1087		light.direction = normalize( lVector );
1088		float angleCos = dot( light.direction, spotLight.direction );
1089		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
1090		if ( spotAttenuation > 0.0 ) {
1091			float lightDistance = length( lVector );
1092			light.color = spotLight.color * spotAttenuation;
1093			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
1094			light.visible = ( light.color != vec3( 0.0 ) );
1095		} else {
1096			light.color = vec3( 0.0 );
1097			light.visible = false;
1098		}
1099	}
1100#endif
1101#if NUM_RECT_AREA_LIGHTS > 0
1102	struct RectAreaLight {
1103		vec3 color;
1104		vec3 position;
1105		vec3 halfWidth;
1106		vec3 halfHeight;
1107	};
1108	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
1109	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
1110#endif
1111#if NUM_HEMI_LIGHTS > 0
1112	struct HemisphereLight {
1113		vec3 direction;
1114		vec3 skyColor;
1115		vec3 groundColor;
1116	};
1117	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
1118	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
1119		float dotNL = dot( normal, hemiLight.direction );
1120		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
1121		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1122		return irradiance;
1123	}
1124#endif
1125#include <lightprobes_pars_fragment>`,Pue=`#ifdef USE_ENVMAP
1126	vec3 getIBLIrradiance( const in vec3 normal ) {
1127		#ifdef ENVMAP_TYPE_CUBE_UV
1128			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
1129			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
1130			return PI * envMapColor.rgb * envMapIntensity;
1131		#else
1132			return vec3( 0.0 );
1133		#endif
1134	}
1135	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1136		#ifdef ENVMAP_TYPE_CUBE_UV
1137			vec3 reflectVec = reflect( - viewDir, normal );
1138			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
1139			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
1140			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
1141			return envMapColor.rgb * envMapIntensity;
1142		#else
1143			return vec3( 0.0 );
1144		#endif
1145	}
1146	#ifdef USE_ANISOTROPY
1147		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1148			#ifdef ENVMAP_TYPE_CUBE_UV
1149				vec3 bentNormal = cross( bitangent, viewDir );
1150				bentNormal = normalize( cross( bentNormal, bitangent ) );
1151				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1152				return getIBLRadiance( viewDir, bentNormal, roughness );
1153			#else
1154				return vec3( 0.0 );
1155			#endif
1156		}
1157	#endif
1158#endif`,Due=`ToonMaterial material;
1159material.diffuseColor = diffuseColor.rgb;`,kue=`varying vec3 vViewPosition;
1160struct ToonMaterial {
1161	vec3 diffuseColor;
1162};
1163void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1164	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
1165	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1166}
1167void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1168	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1169}
1170#define RE_Direct				RE_Direct_Toon
1171#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Iue=`BlinnPhongMaterial material;
1172material.diffuseColor = diffuseColor.rgb;
1173material.specularColor = specular;
1174material.specularShininess = shininess;
1175material.specularStrength = specularStrength;`,Bue=`varying vec3 vViewPosition;
1176struct BlinnPhongMaterial {
1177	vec3 diffuseColor;
1178	vec3 specularColor;
1179	float specularShininess;
1180	float specularStrength;
1181};
1182void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1183	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1184	vec3 irradiance = dotNL * directLight.color;
1185	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1186	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
1187}
1188void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1189	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1190}
1191#define RE_Direct				RE_Direct_BlinnPhong
1192#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Lue=`PhysicalMaterial material;
1193material.diffuseColor = diffuseColor.rgb;
1194material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1195material.metalness = metalnessFactor;
1196vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
1197float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
1198material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
1199material.roughness = min( material.roughness, 1.0 );
1200#ifdef IOR
1201	material.ior = ior;
1202	#ifdef USE_SPECULAR
1203		float specularIntensityFactor = specularIntensity;
1204		vec3 specularColorFactor = specularColor;
1205		#ifdef USE_SPECULAR_COLORMAP
1206			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
1207		#endif
1208		#ifdef USE_SPECULAR_INTENSITYMAP
1209			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
1210		#endif
1211		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
1212	#else
1213		float specularIntensityFactor = 1.0;
1214		vec3 specularColorFactor = vec3( 1.0 );
1215		material.specularF90 = 1.0;
1216	#endif
1217	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
1218	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
1219#else
1220	material.specularColor = vec3( 0.04 );
1221	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
1222	material.specularF90 = 1.0;
1223#endif
1224#ifdef USE_CLEARCOAT
1225	material.clearcoat = clearcoat;
1226	material.clearcoatRoughness = clearcoatRoughness;
1227	material.clearcoatF0 = vec3( 0.04 );
1228	material.clearcoatF90 = 1.0;
1229	#ifdef USE_CLEARCOATMAP
1230		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
1231	#endif
1232	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1233		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
1234	#endif
1235	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
1236	material.clearcoatRoughness += geometryRoughness;
1237	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
1238#endif
1239#ifdef USE_DISPERSION
1240	material.dispersion = dispersion;
1241#endif
1242#ifdef USE_IRIDESCENCE
1243	material.iridescence = iridescence;
1244	material.iridescenceIOR = iridescenceIOR;
1245	#ifdef USE_IRIDESCENCEMAP
1246		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
1247	#endif
1248	#ifdef USE_IRIDESCENCE_THICKNESSMAP
1249		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
1250	#else
1251		material.iridescenceThickness = iridescenceThicknessMaximum;
1252	#endif
1253#endif
1254#ifdef USE_SHEEN
1255	material.sheenColor = sheenColor;
1256	#ifdef USE_SHEEN_COLORMAP
1257		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
1258	#endif
1259	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
1260	#ifdef USE_SHEEN_ROUGHNESSMAP
1261		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
1262	#endif
1263#endif
1264#ifdef USE_ANISOTROPY
1265	#ifdef USE_ANISOTROPYMAP
1266		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
1267		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
1268		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
1269	#else
1270		vec2 anisotropyV = anisotropyVector;
1271	#endif
1272	material.anisotropy = length( anisotropyV );
1273	if( material.anisotropy == 0.0 ) {
1274		anisotropyV = vec2( 1.0, 0.0 );
1275	} else {
1276		anisotropyV /= material.anisotropy;
1277		material.anisotropy = saturate( material.anisotropy );
1278	}
1279	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1280	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1281	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1282#endif`,Oue=`uniform sampler2D dfgLUT;
1283struct PhysicalMaterial {
1284	vec3 diffuseColor;
1285	vec3 diffuseContribution;
1286	vec3 specularColor;
1287	vec3 specularColorBlended;
1288	float roughness;
1289	float metalness;
1290	float specularF90;
1291	float dispersion;
1292	#ifdef USE_CLEARCOAT
1293		float clearcoat;
1294		float clearcoatRoughness;
1295		vec3 clearcoatF0;
1296		float clearcoatF90;
1297	#endif
1298	#ifdef USE_IRIDESCENCE
1299		float iridescence;
1300		float iridescenceIOR;
1301		float iridescenceThickness;
1302		vec3 iridescenceFresnel;
1303		vec3 iridescenceF0;
1304		vec3 iridescenceFresnelDielectric;
1305		vec3 iridescenceFresnelMetallic;
1306	#endif
1307	#ifdef USE_SHEEN
1308		vec3 sheenColor;
1309		float sheenRoughness;
1310	#endif
1311	#ifdef IOR
1312		float ior;
1313	#endif
1314	#ifdef USE_TRANSMISSION
1315		float transmission;
1316		float transmissionAlpha;
1317		float thickness;
1318		float attenuationDistance;
1319		vec3 attenuationColor;
1320	#endif
1321	#ifdef USE_ANISOTROPY
1322		float anisotropy;
1323		float alphaT;
1324		vec3 anisotropyT;
1325		vec3 anisotropyB;
1326	#endif
1327};
1328vec3 clearcoatSpecularDirect = vec3( 0.0 );
1329vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1330vec3 sheenSpecularDirect = vec3( 0.0 );
1331vec3 sheenSpecularIndirect = vec3(0.0 );
1332vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1333    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1334    float x2 = x * x;
1335    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1336    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1337}
1338float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1339	float a2 = pow2( alpha );
1340	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1341	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1342	return 0.5 / max( gv + gl, EPSILON );
1343}
1344float D_GGX( const in float alpha, const in float dotNH ) {
1345	float a2 = pow2( alpha );
1346	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1347	return RECIPROCAL_PI * a2 / pow2( denom );
1348}
1349#ifdef USE_ANISOTROPY
1350	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1351		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1352		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1353		return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 1353-1512
1353;
1354	}
1355	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1356		float a2 = alphaT * alphaB;
1357		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1358		highp float v2 = dot( v, v );
1359		float w2 = a2 / v2;
1360		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1361	}
1362#endif
1363#ifdef USE_CLEARCOAT
1364	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1365		vec3 f0 = material.clearcoatF0;
1366		float f90 = material.clearcoatF90;
1367		float roughness = material.clearcoatRoughness;
1368		float alpha = pow2( roughness );
1369		vec3 halfDir = normalize( lightDir + viewDir );
1370		float dotNL = saturate( dot( normal, lightDir ) );
1371		float dotNV = saturate( dot( normal, viewDir ) );
1372		float dotNH = saturate( dot( normal, halfDir ) );
1373		float dotVH = saturate( dot( viewDir, halfDir ) );
1374		vec3 F = F_Schlick( f0, f90, dotVH );
1375		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1376		float D = D_GGX( alpha, dotNH );
1377		return F * ( V * D );
1378	}
1379#endif
1380vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1381	vec3 f0 = material.specularColorBlended;
1382	float f90 = material.specularF90;
1383	float roughness = material.roughness;
1384	float alpha = pow2( roughness );
1385	vec3 halfDir = normalize( lightDir + viewDir );
1386	float dotNL = saturate( dot( normal, lightDir ) );
1387	float dotNV = saturate( dot( normal, viewDir ) );
1388	float dotNH = saturate( dot( normal, halfDir ) );
1389	float dotVH = saturate( dot( viewDir, halfDir ) );
1390	vec3 F = F_Schlick( f0, f90, dotVH );
1391	#ifdef USE_IRIDESCENCE
1392		F = mix( F, material.iridescenceFresnel, material.iridescence );
1393	#endif
1394	#ifdef USE_ANISOTROPY
1395		float dotTL = dot( material.anisotropyT, lightDir );
1396		float dotTV = dot( material.anisotropyT, viewDir );
1397		float dotTH = dot( material.anisotropyT, halfDir );
1398		float dotBL = dot( material.anisotropyB, lightDir );
1399		float dotBV = dot( material.anisotropyB, viewDir );
1400		float dotBH = dot( material.anisotropyB, halfDir );
1401		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1402		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1403	#else
1404		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1405		float D = D_GGX( alpha, dotNH );
1406	#endif
1407	return F * ( V * D );
1408}
1409vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1410	const float LUT_SIZE = 64.0;
1411	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1412	const float LUT_BIAS = 0.5 / LUT_SIZE;
1413	float dotNV = saturate( dot( N, V ) );
1414	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1415	uv = uv * LUT_SCALE + LUT_BIAS;
1416	return uv;
1417}
1418float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1419	float l = length( f );
1420	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1421}
1422vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1423	float x = dot( v1, v2 );
1424	float y = abs( x );
1425	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1426	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1427	float v = a / b;
1428	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1429	return cross( v1, v2 ) * theta_sintheta;
1430}
1431vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1432	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1433	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1434	vec3 lightNormal = cross( v1, v2 );
1435	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1436	vec3 T1, T2;
1437	T1 = normalize( V - N * dot( V, N ) );
1438	T2 = - cross( N, T1 );
1439	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1440	vec3 coords[ 4 ];
1441	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1442	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1443	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1444	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1445	coords[ 0 ] = normalize( coords[ 0 ] );
1446	coords[ 1 ] = normalize( coords[ 1 ] );
1447	coords[ 2 ] = normalize( coords[ 2 ] );
1448	coords[ 3 ] = normalize( coords[ 3 ] );
1449	vec3 vectorFormFactor = vec3( 0.0 );
1450	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1451	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1452	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1453	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1454	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1455	return vec3( result );
1456}
1457#if defined( USE_SHEEN )
1458float D_Charlie( float roughness, float dotNH ) {
1459	float alpha = pow2( roughness );
1460	float invAlpha = 1.0 / alpha;
1461	float cos2h = dotNH * dotNH;
1462	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1463	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1464}
1465float V_Neubelt( float dotNV, float dotNL ) {
1466	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1467}
1468vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1469	vec3 halfDir = normalize( lightDir + viewDir );
1470	float dotNL = saturate( dot( normal, lightDir ) );
1471	float dotNV = saturate( dot( normal, viewDir ) );
1472	float dotNH = saturate( dot( normal, halfDir ) );
1473	float D = D_Charlie( sheenRoughness, dotNH );
1474	float V = V_Neubelt( dotNV, dotNL );
1475	return sheenColor * ( D * V );
1476}
1477#endif
1478float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1479	float dotNV = saturate( dot( normal, viewDir ) );
1480	float r2 = roughness * roughness;
1481	float rInv = 1.0 / ( roughness + 0.1 );
1482	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1483	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1484	float DG = exp( a * dotNV + b );
1485	return saturate( DG );
1486}
1487vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1488	float dotNV = saturate( dot( normal, viewDir ) );
1489	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1490	return specularColor * fab.x + specularF90 * fab.y;
1491}
1492#ifdef USE_IRIDESCENCE
1493void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1494#else
1495void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1496#endif
1497	float dotNV = saturate( dot( normal, viewDir ) );
1498	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1499	#ifdef USE_IRIDESCENCE
1500		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1501	#else
1502		vec3 Fr = specularColor;
1503	#endif
1504	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1505	float Ess = fab.x + fab.y;
1506	float Ems = 1.0 - Ess;
1507	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1508	singleScatter += FssEss;
1509	multiScatter += Fms * Ems;
1510}
1511vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1512	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1513-1642
1513	float dotNL = saturate( dot( normal, lightDir ) );
1514	float dotNV = saturate( dot( normal, viewDir ) );
1515	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1516	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1517	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1518	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1519	float Ess_V = dfgV.x + dfgV.y;
1520	float Ess_L = dfgL.x + dfgL.y;
1521	float Ems_V = 1.0 - Ess_V;
1522	float Ems_L = 1.0 - Ess_L;
1523	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1524	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1525	float compensationFactor = Ems_V * Ems_L;
1526	vec3 multiScatter = Fms * compensationFactor;
1527	return singleScatter + multiScatter;
1528}
1529#if NUM_RECT_AREA_LIGHTS > 0
1530	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1531		vec3 normal = geometryNormal;
1532		vec3 viewDir = geometryViewDir;
1533		vec3 position = geometryPosition;
1534		vec3 lightPos = rectAreaLight.position;
1535		vec3 halfWidth = rectAreaLight.halfWidth;
1536		vec3 halfHeight = rectAreaLight.halfHeight;
1537		vec3 lightColor = rectAreaLight.color;
1538		float roughness = material.roughness;
1539		vec3 rectCoords[ 4 ];
1540		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1541		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1542		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1543		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1544		vec4 t1 = texture2D( ltc_1, uv );
1545		vec4 t2 = texture2D( ltc_2, uv );
1546		mat3 mInv = mat3(
1547			vec3( t1.x, 0, t1.y ),
1548			vec3(    0, 1,    0 ),
1549			vec3( t1.z, 0, t1.w )
1550		);
1551		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1552		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1553		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1554		#ifdef USE_CLEARCOAT
1555			vec3 Ncc = geometryClearcoatNormal;
1556			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1557			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1558			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1559			mat3 mInvClearcoat = mat3(
1560				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1561				vec3(             0, 1,             0 ),
1562				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1563			);
1564			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1565			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1566		#endif
1567	}
1568#endif
1569void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1570	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1571	vec3 irradiance = dotNL * directLight.color;
1572	#ifdef USE_CLEARCOAT
1573		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1574		vec3 ccIrradiance = dotNLcc * directLight.color;
1575		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1576	#endif
1577	#ifdef USE_SHEEN
1578 
1579 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1580 
1581 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1582 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1583 
1584 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1585 
1586 		irradiance *= sheenEnergyComp;
1587 
1588 	#endif
1589	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1590	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1591}
1592void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1593	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1594	#ifdef USE_SHEEN
1595		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1596		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1597		diffuse *= sheenEnergyComp;
1598	#endif
1599	reflectedLight.indirectDiffuse += diffuse;
1600}
1601void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1602	#ifdef USE_CLEARCOAT
1603		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1604	#endif
1605	#ifdef USE_SHEEN
1606		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1607 	#endif
1608	vec3 singleScatteringDielectric = vec3( 0.0 );
1609	vec3 multiScatteringDielectric = vec3( 0.0 );
1610	vec3 singleScatteringMetallic = vec3( 0.0 );
1611	vec3 multiScatteringMetallic = vec3( 0.0 );
1612	#ifdef USE_IRIDESCENCE
1613		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1614		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1615	#else
1616		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1617		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1618	#endif
1619	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1620	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1621	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1622	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1623	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1624	vec3 indirectSpecular = radiance * singleScattering;
1625	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1626	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1627	#ifdef USE_SHEEN
1628		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1629		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1630		indirectSpecular *= sheenEnergyComp;
1631		indirectDiffuse *= sheenEnergyComp;
1632	#endif
1633	reflectedLight.indirectSpecular += indirectSpecular;
1634	reflectedLight.indirectDiffuse += indirectDiffuse;
1635}
1636#define RE_Direct				RE_Direct_Physical
1637#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1638#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1639#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1640float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1641	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1642}`,
1642Fue=`
1643vec3 geometryPosition = - vViewPosition;
1644vec3 geometryNormal = normal;
1645vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1646vec3 geometryClearcoatNormal = vec3( 0.0 );
1647#ifdef USE_CLEARCOAT
1648	geometryClearcoatNormal = clearcoatNormal;
1649#endif
1650#ifdef USE_IRIDESCENCE
1651	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1652	if ( material.iridescenceThickness == 0.0 ) {
1653		material.iridescence = 0.0;
1654	} else {
1655		material.iridescence = saturate( material.iridescence );
1656	}
1657	if ( material.iridescence > 0.0 ) {
1658		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1659		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1660		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1661		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1662	}
1663#endif
1664IncidentLight directLight;
1665#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1666	PointLight pointLight;
1667	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1668	PointLightShadow pointLightShadow;
1669	#endif
1670	#pragma unroll_loop_start
1671	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1672		pointLight = pointLights[ i ];
1673		getPointLightInfo( pointLight, geometryPosition, directLight );
1674		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1675		pointLightShadow = pointLightShadows[ i ];
1676		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1677		#endif
1678		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1679	}
1680	#pragma unroll_loop_end
1681#endif
1682#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1683	SpotLight spotLight;
1684	vec4 spotColor;
1685	vec3 spotLightCoord;
1686	bool inSpotLightMap;
1687	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1688	SpotLightShadow spotLightShadow;
1689	#endif
1690	#pragma unroll_loop_start
1691	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1692		spotLight = spotLights[ i ];
1693		getSpotLightInfo( spotLight, geometryPosition, directLight );
1694		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1695		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1696		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1697		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1698		#else
1699		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1700		#endif
1701		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1702			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1703			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1704			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1705			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1706		#endif
1707		#undef SPOT_LIGHT_MAP_INDEX
1708		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1709		spotLightShadow = spotLightShadows[ i ];
1710		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1711		#endif
1712		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1713	}
1714	#pragma unroll_loop_end
1715#endif
1716#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1717	DirectionalLight directionalLight;
1718	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1719	DirectionalLightShadow directionalLightShadow;
1720	#endif
1721	#pragma unroll_loop_start
1722	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1723		directionalLight = directionalLights[ i ];
1724		getDirectionalLightInfo( directionalLight, directLight );
1725		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1726		directionalLightShadow = directionalLightShadows[ i ];
1727		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1728		#endif
1729		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1730	}
1731	#pragma unroll_loop_end
1732#endif
1733#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1734	RectAreaLight rectAreaLight;
1735	#pragma unroll_loop_start
1736	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1737		rectAreaLight = rectAreaLights[ i ];
1738		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1739	}
1740	#pragma unroll_loop_end
1741#endif
1742#if defined( RE_IndirectDiffuse )
1743	vec3 iblIrradiance = vec3( 0.0 );
1744	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1745	#if defined( USE_LIGHT_PROBES )
1746		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1747	#endif
1748	#if ( NUM_HEMI_LIGHTS > 0 )
1749		#pragma unroll_loop_start
1750		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1751			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1752		}
1753		#pragma unroll_loop_end
1754	#endif
1755	#ifdef USE_LIGHT_PROBES_GRID
1756		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1757		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1758		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1759	#endif
1760#endif
1761#if defined( RE_IndirectSpecular )
1762	vec3 radiance = vec3( 0.0 );
1763	vec3 clearcoatRadiance = vec3( 0.0 );
1764#endif`,Uue=`#if defined( RE_IndirectDiffuse )
1765	#ifdef USE_LIGHTMAP
1766		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1767		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1768		irradiance += lightMapIrradiance;
1769	#endif
1770	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1771		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1772			iblIrradiance += getIBLIrradiance( geometryNormal );
1773		#endif
1774	#endif
1775#endif
1776#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1777	#ifdef USE_ANISOTROPY
1778		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1779	#else
1780		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1781	#endif
1782	#ifdef USE_CLEARCOAT
1783		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1784	#endif
1785#endif`,zue=`#if defined( RE_IndirectDiffuse )
1786	#if defined( LAMBERT ) || defined( PHONG )
1787		irradiance += iblIrradiance;
1788	#endif
1789	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1790#endif
1791#if defined( RE_IndirectSpecular )
1792	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1793#endif`,Gue=`#ifdef USE_LIGHT_PROBES_GRID
1794uniform highp sampler3D probesSH;
1795uniform vec3 probesMin;
1796uniform vec3 probesMax;
1797uniform vec3 probesResolution;
1798vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1799	vec3 res = probesResolution;
1800	vec3 gridRange = probesMax - probesMin;
1801	vec3 resMinusOne = res - 1.0;
1802	vec3 probeSpacing = gridRange / resMinusOne;
1803	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1804	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1805	uvw = uvw * resMinusOne / res + 0.5 / res;
1806	float nz          = res.z;
1807	float paddedSlices = nz + 2.0;
1808	float atlasDepth  = 7.0 * paddedSlices;
1809	float uvZBase     = uvw.z * nz + 1.0;
1810	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
1811	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
1812	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
1813	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
1814	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
1815	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
1816	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
1817	vec3 c0 = s0.xyz;
1818	vec3 c1 = vec3( s0.w, s1.xy );
1819	vec3 c2 = vec3( s1.zw, s2.x );
1820	vec3 c3 = s2.yzw;
1821	vec3 c4 = s3.xyz;
1822	vec3 c5 = vec3( s3.w, s4.xy );
1823	vec3 c6 = vec3( s4.zw, s5.x );
1824	vec3 c7 = s5.yzw;
1825	vec3 c8 = s6.xyz;
1826	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1827	vec3 result = c0 * 0.886227;
1828	result += c1 * 2.0 * 0.511664 * y;
1829	result += c2 * 2.0 * 0.511664 * z;
1830	result += c3 * 2.0 * 0.511664 * x;
1831	result += c4 * 2.0 * 0.429043 * x * y;
1832	result += c5 * 2.0 * 0.429043 * y * z;
1833	result += c6 * ( 0.743125 * z * z - 0.247708 );
1834	result += c7 * 2.0 * 0.429043 * x * z;
1835	result += c8 * 0.429043 * ( x * x - y * y );
1836	return max( result, vec3( 0.0 ) );
1837}
1838#endif`,Hue=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1839	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1840#endif`,Vue=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1841	uniform float logDepthBufFC;
1842	varying float vFragDepth;
1843	varying float vIsPerspective;
1844#endif`,Wue=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1845	varying float vFragDepth;
1846	varying float vIsPerspective;
1847#endif`,$ue=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1848	vFragDepth = 1.0 + gl_Position.w;
1849	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1850#endif`,Xue=`#ifdef USE_MAP
1851	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1852	#ifdef DECODE_VIDEO_TEXTURE
1853		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1854	#endif
1855	diffuseColor *= sampledDiffuseColor;
1856#endif`,que=`#ifdef USE_MAP
1857	uniform sampler2D map;
1858#endif`,Yue=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1859	#if defined( USE_POINTS_UV )
1860		vec2 uv = vUv;
1861	#else
1862		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1863	#endif
1864#endif
1865#ifdef USE_MAP
1866	diffuseColor *= texture2D( map, uv );
1867#endif
1868#ifdef USE_ALPHAMAP
1869	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1870#endif`,Que=`#if defined( USE_POINTS_UV )
1871	varying vec2 vUv;
1872#else
1873	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1874		uniform mat3 uvTransform;
1875	#endif
1876#endif
1877#ifdef USE_MAP
1878	uniform sampler2D map;
1879#endif
1880#ifdef USE_ALPHAMAP
1881	uniform sampler2D alphaMap;
1882#endif`,Kue=`float metalnessFactor = metalness;
1883#ifdef USE_METALNESSMAP
1884	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1885	metalnessFactor *= texelMetalness.b;
1886#endif`,Jue=`#ifdef USE_METALNESSMAP
1887	uniform sampler2D metalnessMap;
1888#endif`,Zue=`#ifdef USE_INSTANCING_MORPH
1889	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1890	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1891	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1892		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1893	}
1894#endif`,ede=`#if defined( USE_MORPHCOLORS )
1895	vColor *= morphTargetBaseInfluence;
1896	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1897		#if defined( USE_COLOR_ALPHA )
1898			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1899		#elif defined( USE_COLOR )
1900			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1901		#endif
1902	}
1903#endif`,tde=`#ifdef USE_MORPHNORMALS
1904	objectNormal *= morphTargetBaseInfluence;
1905	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1906		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1907	}
1908#endif`,nde=`#ifdef USE_MORPHTARGETS
1909	#ifndef USE_INSTANCING_MORPH
1910		uniform float morphTargetBaseInfluence;
1911		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1912	#endif
1913	uniform sampler2DArray morphTargetsTexture;
1914	uniform ivec2 morphTargetsTextureSize;
1915	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1916		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1917		int y = texelIndex / morphTargetsTextureSize.x;
1918		int x = texelIndex - y * morphTargetsTextureSize.x;
1919		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1920		return texelFetch( morphTargetsTexture, morphUV, 0 );
1921	}
1922#endif`,rde=`#ifdef USE_MORPHTARGETS
1923	transformed *= morphTargetBaseInfluence;
1924	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1925		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1926	}
1927#endif`,sde=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1928#ifdef FLAT_SHADED
1929	vec3 fdx = dFdx( vViewPosition );
1930	vec3 fdy = dFdy( vViewPosition );
1931	vec3 normal = normalize( cross( fdx, fdy ) );
1932#else
1933	vec3 normal = normalize( vNormal );
1934	#ifdef DOUBLE_SIDED
1935		normal *= faceDirection;
1936	#endif
1937#endif
1938#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1939	#ifdef USE_TANGENT
1940		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1941	#else
1942		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1943		#if defined( USE_NORMALMAP )
1944			vNormalMapUv
1945		#elif defined( USE_CLEARCOAT_NORMALMAP )
1946			vClearcoatNormalMapUv
1947		#else
1948			vUv
1949		#endif
1950		);
1951	#endif
1952	#ifdef DOUBLE_SIDED
1953		tbn[0] *= faceDirection;
1954		tbn[1] *= faceDirection;
1955	#endif
1956#endif
1957#ifdef USE_CLEARCOAT_NORMALMAP
1958	#ifdef USE_TANGENT
1959		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1960	#else
1961		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1962	#endif
1963	#ifdef DOUBLE_SIDED
1964		tbn2[0] *= faceDirection;
1965		tbn2[1] *= faceDirection;
1966	#endif
1967#endif
1968vec3 nonPerturbedNormal = normal;`,ide=`#ifdef USE_NORMALMAP_OBJECTSPACE
1969	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1970	#ifdef FLIP_SIDED
1971		normal = - normal;
1972	#endif
1973	#ifdef DOUBLE_SIDED
1974		normal = normal * faceDirection;
1975	#endif
1976	normal = normalize( normalMatrix * normal );
1977#elif defined( USE_NORMALMAP_TANGENTSPACE )
1978	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1979	#if defined( USE_PACKED_NORMALMAP )
1980		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1981	#endif
1982	mapN.xy *= normalScale;
1983	normal = normalize( tbn * mapN );
1984#elif defined( USE_BUMPMAP )
1985	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1986#endif`,ade=`#ifndef FLAT_SHADED
1987	varying vec3 vNormal;
1988	#ifdef USE_TANGENT
1989		varying vec3 vTangent;
1990		varying vec3 vBitangent;
1991	#endif
1992#endif`,ode=`#ifndef FLAT_SHADED
1993	varying vec3 vNormal;
1994	#ifdef USE_TANGENT
1995		varying vec3 vTangent;
1996		varying vec3 vBitangent;
1997	#endif
1998#endif`,lde=`#ifndef FLAT_SHADED
1999	vNormal = normalize( transformedNormal );
2000	#ifdef USE_TANGENT
2001		vTangent = normalize( transformedTangent );
2002		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2003		#ifdef FLIP_SIDED
2004			vBitangent = - vBitangent;
2005		#endif
2006	#endif
2007#endif`,cde=`#ifdef USE_NORMALMAP
2008	uniform sampler2D normalMap;
2009	uniform vec2 normalScale;
2010#endif
2011#ifdef USE_NORMALMAP_OBJECTSPACE
2012	uniform mat3 normalMatrix;
2013#endif
2014#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
2015	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
2016		vec3 q0 = dFdx( eye_pos.xyz );
2017		vec3 q1 = dFdy( eye_pos.xyz );
2018		vec2 st0 = dFdx( uv.st );
2019		vec2 st1 = dFdy( uv.st );
2020		vec3 N = surf_norm;
2021		vec3 q1perp = cross( q1, N );
2022		vec3 q0perp = cross( N, q0 );
2023		vec3 T = q1perp * st0.x + q0perp * st1.x;
2024		vec3 B = q1perp * st0.y + q0perp * st1.y;
2025		float det = max( dot( T, T ), dot( B, B ) );
2026		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
2027		return mat3( T * scale, B * scale, N );
2028	}
2029#endif`,ude=`#ifdef USE_CLEARCOAT
2030	vec3 clearcoatNormal = nonPerturbedNormal;
2031#endif`,dde=`#ifdef USE_CLEARCOAT_NORMALMAP
2032	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
2033	clearcoatMapN.xy *= clearcoatNormalScale;
2034	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2035#endif`,fde=`#ifdef USE_CLEARCOATMAP
2036	uniform sampler2D clearcoatMap;
2037#endif
2038#ifdef USE_CLEARCOAT_NORMALMAP
2039	uniform sampler2D clearcoatNormalMap;
2040	uniform vec2 clearcoatNormalScale;
2041#endif
2042#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2043	uniform sampler2D clearcoatRoughnessMap;
2044#endif`,hde=`#ifdef USE_IRIDESCENCEMAP
2045	uniform sampler2D iridescenceMap;
2046#endif
2047#ifdef USE_IRIDESCENCE_THICKNESSMAP
2048	uniform sampler2D iridescenceThicknessMap;
2049#endif`,mde=`#ifdef OPAQUE
2050diffuseColor.a = 1.0;
2051#endif
2052#ifdef USE_TRANSMISSION
2053diffuseColor.a *= material.transmissionAlpha;
2054#endif
2055gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,pde=`vec3 packNormalToRGB( const in vec3 normal ) {
2056	return normalize( normal ) * 0.5 + 0.5;
2057}
2058vec3 unpackRGBToNormal( const in vec3 rgb ) {
2059	return 2.0 * rgb.xyz - 1.0;
2060}
2061const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
2062const float Inv255 = 1. / 255.;
2063const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
2064const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
2065const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
2066const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
2067vec4 packDepthToRGBA( const in float v ) {
2068	if( v <= 0.0 )
2069		return vec4( 0., 0., 0., 0. );
2070	if( v >= 1.0 )
2071		return vec4( 1., 1., 1., 1. );
2072	float vuf;
2073	float af = modf( v * PackFactors.a, vuf );
2074	float bf = modf( vuf * ShiftRight8, vuf );
2075	float gf = modf( vuf * ShiftRight8, vuf );
2076	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
2077}
2078vec3 packDepthToRGB( const in float v ) {
2079	if( v <= 0.0 )
2080		return vec3( 0., 0., 0. );
2081	if( v >= 1.0 )
2082		return vec3( 1., 1., 1. );
2083	float vuf;
2084	float bf = modf( v * PackFactors.b, vuf );
2085	float gf = modf( vuf * ShiftRight8, vuf );
2086	return vec3( vuf * Inv255, gf * PackUpscale, bf );
2087}
2088vec2 packDepthToRG( const in float v ) {
2089	if( v <= 0.0 )
2090		return vec2( 0., 0. );
2091	if( v >= 1.0 )
2092		return vec2( 1., 1. );
2093	float vuf;
2094	float gf = modf( v * 256., vuf );
2095	return vec2( vuf * Inv255, gf );
2096}
2097float unpackRGBAToDepth( const in vec4 v ) {
2098	return dot( v, UnpackFactors4 );
2099}
2100float unpackRGBToDepth( const in vec3 v ) {
2101	return dot( v, UnpackFactors3 );
2102}
2103float unpackRGToDepth( const in vec2 v ) {
2104	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
2105}
2106vec4 pack2HalfToRGBA( const in vec2 v ) {
2107	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
2108	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
2109}
2110vec2 unpackRGBATo2Half( const in vec4 v ) {
2111	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
2112}
2113float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
2114	return ( viewZ + near ) / ( near - far );
2115}
2116float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
2117	#ifdef USE_REVERSED_DEPTH_BUFFER
2118	
2119		return depth * ( far - near ) - far;
2120	#else
2121		return depth * ( near - far ) - near;
2122	#endif
2123}
2124float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
2125	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
2126}
2127float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
2128	
2129	#ifdef USE_REVERSED_DEPTH_BUFFER
2130		return ( near * far ) / ( ( near - far ) * depth - near );
2131	#else
2132		return ( near * far ) / ( ( far - near ) * depth - far );
2133	#endif
2134}`,gde=`#ifdef PREMULTIPLIED_ALPHA
2135	gl_FragColor.rgb *= gl_FragColor.a;
2136#endif`,xde=`vec4 mvPosition = vec4( transformed, 1.0 );
2137#ifdef USE_BATCHING
2138	mvPosition = batchingMatrix * mvPosition;
2139#endif
2140#ifdef USE_INSTANCING
2141	mvPosition = instanceMatrix * mvPosition;
2142#endif
2143mvPosition = modelViewMatrix * mvPosition;
2144gl_Position = projectionMatrix * mvPosition;`,bde=`#ifdef DITHERING
2145	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2146#endif`,yde=`#ifdef DITHERING
2147	vec3 dithering( vec3 color ) {
2148		float grid_position = rand( gl_FragCoord.xy );
2149		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
2150		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
2151		return color + dither_shift_RGB;
2152	}
2153#endif`,vde=`float roughnessFactor = roughness;
2154#ifdef USE_ROUGHNESSMAP
2155	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
2156	roughnessFactor *= texelRoughness.g;
2157#endif`,wde=`#ifdef USE_ROUGHNESSMAP
2158	uniform sampler2D roughnessMap;
2159#endif`,Sde=`#if NUM_SPOT_LIGHT_COORDS > 0
2160	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2161#endif
2162#if NUM_SPOT_LIGHT_MAPS > 0
2163	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
2164#endif
2165#ifdef USE_SHADOWMAP
2166	#if NUM_DIR_LIGHT_SHADOWS > 0
2167		#if defined( SHADOWMAP_TYPE_PCF )
2168			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2169		#else
2170			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
2171		#endif
2172		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2173		struct DirectionalLightShadow {
2174			float shadowIntensity;
2175			float shadowBias;
2176			float shadowNormalBias;
2177			float shadowRadius;
2178			vec2 shadowMapSize;
2179		};
2180		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2181	#endif
2182	#if NUM_SPOT_LIGHT_SHADOWS > 0
2183		#if defined( SHADOWMAP_TYPE_PCF )
2184			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2185		#else
2186			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
2187		#endif
2188		struct SpotLightShadow {
2189			float shadowIntensity;
2190			float shadowBias;
2191			float shadowNormalBias;
2192			float shadowRadius;
2193			vec2 shadowMapSize;
2194		};
2195		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2196	#endif
2197	#if NUM_POINT_LIGHT_SHADOWS > 0
2198		#if defined( SHADOWMAP_TYPE_PCF )
2199			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2200		#elif defined( SHADOWMAP_TYPE_BASIC )
2201			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
2202		#endif
2203		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2204		struct PointLightShadow {
2205			float shadowIntensity;
2206			float shadowBias;
2207			float shadowNormalBias;
2208			float shadowRadius;
2209			vec2 shadowMapSize;
2210			float shadowCameraNear;
2211			float shadowCameraFar;
2212		};
2213		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2214	#endif
2215	#if defined( SHADOWMAP_TYPE_PCF )
2216		float interleavedGradientNoise( vec2 position ) {
2217			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
2218		}
2219		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
2220			const float goldenAngle = 2.399963229728653;
2221			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
2222			float theta = float( sampleIndex ) * goldenAngle + phi;
2223			return vec2( cos( theta ), sin( theta ) ) * r;
2224		}
2225	#endif
2226	#if defined( SHADOWMAP_TYPE_PCF )
2227		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2228			float shadow = 1.0;
2229			shadowCoord.xyz /= shadowCoord.w;
2230			shadowCoord.z += shadowBias;
2231			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2232			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2233			if ( frustumTest ) {
2234				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2235				float radius = shadowRadius * texelSize.x;
2236				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2237				shadow = (
2238					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
2239					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
2240					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
2241					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
2242					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
2243				) * 0.2;
2244			}
2245			return mix( 1.0, shadow, shadowIntensity );
2246		}
2247	#elif defined( SHADOWMAP_TYPE_VSM )
2248		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2249			float shadow = 1.0;
2250			shadowCoord.xyz /= shadowCoord.w;
2251			#ifdef USE_REVERSED_DEPTH_BUFFER
2252				shadowCoord.z -= shadowBias;
2253			#else
2254				shadowCoord.z += shadowBias;
2255			#endif
2256			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2257			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2258			if ( frustumTest ) {
2259				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
2260				float mean = distribution.x;
2261				float variance = distribution.y * distribution.y;
2262				#ifdef USE_REVERSED_DEPTH_BUFFER
2263					float hard_shadow = step( mean, shadowCoord.z );
2264				#else
2265					float hard_shadow = step( shadowCoord.z, mean );
2266				#endif
2267				
2268				if ( hard_shadow == 1.0 ) {
2269					shadow = 1.0;
2270				} else {
2271					variance = max( variance, 0.0000001 );
2272					float d = shadowCoord.z - mean;
2273					float p_max = variance / ( variance + d * d );
2274					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
2275					shadow = max( hard_shadow, p_max );
2276				}
2277			}
2278			return mix( 1.0, shadow, shadowIntensity );
2279		}
2280	#else
2281		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
2282			float shadow = 1.0;
2283			shadowCoord.xyz /= shadowCoord.w;
2284			#ifdef USE_REVERSED_DEPTH_BUFFER
2285				shadowCoord.z -= shadowBias;
2286			#else
2287				shadowCoord.z += shadowBias;
2288			#endif
2289			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2290			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2291			if ( frustumTest ) {
2292				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
2293				#ifdef USE_REVERSED_DEPTH_BUFFER
2294					shadow = step( depth, shadowCoord.z );
2295				#else
2296					shadow = step( shadowCoord.z, depth );
2297				#endif
2298			}
2299			return mix( 1.0, shadow, shadowIntensity );
2300		}
2301	#endif
2302	#if NUM_POINT_LIGHT_SHADOWS > 0
2303	#if defined( SHADOWMAP_TYPE_PCF )
2304	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2305		float shadow = 1.0;
2306		vec3 lightToPosition = shadowCoord.xyz;
2307		vec3 bd3D = normalize( lightToPosition );
2308		vec3 absVec = abs( lightToPosition );
2309		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2310		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2311			#ifdef USE_REVERSED_DEPTH_BUFFER
2312				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2313				dp -= shadowBias;
2314			#else
2315				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2316				dp += shadowBias;
2317			#endif
2318			float texelSize = shadowRadius / shadowMapSize.x;
2319			vec3 absDir = abs( bd3D );
2320			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
2321			tangent = normalize( cross( bd3D, tangent ) );
2322			vec3 bitangent = cross( bd3D, tangent );
2323			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2324			vec2 sample0 = vogelDiskSample( 0, 5, phi );
2325			vec2 sample1 = vogelDiskSample( 1, 5, phi );
2326			vec2 sample2 = vogelDiskSample( 2, 5, phi );
2327			vec2 sample3 = vogelDiskSample( 3, 5, phi );
2328			vec2 sample4 = vogelDiskSample( 4, 5, phi );
2329			shadow = (
2330				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
2331				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
2332				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
2333				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
2334				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
2335			) * 0.2;
2336		}
2337		return mix( 1.0, shadow, shadowIntensity );
2338	}
2339	#elif defined( SHADOWMAP_TYPE_BASIC )
2340	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2341		float shadow = 1.0;
2342		vec3 lightToPosition = shadowCoord.xyz;
2343		vec3 absVec = abs( lightToPosition );
2344		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2345		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2346			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2347			dp += shadowBias;
2348			vec3 bd3D = normalize( lightToPosition );
2349			float depth = textureCube( shadowMap, bd3D ).r;
2350			#ifdef USE_REVERSED_DEPTH_BUFFER
2351				depth = 1.0 - depth;
2352			#endif
2353			shadow = step( dp, depth );
2354		}
2355		return mix( 1.0, shadow, shadowIntensity );
2356	}
2357	#endif
2358	#endif
2359#endif`,_de=`#if NUM_SPOT_LIGHT_COORDS > 0
2360	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2361	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2362#endif
2363#ifdef USE_SHADOWMAP
2364	#if NUM_DIR_LIGHT_SHADOWS > 0
2365		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2366		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2367		struct DirectionalLightShadow {
2368			float shadowIntensity;
2369			float shadowBias;
2370			float shadowNormalBias;
2371			float shadowRadius;
2372			vec2 shadowMapSize;
2373		};
2374		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2375	#endif
2376	#if NUM_SPOT_LIGHT_SHADOWS > 0
2377		struct SpotLightShadow {
2378			float shadowIntensity;
2379			float shadowBias;
2380			float shadowNormalBias;
2381			float shadowRadius;
2382			vec2 shadowMapSize;
2383		};
2384		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2385	#endif
2386	#if NUM_POINT_LIGHT_SHADOWS > 0
2387		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2388		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2389		struct PointLightShadow {
2390			float shadowIntensity;
2391			float shadowBias;
2392			float shadowNormalBias;
2393			float shadowRadius;
2394			vec2 shadowMapSize;
2395			float shadowCameraNear;
2396			float shadowCameraFar;
2397		};
2398		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2399	#endif
2400#endif`,Mde=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2401	#ifdef HAS_NORMAL
2402		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2403	#else
2404		vec3 shadowWorldNormal = vec3( 0.0 );
2405	#endif
2406	vec4 shadowWorldPosition;
2407#endif
2408#if defined( USE_SHADOWMAP )
2409	#if NUM_DIR_LIGHT_SHADOWS > 0
2410		#pragma unroll_loop_start
2411		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2412			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2413			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2414		}
2415		#pragma unroll_loop_end
2416	#endif
2417	#if NUM_POINT_LIGHT_SHADOWS > 0
2418		#pragma unroll_loop_start
2419		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2420			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2421			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2422		}
2423		#pragma unroll_loop_end
2424	#endif
2425#endif
2426#if NUM_SPOT_LIGHT_COORDS > 0
2427	#pragma unroll_loop_start
2428	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2429		shadowWorldPosition = worldPosition;
2430		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2431			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2432		#endif
2433		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2434	}
2435	#pragma unroll_loop_end
2436#endif`,Nde=`float getShadowMask() {
2437	float shadow = 1.0;
2438	#ifdef USE_SHADOWMAP
2439	#if NUM_DIR_LIGHT_SHADOWS > 0
2440	DirectionalLightShadow directionalLight;
2441	#pragma unroll_loop_start
2442	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2443		directionalLight = directionalLightShadows[ i ];
2444		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2445	}
2446	#pragma unroll_loop_end
2447	#endif
2448	#if NUM_SPOT_LIGHT_SHADOWS > 0
2449	SpotLightShadow spotLight;
2450	#pragma unroll_loop_start
2451	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2452		spotLight = spotLightShadows[ i ];
2453		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2454	}
2455	#pragma unroll_loop_end
2456	#endif
2457	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2458	PointLightShadow pointLight;
2459	#pragma unroll_loop_start
2460	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2461		pointLight = pointLightShadows[ i ];
2462		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2463	}
2464	#pragma unroll_loop_end
2465	#endif
2466	#endif
2467	return shadow;
2468}`,Ade=`#ifdef USE_SKINNING
2469	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2470	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2471	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2472	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2473#endif`,Cde=`#ifdef USE_SKINNING
2474	uniform mat4 bindMatrix;
2475	uniform mat4 bindMatrixInverse;
2476	uniform highp sampler2D boneTexture;
2477	mat4 getBoneMatrix( const in float i ) {
2478		int size = textureSize( boneTexture, 0 ).x;
2479		int j = int( i ) * 4;
2480		int x = j % size;
2481		int y = j / size;
2482		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2483		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2484		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2485		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2486		return mat4( v1, v2, v3, v4 );
2487	}
2488#endif`,Ede=`#ifdef USE_SKINNING
2489	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2490	vec4 skinned = vec4( 0.0 );
2491	skinned += boneMatX * skinVertex * skinWeight.x;
2492	skinned += boneMatY * skinVertex * skinWeight.y;
2493	skinned += boneMatZ * skinVertex * skinWeight.z;
2494	skinned += boneMatW * skinVertex * skinWeight.w;
2495	transformed = ( bindMatrixInverse * skinned ).xyz;
2496#endif`,jde=`#ifdef USE_SKINNING
2497	mat4 skinMatrix = mat4( 0.0 );
2498	skinMatrix += skinWeight.x * boneMatX;
2499	skinMatrix += skinWeight.y * boneMatY;
2500	skinMatrix += skinWeight.z * boneMatZ;
2501	skinMatrix += skinWeight.w * boneMatW;
2502	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2503	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2504	#ifdef USE_TANGENT
2505		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2506	#endif
2507#endif`,Tde=`float specularStrength;
2508#ifdef USE_SPECULARMAP
2509	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2510	specularStrength = texelSpecular.r;
2511#else
2512	specularStrength = 1.0;
2513#endif`,Rde=`#ifdef USE_SPECULARMAP
2514	uniform sampler2D specularMap;
2515#endif`,Pde=`#if defined( TONE_MAPPING )
2516	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2517#endif`,Dde=`#ifndef saturate
2518#define saturate( a ) clamp( a, 0.0, 1.0 )
2519#endif
2520uniform float toneMappingExposure;
2521vec3 LinearToneMapping( vec3 color ) {
2522	return saturate( toneMappingExposure * color );
2523}
2524vec3 ReinhardToneMapping( vec3 color ) {
2525	color *= toneMappingExposure;
2526	return saturate( color / ( vec3( 1.0 ) + color ) );
2527}
2528vec3 CineonToneMapping( vec3 color ) {
2529	color *= toneMappingExposure;
2530	color = max( vec3( 0.0 ), color - 0.004 );
2531	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2532}
2533vec3 RRTAndODTFit( vec3 v ) {
2534	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2535	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2536	return a / b;
2537}
2538vec3 ACESFilmicToneMapping( vec3 color ) {
2539	const mat3 ACESInputMat = mat3(
2540		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2541		vec3( 0.04823, 0.01566, 0.83777 )
2542	);
2543	const mat3 ACESOutputMat = mat3(
2544		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2545		vec3( -0.07367, -0.00605,  1.07602 )
2546	);
2547	color *= toneMappingExposure / 0.6;
2548	color = ACESInputMat * color;
2549	color = RRTAndODTFit( color );
2550	color = ACESOutputMat * color;
2551	return saturate( color );
2552}
2553const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2554	vec3( 1.6605, - 0.1246, - 0.0182 ),
2555	vec3( - 0.5876, 1.1329, - 0.1006 ),
2556	vec3( - 0.0728, - 0.0083, 1.1187 )
2557);
2558const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2559	vec3( 0.6274, 0.0691, 0.0164 ),
2560	vec3( 0.3293, 0.9195, 0.0880 ),
2561	vec3( 0.0433, 0.0113, 0.8956 )
2562);
2563vec3 agxDefaultContrastApprox( vec3 x ) {
2564	vec3 x2 = x * x;
2565	vec3 x4 = x2 * x2;
2566	return + 15.5 * x4 * x2
2567		- 40.14 * x4 * x
2568		+ 31.96 * x4
2569		- 6.868 * x2 * x
2570		+ 0.4298 * x2
2571		+ 0.1191 * x
2572		- 0.00232;
2573}
2574vec3 AgXToneMapping( vec3 color ) {
2575	const mat3 AgXInsetMatrix = mat3(
2576		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2577		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2578		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2579	);
2580	const mat3 AgXOutsetMatrix = mat3(
2581		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2582		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2583		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2584	);
2585	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2586	color *= toneMappingExposure;
2587	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2588	color = AgXInsetMatrix * color;
2589	color = max( color, 1e-10 );	color = log2( color );
2590	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2591	color = clamp( color, 0.0, 1.0 );
2592	color = agxDefaultContrastApprox( color );
2593	color = AgXOutsetMatrix * color;
2594	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2595	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2596	color = clamp( color, 0.0, 1.0 );
2597	return color;
2598}
2599vec3 NeutralToneMapping( vec3 color ) {
2600	const float StartCompression = 0.8 - 0.04;
2601	const float Desaturation = 0.15;
2602	color *= toneMappingExposure;
2603	float x = min( color.r, min( color.g, color.b ) );
2604	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2605	color -= offset;
2606	float peak = max( color.r, max( color.g, color.b ) );
2607	if ( peak < StartCompression ) return color;
2608	float d = 1. - StartCompression;
2609	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2610	color *= newPeak / peak;
2611	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2612	return mix( color, vec3( newPeak ), g );
2613}
2614vec3 CustomToneMapping( vec3 color ) { return color; }`,kde=`#ifdef USE_TRANSMISSION
2615	material.transmission = transmission;
2616	material.transmissionAlpha = 1.0;
2617	material.thickness = thickness;
2618	material.attenuationDistance = attenuationDistance;
2619	material.attenuationColor = attenuationColor;
2620	#ifdef USE_TRANSMISSIONMAP
2621		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2622	#endif
2623	#ifdef USE_THICKNESSMAP
2624		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2625	#endif
2626	vec3 pos = vWorldPosition;
2627	vec3 v = normalize( cameraPosition - pos );
2628	vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
2629	vec4 transmitted = getIBLVolumeRefraction(
2630		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2631		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2632		material.attenuationColor, material.attenuationDistance );
2633	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2634	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2635#endif`,Ide=`#ifdef USE_TRANSMISSION
2636	uniform float transmission;
2637	uniform float thickness;
2638	uniform float attenuationDistance;
2639	uniform vec3 attenuationColor;
2640	#ifdef USE_TRANSMISSIONMAP
2641		uniform sampler2D transmissionMap;
2642	#endif
2643	#ifdef USE_THICKNESSMAP
2644		uniform sampler2D thicknessMap;
2645	#endif
2646	uniform vec2 transmissionSamplerSize;
2647	uniform sampler2D transmissionSamplerMap;
2648	uniform mat4 modelMatrix;
2649	uniform mat4 projectionMatrix;
2650	varying vec3 vWorldPosition;
2651	float w0( float a ) {
2652		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2653	}
2654	float w1( float a ) {
2655		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2656	}
2657	float w2( float a ){
2658		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2659	}
2660	float w3( float a ) {
2661		return ( 1.0 / 6.0 ) * ( a * a * a );
2662	}
2663	float g0( float a ) {
2664		return w0( a ) + w1( a );
2665	}
2666	float g1( float a ) {
2667		return w2( a ) + w3( a );
2668	}
2669	float h0( float a ) {
2670		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2671	}
2672	float h1( float a ) {
2673		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2674	}
2675	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2676		uv = uv * texelSize.zw + 0.5;
2677		vec2 iuv = floor( uv );
2678		vec2 fuv = fract( uv );
2679		float g0x = g0( fuv.x );
2680		float g1x = g1( fuv.x );
2681		float h0x = h0( fuv.x );
2682		float h1x = h1( fuv.x );
2683		float h0y = h0( fuv.y );
2684		float h1y = h1( fuv.y );
2685		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2686		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2687		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2688		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2689		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2690			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2691	}
2692	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2693		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2694		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2695		vec2 fLodSizeInv = 1.0 / fLodSize;
2696		vec2 cLodSizeInv = 1.0 / cLodSize;
2697		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2698		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2699		return mix( fSample, cSample, fract( lod ) );
2700	}
2701	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2702		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2703		vec3 modelScale;
2704		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2705		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2706		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2707		return normalize( refractionVector ) * thickness * modelScale;
2708	}
2709	float applyIorToRoughness( const in float roughness, const in float ior ) {
2710		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2711	}
2712	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2713		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2714		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2715	}
2716	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2717		if ( isinf( attenuationDistance ) ) {
2718			return vec3( 1.0 );
2719		} else {
2720			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2721			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2722		}
2723	}
2724	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2725		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2726		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2727		const in vec3 attenuationColor, const in float attenuationDistance ) {
2728		vec4 transmittedLight;
2729		vec3 transmittance;
2730		#ifdef USE_DISPERSION
2731			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2732			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2733			for ( int i = 0; i < 3; i ++ ) {
2734				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2735				vec3 refractedRayExit = position + transmissionRay;
2736				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2737				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2738				refractionCoords += 1.0;
2739				refractionCoords /= 2.0;
2740				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2741				transmittedLight[ i ] = transmissionSample[ i ];
2742				transmittedLight.a += transmissionSample.a;
2743				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2744			}
2745			transmittedLight.a /= 3.0;
2746		#else
2747			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2748			vec3 refractedRayExit = position + transmissionRay;
2749			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2750			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2751			refractionCoords += 1.0;
2752			refractionCoords /= 2.0;
2753			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2754			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2755		#endif
2756		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2757		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2758		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2759		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2760	}
2761#endif`,Bde=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2762	varying vec2 vUv;
2763#endif
2764#ifdef USE_MAP
2765	varying vec2 vMapUv;
2766#endif
2767#ifdef USE_ALPHAMAP
2768	varying vec2 vAlphaMapUv;
2769#endif
2770#ifdef USE_LIGHTMAP
2771	varying vec2 vLightMapUv;
2772#endif
2773#ifdef USE_AOMAP
2774	varying vec2 vAoMapUv;
2775#endif
2776#ifdef USE_BUMPMAP
2777	varying vec2 vBumpMapUv;
2778#endif
2779#ifdef USE_NORMALMAP
2780	varying vec2 vNormalMapUv;
2781#endif
2782#ifdef USE_EMISSIVEMAP
2783	varying vec2 vEmissiveMapUv;
2784#endif
2785#ifdef USE_METALNESSMAP
2786	varying vec2 vMetalnessMapUv;
2787#endif
2788#ifdef USE_ROUGHNESSMAP
2789	varying vec2 vRoughnessMapUv;
2790#endif
2791#ifdef USE_ANISOTROPYMAP
2792	varying vec2 vAnisotropyMapUv;
2793#endif
2794#ifdef USE_CLEARCOATMAP
2795	varying vec2 vClearcoatMapUv;
2796#endif
2797#ifdef USE_CLEARCOAT_NORMALMAP
2798	varying vec2 vClearcoatNormalMapUv;
2799#endif
2800#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2801	varying vec2 vClearcoatRoughnessMapUv;
2802#endif
2803#ifdef USE_IRIDESCENCEMAP
2804	varying vec2 vIridescenceMapUv;
2805#endif
2806#ifdef USE_IRIDESCENCE_THICKNESSMAP
2807	varying vec2 vIridescenceThicknessMapUv;
2808#endif
2809#ifdef USE_SHEEN_COLORMAP
2810	varying vec2 vSheenColorMapUv;
2811#endif
2812#ifdef USE_SHEEN_ROUGHNESSMAP
2813	varying vec2 vSheenRoughnessMapUv;
2814#endif
2815#ifdef USE_SPECULARMAP
2816	varying vec2 vSpecularMapUv;
2817#endif
2818#ifdef USE_SPECULAR_COLORMAP
2819	varying vec2 vSpecularColorMapUv;
2820#endif
2821#ifdef USE_SPECULAR_INTENSITYMAP
2822	varying vec2 vSpecularIntensityMapUv;
2823#endif
2824#ifdef USE_TRANSMISSIONMAP
2825	uniform mat3 transmissionMapTransform;
2826	varying vec2 vTransmissionMapUv;
2827#endif
2828#ifdef USE_THICKNESSMAP
2829	uniform mat3 thicknessMapTransform;
2830	varying vec2 vThicknessMapUv;
2831#endif`,Lde=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2832	varying vec2 vUv;
2833#endif
2834#ifdef USE_MAP
2835	uniform mat3 mapTransform;
2836	varying vec2 vMapUv;
2837#endif
2838#ifdef USE_ALPHAMAP
2839	uniform mat3 alphaMapTransform;
2840	varying vec2 vAlphaMapUv;
2841#endif
2842#ifdef USE_LIGHTMAP
2843	uniform mat3 lightMapTransform;
2844	varying vec2 vLightMapUv;
2845#endif
2846#ifdef USE_AOMAP
2847	uniform mat3 aoMapTransform;
2848	varying vec2 vAoMapUv;
2849#endif
2850#ifdef USE_BUMPMAP
2851	uniform mat3 bumpMapTransform;
2852	varying vec2 vBumpMapUv;
2853#endif
2854#ifdef USE_NORMALMAP
2855	uniform mat3 normalMapTransform;
2856	varying vec2 vNormalMapUv;
2857#endif
2858#ifdef USE_DISPLACEMENTMAP
2859	uniform mat3 displacementMapTransform;
2860	varying vec2 vDisplacementMapUv;
2861#endif
2862#ifdef USE_EMISSIVEMAP
2863	uniform mat3 emissiveMapTransform;
2864	varying vec2 vEmissiveMapUv;
2865#endif
2866#ifdef USE_METALNESSMAP
2867	uniform mat3 metalnessMapTransform;
2868	varying vec2 vMetalnessMapUv;
2869#endif
2870#ifdef USE_ROUGHNESSMAP
2871	uniform mat3 roughnessMapTransform;
2872	varying vec2 vRoughnessMapUv;
2873#endif
2874#ifdef USE_ANISOTROPYMAP
2875	uniform mat3 anisotropyMapTransform;
2876	varying vec2 vAnisotropyMapUv;
2877#endif
2878#ifdef USE_CLEARCOATMAP
2879	uniform mat3 clearcoatMapTransform;
2880	varying vec2 vClearcoatMapUv;
2881#endif
2882#ifdef USE_CLEARCOAT_NORMALMAP
2883	uniform mat3 clearcoatNormalMapTransform;
2884	varying vec2 vClearcoatNormalMapUv;
2885#endif
2886#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2887	uniform mat3 clearcoatRoughnessMapTransform;
2888	varying vec2 vClearcoatRoughnessMapUv;
2889#endif
2890#ifdef USE_SHEEN_COLORMAP
2891	uniform mat3 sheenColorMapTransform;
2892	varying vec2 vSheenColorMapUv;
2893#endif
2894#ifdef USE_SHEEN_ROUGHNESSMAP
2895	uniform mat3 sheenRoughnessMapTransform;
2896	varying vec2 vSheenRoughnessMapUv;
2897#endif
2898#ifdef USE_IRIDESCENCEMAP
2899	uniform mat3 iridescenceMapTransform;
2900	varying vec2 vIridescenceMapUv;
2901#endif
2902#ifdef USE_IRIDESCENCE_THICKNESSMAP
2903	uniform mat3 iridescenceThicknessMapTransform;
2904	varying vec2 vIridescenceThicknessMapUv;
2905#endif
2906#ifdef USE_SPECULARMAP
2907	uniform mat3 specularMapTransform;
2908	varying vec2 vSpecularMapUv;
2909#endif
2910#ifdef USE_SPECULAR_COLORMAP
2911	uniform mat3 specularColorMapTransform;
2912	varying vec2 vSpecularColorMapUv;
2913#endif
2914#ifdef USE_SPECULAR_INTENSITYMAP
2915	uniform mat3 specularIntensityMapTransform;
2916	varying vec2 vSpecularIntensityMapUv;
2917#endif
2918#ifdef USE_TRANSMISSIONMAP
2919	uniform mat3 transmissionMapTransform;
2920	varying vec2 vTransmissionMapUv;
2921#endif
2922#ifdef USE_THICKNESSMAP
2923	uniform mat3 thicknessMapTransform;
2924	varying vec2 vThicknessMapUv;
2925#endif`,Ode=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2926	vUv = vec3( uv, 1 ).xy;
2927#endif
2928#ifdef USE_MAP
2929	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2930#endif
2931#ifdef USE_ALPHAMAP
2932	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2933#endif
2934#ifdef USE_LIGHTMAP
2935	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2936#endif
2937#ifdef USE_AOMAP
2938	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2939#endif
2940#ifdef USE_BUMPMAP
2941	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2942#endif
2943#ifdef USE_NORMALMAP
2944	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2945#endif
2946#ifdef USE_DISPLACEMENTMAP
2947	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2948#endif
2949#ifdef USE_EMISSIVEMAP
2950	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2951#endif
2952#ifdef USE_METALNESSMAP
2953	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2954#endif
2955#ifdef USE_ROUGHNESSMAP
2956	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2957#endif
2958#ifdef USE_ANISOTROPYMAP
2959	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2960#endif
2961#ifdef USE_CLEARCOATMAP
2962	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2963#endif
2964#ifdef USE_CLEARCOAT_NORMALMAP
2965	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2966#endif
2967#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2968	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2969#endif
2970#ifdef USE_IRIDESCENCEMAP
2971	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2972#endif
2973#ifdef USE_IRIDESCENCE_THICKNESSMAP
2974	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2975#endif
2976#ifdef USE_SHEEN_COLORMAP
2977	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2978#endif
2979#ifdef USE_SHEEN_ROUGHNESSMAP
2980	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2981#endif
2982#ifdef USE_SPECULARMAP
2983	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2984#endif
2985#ifdef USE_SPECULAR_COLORMAP
2986	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2987#endif
2988#ifdef USE_SPECULAR_INTENSITYMAP
2989	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2990#endif
2991#ifdef USE_TRANSMISSIONMAP
2992	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2993#endif
2994#ifdef USE_THICKNESSMAP
2995	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2996#endif`,Fde=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2997	vec4 worldPosition = vec4( transformed, 1.0 );
2998	#ifdef USE_BATCHING
2999		worldPosition = batchingMatrix * worldPosition;
3000	#endif
3001	#ifdef USE_INSTANCING
3002		worldPosition = instanceMatrix * worldPosition;
3003	#endif
3004	worldPosition = modelMatrix * worldPosition;
3005#endif`;const Ude=`varying vec2 vUv;
3006uniform mat3 uvTransform;
3007void main() {
3008	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3009	gl_Position = vec4( position.xy, 1.0, 1.0 );
3010}`,zde=`uniform sampler2D t2D;
3011uniform float backgroundIntensity;
3012varying vec2 vUv;
3013void main() {
3014	vec4 texColor = texture2D( t2D, vUv );
3015	#ifdef DECODE_VIDEO_TEXTURE
3016		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
3017	#endif
3018	texColor.rgb *= backgroundIntensity;
3019	gl_FragColor = texColor;
3020	#include <tonemapping_fragment>
3021	#include <colorspace_fragment>
3022}`,Gde=`varying vec3 vWorldDirection;
3023#include <common>
3024void main() {
3025	vWorldDirection = transformDirection( position, modelMatrix );
3026	#include <begin_vertex>
3027	#include <project_vertex>
3028	gl_Position.z = gl_Position.w;
3029}`,Hde=`#ifdef ENVMAP_TYPE_CUBE
3030	uniform samplerCube envMap;
3031#elif defined( ENVMAP_TYPE_CUBE_UV )
3032	uniform sampler2D envMap;
3033#endif
3034uniform float backgroundBlurriness;
3035uniform float backgroundIntensity;
3036uniform mat3 backgroundRotation;
3037varying vec3 vWorldDirection;
3038#include <cube_uv_reflection_fragment>
3039void main() {
3040	#ifdef ENVMAP_TYPE_CUBE
3041		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
3042	#elif defined( ENVMAP_TYPE_CUBE_UV )
3043		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
3044	#else
3045		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3046	#endif
3047	texColor.rgb *= backgroundIntensity;
3048	gl_FragColor = texColor;
3049	#include <tonemapping_fragment>
3050	#include <colorspace_fragment>
3051}`,Vde=`varying vec3 vWorldDirection;
3052#include <common>
3053void main() {
3054	vWorldDirection = transformDirection( position, modelMatrix );
3055	#include <begin_vertex>
3056	#include <project_vertex>
3057	gl_Position.z = gl_Position.w;
3058}`,Wde=`uniform samplerCube tCube;
3059uniform float tFlip;
3060uniform float opacity;
3061varying vec3 vWorldDirection;
3062void main() {
3063	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
3064	gl_FragColor = texColor;
3065	gl_FragColor.a *= opacity;
3066	#include <tonemapping_fragment>
3067	#include <colorspace_fragment>
3068}`,$de=`#include <common>
3069#include <batching_pars_vertex>
3070#include <uv_pars_vertex>
3071#include <displacementmap_pars_vertex>
3072#include <morphtarget_pars_vertex>
3073#include <skinning_pars_vertex>
3074#include <logdepthbuf_pars_vertex>
3075#include <clipping_planes_pars_vertex>
3076varying vec2 vHighPrecisionZW;
3077void main() {
3078	#include <uv_vertex>
3079	#include <batching_vertex>
3080	#include <skinbase_vertex>
3081	#include <morphinstance_vertex>
3082	#ifdef USE_DISPLACEMENTMAP
3083		#include <beginnormal_vertex>
3084		#include <morphnormal_vertex>
3085		#include <skinnormal_vertex>
3086	#endif
3087	#include <begin_vertex>
3088	#include <morphtarget_vertex>
3089	#include <skinning_vertex>
3090	#include <displacementmap_vertex>
3091	#include <project_vertex>
3092	#include <logdepthbuf_vertex>
3093	#include <clipping_planes_vertex>
3094	vHighPrecisionZW = gl_Position.zw;
3095}`,Xde=`#if DEPTH_PACKING == 3200
3096	uniform float opacity;
3097#endif
3098#include <common>
3099#include <packing>
3100#include <uv_pars_fragment>
3101#include <map_pars_fragment>
3102#include <alphamap_pars_fragment>
3103#include <alphatest_pars_fragment>
3104#include <alphahash_pars_fragment>
3105#include <logdepthbuf_pars_fragment>
3106#include <clipping_planes_pars_fragment>
3107varying vec2 vHighPrecisionZW;
3108void main() {
3109	vec4 diffuseColor = vec4( 1.0 );
3110	#include <clipping_planes_fragment>
3111	#if DEPTH_PACKING == 3200
3112		diffuseColor.a = opacity;
3113	#endif
3114	#include <map_fragment>
3115	#include <alphamap_fragment>
3116	#include <alphatest_fragment>
3117	#include <alphahash_fragment>
3118	#include <logdepthbuf_fragment>
3119	#ifdef USE_REVERSED_DEPTH_BUFFER
3120		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
3121	#else
3122		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
3123	#endif
3124	#if DEPTH_PACKING == 3200
3125		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
3126	#elif DEPTH_PACKING == 3201
3127		gl_FragColor = packDepthToRGBA( fragCoordZ );
3128	#elif DEPTH_PACKING == 3202
3129		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
3130	#elif DEPTH_PACKING == 3203
3131		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
3132	#endif
3133}`,qde=`#define DISTANCE
3134varying vec3 vWorldPosition;
3135#include <common>
3136#include <batching_pars_vertex>
3137#include <uv_pars_vertex>
3138#include <displacementmap_pars_vertex>
3139#include <morphtarget_pars_vertex>
3140#include <skinning_pars_vertex>
3141#include <clipping_planes_pars_vertex>
3142void main() {
3143	#include <uv_vertex>
3144	#include <batching_vertex>
3145	#include <skinbase_vertex>
3146	#include <morphinstance_vertex>
3147	#ifdef USE_DISPLACEMENTMAP
3148		#include <beginnormal_vertex>
3149		#include <morphnormal_vertex>
3150		#include <skinnormal_vertex>
3151	#endif
3152	#include <begin_vertex>
3153	#include <morphtarget_vertex>
3154	#include <skinning_vertex>
3155	#include <displacementmap_vertex>
3156	#include <project_vertex>
3157	#include <worldpos_vertex>
3158	#include <clipping_planes_vertex>
3159	vWorldPosition = worldPosition.xyz;
3160}`,Yde=`#define DISTANCE
3161uniform vec3 referencePosition;
3162uniform float nearDistance;
3163uniform float farDistance;
3164varying vec3 vWorldPosition;
3165#include <common>
3166#include <uv_pars_fragment>
3167#include <map_pars_fragment>
3168#include <alphamap_pars_fragment>
3169#include <alphatest_pars_fragment>
3170#include <alphahash_pars_fragment>
3171#include <clipping_planes_pars_fragment>
3172void main() {
3173	vec4 diffuseColor = vec4( 1.0 );
3174	#include <clipping_planes_fragment>
3175	#include <map_fragment>
3176	#include <alphamap_fragment>
3177	#include <alphatest_fragment>
3178	#include <alphahash_fragment>
3179	float dist = length( vWorldPosition - referencePosition );
3180	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
3181	dist = saturate( dist );
3182	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
3183}`,Qde=`varying vec3 vWorldDirection;
3184#include <common>
3185void main() {
3186	vWorldDirection = transformDirection( position, modelMatrix );
3187	#include <begin_vertex>
3188	#include <project_vertex>
3189}`,Kde=`uniform sampler2D tEquirect;
3190varying vec3 vWorldDirection;
3191#include <common>
3192void main() {
3193	vec3 direction = normalize( vWorldDirection );
3194	vec2 sampleUV = equirectUv( direction );
3195	gl_FragColor = texture2D( tEquirect, sampleUV );
3196	#include <tonemapping_fragment>
3197	#include <colorspace_fragment>
3198}`,Jde=`uniform float scale;
3199attribute float lineDistance;
3200varying float vLineDistance;
3201#include <common>
3202#include <uv_pars_vertex>
3203#include <color_pars_vertex>
3204#include <fog_pars_vertex>
3205#include <morphtarget_pars_vertex>
3206#include <logdepthbuf_pars_vertex>
3207#include <clipping_planes_pars_vertex>
3208void main() {
3209	vLineDistance = scale * lineDistance;
3210	#include <uv_vertex>
3211	#include <color_vertex>
3212	#include <morphinstance_vertex>
3213	#include <morphcolor_vertex>
3214	#include <begin_vertex>
3215	#include <morphtarget_vertex>
3216	#include <project_vertex>
3217	#include <logdepthbuf_vertex>
3218	#include <clipping_planes_vertex>
3219	#include <fog_vertex>
3220}`,Zde=`uniform vec3 diffuse;
3221uniform float opacity;
3222uniform float dashSize;
3223uniform float totalSize;
3224varying float vLineDistance;
3225#include <common>
3226#include <color_pars_fragment>
3227#include <uv_pars_fragment>
3228#include <map_pars_fragment>
3229#include <fog_pars_fragment>
3230#include <logdepthbuf_pars_fragment>
3231#include <clipping_planes_pars_fragment>
3232void main() {
3233	vec4 diffuseColor = vec4( diffuse, opacity );
3234	#include <clipping_planes_fragment>
3235	if ( mod( vLineDistance, totalSize ) > dashSize ) {
3236		discard;
3237	}
3238	vec3 outgoingLight = vec3( 0.0 );
3239	#include <logdepthbuf_fragment>
3240	#include <map_fragment>
3241	#include <color_fragment>
3242	outgoingLight = diffuseColor.rgb;
3243	#include <opaque_fragment>
3244	#include <tonemapping_fragment>
3245	#include <colorspace_fragment>
3246	#include <fog_fragment>
3247	#include <premultiplied_alpha_fragment>
3248}`,efe=`#include <common>
3249#include <batching_pars_vertex>
3250#include <uv_pars_vertex>
3251#include <envmap_pars_vertex>
3252#include <color_pars_vertex>
3253#include <fog_pars_vertex>
3254#include <morphtarget_pars_vertex>
3255#include <skinning_pars_vertex>
3256#include <logdepthbuf_pars_vertex>
3257#include <clipping_planes_pars_vertex>
3258void main() {
3259	#include <uv_vertex>
3260	#include <color_vertex>
3261	#include <morphinstance_vertex>
3262	#include <morphcolor_vertex>
3263	#include <batching_vertex>
3264	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
3265		#include <beginnormal_vertex>
3266		#include <morphnormal_vertex>
3267		#include <skinbase_vertex>
3268		#include <skinnormal_vertex>
3269		#include <defaultnormal_vertex>
3270	#endif
3271	#include <begin_vertex>
3272	#include <morphtarget_vertex>
3273	#include <skinning_vertex>
3274	#include <project_vertex>
3275	#include <logdepthbuf_vertex>
3276	#include <clipping_planes_vertex>
3277	#include <worldpos_vertex>
3278	#include <envmap_vertex>
3279	#include <fog_vertex>
3280}`,tfe=`uniform vec3 diffuse;
3281uniform float opacity;
3282#ifndef FLAT_SHADED
3283	varying vec3 vNormal;
3284#endif
3285#include <common>
3286#include <dithering_pars_fragment>
3287#include <color_pars_fragment>
3288#include <uv_pars_fragment>
3289#include <map_pars_fragment>
3290#include <alphamap_pars_fragment>
3291#include <alphatest_pars_fragment>
3292#include <alphahash_pars_fragment>
3293#include <aomap_pars_fragment>
3294#include <lightmap_pars_fragment>
3295#include <envmap_common_pars_fragment>
3296#include <envmap_pars_fragment>
3297#include <fog_pars_fragment>
3298#include <specularmap_pars_fragment>
3299#include <logdepthbuf_pars_fragment>
3300#include <clipping_planes_pars_fragment>
3301void main() {
3302	vec4 diffuseColor = vec4( diffuse, opacity );
3303	#include <clipping_planes_fragment>
3304	#include <logdepthbuf_fragment>
3305	#include <map_fragment>
3306	#include <color_fragment>
3307	#include <alphamap_fragment>
3308	#include <alphatest_fragment>
3309	#include <alphahash_fragment>
3310	#include <specularmap_fragment>
3311	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3312	#ifdef USE_LIGHTMAP
3313		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3314		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3315	#else
3316		reflectedLight.indirectDiffuse += vec3( 1.0 );
3317	#endif
3318	#include <aomap_fragment>
3319	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3320	vec3 outgoingLight = reflectedLight.indirectDiffuse;
3321	#include <envmap_fragment>
3322	#include <opaque_fragment>
3323	#include <tonemapping_fragment>
3324	#include <colorspace_fragment>
3325	#include <fog_fragment>
3326	#include <premultiplied_alpha_fragment>
3327	#include <dithering_fragment>
3328}`,nfe=`#define LAMBERT
3329varying vec3 vViewPosition;
3330#include <common>
3331#include <batching_pars_vertex>
3332#include <uv_pars_vertex>
3333#include <displacementmap_pars_vertex>
3334#include <envmap_pars_vertex>
3335#include <color_pars_vertex>
3336#include <fog_pars_vertex>
3337#include <normal_pars_vertex>
3338#include <morphtarget_pars_vertex>
3339#include <skinning_pars_vertex>
3340#include <shadowmap_pars_vertex>
3341#include <logdepthbuf_pars_vertex>
3342#include <clipping_planes_pars_vertex>
3343void main() {
3344	#include <uv_vertex>
3345	#include <color_vertex>
3346	#include <morphinstance_vertex>
3347	#include <morphcolor_vertex>
3348	#include <batching_vertex>
3349	#include <beginnormal_vertex>
3350	#include <morphnormal_vertex>
3351	#include <skinbase_vertex>
3352	#include <skinnormal_vertex>
3353	#include <defaultnormal_vertex>
3354	#include <normal_vertex>
3355	#include <begin_vertex>
3356	#include <morphtarget_vertex>
3357	#include <skinning_vertex>
3358	#include <displacementmap_vertex>
3359	#include <project_vertex>
3360	#include <logdepthbuf_vertex>
3361	#include <clipping_planes_vertex>
3362	vViewPosition = - mvPosition.xyz;
3363	#include <worldpos_vertex>
3364	#include <envmap_vertex>
3365	#include <shadowmap_vertex>
3366	#include <fog_vertex>
3367}`,rfe=`#define LAMBERT
3368uniform vec3 diffuse;
3369uniform vec3 emissive;
3370uniform float opacity;
3371#include <common>
3372#include <dithering_pars_fragment>
3373#include <color_pars_fragment>
3374#include <uv_pars_fragment>
3375#include <map_pars_fragment>
3376#include <alphamap_pars_fragment>
3377#include <alphatest_pars_fragment>
3378#include <alphahash_pars_fragment>
3379#include <aomap_pars_fragment>
3380#include <lightmap_pars_fragment>
3381#include <emissivemap_pars_fragment>
3382#include <cube_uv_reflection_fragment>
3383#include <envmap_common_pars_fragment>
3384#include <envmap_pars_fragment>
3385#include <envmap_physical_pars_fragment>
3386#include <fog_pars_fragment>
3387#include <bsdfs>
3388#include <lights_pars_begin>
3389#include <normal_pars_fragment>
3390#include <lights_lambert_pars_fragment>
3391#include <shadowmap_pars_fragment>
3392#include <bumpmap_pars_fragment>
3393#include <normalmap_pars_fragment>
3394#include <specularmap_pars_fragment>
3395#include <logdepthbuf_pars_fragment>
3396#include <clipping_planes_pars_fragment>
3397void main() {
3398	vec4 diffuseColor = vec4( diffuse, opacity );
3399	#include <clipping_planes_fragment>
3400	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3401	vec3 totalEmissiveRadiance = emissive;
3402	#include <logdepthbuf_fragment>
3403	#include <map_fragment>
3404	#include <color_fragment>
3405	#include <alphamap_fragment>
3406	#include <alphatest_fragment>
3407	#include <alphahash_fragment>
3408	#include <specularmap_fragment>
3409	#include <normal_fragment_begin>
3410	#include <normal_fragment_maps>
3411	#include <emissivemap_fragment>
3412	#include <lights_lambert_fragment>
3413	#include <lights_fragment_begin>
3414	#include <lights_fragment_maps>
3415	#include <lights_fragment_end>
3416	#include <aomap_fragment>
3417	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3418	#include <envmap_fragment>
3419	#include <opaque_fragment>
3420	#include <tonemapping_fragment>
3421	#include <colorspace_fragment>
3422	#include <fog_fragment>
3423	#include <premultiplied_alpha_fragment>
3424	#include <dithering_fragment>
3425}`,sfe=`#define MATCAP
3426varying vec3 vViewPosition;
3427#include <common>
3428#include <batching_pars_vertex>
3429#include <uv_pars_vertex>
3430#include <color_pars_vertex>
3431#include <displacementmap_pars_vertex>
3432#include <fog_pars_vertex>
3433#include <normal_pars_vertex>
3434#include <morphtarget_pars_vertex>
3435#include <skinning_pars_vertex>
3436#include <logdepthbuf_pars_vertex>
3437#include <clipping_planes_pars_vertex>
3438void main() {
3439	#include <uv_vertex>
3440	#include <color_vertex>
3441	#include <morphinstance_vertex>
3442	#include <morphcolor_vertex>
3443	#include <batching_vertex>
3444	#include <beginnormal_vertex>
3445	#include <morphnormal_vertex>
3446	#include <skinbase_vertex>
3447	#include <skinnormal_vertex>
3448	#include <defaultnormal_vertex>
3449	#include <normal_vertex>
3450	#include <begin_vertex>
3451	#include <morphtarget_vertex>
3452	#include <skinning_vertex>
3453	#include <displacementmap_vertex>
3454	#include <project_vertex>
3455	#include <logdepthbuf_vertex>
3456	#include <clipping_planes_vertex>
3457	#include <fog_vertex>
3458	vViewPosition = - mvPosition.xyz;
3459}`,ife=`#define MATCAP
3460uniform vec3 diffuse;
3461uniform float opacity;
3462uniform sampler2D matcap;
3463varying vec3 vViewPosition;
3464#include <common>
3465#include <dithering_pars_fragment>
3466#include <color_pars_fragment>
3467#include <uv_pars_fragment>
3468#include <map_pars_fragment>
3469#include <alphamap_pars_fragment>
3470#include <alphatest_pars_fragment>
3471#include <alphahash_pars_fragment>
3472#include <fog_pars_fragment>
3473#include <normal_pars_fragment>
3474#include <bumpmap_pars_fragment>
3475#include <n
3475ormalmap_pars_fragment>
3476#include <logdepthbuf_pars_fragment>
3477#include <clipping_planes_pars_fragment>
3478void main() {
3479	vec4 diffuseColor = vec4( diffuse, opacity );
3480	#include <clipping_planes_fragment>
3481	#include <logdepthbuf_fragment>
3482	#include <map_fragment>
3483	#include <color_fragment>
3484	#include <alphamap_fragment>
3485	#include <alphatest_fragment>
3486	#include <alphahash_fragment>
3487	#include <normal_fragment_begin>
3488	#include <normal_fragment_maps>
3489	vec3 viewDir = normalize( vViewPosition );
3490	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3491	vec3 y = cross( viewDir, x );
3492	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3493	#ifdef USE_MATCAP
3494		vec4 matcapColor = texture2D( matcap, uv );
3495	#else
3496		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3497	#endif
3498	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3499	#include <opaque_fragment>
3500	#include <tonemapping_fragment>
3501	#include <colorspace_fragment>
3502	#include <fog_fragment>
3503	#include <premultiplied_alpha_fragment>
3504	#include <dithering_fragment>
3505}`,afe=`#define NORMAL
3506#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3507	varying vec3 vViewPosition;
3508#endif
3509#include <common>
3510#include <batching_pars_vertex>
3511#include <uv_pars_vertex>
3512#include <displacementmap_pars_vertex>
3513#include <normal_pars_vertex>
3514#include <morphtarget_pars_vertex>
3515#include <skinning_pars_vertex>
3516#include <logdepthbuf_pars_vertex>
3517#include <clipping_planes_pars_vertex>
3518void main() {
3519	#include <uv_vertex>
3520	#include <batching_vertex>
3521	#include <beginnormal_vertex>
3522	#include <morphinstance_vertex>
3523	#include <morphnormal_vertex>
3524	#include <skinbase_vertex>
3525	#include <skinnormal_vertex>
3526	#include <defaultnormal_vertex>
3527	#include <normal_vertex>
3528	#include <begin_vertex>
3529	#include <morphtarget_vertex>
3530	#include <skinning_vertex>
3531	#include <displacementmap_vertex>
3532	#include <project_vertex>
3533	#include <logdepthbuf_vertex>
3534	#include <clipping_planes_vertex>
3535#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3536	vViewPosition = - mvPosition.xyz;
3537#endif
3538}`,ofe=`#define NORMAL
3539uniform float opacity;
3540#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3541	varying vec3 vViewPosition;
3542#endif
3543#include <uv_pars_fragment>
3544#include <normal_pars_fragment>
3545#include <bumpmap_pars_fragment>
3546#include <normalmap_pars_fragment>
3547#include <logdepthbuf_pars_fragment>
3548#include <clipping_planes_pars_fragment>
3549void main() {
3550	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3551	#include <clipping_planes_fragment>
3552	#include <logdepthbuf_fragment>
3553	#include <normal_fragment_begin>
3554	#include <normal_fragment_maps>
3555	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3556	#ifdef OPAQUE
3557		gl_FragColor.a = 1.0;
3558	#endif
3559}`,lfe=`#define PHONG
3560varying vec3 vViewPosition;
3561#include <common>
3562#include <batching_pars_vertex>
3563#include <uv_pars_vertex>
3564#include <displacementmap_pars_vertex>
3565#include <envmap_pars_vertex>
3566#include <color_pars_vertex>
3567#include <fog_pars_vertex>
3568#include <normal_pars_vertex>
3569#include <morphtarget_pars_vertex>
3570#include <skinning_pars_vertex>
3571#include <shadowmap_pars_vertex>
3572#include <logdepthbuf_pars_vertex>
3573#include <clipping_planes_pars_vertex>
3574void main() {
3575	#include <uv_vertex>
3576	#include <color_vertex>
3577	#include <morphcolor_vertex>
3578	#include <batching_vertex>
3579	#include <beginnormal_vertex>
3580	#include <morphinstance_vertex>
3581	#include <morphnormal_vertex>
3582	#include <skinbase_vertex>
3583	#include <skinnormal_vertex>
3584	#include <defaultnormal_vertex>
3585	#include <normal_vertex>
3586	#include <begin_vertex>
3587	#include <morphtarget_vertex>
3588	#include <skinning_vertex>
3589	#include <displacementmap_vertex>
3590	#include <project_vertex>
3591	#include <logdepthbuf_vertex>
3592	#include <clipping_planes_vertex>
3593	vViewPosition = - mvPosition.xyz;
3594	#include <worldpos_vertex>
3595	#include <envmap_vertex>
3596	#include <shadowmap_vertex>
3597	#include <fog_vertex>
3598}`,cfe=`#define PHONG
3599uniform vec3 diffuse;
3600uniform vec3 emissive;
3601uniform vec3 specular;
3602uniform float shininess;
3603uniform float opacity;
3604#include <common>
3605#include <dithering_pars_fragment>
3606#include <color_pars_fragment>
3607#include <uv_pars_fragment>
3608#include <map_pars_fragment>
3609#include <alphamap_pars_fragment>
3610#include <alphatest_pars_fragment>
3611#include <alphahash_pars_fragment>
3612#include <aomap_pars_fragment>
3613#include <lightmap_pars_fragment>
3614#include <emissivemap_pars_fragment>
3615#include <cube_uv_reflection_fragment>
3616#include <envmap_common_pars_fragment>
3617#include <envmap_pars_fragment>
3618#include <envmap_physical_pars_fragment>
3619#include <fog_pars_fragment>
3620#include <bsdfs>
3621#include <lights_pars_begin>
3622#include <normal_pars_fragment>
3623#include <lights_phong_pars_fragment>
3624#include <shadowmap_pars_fragment>
3625#include <bumpmap_pars_fragment>
3626#include <normalmap_pars_fragment>
3627#include <specularmap_pars_fragment>
3628#include <logdepthbuf_pars_fragment>
3629#include <clipping_planes_pars_fragment>
3630void main() {
3631	vec4 diffuseColor = vec4( diffuse, opacity );
3632	#include <clipping_planes_fragment>
3633	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3634	vec3 totalEmissiveRadiance = emissive;
3635	#include <logdepthbuf_fragment>
3636	#include <map_fragment>
3637	#include <color_fragment>
3638	#include <alphamap_fragment>
3639	#include <alphatest_fragment>
3640	#include <alphahash_fragment>
3641	#include <specularmap_fragment>
3642	#include <normal_fragment_begin>
3643	#include <normal_fragment_maps>
3644	#include <emissivemap_fragment>
3645	#include <lights_phong_fragment>
3646	#include <lights_fragment_begin>
3647	#include <lights_fragment_maps>
3648	#include <lights_fragment_end>
3649	#include <aomap_fragment>
3650	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3651	#include <envmap_fragment>
3652	#include <opaque_fragment>
3653	#include <tonemapping_fragment>
3654	#include <colorspace_fragment>
3655	#include <fog_fragment>
3656	#include <premultiplied_alpha_fragment>
3657	#include <dithering_fragment>
3658}`,ufe=`#define STANDARD
3659varying vec3 vViewPosition;
3660#ifdef USE_TRANSMISSION
3661	varying vec3 vWorldPosition;
3662#endif
3663#include <common>
3664#include <batching_pars_vertex>
3665#include <uv_pars_vertex>
3666#include <displacementmap_pars_vertex>
3667#include <color_pars_vertex>
3668#include <fog_pars_vertex>
3669#include <normal_pars_vertex>
3670#include <morphtarget_pars_vertex>
3671#include <skinning_pars_vertex>
3672#include <shadowmap_pars_vertex>
3673#include <logdepthbuf_pars_vertex>
3674#include <clipping_planes_pars_vertex>
3675void main() {
3676	#include <uv_vertex>
3677	#include <color_vertex>
3678	#include <morphinstance_vertex>
3679	#include <morphcolor_vertex>
3680	#include <batching_vertex>
3681	#include <beginnormal_vertex>
3682	#include <morphnormal_vertex>
3683	#include <skinbase_vertex>
3684	#include <skinnormal_vertex>
3685	#include <defaultnormal_vertex>
3686	#include <normal_vertex>
3687	#include <begin_vertex>
3688	#include <morphtarget_vertex>
3689	#include <skinning_vertex>
3690	#include <displacementmap_vertex>
3691	#include <project_vertex>
3692	#include <logdepthbuf_vertex>
3693	#include <clipping_planes_vertex>
3694	vViewPosition = - mvPosition.xyz;
3695	#include <worldpos_vertex>
3696	#include <shadowmap_vertex>
3697	#include <fog_vertex>
3698#ifdef USE_TRANSMISSION
3699	vWorldPosition = worldPosition.xyz;
3700#endif
3701}`,dfe=`#define STANDARD
3702#ifdef PHYSICAL
3703	#define IOR
3704	#define USE_SPECULAR
3705#endif
3706uniform vec3 diffuse;
3707uniform vec3 emissive;
3708uniform float roughness;
3709uniform float metalness;
3710uniform float opacity;
3711#ifdef IOR
3712	uniform float ior;
3713#endif
3714#ifdef USE_SPECULAR
3715	uniform float specularIntensity;
3716	uniform vec3 specularColor;
3717	#ifdef USE_SPECULAR_COLORMAP
3718		uniform sampler2D specularColorMap;
3719	#endif
3720	#ifdef USE_SPECULAR_INTENSITYMAP
3721		uniform sampler2D specularIntensityMap;
3722	#endif
3723#endif
3724#ifdef USE_CLEARCOAT
3725	uniform float clearcoat;
3726	uniform float clearcoatRoughness;
3727#endif
3728#ifdef USE_DISPERSION
3729	uniform float dispersion;
3730#endif
3731#ifdef USE_IRIDESCENCE
3732	uniform float iridescence;
3733	uniform float iridescenceIOR;
3734	uniform float iridescenceThicknessMinimum;
3735	uniform float iridescenceThicknessMaximum;
3736#endif
3737#ifdef USE_SHEEN
3738	uniform vec3 sheenColor;
3739	uniform float sheenRoughness;
3740	#ifdef USE_SHEEN_COLORMAP
3741		uniform sampler2D sheenColorMap;
3742	#endif
3743	#ifdef USE_SHEEN_ROUGHNESSMAP
3744		uniform sampler2D sheenRoughnessMap;
3745	#endif
3746#endif
3747#ifdef USE_ANISOTROPY
3748	uniform vec2 anisotropyVector;
3749	#ifdef USE_ANISOTROPYMAP
3750		uniform sampler2D anisotropyMap;
3751	#endif
3752#endif
3753varying vec3 vViewPosition;
3754#include <common>
3755#include <dithering_pars_fragment>
3756#include <color_pars_fragment>
3757#include <uv_pars_fragment>
3758#include <map_pars_fragment>
3759#include <alphamap_pars_fragment>
3760#include <alphatest_pars_fragment>
3761#include <alphahash_pars_fragment>
3762#include <aomap_pars_fragment>
3763#include <lightmap_pars_fragment>
3764#include <emissivemap_pars_fragment>
3765#include <iridescence_fragment>
3766#include <cube_uv_reflection_fragment>
3767#include <envmap_common_pars_fragment>
3768#include <envmap_physical_pars_fragment>
3769#include <fog_pars_fragment>
3770#include <lights_pars_begin>
3771#include <normal_pars_fragment>
3772#include <lights_physical_pars_fragment>
3773#include <transmission_pars_fragment>
3774#include <shadowmap_pars_fragment>
3775#include <bumpmap_pars_fragment>
3776#include <normalmap_pars_fragment>
3777#include <clearcoat_pars_fragment>
3778#include <iridescence_pars_fragment>
3779#include <roughnessmap_pars_fragment>
3780#include <metalnessmap_pars_fragment>
3781#include <logdepthbuf_pars_fragment>
3782#include <clipping_planes_pars_fragment>
3783void main() {
3784	vec4 diffuseColor = vec4( diffuse, opacity );
3785	#include <clipping_planes_fragment>
3786	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3787	vec3 totalEmissiveRadiance = emissive;
3788	#include <logdepthbuf_fragment>
3789	#include <map_fragment>
3790	#include <color_fragment>
3791	#include <alphamap_fragment>
3792	#include <alphatest_fragment>
3793	#include <alphahash_fragment>
3794	#include <roughnessmap_fragment>
3795	#include <metalnessmap_fragment>
3796	#include <normal_fragment_begin>
3797	#include <normal_fragment_maps>
3798	#include <clearcoat_normal_fragment_begin>
3799	#include <clearcoat_normal_fragment_maps>
3800	#include <emissivemap_fragment>
3801	#include <lights_physical_fragment>
3802	#include <lights_fragment_begin>
3803	#include <lights_fragment_maps>
3804	#include <lights_fragment_end>
3805	#include <aomap_fragment>
3806	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3807	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3808	#include <transmission_fragment>
3809	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3810	#ifdef USE_SHEEN
3811 
3812		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3813 
3814 	#endif
3815	#ifdef USE_CLEARCOAT
3816		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3817		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3818		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3819	#endif
3820	#include <opaque_fragment>
3821	#include <tonemapping_fragment>
3822	#include <colorspace_fragment>
3823	#include <fog_fragment>
3824	#include <premultiplied_alpha_fragment>
3825	#include <dithering_fragment>
3826}`,ffe=`#define TOON
3827varying vec3 vViewPosition;
3828#include <common>
3829#include <batching_pars_vertex>
3830#include <uv_pars_vertex>
3831#include <displacementmap_pars_vertex>
3832#include <color_pars_vertex>
3833#include <fog_pars_vertex>
3834#include <normal_pars_vertex>
3835#include <morphtarget_pars_vertex>
3836#include <skinning_pars_vertex>
3837#include <shadowmap_pars_vertex>
3838#include <logdepthbuf_pars_vertex>
3839#include <clipping_planes_pars_vertex>
3840void main() {
3841	#include <uv_vertex>
3842	#include <color_vertex>
3843	#include <morphinstance_vertex>
3844	#include <morphcolor_vertex>
3845	#include <batching_vertex>
3846	#include <beginnormal_vertex>
3847	#include <morphnormal_vertex>
3848	#include <skinbase_vertex>
3849	#include <skinnormal_vertex>
3850	#include <defaultnormal_vertex>
3851	#include <normal_vertex>
3852	#include <begin_vertex>
3853	#include <morphtarget_vertex>
3854	#include <skinning_vertex>
3855	#include <displacementmap_vertex>
3856	#include <project_vertex>
3857	#include <logdepthbuf_vertex>
3858	#include <clipping_planes_vertex>
3859	vViewPosition = - mvPosition.xyz;
3860	#include <worldpos_vertex>
3861	#include <shadowmap_vertex>
3862	#include <fog_vertex>
3863}`,hfe=`#define TOON
3864uniform vec3 diffuse;
3865uniform vec3 emissive;
3866uniform float opacity;
3867#include <common>
3868#include <dithering_pars_fragment>
3869#include <color_pars_fragment>
3870#include <uv_pars_fragment>
3871#include <map_pars_fragment>
3872#include <alphamap_pars_fragment>
3873#include <alphatest_pars_fragment>
3874#include <alphahash_pars_fragment>
3875#include <aomap_pars_fragment>
3876#include <lightmap_pars_fragment>
3877#include <emissivemap_pars_fragment>
3878#include <gradientmap_pars_fragment>
3879#include <fog_pars_fragment>
3880#include <bsdfs>
3881#include <lights_pars_begin>
3882#include <normal_pars_fragment>
3883#include <lights_toon_pars_fragment>
3884#include <shadowmap_pars_fragment>
3885#include <bumpmap_pars_fragment>
3886#include <normalmap_pars_fragment>
3887#include <logdepthbuf_pars_fragment>
3888#include <clipping_planes_pars_fragment>
3889void main() {
3890	vec4 diffuseColor = vec4( diffuse, opacity );
3891	#include <clipping_planes_fragment>
3892	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3893	vec3 totalEmissiveRadiance = emissive;
3894	#include <logdepthbuf_fragment>
3895	#include <map_fragment>
3896	#include <color_fragment>
3897	#include <alphamap_fragment>
3898	#include <alphatest_fragment>
3899	#include <alphahash_fragment>
3900	#include <normal_fragment_begin>
3901	#include <normal_fragment_maps>
3902	#include <emissivemap_fragment>
3903	#include <lights_toon_fragment>
3904	#include <lights_fragment_begin>
3905	#include <lights_fragment_maps>
3906	#include <lights_fragment_end>
3907	#include <aomap_fragment>
3908	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3909	#include <opaque_fragment>
3910	#include <tonemapping_fragment>
3911	#include <colorspace_fragment>
3912	#include <fog_fragment>
3913	#include <premultiplied_alpha_fragment>
3914	#include <dithering_fragment>
3915}`,mfe=`uniform float size;
3916uniform float scale;
3917#include <common>
3918#include <color_pars_vertex>
3919#include <fog_pars_vertex>
3920#include <morphtarget_pars_vertex>
3921#include <logdepthbuf_pars_vertex>
3922#include <clipping_planes_pars_vertex>
3923#ifdef USE_POINTS_UV
3924	varying vec2 vUv;
3925	uniform mat3 uvTransform;
3926#endif
3927void main() {
3928	#ifdef USE_POINTS_UV
3929		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3930	#endif
3931	#include <color_vertex>
3932	#include <morphinstance_vertex>
3933	#include <morphcolor_vertex>
3934	#include <begin_vertex>
3935	#include <morphtarget_vertex>
3936	#include <project_vertex>
3937	gl_PointSize = size;
3938	#ifdef USE_SIZEATTENUATION
3939		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3940		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3941	#endif
3942	#include <logdepthbuf_vertex>
3943	#include <clipping_planes_vertex>
3944	#include <worldpos_vertex>
3945	#include <fog_vertex>
3946}`,pfe=`uniform vec3 diffuse;
3947uniform float opacity;
3948#include <common>
3949#include <color_pars_fragment>
3950#include <map_particle_pars_fragment>
3951#include <alphatest_pars_fragment>
3952#include <alphahash_pars_fragment>
3953#include <fog_pars_fragment>
3954#include <logdepthbuf_pars_fragment>
3955#include <clipping_planes_pars_fragment>
3956void main() {
3957	vec4 diffuseColor = vec4( diffuse, opacity );
3958	#include <clipping_planes_fragment>
3959	vec3 outgoingLight = vec3( 0.0 );
3960	#include <logdepthbuf_fragment>
3961	#include <map_particle_fragment>
3962	#include <color_fragment>
3963	#include <alphatest_fragment>
3964	#include <alphahash_fragment>
3965	outgoingLight = diffuseColor.rgb;
3966	#include <opaque_fragment>
3967	#include <tonemapping_fragment>
3968	#include <colorspace_fragment>
3969	#include <fog_fragment>
3970	#include <premultiplied_alpha_fragment>
3971}`,gfe=`#include <common>
3972#include <batching_pars_vertex>
3973#include <fog_pars_vertex>
3974#include <morphtarget_pars_vertex>
3975#include <skinning_pars_vertex>
3976#include <logdepthbuf_pars_vertex>
3977#include <shadowmap_pars_vertex>
3978void main() {
3979	#include <batching_vertex>
3980	#include <beginnormal_vertex>
3981	#include <morphinstance_vertex>
3982	#include <morphnormal_vertex>
3983	#include <skinbase_vertex>
3984	#include <skinnormal_vertex>
3985	#include <defaultnormal_vertex>
3986	#include <begin_vertex>
3987	#include <morphtarget_vertex>
3988	#include <skinning_vertex>
3989	#include <project_vertex>
3990	#include <logdepthbuf_vertex>
3991	#include <worldpos_vertex>
3992	#include <shadowmap_vertex>
3993	#include <fog_vertex>
3994}`,xfe=`uniform vec3 color;
3995uniform float opacity;
3996#include <common>
3997#include <fog_pars_fragment>
3998#include <bsdfs>
3999#include <lights_pars_begin>
4000#include <logdepthbuf_pars_fragment>
4001#include <shadowmap_pars_fragment>
4002#include <shadowmask_pars_fragment>
4003void main() {
4004	#include <logdepthbuf_fragment>
4005	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
4006	#include <tonemapping_fragment>
4007	#include <colorspace_fragment>
4008	#include <fog_fragment>
4009	#include <premultiplied_alpha_fragment>
4010}`,bfe=`uniform float rotation;
4011uniform vec2 center;
4012#include <common>
4013#include <uv_pars_vertex>
4014#include <fog_pars_vertex>
4015#include <logdepthbuf_pars_vertex>
4016#include <clipping_planes_pars_vertex>
4017void main() {
4018	#include <uv_vertex>
4019	vec4 mvPosition = modelViewMatrix[ 3 ];
4020	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
4021	#ifndef USE_SIZEATTENUATION
4022		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4023		if ( isPerspective ) scale *= - mvPosition.z;
4024	#endif
4025	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
4026	vec2 rotatedPosition;
4027	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
4028	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
4029	mvPosition.xy += rotatedPosition;
4030	gl_Position = projectionMatrix * mvPosition;
4031	#include <logdepthbuf_vertex>
4032	#include <clipping_planes_vertex>
4033	#include <fog_vertex>
4034}
4034`,yfe=`uniform vec3 diffuse;
4035uniform float opacity;
4036#include <common>
4037#include <uv_pars_fragment>
4038#include <map_pars_fragment>
4039#include <alphamap_pars_fragment>
4040#include <alphatest_pars_fragment>
4041#include <alphahash_pars_fragment>
4042#include <fog_pars_fragment>
4043#include <logdepthbuf_pars_fragment>
4044#include <clipping_planes_pars_fragment>
4045void main() {
4046	vec4 diffuseColor = vec4( diffuse, opacity );
4047	#include <clipping_planes_fragment>
4048	vec3 outgoingLight = vec3( 0.0 );
4049	#include <logdepthbuf_fragment>
4050	#include <map_fragment>
4051	#include <alphamap_fragment>
4052	#include <alphatest_fragment>
4053	#include <alphahash_fragment>
4054	outgoingLight = diffuseColor.rgb;
4055	#include <opaque_fragment>
4056	#include <tonemapping_fragment>
4057	#include <colorspace_fragment>
4058	#include <fog_fragment>
4059}`,Yn={alphahash_fragment:Uce,alphahash_pars_fragment:zce,alphamap_fragment:Gce,alphamap_pars_fragment:Hce,alphatest_fragment:Vce,alphatest_pars_fragment:Wce,aomap_fragment:$ce,aomap_pars_fragment:Xce,batching_pars_vertex:qce,batching_vertex:Yce,begin_vertex:Qce,beginnormal_vertex:Kce,bsdfs:Jce,iridescence_fragment:Zce,bumpmap_pars_fragment:eue,clipping_planes_fragment:tue,clipping_planes_pars_fragment:nue,clipping_planes_pars_vertex:rue,clipping_planes_vertex:sue,color_fragment:iue,color_pars_fragment:aue,color_pars_vertex:oue,color_vertex:lue,common:cue,cube_uv_reflection_fragment:uue,defaultnormal_vertex:due,displacementmap_pars_vertex:fue,displacementmap_vertex:hue,emissivemap_fragment:mue,emissivemap_pars_fragment:pue,colorspace_fragment:gue,colorspace_pars_fragment:xue,envmap_fragment:bue,envmap_common_pars_fragment:yue,envmap_pars_fragment:vue,envmap_pars_vertex:wue,envmap_physical_pars_fragment:Pue,envmap_vertex:Sue,fog_vertex:_ue,fog_pars_vertex:Mue,fog_fragment:Nue,fog_pars_fragment:Aue,gradientmap_pars_fragment:Cue,lightmap_pars_fragment:Eue,lights_lambert_fragment:jue,lights_lambert_pars_fragment:Tue,lights_pars_begin:Rue,lights_toon_fragment:Due,lights_toon_pars_fragment:kue,lights_phong_fragment:Iue,lights_phong_pars_fragment:Bue,lights_physical_fragment:Lue,lights_physical_pars_fragment:Oue,lights_fragment_begin:Fue,lights_fragment_maps:Uue,lights_fragment_end:zue,lightprobes_pars_fragment:Gue,logdepthbuf_fragment:Hue,logdepthbuf_pars_fragment:Vue,logdepthbuf_pars_vertex:Wue,logdepthbuf_vertex:$ue,map_fragment:Xue,map_pars_fragment:que,map_particle_fragment:Yue,map_particle_pars_fragment:Que,metalnessmap_fragment:Kue,metalnessmap_pars_fragment:Jue,morphinstance_vertex:Zue,morphcolor_vertex:ede,morphnormal_vertex:tde,morphtarget_pars_vertex:nde,morphtarget_vertex:rde,normal_fragment_begin:sde,normal_fragment_maps:ide,normal_pars_fragment:ade,normal_pars_vertex:ode,normal_vertex:lde,normalmap_pars_fragment:cde,clearcoat_normal_fragment_begin:ude,clearcoat_normal_fragment_maps:dde,clearcoat_pars_fragment:fde,iridescence_pars_fragment:hde,opaque_fragment:mde,packing:pde,premultiplied_alpha_fragment:gde,project_vertex:xde,dithering_fragment:bde,dithering_pars_fragment:yde,roughnessmap_fragment:vde,roughnessmap_pars_fragment:wde,shadowmap_pars_fragment:Sde,shadowmap_pars_vertex:_de,shadowmap_vertex:Mde,shadowmask_pars_fragment:Nde,skinbase_vertex:Ade,skinning_pars_vertex:Cde,skinning_vertex:Ede,skinnormal_vertex:jde,specularmap_fragment:Tde,specularmap_pars_fragment:Rde,tonemapping_fragment:Pde,tonemapping_pars_fragment:Dde,transmission_fragment:kde,transmission_pars_fragment:Ide,uv_pars_fragment:Bde,uv_pars_vertex:Lde,uv_vertex:Ode,worldpos_vertex:Fde,background_vert:Ude,background_frag:zde,backgroundCube_vert:Gde,backgroundCube_frag:Hde,cube_vert:Vde,cube_frag:Wde,depth_vert:$de,depth_frag:Xde,distance_vert:qde,distance_frag:Yde,equirect_vert:Qde,equirect_frag:Kde,linedashed_vert:Jde,linedashed_frag:Zde,meshbasic_vert:efe,meshbasic_frag:tfe,meshlambert_vert:nfe,meshlambert_frag:rfe,meshmatcap_vert:sfe,meshmatcap_frag:ife,meshnormal_vert:afe,meshnormal_frag:ofe,meshphong_vert:lfe,meshphong_frag:cfe,meshphysical_vert:ufe,meshphysical_frag:dfe,meshtoon_vert:ffe,meshtoon_frag:hfe,points_vert:mfe,points_frag:pfe,shadow_vert:gfe,shadow_frag:xfe,sprite_vert:bfe,sprite_frag:yfe},Xt={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ln},alphaMap:{value:null},alphaMapTransform:{value:new Ln},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ln}},envmap:{envMap:{value:null},envMapRotation:{value:new Ln},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ln}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ln}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ln},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ln},normalScale:{value:new wt(1,1)}}
vendor: 7,574 bytes, line 4059
4059,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ln},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ln}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ln}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ln}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new we},probesMax:{value:new we},probesResolution:{value:new we}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ln},alphaTest:{value:0},uvTransform:{value:new Ln}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new wt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ln},alphaMap:{value:null},alphaMapTransform:{value:new Ln},alphaTest:{value:0}}},wc={basic:{uniforms:Xa([Xt.common,Xt.specularmap,Xt.envmap,Xt.aomap,Xt.lightmap,Xt.fog]),vertexShader:Yn.meshbasic_vert,fragmentShader:Yn.meshbasic_frag},lambert:{uniforms:Xa([Xt.common,Xt.specularmap,Xt.envmap,Xt.aomap,Xt.lightmap,Xt.emissivemap,Xt.bumpmap,Xt.normalmap,Xt.displacementmap,Xt.fog,Xt.lights,{emissive:{value:new Ut(0)},envMapIntensity:{value:1}}]),vertexShader:Yn.meshlambert_vert,fragmentShader:Yn.meshlambert_frag},phong:{uniforms:Xa([Xt.common,Xt.specularmap,Xt.envmap,Xt.aomap,Xt.lightmap,Xt.emissivemap,Xt.bumpmap,Xt.normalmap,Xt.displacementmap,Xt.fog,Xt.lights,{emissive:{value:new Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Yn.meshphong_vert,fragmentShader:Yn.meshphong_frag},standard:{uniforms:Xa([Xt.common,Xt.envmap,Xt.aomap,Xt.lightmap,Xt.emissivemap,Xt.bumpmap,Xt.normalmap,Xt.displacementmap,Xt.roughnessmap,Xt.metalnessmap,Xt.fog,Xt.lights,{emissive:{value:new Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Yn.meshphysical_vert,fragmentShader:Yn.meshphysical_frag},toon:{uniforms:Xa([Xt.common,Xt.aomap,Xt.lightmap,Xt.emissivemap,Xt.bumpmap,Xt.normalmap,Xt.displacementmap,Xt.gradientmap,Xt.fog,Xt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:Yn.meshtoon_vert,fragmentShader:Yn.meshtoon_frag},matcap:{uniforms:Xa([Xt.common,Xt.bumpmap,Xt.normalmap,Xt.displacementmap,Xt.fog,{matcap:{value:null}}]),vertexShader:Yn.meshmatcap_vert,fragmentShader:Yn.meshmatcap_frag},points:{uniforms:Xa([Xt.points,Xt.fog]),vertexShader:Yn.points_vert,fragmentShader:Yn.points_frag},dashed:{uniforms:Xa([Xt.common,Xt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Yn.linedashed_vert,fragmentShader:Yn.linedashed_frag},depth:{uniforms:Xa([Xt.common,Xt.displacementmap]),vertexShader:Yn.depth_vert,fragmentShader:Yn.depth_frag},normal:{uniforms:Xa([Xt.common,Xt.bumpmap,Xt.normalmap,Xt.displacementmap,{opacity:{value:1}}]),vertexShader:Yn.meshnormal_vert,fragmentShader:Yn.meshnormal_frag},sprite:{uniforms:Xa([Xt.sprite,Xt.fog]),vertexShader:Yn.sprite_vert,fragmentShader:Yn.sprite_frag},background:{uniforms:{uvTransform:{value:new Ln},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Yn.background_vert,fragmentShader:Yn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ln}},vertexShader:Yn.backgroundCube_vert,fragmentShader:Yn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Yn.cube_vert,fragmentShader:Yn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Yn.equirect_vert,fragmentShader:Yn.equirect_frag},distance:{uniforms:Xa([Xt.common,Xt.displacementmap,{referencePosition:{value:new we},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Yn.distance_vert,fragmentShader:Yn.distance_frag},shadow:{uniforms:Xa([Xt.lights,Xt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:Yn.shadow_vert,fragmentShader:Yn.shadow_frag}};wc.physical={uniforms:Xa([wc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ln},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ln},clearcoatNormalScale:{value:new wt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ln},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ln},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ln},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ln},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ln},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ln},transmissionSamplerSize:{value:new wt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ln},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ln},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ln},anisotropyVector:{value:new wt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ln}}]),vertexShader:Yn.meshphysical_vert,fragmentShader:Yn.meshphysical_frag};const AS={r:0,b:0,g:0},vfe=new yn,S9=new Ln;S9.set(-1,0,0,0,1,0,0,0,1);function wfe(n,e,t,r,s,a){const o=new Ut(0);let l=s===!0?0:1,u,d,h=null,p=0,x=null;function y(A){let E=A.isScene===!0?A.background:null;if(E&&E.isTexture){const C=A.backgroundBlurriness>0;E=e.get(E,C)}return E}function v(A){let E=!1;const C=y(A);C===null?M(o,l):C&&C.isColor&&(M(C,1),E=!0);const I=n.xr.getEnvironmentBlendMode();I==="additive"?t.buffers.color.setClear(0,0,0,1,a):I==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,a),(n.autoClear||E)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function _(A,E){const C=y(E);C&&(C.isCubeTexture||C.mapping===a0)?(d===void 0&&(d=new Ns(new Ep(1,1,1),new oo({name:"Backgroun
4059dCubeMaterial",uniforms:Hx(wc.backgroundCube.uniforms),vertexShader:wc.backgroundCube.vertexShader,fragmentShader:wc.backgroundCube.fragmentShader,side:Da,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(I,D,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),d.material.uniforms.envMap.value=C,d.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(vfe.makeRotationFromEuler(E.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&d.material.uniforms.backgroundRotation.value.premultiply(S9),d.material.toneMapped=ur.getTransfer(C.colorSpace)!==$r,(h!==C||p!==C.version||x!==n.toneMapping)&&(d.material.needsUpdate=!0,h=C,p=C.version,x=n.toneMapping),d.layers.enableAll(),A.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(u===void 0&&(u=new Ns(new Yd(2,2),new oo({name:"BackgroundMaterial",uniforms:Hx(wc.background.uniforms),vertexShader:wc.background.vertexShader,fragmentShader:wc.background.fragmentShader,side:Bu,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(u)),u.material.uniforms.t2D.value=C,u.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,u.material.toneMapped=ur.getTransfer(C.colorSpace)!==$r,C.matrixAutoUpdate===!0&&C.updateMatrix(),u.material.uniforms.uvTransform.value.copy(C.matrix),(h!==C||p!==C.version||x!==n.toneMapping)&&(u.material.needsUpdate=!0,h=C,p=C.version,x=n.toneMapping),u.layers.enableAll(),A.unshift(u,u.geometry,u.material,0,0,null))}function M(A,E){A.getRGB(AS,H8(n)),t.buffers.color.setClear(AS.r,AS.g,AS.b,E,a)}function S(){d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0),u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0)}return{getClearColor:function(){return o},setClearColor:function(A,E=1){o.set(A),l=E,M(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,M(o,l)},render:v,addToRenderList:_,dispose:S}}function Sfe(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},s=x(null);let a=s,o=!1;function l(V,U,$,X,ee){let z=!1;const K=p(V,X,$,U);a!==K&&(a=K,d(a.object)),z=y(V,X,$,ee),z&&v(V,X,$,ee),ee!==null&&e.update(ee,n.ELEMENT_ARRAY_BUFFER),(z||o)&&(o=!1,C(V,U,$,X),ee!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(ee).buffer))}function u(){return n.createVertexArray()}function d(V){return n.bindVertexArray(V)}function h(V){return n.deleteVertexArray(V)}function p(V,U,$,X){const ee=X.wireframe===!0;let z=r[U.id];z===void 0&&(z={},r[U.id]=z);const K=V.isInstancedMesh===!0?V.id:0;let ae=z[K];ae===void 0&&(ae={},z[K]=ae);let oe=ae[$.id];oe===void 0&&(oe={},ae[$.id]=oe);let re=oe[ee];return re===void 0&&(re=x(u()),oe[ee]=re),re}function x(V){const U=[],$=[],X=[];for(let ee=0;ee<t;ee++)U[ee]=0,$[ee]=0,X[ee]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:$,attributeDivisors:X,object:V,attributes:{},index:null}}function y(V,U,$,X){const ee=a.attributes,z=U.attributes;let K=0;const ae=$.getAttributes();for(const oe in ae)if(ae[oe].location>=0){const F=ee[oe];let O=z[oe];if(O===void 0&&(oe==="instanceMatrix"&&V.instanceMatrix&&(O=V.instanceMatrix),oe==="instanceColor"&&V.instanceColor&&(O=V.instanceColor)),F===void 0||F.attribute!==O||O&&F.data!==O.data)return!0;K++}return a.attributesNum!==K||a.index!==X}function v(V,U,$,X){const ee={},z=U.attributes;let K=0;const ae=$.getAttributes();for(const oe in ae)if(ae[oe].location>=0){let F=z[oe];F===void 0&&(oe==="instanceMatrix"&&V.instanceMatrix&&(F=V.instanceMatrix),oe==="instanceColor"&&V.instanceColor&&(F=V.instanceColor));const O={};O.attribute=F,F&&F.data&&(O.data=F.data),ee[oe]=O,K++}a.attributes=ee,a.attributesNum=K,a.index=X}function _(){const V=a.newAttributes;for(let U=0,$=V.length;U<$;U++)V[U]=0}function M(V){S(V,0)}function S(V,U){const $=a.newAttributes,X=a.enabledAttributes,ee=a.attributeDivisors;$[V]=1,X[V]===0&&(n.enableVertexAttribArray(V),X[V]=1),ee[V]!==U&&(n.vertexAttribDivisor(V,U),ee[V]=U)}function A(){const V=a.newAttributes,U=a.enabledAttributes;for(let $=0,X=U.length;$<X;$++)U[$]!==V[$]&&(n.disableVertexAttribArray($),U[$]=0)}function E(V,U,$,X,ee,z,K){K===!0?n.vertexAttribIPointer(V,U,$,ee,z):n.vertexAttribPointer(V,U,$,X,ee,z)}function C(V,U,$,X){_();const ee=X.attributes,z=$.getAttributes(),K=U.defaultAttributeValues;for(const ae in z){const oe=z[ae];if(oe.location>=0){let re=ee[ae];if(re===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(re=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(re=V.instanceColor)),re!==void 0){const F=re.normalized,O=re.itemSize,J=e.get(re);if(J===void 0)continue;const q=J.buffer,Q=J.type,ne=J.bytesPerElement,Z=Q===n.INT||Q===n.UNSIGNED_INT||re.gpuType===MN;if(re.isInterleavedBufferAttribute){const se=re.data,me=se.stride,ze=re.offset;if(se.isInstancedInterleavedBuffer){for(let Be=0;Be<oe.locationSize;Be++)S(oe.location+Be,se.meshPerAttribute);V.isInstancedMesh!==!0&&X._maxInstanceCount===void 0&&(X._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Be=0;Be<oe.locationSize;Be++)M(oe.location+Be);n.bindBuffer(n.ARRAY_BUFFER,q);for(let Be=0;Be<oe.locationSize;Be++)E(oe.location+Be,O/oe.locationSize,Q,F,me*ne,(ze+O/oe.locationSize*Be)*ne,Z)}else{if(re.isInstancedBufferAttribute){for(let se=0;se<oe.locationSize;se++)S(oe.location+se,re.meshPerAttribute);V.isInstancedMesh!==!0&&X._maxInstanceCount===void 0&&(X._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let se=0;se<oe.locationSize;se++)M(oe.location+se);n.bindBuffer(n.ARRAY_BUFFER,q);for(let se=0;se<oe.locationSize;se++)E(oe.location+se,O/oe.locationSize,Q,F,O*ne,O/oe.locationSize*se*ne,Z)}}else if(K!==void 0){const F=K[ae];if(F!==void 0)switch(F.length){case 2:n.vertexAttrib2fv(oe.location,F);break;case 3:n.vertexAttrib3fv(oe.location,F);break;case 4:n.vertexAttrib4fv(oe.location,F);break;default:n.vertexAttrib1fv(oe.location,F)}}}}A()}function I(){G();for(const V in r){const U=r[V];for(const $ in U){const X=U[$];for(const ee in X){const z=X[ee];for(const K in z)h(z[K].object),delete z[K];delete X[ee]}}delete r[V]}}function D(V){if(r[V.id]===void 0)return;const U=r[V.id];for(const $ in U){const X=U[$];for(const ee in X){const z=X[ee];for(const K in z)h(z[K].object),delete z[K];delete X[ee]}}delete r[V.id]}function B(V){for(const U in r){const $=r[U];for(const X in $){const ee=$[X];if(ee[V.id]===void 0)continue;const z=ee[V.id];for(const K in z)h(z[K].object),delete z[K];delete ee[V.id]}}}function P(V){for(const U in r){const $=r[U],X=V.isInstancedMesh===!0?V.id:0,ee=$[X];if(ee!==void 0){for(const z in ee){const K=ee[z];for(const ae in K)h(K[ae].object),delete K[ae];delete ee[z]}
vendor: 7,355 bytes, line 4059
4059delete $[X],Object.keys($).length===0&&delete r[U]}}}function G(){k(),o=!0,a!==s&&(a=s,d(a.object))}function k(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:l,reset:G,resetDefaultState:k,dispose:I,releaseStatesOfGeometry:D,releaseStatesOfObject:P,releaseStatesOfProgram:B,initAttributes:_,enableAttribute:M,disableUnusedAttributes:A}}function _fe(n,e,t){let r;function s(u){r=u}function a(u,d){n.drawArrays(r,u,d),t.update(d,r,1)}function o(u,d,h){h!==0&&(n.drawArraysInstanced(r,u,d,h),t.update(d,r,h))}function l(u,d,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,u,0,d,0,h);let x=0;for(let y=0;y<h;y++)x+=d[y];t.update(x,r,1)}this.setMode=s,this.render=a,this.renderInstances=o,this.renderMultiDraw=l}function Mfe(n,e,t,r){let s;function a(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const B=e.get("EXT_texture_filter_anisotropic");s=n.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(B){return!(B!==Pa&&r.convert(B)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(B){const P=B===Ou&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(B!==eo&&r.convert(B)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&B!==ao&&!P)}function u(B){if(B==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=t.precision!==void 0?t.precision:"highp";const h=u(d);h!==d&&($t("WebGLRenderer:",d,"not supported, using",h,"instead."),d=h);const p=t.logarithmicDepthBuffer===!0,x=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&x===!1&&$t("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const y=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),M=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),S=n.getParameter(n.MAX_VERTEX_ATTRIBS),A=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),E=n.getParameter(n.MAX_VARYING_VECTORS),C=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),I=n.getParameter(n.MAX_SAMPLES),D=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:l,precision:d,logarithmicDepthBuffer:p,reversedDepthBuffer:x,maxTextures:y,maxVertexTextures:v,maxTextureSize:_,maxCubemapSize:M,maxAttributes:S,maxVertexUniforms:A,maxVaryings:E,maxFragmentUniforms:C,maxSamples:I,samples:D}}function Nfe(n){const e=this;let t=null,r=0,s=!1,a=!1;const o=new _u,l=new Ln,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(p,x){const y=p.length!==0||x||r!==0||s;return s=x,r=p.length,y},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(p,x){t=h(p,x,0)},this.setState=function(p,x,y){const v=p.clippingPlanes,_=p.clipIntersection,M=p.clipShadows,S=n.get(p);if(!s||v===null||v.length===0||a&&!M)a?h(null):d();else{const A=a?0:r,E=A*4;let C=S.clippingState||null;u.value=C,C=h(v,x,E,y);for(let I=0;I!==E;++I)C[I]=t[I];S.clippingState=C,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=A}};function d(){u.value!==t&&(u.value=t,u.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(p,x,y,v){const _=p!==null?p.length:0;let M=null;if(_!==0){if(M=u.value,v!==!0||M===null){const S=y+_*4,A=x.matrixWorldInverse;l.getNormalMatrix(A),(M===null||M.length<S)&&(M=new Float32Array(S));for(let E=0,C=y;E!==_;++E,C+=4)o.copy(p[E]).applyMatrix4(A,l),o.normal.toArray(M,C),M[C+3]=o.constant}u.value=M,u.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,M}}const ih=4,u4=[.125,.215,.35,.446,.526,.582],Bm=20,Afe=256,Xb=new Ru,d4=new Ut;let TE=null,RE=0,PE=0,DE=!1;const Cfe=new we;class HT{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,r=.1,s=100,a={}){const{size:o=256,position:l=Cfe}=a;TE=this._renderer.getRenderTarget(),RE=this._renderer.getActiveCubeFace(),PE=this._renderer.getActiveMipmapLevel(),DE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,r,s,u,l),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=m4(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=h4(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(TE,RE,PE),this._renderer.xr.enabled=DE,e.scissorTest=!1,sx(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Lu||e.mapping===xh?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),TE=this._renderer.getRenderTarget(),RE=this._renderer.getActiveCubeFace(),PE=this._renderer.getActiveMipmapLevel(),DE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:qr,minFilter:qr,generateMipmaps:!1,type:Ou,format:Pa,colorSpace:Fx,depthBuffer:!1},s=f4(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=f4(e,t,r);const{_lodMax:a}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Efe(a)),this._blurMaterial=Tfe(a,e,t),this._ggxMaterial=jfe(a,e,t)}return s}_compileMaterial(e){const t=new Ns(new Bn,e);this._renderer.compile(t,Xb)}_sceneToCubeUV(e,t,r,s,a){const u=new ti(90,1,t,r),d=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],p=this._renderer,x=p.autoClear,y=p.toneMapping;p.getClearColor(d4),p.toneMapping=Gl,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(s),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ns(new Ep,new ko({name:"PMREM.Backgroun
4059d",side:Da,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,M=_.material;let S=!1;const A=e.background;A?A.isColor&&(M.color.copy(A),e.background=null,S=!0):(M.color.copy(d4),S=!0);for(let E=0;E<6;E++){const C=E%3;C===0?(u.up.set(0,d[E],0),u.position.set(a.x,a.y,a.z),u.lookAt(a.x+h[E],a.y,a.z)):C===1?(u.up.set(0,0,d[E]),u.position.set(a.x,a.y,a.z),u.lookAt(a.x,a.y+h[E],a.z)):(u.up.set(0,d[E],0),u.position.set(a.x,a.y,a.z),u.lookAt(a.x,a.y,a.z+h[E]));const I=this._cubeSize;sx(s,C*I,E>2?I:0,I,I),p.setRenderTarget(s),S&&p.render(_,u),p.render(e,u)}p.toneMapping=y,p.autoClear=x,e.background=A}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===Lu||e.mapping===xh;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=m4()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=h4());const a=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=a;const l=a.uniforms;l.envMap.value=e;const u=this._cubeSize;sx(t,0,0,3*u,2*u),r.setRenderTarget(t),r.render(o,Xb)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const s=this._lodMeshes.length;for(let a=1;a<s;a++)this._applyGGXFilter(e,a-1,a);t.autoClear=r}_applyGGXFilter(e,t,r){const s=this._renderer,a=this._pingPongRenderTarget,o=this._ggxMaterial,l=this._lodMeshes[r];l.material=o;const u=o.uniforms,d=r/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),p=Math.sqrt(d*d-h*h),x=0+d*1.25,y=p*x,{_lodMax:v}=this,_=this._sizeLods[r],M=3*_*(r>v-ih?r-v+ih:0),S=4*(this._cubeSize-_);u.envMap.value=e.texture,u.roughness.value=y,u.mipInt.value=v-t,sx(a,M,S,3*_,2*_),s.setRenderTarget(a),s.render(l,Xb),u.envMap.value=a.texture,u.roughness.value=0,u.mipInt.value=v-r,sx(e,M,S,3*_,2*_),s.setRenderTarget(e),s.render(l,Xb)}_blur(e,t,r,s,a){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,s,"latitudinal",a),this._halfBlur(o,e,r,r,s,"longitudinal",a)}_halfBlur(e,t,r,s,a,o,l){const u=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&fn("blur direction must be either latitudinal or longitudinal!");const h=3,p=this._lodMeshes[s];p.material=d;const x=d.uniforms,y=this._sizeLods[r]-1,v=isFinite(a)?Math.PI/(2*y):2*Math.PI/(2*Bm-1),_=a/v,M=isFinite(a)?1+Math.floor(h*_):Bm;M>Bm&&$t(`sigmaRadians, ${a}, is too large and will clip, as it requested ${M} samples when the maximum is set to ${Bm}`);const S=[];let A=0;for(let B=0;B<Bm;++B){const P=B/_,G=Math.exp(-P*P/2);S.push(G),B===0?A+=G:B<M&&(A+=2*G)}for(let B=0;B<S.length;B++)S[B]=S[B]/A;x.envMap.value=e.texture,x.samples.value=M,x.weights.value=S,x.latitudinal.value=o==="latitudinal",l&&(x.poleAxis.value=l);const{_lodMax:E}=this;x.dTheta.value=v,x.mipInt.value=E-r;const C=this._sizeLods[s],I=3*C*(s>E-ih?s-E+ih:0),D=4*(this._cubeSize-C);sx(t,I,D,3*C,2*C),u.setRenderTarget(t),u.render(p,Xb)}}function Efe(n){const e=[],t=[],r=[];let s=n;const a=n-ih+1+u4.length;for(let o=0;o<a;o++){const l=Math.pow(2,s);e.push(l);let u=1/l;o>n-ih?u=u4[o-n+ih-1]:o===0&&(u=0),t.push(u);const d=1/(l-2),h=-d,p=1+d,x=[h,h,p,h,p,p,h,h,p,p,h,p],y=6,v=6,_=3,M=2,S=1,A=new Float32Array(_*v*y),E=new Float32Array(M*v*y),C=new Float32Array(S*v*y);for(let D=0;D<y;D++){const B=D%3*2/3-1,P=D>2?0:-1,G=[B,P,0,B+2/3,P,0,B+2/3,P+1,0,B,P,0,B+2/3,P+1,0,B,P+1,0];A.set(G,_*v*D),E.set(x,M*v*D);const k=[D,D,D,D,D,D];C.set(k,S*v*D)}const I=new Bn;I.setAttribute("position",new Er(A,_)),I.setAttribute("uv",new Er(E,M)),I.setAttribute("faceIndex",new Er(C,S)),r.push(new Ns(I,null)),s>ih&&s--}return{lodMeshes:r,sizeLods:e,sigmas:t}}function f4(n,e,t){const r=new el(n,e,t);return r.texture.mapping=a0,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function sx(n,e,t,r,s){n.viewport.set(e,t,r,s),n.scissor.set(e,t,r,s)}function jfe(n,e,t){return new oo({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Afe,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:oA(),fragmentShader:`
4060
4061			precision highp float;
4062			precision highp int;
4063
4064			varying vec3 vOutputDirection;
4065
4066			uniform sampler2D envMap;
4067			uniform float roughness;
4068			uniform float mipInt;
4069
4070			#define ENVMAP_TYPE_CUBE_UV
4071			#include <cube_uv_reflection_fragment>
4072
4073			#define PI 3.14159265359
4074
4075			// Van der Corput radical inverse
4076			float radicalInverse_VdC(uint bits) {
4077				bits = (bits << 16u) | (bits >> 16u);
4078				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
4079				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
4080				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
4081				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
4082				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
4083			}
4084
4085			// Hammersley sequence
4086			vec2 hammersley(uint i, uint N) {
4087				return vec2(float(i) / float(N), radicalInverse_VdC(i));
4088			}
4089
4090			// GGX VNDF importance sampling (Eric Heitz 2018)
4091			// "Sampling the GGX Distribution of Visible Normals"
4092			// https://jcgt.org/published/0007/04/01/
4093			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
4094				float alpha = roughness * roughness;
4095
4096				// Section 4.1: Orthonormal basis
4097				vec3 T1 = vec3(1.0, 0.0, 0.0);
4098				vec3 T2 = cross(V, T1);
4099
4100				// Section 4.2: Parameterization of projected area
4101				float r = sqrt(Xi.x);
4102				float phi = 2.0 * PI * Xi.y;
4103				float t1 = r * cos(phi);
4104				float t2 = r * sin(phi);
4105				float s = 0.5 * (1.0 + V.z);
4106				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
4107
4108				// Section 4.3: Reprojection onto hemisphere
4109				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
4110
4111				// Section 3.4: Transform back to ellipsoid configuration
4112				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
4113			}
4114
4115			void main() {
4116				vec3 N = normalize(vOutputDirection);
4117				vec3 V = N; // Assume view direction equals normal for pre-filtering
4118
4119				vec3 prefilteredColor = vec3(0.0);
4120				float totalWeight = 0.0;
4121
4122				// For very low roughness, just sample the environment directly
4123				if (roughness < 0.001) {
4124					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
4125					return;
4126				}
4127
4128				// Tangent space basis for VNDF sampling
4129				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
4130				vec3 tangent = normalize(cross(up, N));
4131				vec3 bitangent = cross(N, tangent);
4132
4133				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
4134					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
4135
4136					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
4137					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
4138
4139					// Transform H back to world space
4140					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
4141					vec3 L = normalize(2.0 * dot(V, H) * H - V);
4142
4143					float NdotL = max(dot(N, L), 0.0);
4144
4145					if(NdotL > 0.0) {
4146						// Sample environment at fixed mip level
4147						// VNDF importance sampling handles the distribution filtering
4148						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
4149
4150						// Weight by NdotL for the split-sum approximation
4151						// VNDF PDF naturally accounts for the visible microfacet distribution
4152						prefilteredColor += sampleColor * NdotL;
4153						totalWeight += NdotL;
4154					}
4155				}
4156
4157				if (totalWeight > 0.0) {
4158					prefilteredColor = prefilteredColor / totalWeight;
4159				}
4160
4161				gl_FragColor = vec4(prefilteredColor, 1.0);
4162			}
4163		`,blending:Tu,depthTest:!1,depthWrite:!1})}function Tfe(n,e,t){const r=new Float32Array(Bm),s=new we(0,1,0);return new oo({name:"SphericalGaussianBlur",defines:{n:Bm,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:oA(),fragmentShader:`
4164
4165			precision mediump float;
4166			precision mediump int;
4167
4168			varying vec3 vOutputDirection;
4169
4170			uniform sampler2D envMap;
4171			uniform int samples;
4172			uniform float weights[ n ];
4173			uniform bool latitudinal;
4174			uniform float dTheta;
4175			uniform float mipInt;
4176			uniform vec3 poleAxis;
4177
4178			#define ENVMAP_TYPE_CUBE_UV
4179			#include <cube_uv_reflection_fragment>
4180
4181			vec3 getSample( float theta, vec3 axis ) {
4182
4183				float cosTheta = cos( theta );
4184				// Rodrigues' axis-angle rotation
4185				vec3 sampleDirection = vOutputDirection * cosTheta
4186					+ cross( axis, vOutputDirection ) * sin( theta )
4187					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
4188
4189				return bilinearCubeUV( envMap, sampleDirection, mipInt );
4190
4191			}
4192
4193			void main() {
4194
4195				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
4196
4197				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
4198
4199					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
4200
4201				}
4202
4203				axis = normalize( axis );
4204
4205				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
4206				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
4207
4208				for ( int i = 1; i < n; i++ ) {
4209
4210					if ( i >= samples ) {
4211
4212						break;
4213
4214					}
4215
4216					float theta = dTheta * float( i );
4217					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
4218					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
4219
4220				}
4221
4222			}
4223		`,blending:Tu,depthTest:!1,depthWrite:!1})}function h4(){return new oo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:oA(),fragmentShader:`
4224
4225			precision mediump float;
4226			precision mediump int;
4227
4228			varying vec3 vOutputDirection;
4229
4230			uniform sampler2D envMap;
4231
4232			#include <common>
4233
4234			void main() {
4235
4236				vec3 outputDirection = normalize( vOutputDirection );
4237				vec2 uv = equirectUv( outputDirection );
4238
4239				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
4240
4241			}
4242		`,blending:Tu,depthTest:!1,depthWrite:!1})}function m4(){return new oo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:oA(),fragmentShader:`
4243
4244			precision mediump float;
4245			precision mediump int;
4246
4247			uniform float flipEnvMap;
4248
4249			varying vec3 vOutputDirection;
4250
4251			uniform samplerCube envMap;
4252
4253			void main() {
4254
4255				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
4256
4257			}
4258		`,blending:Tu,depthTest:!1,depthWrite:!1})}function oA(){return`
4259
4260		precision mediump float;
4261		precision mediump int;
4262
4263		attribute float faceIndex;
4264
4265		varying vec3 vOutputDirection;
4266
4267		// RH coordinate system; PMREM face-indexing convention
4268		vec3 getDirection( vec2 uv, float face ) {
4269
4270			uv = 2.0 * uv - 1.0;
4271
4272			vec3 direction = vec3( uv, 1.0 );
4273
4274			if ( face == 0.0 ) {
4275
4276				direction = direction.zyx; // ( 1, v, u ) pos x
4277
4278			} else if ( face == 1.0 ) {
4279
4280				direction = direction.xzy;
4281				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
4282
4283			} else if ( face == 2.0 ) {
4284
4285				direction.x *= -1.0; // ( -u, v, 1 ) pos z
4286
4287			} else if ( face == 3.0 ) {
4288
4289				direction = direction.zyx;
4290				direction.xz *= -1.0; // ( -1, v, -u ) neg x
4291
4292			} else if ( face == 4.0 ) {
4293
4294				direction = direction.xzy;
4295				direction.xy *= -1.0; // ( -u, -1, v ) neg y
4296
4297			} else if ( face == 5.0 ) {
4298
4299				direction.z *= -1.0; // ( u, v, -1 ) neg z
4300
4301			}
4302
4303			return direction;
4304
4305		}
4306
4307		void main() {
4308
4309			vOutputDirection = getDirection( uv, faceIndex );
4310			gl_Position = vec4( position, 1.0 );
4311
4312		}
4313	`}class BR extends el{constructor(e=1,t={}
vendor: 25,940 bytes, lines 4313-4429
4313){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},s=[r,r,r,r,r,r];this.texture=new Cv(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
4314
4315				varying vec3 vWorldDirection;
4316
4317				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
4318
4319					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
4320
4321				}
4322
4323				void main() {
4324
4325					vWorldDirection = transformDirection( position, modelMatrix );
4326
4327					#include <begin_vertex>
4328					#include <project_vertex>
4329
4330				}
4331			`,fragmentShader:`
4332
4333				uniform sampler2D tEquirect;
4334
4335				varying vec3 vWorldDirection;
4336
4337				#include <common>
4338
4339				void main() {
4340
4341					vec3 direction = normalize( vWorldDirection );
4342
4343					vec2 sampleUV = equirectUv( direction );
4344
4345					gl_FragColor = texture2D( tEquirect, sampleUV );
4346
4347				}
4348			`},s=new Ep(5,5,5),a=new oo({name:"CubemapFromEquirect",uniforms:Hx(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Da,blending:Tu});a.uniforms.tEquirect.value=t;const o=new Ns(s,a),l=t.minFilter;return t.minFilter===Fl&&(t.minFilter=qr),new u9(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,s=!0){const a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,s);e.setRenderTarget(a)}}function Rfe(n){let e=new WeakMap,t=new WeakMap,r=null;function s(x,y=!1){return x==null?null:y?o(x):a(x)}function a(x){if(x&&x.isTexture){const y=x.mapping;if(y===by||y===yy)if(e.has(x)){const v=e.get(x).texture;return l(v,x.mapping)}else{const v=x.image;if(v&&v.height>0){const _=new BR(v.height);return _.fromEquirectangularTexture(n,x),e.set(x,_),x.addEventListener("dispose",d),l(_.texture,x.mapping)}else return null}}return x}function o(x){if(x&&x.isTexture){const y=x.mapping,v=y===by||y===yy,_=y===Lu||y===xh;if(v||_){let M=t.get(x);const S=M!==void 0?M.texture.pmremVersion:0;if(x.isRenderTargetTexture&&x.pmremVersion!==S)return r===null&&(r=new HT(n)),M=v?r.fromEquirectangular(x,M):r.fromCubemap(x,M),M.texture.pmremVersion=x.pmremVersion,t.set(x,M),M.texture;if(M!==void 0)return M.texture;{const A=x.image;return v&&A&&A.height>0||_&&A&&u(A)?(r===null&&(r=new HT(n)),M=v?r.fromEquirectangular(x):r.fromCubemap(x),M.texture.pmremVersion=x.pmremVersion,t.set(x,M),x.addEventListener("dispose",h),M.texture):null}}}return x}function l(x,y){return y===by?x.mapping=Lu:y===yy&&(x.mapping=xh),x}function u(x){let y=0;const v=6;for(let _=0;_<v;_++)x[_]!==void 0&&y++;return y===v}function d(x){const y=x.target;y.removeEventListener("dispose",d);const v=e.get(y);v!==void 0&&(e.delete(y),v.dispose())}function h(x){const y=x.target;y.removeEventListener("dispose",h);const v=t.get(y);v!==void 0&&(t.delete(y),v.dispose())}function p(){e=new WeakMap,t=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:s,dispose:p}}function Pfe(n){const e={};function t(r){if(e[r]!==void 0)return e[r];const s=n.getExtension(r);return e[r]=s,s}return{has:function(r){return t(r)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(r){const s=t(r);return s===null&&ah("WebGLRenderer: "+r+" extension not supported."),s}}}function Dfe(n,e,t,r){const s={},a=new WeakMap;function o(p){const x=p.target;x.index!==null&&e.remove(x.index);for(const v in x.attributes)e.remove(x.attributes[v]);x.removeEventListener("dispose",o),delete s[x.id];const y=a.get(x);y&&(e.remove(y),a.delete(x)),r.releaseStatesOfGeometry(x),x.isInstancedBufferGeometry===!0&&delete x._maxInstanceCount,t.memory.geometries--}function l(p,x){return s[x.id]===!0||(x.addEventListener("dispose",o),s[x.id]=!0,t.memory.geometries++),x}function u(p){const x=p.attributes;for(const y in x)e.update(x[y],n.ARRAY_BUFFER)}function d(p){const x=[],y=p.index,v=p.attributes.position;let _=0;if(v===void 0)return;if(y!==null){const A=y.array;_=y.version;for(let E=0,C=A.length;E<C;E+=3){const I=A[E+0],D=A[E+1],B=A[E+2];x.push(I,D,D,B,B,I)}}else{const A=v.array;_=v.version;for(let E=0,C=A.length/3-1;E<C;E+=3){const I=E+0,D=E+1,B=E+2;x.push(I,D,D,B,B,I)}}const M=new(v.count>=65535?uR:cR)(x,1);M.version=_;const S=a.get(p);S&&e.remove(S),a.set(p,M)}function h(p){const x=a.get(p);if(x){const y=p.index;y!==null&&x.version<y.version&&d(p)}else d(p);return a.get(p)}return{get:l,update:u,getWireframeAttribute:h}}function kfe(n,e,t){let r;function s(p){r=p}let a,o;function l(p){a=p.type,o=p.bytesPerElement}function u(p,x){n.drawElements(r,x,a,p*o),t.update(x,r,1)}function d(p,x,y){y!==0&&(n.drawElementsInstanced(r,x,a,p*o,y),t.update(x,r,y))}function h(p,x,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,x,0,a,p,0,y);let _=0;for(let M=0;M<y;M++)_+=x[M];t.update(_,r,1)}this.setMode=s,this.setIndex=l,this.render=u,this.renderInstances=d,this.renderMultiDraw=h}function Ife(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(a,o,l){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=l*(a/3);break;case n.LINES:t.lines+=l*(a/2);break;case n.LINE_STRIP:t.lines+=l*(a-1);break;case n.LINE_LOOP:t.lines+=l*a;break;case n.POINTS:t.points+=l*a;break;default:fn("WebGLInfo: Unknown draw mode:",o);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:r}}function Bfe(n,e,t){const r=new WeakMap,s=new mr;function a(o,l,u){const d=o.morphTargetInfluences,h=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,p=h!==void 0?h.length:0;let x=r.get(l);if(x===void 0||x.count!==p){let G=function(){B.dispose(),r.delete(l),l.removeEventListener("dispose",G)};x!==void 0&&x.texture.dispose();const y=l.morphAttributes.position!==void 0,v=l.morphAttributes.normal!==void 0,_=l.morphAttributes.color!==void 0,M=l.morphAttributes.position||[],S=l.morphAttributes.normal||[],A=l.morphAttributes.color||[];let E=0;y===!0&&(E=1),v===!0&&(E=2),_===!0&&(E=3);let C=l.attributes.position.count*E,I=1;C>e.maxTextureSize&&(I=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const D=new Float32Array(C*I*4*p),B=new kN(D,C,I,p);B.type=ao,B.needsUpdate=!0;const P=E*4;for(let k=0;k<p;k++){const V=M[k],U=S[k],$=A[k],X=C*I*4*k;for(let ee=0;ee<V.count;ee++){const z=ee*P;y===!0&&(s.fromBufferAttribute(V,ee),D[X+z+0]=s.x,D[X+z+1]=s.y,D[X+z+2]=s.z,D[X+z+3]=0),v===!0&&(s.fromBufferAttribute(U,ee),D[X+z+4]=s.x,D[X+z+5]=s.y,D[X+z+6]=s.z,D[X+z+7]=0),_===!0&&(s.fromBufferAttribute($,ee),D[X+z+8]=s.x,D[X+z+9]=s.y,D[X+z+10]=s.z,D[X+z+11]=$.itemSize===4?s.w:1)}}x={count:p,texture:B,size:new wt(C,I)},r.set(l,x),l.addEventListener("dispose",G)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)u.getUniforms().setValue(n,"morphTexture",o.morphTexture,t);else{let y=0;for(let _=0;_<d.length;_++)y+=d[_];const v=l.morphTargetsRelative?1:1-y;u.getUniforms().setValue(n,"morphTargetBaseInfluence",v),u.getUniforms().setValue(n,"morphTargetInfluences",d)}u.getUniforms().setValue(n,"morphTargetsTexture",x.texture,t),u.getUniforms().setValue(n,"morphTargetsTextureSize",x.size)}return{update:a}}function Lfe(n,e,t,r,s){let a=new WeakMap;function o(d){const h=s.render.frame,p=d.geometry,x=e.get(d,p);if(a.get(x)!==h&&(e.update(x),a.set(x,h)),d.isInstancedMesh&&(d.hasEventListener("dispose",u)===!1&&d.addEventListener("dispose",u),a.get(d)!==h&&(t.update(d.instanceMatrix,n.ARRAY_BUFFER),d.instanceColor!==null&&t.update(d.instanceColor,n.ARRAY_BUFFER),a.set(d,h))),d.isSkinnedMesh){const y=d.skeleton;a.get(y)!==h&&(y.update(),a.set(y,h))}return x}function l(){a=new WeakMap}function u(d){const h=d.target;h.removeEventListener("dispose",u),r.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:o,dispose:l}}const Ofe={[$3]:"LINEAR_TONE_MAPPING",[X3]:"REINHARD_TONE_MAPPING",[q3]:"CINEON_TONE_MAPPING",[wN]:"ACES_FILMIC_TONE_MAPPING",[Q3]:"AGX_TONE_MAPPING",[K3]:"NEUTRAL_TONE_MAPPING",[Y3]:"CUSTOM_TONE_MAPPING"};function Ffe(n,e,t,r,s,a){const o=new el(e,t,{type:n,depthBuffer:s,stencilBuffer:a,samples:r?4:0,depthTexture:s?new gp(e,t):void 0}),l=new el(e,t,{type:Ou,depthBuffer:!1,stencilBuffer:!1}),u=new Bn;u.setAttribute("position",new tn([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new tn([0,2,0,0,2,0],2));const d=new MR({uniforms:{tDiffuse:{value:null}},vertexShader:`
4349			precision highp float;
4350
4351			uniform mat4 modelViewMatrix;
4352			uniform mat4 projectionMatrix;
4353
4354			attribute vec3 position;
4355			attribute vec2 uv;
4356
4357			varying vec2 vUv;
4358
4359			void main() {
4360				vUv = uv;
4361				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4362			}`,fragmentShader:`
4363			precision highp float;
4364
4365			uniform sampler2D tDiffuse;
4366
4367			varying vec2 vUv;
4368
4369			#include <tonemapping_pars_fragment>
4370			#include <colorspace_pars_fragment>
4371
4372			void main() {
4373				gl_FragColor = texture2D( tDiffuse, vUv );
4374
4375				#ifdef LINEAR_TONE_MAPPING
4376					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
4377				#elif defined( REINHARD_TONE_MAPPING )
4378					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
4379				#elif defined( CINEON_TONE_MAPPING )
4380					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
4381				#elif defined( ACES_FILMIC_TONE_MAPPING )
4382					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
4383				#elif defined( AGX_TONE_MAPPING )
4384					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4385				#elif defined( NEUTRAL_TONE_MAPPING )
4386					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4387				#elif defined( CUSTOM_TONE_MAPPING )
4388					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4389				#endif
4390
4391				#ifdef SRGB_TRANSFER
4392					gl_FragColor = sRGBTransferOETF( gl_FragColor );
4393				#endif
4394			}`,depthTest:!1,depthWrite:!1}),h=new Ns(u,d),p=new Ru(-1,1,1,-1,0,1);let x=null,y=null,v=!1,_,M=null,S=[],A=!1;this.setSize=function(E,C){o.setSize(E,C),l.setSize(E,C);for(let I=0;I<S.length;I++){const D=S[I];D.setSize&&D.setSize(E,C)}},this.setEffects=function(E){S=E,A=S.length>0&&S[0].isRenderPass===!0;const C=o.width,I=o.height;for(let D=0;D<S.length;D++){const B=S[D];B.setSize&&B.setSize(C,I)}},this.begin=function(E,C){if(v||E.toneMapping===Gl&&S.length===0)return!1;if(M=C,C!==null){const I=C.width,D=C.height;(o.width!==I||o.height!==D)&&this.setSize(I,D)}return A===!1&&E.setRenderTarget(o),_=E.toneMapping,E.toneMapping=Gl,!0},this.hasRenderPass=function(){return A},this.end=function(E,C){E.toneMapping=_,v=!0;let I=o,D=l;for(let B=0;B<S.length;B++){const P=S[B];if(P.enabled!==!1&&(P.render(E,D,I,C),P.needsSwap!==!1)){const G=I;I=D,D=G}}if(x!==E.outputColorSpace||y!==E.toneMapping){x=E.outputColorSpace,y=E.toneMapping,d.defines={},ur.getTransfer(x)===$r&&(d.defines.SRGB_TRANSFER="");const B=Ofe[y];B&&(d.defines[B]=""),d.needsUpdate=!0}d.uniforms.tDiffuse.value=I.texture,E.setRenderTarget(M),E.render(h,p),M=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),l.dispose(),u.dispose(),d.dispose()}}const _9=new ms,VT=new gp(1,1),M9=new kN,N9=new IN,A9=new Cv,p4=[],g4=[],x4=new Float32Array(16),b4=new Float32Array(9),y4=new Float32Array(4);function o0(n,e,t){const r=n[0];if(r<=0||r>0)return n;const s=e*t;let a=p4[s];if(a===void 0&&(a=new Float32Array(s),p4[s]=a),e!==0){r.toArray(a,0);for(let o=1,l=0;o!==e;++o)l+=t,n[o].toArray(a,l)}return a}function Fi(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t<r;t++)if(n[t]!==e[t])return!1;return!0}function Ui(n,e){for(let t=0,r=e.length;t<r;t++)n[t]=e[t]}function lA(n,e){let t=g4[e];t===void 0&&(t=new Int32Array(e),g4[e]=t);for(let r=0;r!==e;++r)t[r]=n.allocateTextureUnit();return t}function Ufe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function zfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Fi(t,e))return;n.uniform2fv(this.addr,e),Ui(t,e)}}function Gfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Fi(t,e))return;n.uniform3fv(this.addr,e),Ui(t,e)}}function Hfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Fi(t,e))return;n.uniform4fv(this.addr,e),Ui(t,e)}}function Vfe(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(Fi(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Ui(t,e)}else{if(Fi(t,r))return;y4.set(r),n.uniformMatrix2fv(this.addr,!1,y4),Ui(t,r)}}function Wfe(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(Fi(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Ui(t,e)}else{if(Fi(t,r))return;b4.set(r),n.uniformMatrix3fv(this.addr,!1,b4),Ui(t,r)}}function $fe(n,e){const t=this.cache,r=e.elements;if(r===void 0){if(Fi(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Ui(t,e)}else{if(Fi(t,r))return;x4.set(r),n.uniformMatrix4fv(this.addr,!1,x4),Ui(t,r)}}function Xfe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function qfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Fi(t,e))return;n.uniform2iv(this.addr,e),Ui(t,e)}}function Yfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Fi(t,e))return;n.uniform3iv(this.addr,e),Ui(t,e)}}function Qfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Fi(t,e))return;n.uniform4iv(this.addr,e),Ui(t,e)}}function Kfe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Jfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Fi(t,e))return;n.uniform2uiv(this.addr,e),Ui(t,e)}}function Zfe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Fi(t,e))return;n.uniform3uiv(this.addr,e),Ui(t,e)}}function ehe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Fi(t,e))return;n.uniform4uiv(this.addr,e),Ui(t,e)}}function the(n,e,t){const r=this.cache,s=t.allocateTextureUnit();r[0]!==s&&(n.uniform1i(this.addr,s),r[0]=s);let a;this.type===n.SAMPLER_2D_SHADOW?(VT.compareFunction=t.isReversedDepthBuffer()?PN:RN,a=VT):a=_9,t.setTexture2D(e||a,s)}function nhe(n,e,t){const r=this.cache,s=t.allocateTextureUnit();r[0]!==s&&(n.uniform1i(this.addr,s),r[0]=s),t.setTexture3D(e||N9,s)}function rhe(n,e,t){const r=this.cache,s=t.allocateTextureUnit();r[0]!==s&&(n.uniform1i(this.addr,s),r[0]=s),t.setTextureCube(e||A9,s)}function she(n,e,t){const r=this.cache,s=t.allocateTextureUnit();r[0]!==s&&(n.uniform1i(this.addr,s),r[0]=s),t.setTexture2DArray(e||M9,s)}function ihe(n){switch(n){case 5126:return Ufe;case 35664:return zfe;case 35665:return Gfe;case 35666:return Hfe;case 35674:return Vfe;case 35675:return Wfe;case 35676:return $fe;case 5124:case 35670:return Xfe;case 35667:case 35671:return qfe;case 35668:case 35672:return Yfe;case 35669:case 35673:return Qfe;case 5125:return Kfe;case 36294:return Jfe;case 36295:return Zfe;case 36296:return ehe;case 35678:case 36198:case 36298:case 36306:case 35682:return the;case 35679:case 36299:case 36307:return nhe;case 35680:case 36300:case 36308:case 36293:return rhe;case 36289:case 36303:case 36311:case 36292:return she}}function ahe(n,e){n.uniform1fv(this.addr,e)}function ohe(n,e){const t=o0(e,this.size,2);n.uniform2fv(this.addr,t)}function lhe(n,e){const t=o0(e,this.size,3);n.uniform3fv(this.addr,t)}function che(n,e){const t=o0(e,this.size,4);n.uniform4fv(this.addr,t)}function uhe(n,e){const t=o0(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function dhe(n,e){const t=o0(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function fhe(n,e){const t=o0(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function hhe(n,e){n.uniform1iv(this.addr,e)}function mhe(n,e){n.uniform2iv(this.addr,e)}function phe(n,e){n.uniform3iv(this.addr,e)}function ghe(n,e){n.uniform4iv(this.addr,e)}function xhe(n,e){n.uniform1uiv(this.addr,e)}function bhe(n,e){n.uniform2uiv(this.addr,e)}function yhe(n,e){n.uniform3uiv(this.addr,e)}function vhe(n,e){n.uniform4uiv(this.addr,e)}function whe(n,e,t){const r=this.cache,s=e.length,a=lA(t,s);Fi(r,a)||(n.uniform1iv(this.addr,a),Ui(r,a));let o;this.type===n.SAMPLER_2D_SHADOW?o=VT:o=_9;for(let l=0;l!==s;++l)t.setTexture2D(e[l]||o,a[l])}function She(n,e,t){const r=this.cache,s=e.length,a=lA(t,s);Fi(r,a)||(n.uniform1iv(this.addr,a),Ui(r,a));for(let o=0;o!==s;++o)t.setTexture3D(e[o]||N9,a[o])}function _he(n,e,t){const r=this.cache,s=e.length,a=lA(t,s);Fi(r,a)||(n.uniform1iv(this.addr,a),Ui(r,a));for(let o=0;o!==s;++o)t.setTextureCube(e[o]||A9,a[o])}function Mhe(n,e,t){const r=this.cache,s=e.length,a=lA(t,s);Fi(r,a)||(n.uniform1iv(this.addr,a),Ui(r,a));for(let o=0;o!==s;++o)t.setTexture2DArray(e[o]||M9,a[o])}function Nhe(n){switch(n){case 5126:return ahe;case 35664:return ohe;case 35665:return lhe;case 35666:return che;case 35674:return uhe;case 35675:return dhe;case 35676:return fhe;case 5124:case 35670:return hhe;case 35667:case 35671:return mhe;case 35668:case 35672:return phe;case 35669:case 35673:return ghe;case 5125:return xhe;case 36294:return bhe;case 36295:return yhe;case 36296:return vhe;case 35678:case 36198:case 36298:case 36306:case 35682:return whe;case 35679:case 36299:case 36307:return She;case 35680:case 36300:case 36308:case 36293:return _he;case 36289:case 36303:case 36311:case 36292:return Mhe}}class Ahe{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=ihe(t.type)}}class Che{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Nhe(t.type)}}class Ehe{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const s=this.seq;for(let a=0,o=s.length;a!==o;++a){const l=s[a];l.setValue(e,t[l.id],r)}}}const kE=/(\w+)(\])?(\[|\.)?/g;function v4(n,e){n.seq.push(e),n.map[e.id]=e}function jhe(n,e,t){const r=n.name,s=r.length;for(kE.lastIndex=0;;){const a=kE.exec(r),o=kE.lastIndex;let l=a[1];const u=a[2]==="]",d=a[3];if(u&&(l=l|0),d===void 0||d==="["&&o+2===s){v4(t,d===void 0?new Ahe(l,n,e):new Che(l,n,e));break}else{let p=t.map[l];p===void 0&&(p=new Ehe(l),v4(t,p)),t=p}}}class c_{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<r;++o){const l=e.getActiveUniform(t,o),u=e.getUniformLocation(t,l.name);jhe(l,u,this)}const s=[],a=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?s.push(o):a.push(o);s.length>0&&(this.seq=s.concat(a))}setValue(e,t,r,s){const a=this.map[t];a!==void 0&&a.setValue(e,r,s)}setOptional(e,t,r){const s=t[r];s!==void 0&&this.setValue(e,r,s)}static upload(e,t,r,s){for(let a=0,o=t.length;a!==o;++a){const l=t[a],u=r[l.id];u.needsUpdate!==!1&&l.setValue(e,u.value,s)}}static seqWithValue(e,t){const r=[];for(let s=0,a=e.length;s!==a;++s){const o=e[s];o.id in t&&r.push(o)}return r}}function w4(n,e,t){const r=n.createShader(e);return n.shaderSource(r,t),n.compileShader(r),r}const The=37297;let Rhe=0;function Phe(n,e){const t=n.split(`
4395`),r=[],s=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let o=s;o<a;o++){const l=o+1;r.push(`${l===e?">":" "} ${l}: ${t[o]}`)}return r.join(`
4396`)}const S4=new Ln;function Dhe(n){ur._getMatrix(S4,ur.workingColorSpace,n);const e=`mat3( ${S4.elements.map(t=>t.toFixed(4))} )`;switch(ur.getTransfer(n)){case qy:return[e,"LinearTransferOETF"];case $r:return[e,"sRGBTransferOETF"];default:return $t("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function _4(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),a=(n.getShaderInfoLog(e)||"").trim();if(r&&a==="")return"";const o=/ERROR: 0:(\d+)/.exec(a);if(o){const l=parseInt(o[1]);return t.toUpperCase()+`
4397
4398`+a+`
4399
4400`+Phe(n.getShaderSource(e),l)}else return a}function khe(n,e){const t=Dhe(e);return[`vec4 ${n}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4401`)}const Ihe={[$3]:"Linear",[X3]:"Reinhard",[q3]:"Cineon",[wN]:"ACESFilmic",[Q3]:"AgX",[K3]:"Neutral",[Y3]:"Custom"};function Bhe(n,e){const t=Ihe[e];return t===void 0?($t("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const CS=new we;function Lhe(){ur.getLuminanceCoefficients(CS);const n=CS.x.toFixed(4),e=CS.y.toFixed(4),t=CS.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${n}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
4402`)}function Ohe(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ny).join(`
4403`)}function Fhe(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(`
4404`)}function Uhe(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){const a=n.getActiveAttrib(e,s),o=a.name;let l=1;a.type===n.FLOAT_MAT2&&(l=2),a.type===n.FLOAT_MAT3&&(l=3),a.type===n.FLOAT_MAT4&&(l=4),t[o]={type:a.type,location:n.getAttribLocation(e,o),locationSize:l}}return t}function ny(n){return n!==""}function M4(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function N4(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const zhe=/^[ \t]*#include +<([\w\d./]+)>/gm;function WT(n){return n.replace(zhe,Hhe)}const Ghe=new Map;function Hhe(n,e){let t=Yn[e];if(t===void 0){const r=Ghe.get(e);if(r!==void 0)t=Yn[r],$t('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return WT(t)}const Vhe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function A4(n){return n.replace(Vhe,Whe)}function Whe(n,e,t,r){let s="";for(let a=parseInt(e);a<parseInt(t);a++)s+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return s}function C4(n){let e=`precision ${n.precision} float;
4405	precision ${n.precision} int;
4406	precision ${n.precision} sampler2D;
4407	precision ${n.precision} samplerCube;
4408	precision ${n.precision} sampler3D;
4409	precision ${n.precision} sampler2DArray;
4410	precision ${n.precision} sampler2DShadow;
4411	precision ${n.precision} samplerCubeShadow;
4412	precision ${n.precision} sampler2DArrayShadow;
4413	precision ${n.precision} isampler2D;
4414	precision ${n.precision} isampler3D;
4415	precision ${n.precision} isamplerCube;
4416	precision ${n.precision} isampler2DArray;
4417	precision ${n.precision} usampler2D;
4418	precision ${n.precision} usampler3D;
4419	precision ${n.precision} usamplerCube;
4420	precision ${n.precision} usampler2DArray;
4421	`;return n.precision==="highp"?e+=`
4422#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
4423#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
4424#define LOW_PRECISION`),e}const $he={[Sx]:"SHADOWMAP_TYPE_PCF",[Gm]:"SHADOWMAP_TYPE_VSM"};function Xhe(n){return $he[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const qhe={[Lu]:"ENVMAP_TYPE_CUBE",[xh]:"ENVMAP_TYPE_CUBE",[a0]:"ENVMAP_TYPE_CUBE_UV"};function Yhe(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":qhe[n.envMapMode]||"ENVMAP_TYPE_CUBE"}const Qhe={[xh]:"ENVMAP_MODE_REFRACTION"};function Khe(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":Qhe[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Jhe={[_v]:"ENVMAP_BLENDING_MULTIPLY",[a8]:"ENVMAP_BLENDING_MIX",[o8]:"ENVMAP_BLENDING_ADD"};function Zhe(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":Jhe[n.combine]||"ENVMAP_BLENDING_NONE"}function eme(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}function tme(n,e,t,r){const s=n.getContext(),a=t.defines;let o=t.vertexShader,l=t.fragmentShader;const u=Xhe(t),d=Yhe(t),h=Khe(t),p=Zhe(t),x=eme(t),y=Ohe(t),v=Fhe(a),_=s.createProgram();let M,S,A=t.glslVersion?"#version "+t.glslVersion+`
4425`:"";t.isRawShaderMaterial?(M=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(ny).join(`
4426`),M.length>0&&(M+=`
4427`),S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(ny).join(`
4428`),S.length>0&&(S+=`
4429`)):(M=[C4(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionCl
vendor: 6,566 bytes, lines 4429-4431
4429ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
4430`].filter(ny).join(`
4431`),S=[C4(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",t.envMap?"#define "+p:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4431IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Gl?"#define TONE_MAPPING":"",t.toneMapping!==Gl?Yn.tonemapping_pars_fragment:"",t.toneMapping!==Gl?Bhe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Yn.colorspace_pars_fragment,khe("linearToOutputTexel",t.outputColorSpace),Lhe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4432`].filter(ny).join(`
4433`)),o=WT(o),o=M4(o,t),o=N4(o,t),l=WT(l),l=M4(l,t),l=N4(l,t),o=A4(o),l=A4(l),t.isRawShaderMaterial!==!0&&(A=`#version 300 es
4434`,M=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4435`)+`
4436`+M,S=["#define varying in",t.glslVersion===kT?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===kT?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4437`)+`
4438`+S);const E=A+M+o,C=A+S+l,I=w4(s,s.VERTEX_SHADER,E),D=w4(s,s.FRAGMENT_SHADER,C);s.attachShader(_,I),s.attachShader(_,D),t.index0AttributeName!==void 0?s.bindAttribLocation(_,0,t.index0AttributeName):t.hasPositionAttribute===!0&&s.bindAttribLocation(_,0,"position"),s.linkProgram(_);function B(V){if(n.debug.checkShaderErrors){const U=s.getProgramInfoLog(_)||"",$=s.getShaderInfoLog(I)||"",X=s.getShaderInfoLog(D)||"",ee=U.trim(),z=$.trim(),K=X.trim();let ae=!0,oe=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(ae=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(s,_,I,D);else{const re=_4(s,I,"vertex"),F=_4(s,D,"fragment");fn("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+`
4439
4440Material Name: `+V.name+`
4441Material Type: `+V.type+`
4442
4443Program Info Log: `+ee+`
4444`+re+`
4445`+F)}else ee!==""?$t("WebGLProgram: Program Info Log:",ee):(z===""||K==="")&&(oe=!1);oe&&(V.diagnostics={runnable:ae,programLog:ee,vertexShader:{log:z,prefix:M},fragmentShader:{log:K,prefix:S}})}s.deleteShader(I),s.deleteShader(D),P=new c_(s,_),G=Uhe(s,_)}let P;this.getUniforms=function(){return P===void 0&&B(this),P};let G;this.getAttributes=function(){return G===void 0&&B(this),G};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=s.getProgramParameter(_,The)),k},this.destroy=function(){r.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Rhe++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=D,this}let nme=0;class rme{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,r){const s=this._getShaderCacheForMaterial(e);return s.has(t)===!1&&(s.add(t),t.usedTimes++),s.has(r)===!1&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new sme(e),t.set(e,r)),r}}class sme{constructor(e){this.id=nme++,this.code=e,this.usedTimes=0}}function ime(n){return n===yh||n===Wy||n===$y}function ame(n,e,t,r,s,a){const o=new zx,l=new rme,u=new Set,d=[],h=new Map,p=r.logarithmicDepthBuffer;let x=r.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(P){return u.add(P),P===0?"uv":`uv${P}`}function _(P,G,k,V,U,$){const X=V.fog,ee=U.geometry,z=P.isMeshStandardMaterial||P.isMeshLambertMaterial||P.isMeshPhongMaterial?V.environment:null,K=P.isMeshStandardMaterial||P.isMeshLambertMaterial&&!P.envMap||P.isMeshPhongMaterial&&!P.envMap,ae=e.get(P.envMap||z,K),oe=ae&&ae.mapping===a0?ae.image.height:null,re=y[P.type];P.precision!==null&&(x=r.getMaxPrecision(P.precision),x!==P.precision&&$t("WebGLProgram.getParameters:",P.precision,"not supported, using",x,"instead."));const F=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,O=F!==void 0?F.length:0;let J=0;ee.morphAttributes.position!==void 0&&(J=1),ee.morphAttributes.normal!==void 0&&(J=2),ee.morphAttributes.color!==void 0&&(J=3);let q,Q,ne,Z;if(re){const ue=wc[re];q=ue.vertexShader,Q=ue.fragmentShader}else{q=P.vertexShader,Q=P.fragmentShader;const ue=l.getVertexShaderStage(P),Je=l.getFragmentShaderStage(P);l.update(P,ue,Je),ne=ue.id,Z=Je.id}const se=n.getRenderTarget(),me=n.state.buffers.depth.getReversed(),ze=U.isInstancedMesh===!0,Be=U.isBatchedMesh===!0,ye=!!P.map,Le=!!P.matcap,Ce=!!ae,Re=!!P.aoMap,De=!!P.lightMap,he=!!P.bumpMap&&P.wireframe===!1,le=!!P.normalMap,Xe=!!P.displacementMap,qe=!!P.emissiveMap,Ge=!!P.metalnessMap,ot=!!P.roughnessMap,ve=P.anisotropy>0,mt=P.clearcoat>0,xt=P.dispersion>0,ge=P.iridescence>0,Y=P.sheen>0,je=P.transmission>0,Ie=ve&&!!P.anisotropyMap,Ve=mt&&!!P.clearcoatMap,ft=mt&&!!P.clearcoatNormalMap,vt=mt&&!!P.clearcoatRoughnessMap,ce=ge&&!!P.iridescenceMap,Me=ge&&!!P.iridescenceThicknessMap,Fe=Y&&!!P.sheenColorMap,ie=Y&&!!P.sheenRoughnessMap,Se=!!P.specularMap,Ae=!!P.specularColorMap,at=!!P.specularIntensityMap,pe=je&&!!P.transmissionMap,Ke=je&&!!P.thicknessMap,Ne=!!P.gradientMap,Ye=!!P.alphaMap,Te=P.alphaTest>0,st=!!P.alphaHash,et=!!P.extensions;let Qe=Gl;P.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(Qe=n.toneMapping);const Mt={shaderID:re,shaderType:P.type,shaderName:P.name,vertexShader:q,fragmentShader:Q,defines:P.defines,customVertexShaderID:ne,customFragmentShaderID:Z,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:x,batching:Be,batchingColor:Be&&U._colorsTexture!==null,instancing:ze,instancingColor:ze&&U.instanceColor!==null,instancingMorph:ze&&U.morphTexture!==null,outputColorSpace:se===null?n.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:ur.w
vendor: 5,296 bytes, line 4445
4445orkingColorSpace,alphaToCoverage:!!P.alphaToCoverage,map:ye,matcap:Le,envMap:Ce,envMapMode:Ce&&ae.mapping,envMapCubeUVHeight:oe,aoMap:Re,lightMap:De,bumpMap:he,normalMap:le,displacementMap:Xe,emissiveMap:qe,normalMapObjectSpace:le&&P.normalMapType===p8,normalMapTangentSpace:le&&P.normalMapType===Hd,packedNormalMap:le&&P.normalMapType===Hd&&ime(P.normalMap.format),metalnessMap:Ge,roughnessMap:ot,anisotropy:ve,anisotropyMap:Ie,clearcoat:mt,clearcoatMap:Ve,clearcoatNormalMap:ft,clearcoatRoughnessMap:vt,dispersion:xt,iridescence:ge,iridescenceMap:ce,iridescenceThicknessMap:Me,sheen:Y,sheenColorMap:Fe,sheenRoughnessMap:ie,specularMap:Se,specularColorMap:Ae,specularIntensityMap:at,transmission:je,transmissionMap:pe,thicknessMap:Ke,gradientMap:Ne,opaque:P.transparent===!1&&P.blending===tp&&P.alphaToCoverage===!1,alphaMap:Ye,alphaTest:Te,alphaHash:st,combine:P.combine,mapUv:ye&&v(P.map.channel),aoMapUv:Re&&v(P.aoMap.channel),lightMapUv:De&&v(P.lightMap.channel),bumpMapUv:he&&v(P.bumpMap.channel),normalMapUv:le&&v(P.normalMap.channel),displacementMapUv:Xe&&v(P.displacementMap.channel),emissiveMapUv:qe&&v(P.emissiveMap.channel),metalnessMapUv:Ge&&v(P.metalnessMap.channel),roughnessMapUv:ot&&v(P.roughnessMap.channel),anisotropyMapUv:Ie&&v(P.anisotropyMap.channel),clearcoatMapUv:Ve&&v(P.clearcoatMap.channel),clearcoatNormalMapUv:ft&&v(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:vt&&v(P.clearcoatRoughnessMap.channel),iridescenceMapUv:ce&&v(P.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&v(P.iridescenceThicknessMap.channel),sheenColorMapUv:Fe&&v(P.sheenColorMap.channel),sheenRoughnessMapUv:ie&&v(P.sheenRoughnessMap.channel),specularMapUv:Se&&v(P.specularMap.channel),specularColorMapUv:Ae&&v(P.specularColorMap.channel),specularIntensityMapUv:at&&v(P.specularIntensityMap.channel),transmissionMapUv:pe&&v(P.transmissionMap.channel),thicknessMapUv:Ke&&v(P.thicknessMap.channel),alphaMapUv:Ye&&v(P.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(le||ve),vertexNormals:!!ee.attributes.normal,vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!ee.attributes.uv&&(ye||Ye),fog:!!X,useFog:P.fog===!0,fogExp2:!!X&&X.isFogExp2,flatShading:P.wireframe===!1&&(P.flatShading===!0||ee.attributes.normal===void 0&&le===!1&&(P.isMeshLambertMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isMeshPhysicalMaterial)),sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:me,skinning:U.isSkinnedMesh===!0,hasPositionAttribute:ee.attributes.position!==void 0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:O,morphTextureStride:J,numDirLights:G.directional.length,numPointLights:G.point.length,numSpotLights:G.spot.length,numSpotLightMaps:G.spotLightMap.length,numRectAreaLights:G.rectArea.length,numHemiLights:G.hemi.length,numDirLightShadows:G.directionalShadowMap.length,numPointLightShadows:G.pointShadowMap.length,numSpotLightShadows:G.spotShadowMap.length,numSpotLightShadowsWithMaps:G.numSpotLightShadowsWithMaps,numLightProbes:G.numLightProbes,numLightProbeGrids:$.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:P.dithering,shadowMapEnabled:n.shadowMap.enabled&&k.length>0,shadowMapType:n.shadowMap.type,toneMapping:Qe,decodeVideoTexture:ye&&P.map.isVideoTexture===!0&&ur.getTransfer(P.map.colorSpace)===$r,decodeVideoTextureEmissive:qe&&P.emissiveMap.isVideoTexture===!0&&ur.getTransfer(P.emissiveMap.colorSpace)===$r,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===Ll,flipSided:P.side===Da,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionClipCullDistance:et&&P.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(et&&P.extensions.multiDraw===!0||Be)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:P.customProgramCacheKey()};return Mt.vertexUv1s=u.has(1),Mt.vertexUv2s=u.has(2),Mt.vertexUv3s=u.has(3),u.clear(),Mt}function M(P){const G=[];if(P.shaderID?G.push(P.shaderID):(G.push(P.customVertexShaderID),G.push(P.customFragmentShaderID)),P.defines!==void 0)for(const k in P.defines)G.push(k),G.push(P.defines[k]);return P.isRawShaderMaterial===!1&&(S(G,P),A(G,P),G.push(n.outputColorSpace)),G.push(P.customProgramCacheKey),G.join()}function S(P,G){P.push(G.precision),P.push(G.outputColorSpace),P.push(G.envMapMode),P.push(G.envMapCubeUVHeight),P.push(G.mapUv),P.push(G.alphaMapUv),P.push(G.lightMapUv),P.push(G.aoMapUv),P.push(G.bumpMapUv),P.push(G.normalMapUv),P.push(G.displacementMapUv),P.push(G.emissiveMapUv),P.push(G.metalnessMapUv),P.push(G.roughnessMapUv),P.push(G.anisotropyMapUv),P.push(G.clearcoatMapUv),P.push(G.clearcoatNormalMapUv),P.push(G.clearcoatRoughnessMapUv),P.push(G.iridescenceMapUv),P.push(G.iridescenceThicknessMapUv),P.push(G.sheenColorMapUv),P.push(G.sheenRoughnessMapUv),P.push(G.specularMapUv),P.push(G.specularColorMapUv),P.push(G.specularIntensityMapUv),P.push(G.transmissionMapUv),P.push(G.thicknessMapUv),P.push(G.combine),P.push(G.fogExp2),P.pu
vendor: 10,574 bytes, line 4445
4445sh(G.sizeAttenuation),P.push(G.morphTargetsCount),P.push(G.morphAttributeCount),P.push(G.numDirLights),P.push(G.numPointLights),P.push(G.numSpotLights),P.push(G.numSpotLightMaps),P.push(G.numHemiLights),P.push(G.numRectAreaLights),P.push(G.numDirLightShadows),P.push(G.numPointLightShadows),P.push(G.numSpotLightShadows),P.push(G.numSpotLightShadowsWithMaps),P.push(G.numLightProbes),P.push(G.shadowMapType),P.push(G.toneMapping),P.push(G.numClippingPlanes),P.push(G.numClipIntersection),P.push(G.depthPacking)}function A(P,G){o.disableAll(),G.instancing&&o.enable(0),G.instancingColor&&o.enable(1),G.instancingMorph&&o.enable(2),G.matcap&&o.enable(3),G.envMap&&o.enable(4),G.normalMapObjectSpace&&o.enable(5),G.normalMapTangentSpace&&o.enable(6),G.clearcoat&&o.enable(7),G.iridescence&&o.enable(8),G.alphaTest&&o.enable(9),G.vertexColors&&o.enable(10),G.vertexAlphas&&o.enable(11),G.vertexUv1s&&o.enable(12),G.vertexUv2s&&o.enable(13),G.vertexUv3s&&o.enable(14),G.vertexTangents&&o.enable(15),G.anisotropy&&o.enable(16),G.alphaHash&&o.enable(17),G.batching&&o.enable(18),G.dispersion&&o.enable(19),G.batchingColor&&o.enable(20),G.gradientMap&&o.enable(21),G.packedNormalMap&&o.enable(22),G.vertexNormals&&o.enable(23),P.push(o.mask),o.disableAll(),G.fog&&o.enable(0),G.useFog&&o.enable(1),G.flatShading&&o.enable(2),G.logarithmicDepthBuffer&&o.enable(3),G.reversedDepthBuffer&&o.enable(4),G.skinning&&o.enable(5),G.morphTargets&&o.enable(6),G.morphNormals&&o.enable(7),G.morphColors&&o.enable(8),G.premultipliedAlpha&&o.enable(9),G.shadowMapEnabled&&o.enable(10),G.doubleSided&&o.enable(11),G.flipSided&&o.enable(12),G.useDepthPacking&&o.enable(13),G.dithering&&o.enable(14),G.transmission&&o.enable(15),G.sheen&&o.enable(16),G.opaque&&o.enable(17),G.pointsUvs&&o.enable(18),G.decodeVideoTexture&&o.enable(19),G.decodeVideoTextureEmissive&&o.enable(20),G.alphaToCoverage&&o.enable(21),G.numLightProbeGrids>0&&o.enable(22),G.hasPositionAttribute&&o.enable(23),P.push(o.mask)}function E(P){const G=y[P.type];let k;if(G){const V=wc[G];k=Vx.clone(V.uniforms)}else k=P.uniforms;return k}function C(P,G){let k=h.get(G);return k!==void 0?++k.usedTimes:(k=new tme(n,G,P,s),d.push(k),h.set(G,k)),k}function I(P){if(--P.usedTimes===0){const G=d.indexOf(P);d[G]=d[d.length-1],d.pop(),h.delete(P.cacheKey),P.destroy()}}function D(P){l.remove(P)}function B(){l.dispose()}return{getParameters:_,getProgramCacheKey:M,getUniforms:E,acquireProgram:C,releaseProgram:I,releaseShaderCache:D,programs:d,dispose:B}}function ome(){let n=new WeakMap;function e(o){return n.has(o)}function t(o){let l=n.get(o);return l===void 0&&(l={},n.set(o,l)),l}function r(o){n.delete(o)}function s(o,l,u){n.get(o)[l]=u}function a(){n=new WeakMap}return{has:e,get:t,remove:r,update:s,dispose:a}}function lme(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function E4(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function j4(){const n=[];let e=0;const t=[],r=[],s=[];function a(){e=0,t.length=0,r.length=0,s.length=0}function o(x){let y=0;return x.isInstancedMesh&&(y+=2),x.isSkinnedMesh&&(y+=1),y}function l(x,y,v,_,M,S){let A=n[e];return A===void 0?(A={id:x.id,object:x,geometry:y,material:v,materialVariant:o(x),groupOrder:_,renderOrder:x.renderOrder,z:M,group:S},n[e]=A):(A.id=x.id,A.object=x,A.geometry=y,A.material=v,A.materialVariant=o(x),A.groupOrder=_,A.renderOrder=x.renderOrder,A.z=M,A.group=S),e++,A}function u(x,y,v,_,M,S){const A=l(x,y,v,_,M,S);v.transmission>0?r.push(A):v.transparent===!0?s.push(A):t.push(A)}function d(x,y,v,_,M,S){const A=l(x,y,v,_,M,S);v.transmission>0?r.unshift(A):v.transparent===!0?s.unshift(A):t.unshift(A)}function h(x,y,v){t.length>1&&t.sort(x||lme),r.length>1&&r.sort(y||E4),s.length>1&&s.sort(y||E4),v&&(t.reverse(),r.reverse(),s.reverse())}function p(){for(let x=e,y=n.length;x<y;x++){const v=n[x];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:r,transparent:s,init:a,push:u,unshift:d,finish:p,sort:h}}function cme(){let n=new WeakMap;function e(r,s){const a=n.get(r);let o;return a===void 0?(o=new j4,n.set(r,[o])):s>=a.length?(o=new j4,a.push(o)):o=a[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function ume(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new we,color:new Ut};break;case"SpotLight":t={position:new we,direction:new we,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new we,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new we,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new we,halfWidth:new we,halfHeight:new we};break}return n[e.id]=t,t}}}function dme(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new wt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new wt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new wt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let fme=0;function hme(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function mme(n){const e=new ume,t=dme(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)r.probe.push(new we);const s=new we,a=new yn,o=new yn;function l(d){let h=0,p=0,x=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let y=0,v=0,_=0,M=0,S=0,A=0,E=0,C=0,I=0,D=0,B=0;d.sort(hme);for(let G=0,k=d.length;G<k;G++){const V=d[G],U=V.color,$=V.intensity,X=V.distance;let ee=null;if(V.shadow&&V.shadow.map&&(V.shadow.map.texture.format===yh?ee=V.shadow.map.texture:ee=V.shadow.map.depthTexture||V.shadow.map.texture),V.isAmbientLight)h+=U.r*$,p+=U.g*$,x+=U.b*$;else if(V.isLightProbe){for(let z=0;z<9;z++)r.probe[z].addScaledVector(V.sh.coefficients[z],$);B++}else if(V.isDirectionalLight){const z=e.get(V);if(z.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){const K=V.shadow,ae=t.get(V);ae.shadowIntensity=K.intensity,ae.shadowBias=K.bias,ae.shadowNormalBias=K.normalBias,ae.shadowRadius=K.radius,ae.shadowMapSize=K.mapSize,r.directionalShadow[y]=ae,r.directionalShadowMap[y]=ee,r.directionalShadowMatrix[y]=V.shadow.matrix,A++}r.directional[y]=z,y++}else if(V.isSpotLight){const z=e.get(V);z.position.setFromMatrixPosition(V.matrixWorld),z.color.copy(U).multiplyScalar($),z.distance=X,z.coneCos=Math.cos(V.angle),z.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),z.decay=V.decay,r.spot[_]=z;const K=V.shadow;if(V.map&&(r.spotLightMap[I]=V.map,I++,K.updateMatrices(V),V.castShadow&&D++),r.spotLightMatrix[_]=K.matrix,V.castShadow){const ae=t.get(V);ae.shadowIntensity=K.intensity,ae.shadowBias=K.bias,ae.shadowNormalBias=K.normalBias,ae.shadowRadius=K.radius,ae.shadowMapSize=K.mapSize,r.spotShadow[_]=ae,r.spotShadowMap[_]=ee,C++}_++}else if(V.isRectAreaLight){const z=e.get(V);z.color.copy(U).multiplyScalar($),z.halfWidth.set(V.width*.5,0,0),z.halfHeight.set(0,V.height*.5,0),r.rectArea[M]=z,M++}else if(V.isPointLight){const z=e.get(V);if(z.color.copy(V.color).multiplyScalar(V.intensity),z.distance=V.distance,z.decay=V.decay,V.castShadow){const K=V.shadow,ae=t.get(V);ae.shadowIntensity=K.intensity,ae.shadowBias=K.bias,ae.shadowNormalBias=K.normalBias,ae.shadowRadius=K.radius,ae.shadowMapSize=K.mapSize,ae.shadowCameraNear=K.camera.near,ae.shadowCameraFar=K.camera.far,r.pointShadow[v]=ae,r.pointShadowMap[v]=ee,r.pointShadowMatrix[v]=V.shadow.matrix,E++}r.point[v]=z,v++}else if(V.isHemisphereLight){const z=e.get(V);z.skyColor.copy(V.color).multiplyScalar($),z.groundColor.copy(V.groundColor).multiplyScalar($),r.hemi[S]=z,S++}}M>0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Xt.LTC_FLOAT_1,r.rectAreaLTC2=Xt.LTC_FLOAT_2):(r.rectAreaLTC1=Xt.LTC_HALF_1,r.rectAreaLTC2=Xt.LTC_HALF_2)),r.ambient[0]=h,r.ambient[1]=p,r.ambient[2]=x;const P=r.hash;(P.directionalLength!==y||P.pointLength!==v||P.spotLength!==_||P.rectAreaLength!==M||P.hemiLength!==S||P.numDirectionalShadows!==A||P.numPointShadows!==E||P.numSpotShadows!==C||P.numSpotMaps!==I||P.numLightProbes!==B)&&(r.directional.length=y,r.spot.length=_,r.rectArea.length=M,r.point.length=v,r.hemi.length=S,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=E,r.pointShadowMap.length=E,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=E,r.spotLightMatrix.length=C+I-D,r.spotLightMap.length=I,r.numSpotLightShadowsWithMaps=D,r.numLightProbes=B,P.directionalLength=y,P.pointLength=v,P.spotLength=_,P.rectAreaLength=M,P.hemiLength=S,P.numDirectionalShadows=A,P.numPointShadows=E,P.numSpotShadows=C,P.numSpotMaps=I,P.numLightProbes=B,r.version=fme++)}function u(d,h){let p=0,x=0,y=0,v=0,_=0;const M=h.matrixWorldInverse;for(let S=0,A=d.length;S<A;S++){const E=d[S];if(E.isDirectionalLight){const C=r.directional[p];C.direction.setFromMatrixPosition(E.matrixWorld),s.setFromMatrixPosition(E.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(M),p++}else if(E.isSpotLight){const C=r.spot[y];C.position.setFromMatrixPosition(E.matrixWorld),C.position.applyMatrix4(M),C.direction.setFromMatrixPosition(E.matrixWorld),s.setFromMatrixPosition(E.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(M),y++}else if(E.isRectAreaLight){const C=r.rectArea[v];C.position.setFromMatrixPosition(E.matrixWorld),C.position.applyMatrix4(M),o.identity(),a.copy(E.matrixWorld),a.premultiply(M),o.extractRotation(a),C.halfWidth.set(E.width*.5,0,0),C.halfHeight.set(0,E.height*.5,0),
vendor: 5,081 bytes, lines 4445-4472
4445C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),v++}else if(E.isPointLight){const C=r.point[x];C.position.setFromMatrixPosition(E.matrixWorld),C.position.applyMatrix4(M),x++}else if(E.isHemisphereLight){const C=r.hemi[_];C.direction.setFromMatrixPosition(E.matrixWorld),C.direction.transformDirection(M),_++}}}return{setup:l,setupView:u,state:r}}function T4(n){const e=new mme(n),t=[],r=[],s=[];function a(x){p.camera=x,t.length=0,r.length=0,s.length=0}function o(x){t.push(x)}function l(x){r.push(x)}function u(x){s.push(x)}function d(){e.setup(t)}function h(x){e.setupView(t,x)}const p={lightsArray:t,shadowsArray:r,lightProbeGridArray:s,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:a,state:p,setupLights:d,setupLightsView:h,pushLight:o,pushShadow:l,pushLightProbeGrid:u}}function pme(n){let e=new WeakMap;function t(s,a=0){const o=e.get(s);let l;return o===void 0?(l=new T4(n),e.set(s,[l])):a>=o.length?(l=new T4(n),o.push(l)):l=o[a],l}function r(){e=new WeakMap}return{get:t,dispose:r}}const gme=`void main() {
4446	gl_Position = vec4( position, 1.0 );
4447}`,xme=`uniform sampler2D shadow_pass;
4448uniform vec2 resolution;
4449uniform float radius;
4450void main() {
4451	const float samples = float( VSM_SAMPLES );
4452	float mean = 0.0;
4453	float squared_mean = 0.0;
4454	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4455	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4456	for ( float i = 0.0; i < samples; i ++ ) {
4457		float uvOffset = uvStart + i * uvStride;
4458		#ifdef HORIZONTAL_PASS
4459			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4460			mean += distribution.x;
4461			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4462		#else
4463			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4464			mean += depth;
4465			squared_mean += depth * depth;
4466		#endif
4467	}
4468	mean = mean / samples;
4469	squared_mean = squared_mean / samples;
4470	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4471	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4472}`,bme=[new we(1,0,0),new we(-1,0,0),new we(0,1,0),new we(0,-1,0),new we(0,0,1),new we(0,0,-1)],yme=[new we(0,-1,0),new we(0,-1,0),new we(0,0,1),new we(0,0,-1),new we(0,-1,0),new we(0,-1,0)],R4=new yn,qb=new we,IE=new we;function vme(n,e,t){let r=new pp;const s=new wt,a=new wt,o=new mr,l=new tA,u=new nA,d={},h=t.maxTextureSize,p={[Bu]:Da,[Da]:Bu,[Ll]:Ll},x=new oo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new wt},radius:{value:4}},vertexShader:gme,fragmentShader:xme}),y=x.clone();y.defines.HORIZONTAL_PASS=1;const v=new Bn;v.setAttribute("position",new Er(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Ns(v,x),M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Sx;let S=this.type;this.render=function(D,B,P){if(M.enabled===!1||M.autoUpdate===!1&&M.needsUpdate===!1||D.length===0)return;this.type===xy&&($t("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Sx);const G=n.getRenderTarget(),k=n.getActiveCubeFace(),V=n.getActiveMipmapLevel(),U=n.state;U.setBlending(Tu),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const $=S!==this.type;$&&B.traverse(function(X){X.material&&(Array.isArray(X.material)?X.material.forEach(ee=>ee.needsUpdate=!0):X.material.needsUpdate=!0)});for(let X=0,ee=D.length;X<ee;X++){const z=D[X],K=z.shadow;if(K===void 0){$t("WebGLShadowMap:",z,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;s.copy(K.mapSize);const ae=K.getFrameExtents();s.multiply(ae),a.copy(K.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(a.x=Math.floor(h/ae.x),s.x=a.x*ae.x,K.mapSize.x=a.x),s.y>h&&(a.y=Math.floor(h/ae.y),s.y=a.y*ae.y,K.mapSize.y=a.y));const oe=n.state.buffers.depth.getReversed();if(K.camera._reversedDepth=oe,K.map===null||$===!0){if(K.map!==null&&(K.map.depthTexture!==null&&(K.map.depthTexture.dispose(),K.map.depthTexture=null),K.map.dispose()),this.type===Gm){if(z.isPointLight){$t("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}K.map=new el(s.x,s.y,{format:yh,type:Ou,minFilter:qr,magFilter:qr,generateMipmaps:!1}),K.map.texture.name=z.name+".shadowMap",K.map.depthTexture=new gp(s.x,s.y,ao),K.map.depthTexture.name=z.name+".shadowMapDepth",K.map.depthTexture.format=Fu,K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=ri,K.map.depthTexture.magFilter=ri}else z.isPointLight?(K.map=new BR(s.x),K.map.depthTexture=new P8(s.x,Wl)):(K.map=new el(s.x,s.y),K.map.depthTexture=new gp(s.x,s.y,Wl)),K.map.depthTexture.name=z.name+".shadowMap",K.map.depthTexture.format=Fu,this.type===Sx?(K.map.depthTexture.compareFunction=oe?PN:RN,K.map.depthTexture.minFilter=qr,K.map.depthTexture.magFilter=qr):(K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=ri,K.map.depthTexture.magFilter=ri);K.camera.updateProjectionMatrix()}
vendor: 9,364 bytes, line 4472
4472const re=K.map.isWebGLCubeRenderTarget?6:1;for(let F=0;F<re;F++){if(K.map.isWebGLCubeRenderTarget)n.setRenderTarget(K.map,F),n.clear();else{F===0&&(n.setRenderTarget(K.map),n.clear());const O=K.getViewport(F);o.set(a.x*O.x,a.y*O.y,a.x*O.z,a.y*O.w),U.viewport(o)}if(z.isPointLight){const O=K.camera,J=K.matrix,q=z.distance||O.far;q!==O.far&&(O.far=q,O.updateProjectionMatrix()),qb.setFromMatrixPosition(z.matrixWorld),O.position.copy(qb),IE.copy(O.position),IE.add(bme[F]),O.up.copy(yme[F]),O.lookAt(IE),O.updateMatrixWorld(),J.makeTranslation(-qb.x,-qb.y,-qb.z),R4.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),K._frustum.setFromProjectionMatrix(R4,O.coordinateSystem,O.reversedDepth)}else K.updateMatrices(z);r=K.getFrustum(),C(B,P,K.camera,z,this.type)}K.isPointLightShadow!==!0&&this.type===Gm&&A(K,P),K.needsUpdate=!1}S=this.type,M.needsUpdate=!1,n.setRenderTarget(G,k,V)};function A(D,B){const P=e.update(_);x.defines.VSM_SAMPLES!==D.blurSamples&&(x.defines.VSM_SAMPLES=D.blurSamples,y.defines.VSM_SAMPLES=D.blurSamples,x.needsUpdate=!0,y.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new el(s.x,s.y,{format:yh,type:Ou})),x.uniforms.shadow_pass.value=D.map.depthTexture,x.uniforms.resolution.value=D.mapSize,x.uniforms.radius.value=D.radius,n.setRenderTarget(D.mapPass),n.clear(),n.renderBufferDirect(B,null,P,x,_,null),y.uniforms.shadow_pass.value=D.mapPass.texture,y.uniforms.resolution.value=D.mapSize,y.uniforms.radius.value=D.radius,n.setRenderTarget(D.map),n.clear(),n.renderBufferDirect(B,null,P,y,_,null)}function E(D,B,P,G){let k=null;const V=P.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(V!==void 0)k=V;else if(k=P.isPointLight===!0?u:l,n.localClippingEnabled&&B.clipShadows===!0&&Array.isArray(B.clippingPlanes)&&B.clippingPlanes.length!==0||B.displacementMap&&B.displacementScale!==0||B.alphaMap&&B.alphaTest>0||B.map&&B.alphaTest>0||B.alphaToCoverage===!0){const U=k.uuid,$=B.uuid;let X=d[U];X===void 0&&(X={},d[U]=X);let ee=X[$];ee===void 0&&(ee=k.clone(),X[$]=ee,B.addEventListener("dispose",I)),k=ee}if(k.visible=B.visible,k.wireframe=B.wireframe,G===Gm?k.side=B.shadowSide!==null?B.shadowSide:B.side:k.side=B.shadowSide!==null?B.shadowSide:p[B.side],k.alphaMap=B.alphaMap,k.alphaTest=B.alphaToCoverage===!0?.5:B.alphaTest,k.map=B.map,k.clipShadows=B.clipShadows,k.clippingPlanes=B.clippingPlanes,k.clipIntersection=B.clipIntersection,k.displacementMap=B.displacementMap,k.displacementScale=B.displacementScale,k.displacementBias=B.displacementBias,k.wireframeLinewidth=B.wireframeLinewidth,k.linewidth=B.linewidth,P.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const U=n.properties.get(k);U.light=P}return k}function C(D,B,P,G,k){if(D.visible===!1)return;if(D.layers.test(B.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===Gm)&&(!D.frustumCulled||r.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,D.matrixWorld);const $=e.update(D),X=D.material;if(Array.isArray(X)){const ee=$.groups;for(let z=0,K=ee.length;z<K;z++){const ae=ee[z],oe=X[ae.materialIndex];if(oe&&oe.visible){const re=E(D,oe,G,k);D.onBeforeShadow(n,D,B,P,$,re,ae),n.renderBufferDirect(P,null,$,re,D,ae),D.onAfterShadow(n,D,B,P,$,re,ae)}}}else if(X.visible){const ee=E(D,X,G,k);D.onBeforeShadow(n,D,B,P,$,ee,null),n.renderBufferDirect(P,null,$,ee,D,null),D.onAfterShadow(n,D,B,P,$,ee,null)}}const U=D.children;for(let $=0,X=U.length;$<X;$++)C(U[$],B,P,G,k)}function I(D){D.target.removeEventListener("dispose",I);for(const P in d){const G=d[P],k=D.target.uuid;k in G&&(G[k].dispose(),delete G[k])}}}function wme(n,e){function t(){let Ne=!1;const Ye=new mr;let Te=null;const st=new mr(0,0,0,0);return{setMask:function(et){Te!==et&&!Ne&&(n.colorMask(et,et,et,et),Te=et)},setLocked:function(et){Ne=et},setClear:function(et,Qe,Mt,ue,Je){Je===!0&&(et*=ue,Qe*=ue,Mt*=ue),Ye.set(et,Qe,Mt,ue),st.equals(Ye)===!1&&(n.clearColor(et,Qe,Mt,ue),st.copy(Ye))},reset:function(){Ne=!1,Te=null,st.set(-1,0,0,0)}}}function r(){let Ne=!1,Ye=!1,Te=null,st=null,et=null;return{setReversed:function(Qe){if(Ye!==Qe){const Mt=e.get("EXT_clip_control");Qe?Mt.clipControlEXT(Mt.LOWER_LEFT_EXT,Mt.ZERO_TO_ONE_EXT):Mt.clipControlEXT(Mt.LOWER_LEFT_EXT,Mt.NEGATIVE_ONE_TO_ONE_EXT),Ye=Qe;const ue=et;et=null,this.setClear(ue)}},getReversed:function(){return Ye},setTest:function(Qe){Qe?se(n.DEPTH_TEST):me(n.DEPTH_TEST)},setMask:function(Qe){Te!==Qe&&!Ne&&(n.depthMask(Qe),Te=Qe)},setFunc:function(Qe){if(Ye&&(Qe=Wae[Qe]),st!==Qe){switch(Qe){case F_:n.depthFunc(n.NEVER);break;case U_:n.depthFunc(n.ALWAYS);break;case z_:n.depthFunc(n.LESS);break;case hp:n.depthFunc(n.LEQUAL);break;case G_:n.depthFunc(n.EQUAL);break;case H_:n.depthFunc(n.GEQUAL);break;case V_:n.depthFunc(n.GREATER);break;case W_:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}st=Qe}},setLocked:function(Qe){Ne=Qe},setClear:function(Qe){et!==Qe&&(et=Qe,Ye&&(Qe=1-Qe),n.clearDepth(Qe))},reset:function(){Ne=!1,Te=null,st=null,et=null,Ye=!1}}}function s(){let Ne=!1,Ye=null,Te=null,st=null,et=null,Qe=null,Mt=null,ue=null,Je=null;return{setTest:function(it){Ne||(it?se(n.STENCIL_TEST):me(n.STENCIL_TEST))},setMask:function(it){Ye!==it&&!Ne&&(n.stencilMask(it),Ye=it)},setFunc:function(it,Et,Wt){(Te!==it||st!==Et||et!==Wt)&&(n.stencilFunc(it,Et,Wt),Te=it,st=Et,et=Wt)},setOp:function(it,Et,Wt){(Qe!==it||Mt!==Et||ue!==Wt)&&(n.stencilOp(it,Et,Wt),Qe=it,Mt=Et,ue=Wt)},setLocked:function(it){Ne=it},setClear:function(it){Je!==it&&(n.clearStencil(it),Je=it)},reset:function(){Ne=!1,Ye=null,Te=null,st=null,et=null,Qe=null,Mt=null,ue=null,Je=null}}}const a=new t,o=new r,l=new s,u=new WeakMap,d=new WeakMap;let h={},p={},x={},y=new WeakMap,v=[],_=null,M=!1,S=null,A=null,E=null,C=null,I=null,D=null,B=null,P=new Ut(0,0,0),G=0,k=!1,V=null,U=null,$=null,X=null,ee=null;const z=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,ae=0;const oe=n.getParameter(n.VERSION);oe.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(oe)[1]),K=ae>=1):oe.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(oe)[1]),K=ae>=2);let re=null,F={};const O=n.getParameter(n.SCISSOR_BOX),J=n.getParameter(n.VIEWPORT),q=new mr().fromArray(O),Q=new mr().fromArray(J);function ne(Ne,Ye,Te,st){const et=new Uint8Array(4),Qe=n.createTexture();n.bindTexture(Ne,Qe),n.texParameteri(Ne,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(Ne,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Mt=0;Mt<Te;Mt++)Ne===n.TEXTURE_3D||Ne===n.TEXTURE_2D_ARRAY?n.texImage3D(Ye,0,n.RGBA,1,1,st,0,n.RGBA,n.UNSIGNED_BYTE,et):n.texImage2D(Ye+Mt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,et);return Qe}const Z={};Z[n.TEXTURE_2D]=ne(n.TEXTURE_2D,n.TEXTURE_2D,1),Z[n.TEXTURE_CUBE_MAP]=ne(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[n.TEXTURE_2D_ARRAY]=ne(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Z[n.TEXTURE_3D]=ne(n.TEXTURE_3D,n.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),l.setClear(0),se(n.DEPTH_TEST),o.setFunc(hp),he(!1),le(CT),se(n.CULL_FACE),Re(Tu);function se(Ne){h[Ne]!==!0&&(n.enable(Ne),h[Ne]=!0)}function me(Ne){h[Ne]!==!1&&(n.disable(Ne),h[Ne]=!1)}function ze(Ne,Ye){return x[Ne]!==Ye?(n.bindFramebuffer(Ne,Ye),x[Ne]=Ye,Ne===n.DRAW_FRAMEBUFFER&&(x[n.FRAMEBUFFER]=Ye),Ne===n.FRAMEBUFFER&&(x[n.DRAW_FRAMEBUFFER]=Ye),!0):!1}function Be(Ne,Ye){let Te=v,st=!1;if(Ne){Te=y.get(Ye),Te===void 0&&(Te=[],y.set(Ye,Te));const et=Ne.textures;if(Te.length!==et.length||Te[0]!==n.COLOR_ATTACHMENT0){for(let Qe=0,Mt=et.length;Qe<Mt;Qe++)Te[Qe]=n.COLOR_ATTACHMENT0+Qe;Te.length=et.length,st=!0}}else Te[0]!==n.BACK&&(Te[0]=n.BACK,st=!0);st&&n.drawBuffers(Te)}function ye(Ne){return _!==Ne?(n.useProgram(Ne),_=Ne,!0):!1}const Le={[Kf]:n.FUNC_ADD,[H6]:n.FUNC_SUBTRACT,[V6]:n.FUNC_REVERSE_SUBTRACT};Le[W6]=n.MIN,Le[$6]=n.MAX;const Ce={[X6]:n.ZERO,[q6]:n.ONE,[Y6]:n.SRC_COLOR,[L_]:n.SRC_ALPHA,[t8]:n.SRC_ALPHA_SATURATE,[Z6]:n.DST_COLOR,[K6]:n.DST_ALPHA,[Q6]:n.ONE_MINUS_SRC_COLOR,[O_]:n.ONE_MINUS_SRC_ALPHA,[e8]:n.ONE_MINUS_DST_COLOR,[J6]:n.ONE_MINUS_DST_ALPHA,[n8]:n.CONSTANT_COLOR,[r8]:n.ONE_MINUS_CONSTANT_COLOR,[s8]:n.CONSTANT_ALPHA,[i8]:n.ONE_MINUS_CONSTANT_ALPHA};function Re(Ne,Ye,Te,st,et,Qe,Mt,ue,Je,it){if(Ne===Tu){M===!0&&(me(n.BLEND),M=!1);return}if(M===!1&&(se(n.BLEND),M=!0),Ne!==G6){if(Ne!==S||it!==k){if((A!==Kf||I!==Kf)&&(n.blendEquation(n.FUNC_ADD),A=Kf,I=Kf),it)switch(Ne){case tp:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ET:n.blendFunc(n.ONE,n.ONE);break;case jT:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case TT:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:fn("WebGLState: Invalid blending: ",Ne);break}else switch(Ne){case tp:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ET:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case jT:fn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case TT:fn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:fn("WebGLState: Invalid blending: ",Ne);break}E=null,C=null,D=null,B=null,P.set(0,0,0),G=0,S=Ne,k=it}return}et=et||Ye,Qe=Qe||Te,Mt=Mt||st,(Ye!==A||et!==I)&&(n.blendEquationSeparate(Le[Ye],Le[et]),A=Ye,I=et),(Te!==E||st!==C||Qe!==D||Mt!==B)&&(n.blendFuncSeparate(Ce[Te],Ce[st],Ce[Qe],Ce[Mt]),E=Te,C=st,D=Qe,B=Mt),(ue.equals(P)===!1||Je!==G)&&(n.blendColor
vendor: 10,424 bytes, line 4472
4472(ue.r,ue.g,ue.b,Je),P.copy(ue),G=Je),S=Ne,k=!1}function De(Ne,Ye){Ne.side===Ll?me(n.CULL_FACE):se(n.CULL_FACE);let Te=Ne.side===Da;Ye&&(Te=!Te),he(Te),Ne.blending===tp&&Ne.transparent===!1?Re(Tu):Re(Ne.blending,Ne.blendEquation,Ne.blendSrc,Ne.blendDst,Ne.blendEquationAlpha,Ne.blendSrcAlpha,Ne.blendDstAlpha,Ne.blendColor,Ne.blendAlpha,Ne.premultipliedAlpha),o.setFunc(Ne.depthFunc),o.setTest(Ne.depthTest),o.setMask(Ne.depthWrite),a.setMask(Ne.colorWrite);const st=Ne.stencilWrite;l.setTest(st),st&&(l.setMask(Ne.stencilWriteMask),l.setFunc(Ne.stencilFunc,Ne.stencilRef,Ne.stencilFuncMask),l.setOp(Ne.stencilFail,Ne.stencilZFail,Ne.stencilZPass)),qe(Ne.polygonOffset,Ne.polygonOffsetFactor,Ne.polygonOffsetUnits),Ne.alphaToCoverage===!0?se(n.SAMPLE_ALPHA_TO_COVERAGE):me(n.SAMPLE_ALPHA_TO_COVERAGE)}function he(Ne){V!==Ne&&(Ne?n.frontFace(n.CW):n.frontFace(n.CCW),V=Ne)}function le(Ne){Ne!==F6?(se(n.CULL_FACE),Ne!==U&&(Ne===CT?n.cullFace(n.BACK):Ne===U6?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):me(n.CULL_FACE),U=Ne}function Xe(Ne){Ne!==$&&(K&&n.lineWidth(Ne),$=Ne)}function qe(Ne,Ye,Te){Ne?(se(n.POLYGON_OFFSET_FILL),(X!==Ye||ee!==Te)&&(X=Ye,ee=Te,o.getReversed()&&(Ye=-Ye),n.polygonOffset(Ye,Te))):me(n.POLYGON_OFFSET_FILL)}function Ge(Ne){Ne?se(n.SCISSOR_TEST):me(n.SCISSOR_TEST)}function ot(Ne){Ne===void 0&&(Ne=n.TEXTURE0+z-1),re!==Ne&&(n.activeTexture(Ne),re=Ne)}function ve(Ne,Ye,Te){Te===void 0&&(re===null?Te=n.TEXTURE0+z-1:Te=re);let st=F[Te];st===void 0&&(st={type:void 0,texture:void 0},F[Te]=st),(st.type!==Ne||st.texture!==Ye)&&(re!==Te&&(n.activeTexture(Te),re=Te),n.bindTexture(Ne,Ye||Z[Ne]),st.type=Ne,st.texture=Ye)}function mt(){const Ne=F[re];Ne!==void 0&&Ne.type!==void 0&&(n.bindTexture(Ne.type,null),Ne.type=void 0,Ne.texture=void 0)}function xt(){try{n.compressedTexImage2D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function ge(){try{n.compressedTexImage3D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function Y(){try{n.texSubImage2D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function je(){try{n.texSubImage3D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function Ie(){try{n.compressedTexSubImage2D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function Ve(){try{n.compressedTexSubImage3D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function ft(){try{n.texStorage2D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function vt(){try{n.texStorage3D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function ce(){try{n.texImage2D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function Me(){try{n.texImage3D(...arguments)}catch(Ne){fn("WebGLState:",Ne)}}function Fe(Ne){return p[Ne]!==void 0?p[Ne]:n.getParameter(Ne)}function ie(Ne,Ye){p[Ne]!==Ye&&(n.pixelStorei(Ne,Ye),p[Ne]=Ye)}function Se(Ne){q.equals(Ne)===!1&&(n.scissor(Ne.x,Ne.y,Ne.z,Ne.w),q.copy(Ne))}function Ae(Ne){Q.equals(Ne)===!1&&(n.viewport(Ne.x,Ne.y,Ne.z,Ne.w),Q.copy(Ne))}function at(Ne,Ye){let Te=d.get(Ye);Te===void 0&&(Te=new WeakMap,d.set(Ye,Te));let st=Te.get(Ne);st===void 0&&(st=n.getUniformBlockIndex(Ye,Ne.name),Te.set(Ne,st))}function pe(Ne,Ye){const st=d.get(Ye).get(Ne);u.get(Ye)!==st&&(n.uniformBlockBinding(Ye,st,Ne.__bindingPointIndex),u.set(Ye,st))}function Ke(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),h={},p={},re=null,F={},x={},y=new WeakMap,v=[],_=null,M=!1,S=null,A=null,E=null,C=null,I=null,D=null,B=null,P=new Ut(0,0,0),G=0,k=!1,V=null,U=null,$=null,X=null,ee=null,q.set(0,0,n.canvas.width,n.canvas.height),Q.set(0,0,n.canvas.width,n.canvas.height),a.reset(),o.reset(),l.reset()}return{buffers:{color:a,depth:o,stencil:l},enable:se,disable:me,bindFramebuffer:ze,drawBuffers:Be,useProgram:ye,setBlending:Re,setMaterial:De,setFlipSided:he,setCullFace:le,setLineWidth:Xe,setPolygonOffset:qe,setScissorTest:Ge,activeTexture:ot,bindTexture:ve,unbindTexture:mt,compressedTexImage2D:xt,compressedTexImage3D:ge,texImage2D:ce,texImage3D:Me,pixelStorei:ie,getParameter:Fe,updateUBOMapping:at,uniformBlockBinding:pe,texStorage2D:ft,texStorage3D:vt,texSubImage2D:Y,texSubImage3D:je,compressedTexSubImage2D:Ie,compressedTexSubImage3D:Ve,scissor:Se,viewport:Ae,reset:Ke}}function Sme(n,e,t,r,s,a,o){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new wt,h=new WeakMap,p=new Set;let x;const y=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(ge,Y){return v?new OffscreenCanvas(ge,Y):Qy("canvas")}function M(ge,Y,je){let Ie=1;const Ve=xt(ge);if((Ve.width>je||Ve.height>je)&&(Ie=je/Math.max(Ve.width,Ve.height)),Ie<1)if(typeof HTMLImageElement<"u"&&ge instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ge instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ge instanceof ImageBitmap||typeof VideoFrame<"u"&&ge instanceof VideoFrame){const ft=Math.floor(Ie*Ve.width),vt=Math.floor(Ie*Ve.height);x===void 0&&(x=_(ft,vt));const ce=Y?_(ft,vt):x;return ce.width=ft,ce.height=vt,ce.getContext("2d").drawImage(ge,0,0,ft,vt),$t("WebGLRenderer: Texture has been resized from ("+Ve.width+"x"+Ve.height+") to ("+ft+"x"+vt+")."),ce}else return"data"in ge&&$t("WebGLRenderer: Image in DataTexture is too big ("+Ve.width+"x"+Ve.height+")."),ge;return ge}function S(ge){return ge.generateMipmaps}function A(ge){n.generateMipmap(ge)}function E(ge){return ge.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:ge.isWebGL3DRenderTarget?n.TEXTURE_3D:ge.isWebGLArrayRenderTarget||ge.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function C(ge,Y,je,Ie,Ve,ft=!1){if(ge!==null){if(n[ge]!==void 0)return n[ge];$t("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ge+"'")}let vt;Ie&&(vt=e.get("EXT_texture_norm16"),vt||$t("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ce=Y;if(Y===n.RED&&(je===n.FLOAT&&(ce=n.R32F),je===n.HALF_FLOAT&&(ce=n.R16F),je===n.UNSIGNED_BYTE&&(ce=n.R8),je===n.UNSIGNED_SHORT&&vt&&(ce=vt.R16_EXT),je===n.SHORT&&vt&&(ce=vt.R16_SNORM_EXT)),Y===n.RED_INTEGER&&(je===n.UNSIGNED_BYTE&&(ce=n.R8UI),je===n.UNSIGNED_SHORT&&(ce=n.R16UI),je===n.UNSIGNED_INT&&(ce=n.R32UI),je===n.BYTE&&(ce=n.R8I),je===n.SHORT&&(ce=n.R16I),je===n.INT&&(ce=n.R32I)),Y===n.RG&&(je===n.FLOAT&&(ce=n.RG32F),je===n.HALF_FLOAT&&(ce=n.RG16F),je===n.UNSIGNED_BYTE&&(ce=n.RG8),je===n.UNSIGNED_SHORT&&vt&&(ce=vt.RG16_EXT),je===n.SHORT&&vt&&(ce=vt.RG16_SNORM_EXT)),Y===n.RG_INTEGER&&(je===n.UNSIGNED_BYTE&&(ce=n.RG8UI),je===n.UNSIGNED_SHORT&&(ce=n.RG16UI),je===n.UNSIGNED_INT&&(ce=n.RG32UI),je===n.BYTE&&(ce=n.RG8I),je===n.SHORT&&(ce=n.RG16I),je===n.INT&&(ce=n.RG32I)),Y===n.RGB_INTEGER&&(je===n.UNSIGNED_BYTE&&(ce=n.RGB8UI),je===n.UNSIGNED_SHORT&&(ce=n.RGB16UI),je===n.UNSIGNED_INT&&(ce=n.RGB32UI),je===n.BYTE&&(ce=n.RGB8I),je===n.SHORT&&(ce=n.RGB16I),je===n.INT&&(ce=n.RGB32I)),Y===n.RGBA_INTEGER&&(je===n.UNSIGNED_BYTE&&(ce=n.RGBA8UI),je===n.UNSIGNED_SHORT&&(ce=n.RGBA16UI),je===n.UNSIGNED_INT&&(ce=n.RGBA32UI),je===n.BYTE&&(ce=n.RGBA8I),je===n.SHORT&&(ce=n.RGBA16I),je===n.INT&&(ce=n.RGBA32I)),Y===n.RGB&&(je===n.UNSIGNED_SHORT&&vt&&(ce=vt.RGB16_EXT),je===n.SHORT&&vt&&(ce=vt.RGB16_SNORM_EXT),je===n.UNSIGNED_INT_5_9_9_9_REV&&(ce=n.RGB9_E5),je===n.UNSIGNED_INT_10F_11F_11F_REV&&(ce=n.R11F_G11F_B10F)),Y===n.RGBA){const Me=ft?qy:ur.getTransfer(Ve);je===n.FLOAT&&(ce=n.RGBA32F),je===n.HALF_FLOAT&&(ce=n.RGBA16F),je===n.UNSIGNED_BYTE&&(ce=Me===$r?n.SRGB8_ALPHA8:n.RGBA8),je===n.UNSIGNED_SHORT&&vt&&(ce=vt.RGBA16_EXT),je===n.SHORT&&vt&&(ce=vt.RGBA16_SNORM_EXT),je===n.UNSIGNED_SHORT_4_4_4_4&&(ce=n.RGBA4),je===n.UNSIGNED_SHORT_5_5_5_1&&(ce=n.RGB5_A1)}return(ce===n.R16F||ce===n.R32F||ce===n.RG16F||ce===n.RG32F||ce===n.RGBA16F||ce===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ce}function I(ge,Y){let je;return ge?Y===null||Y===Wl||Y===Bx?je=n.DEPTH24_STENCIL8:Y===ao?je=n.DEPTH32F_STENCIL8:Y===Ix&&(je=n.DEPTH24_STENCIL8,$t("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Y===null||Y===Wl||Y===Bx?je=n.DEPTH_COMPONENT24:Y===ao?je=n.DEPTH_COMPONENT32F:Y===Ix&&(je=n.DEPTH_COMPONENT16),je}function D(ge,Y){return S(ge)===!0||ge.isFramebufferTexture&&ge.minFilter!==ri&&ge.minFilter!==qr?Math.log2(Math.max(Y.width,Y.height))+1:ge.mipmaps!==void 0&&ge.mipmaps.length>0?ge.mipmaps.length:ge.isCompressedTexture&&Array.isArray(ge.image)?Y.mipmaps.length:1}function B(ge){const Y=ge.target;Y.removeEventListener("dispose",B),G(Y),Y.isVideoTexture&&h.delete(Y),Y.isHTMLTexture&&p.delete(Y)}function P(ge){const Y=ge.target;Y.removeEventListener("dispose",P),V(Y)}function G(ge){const Y=r.get(ge);if(Y.__webglInit===void 0)return;const je=ge.source,Ie=y.get(je);if(Ie){const Ve=Ie[Y.__cacheKey];Ve.usedTimes--,Ve.usedTimes===0&&k(ge),Object.keys(Ie).length===0&&y.delete(je)}r.remove(ge)}function k(ge){const Y=r.get(ge);n.deleteTexture(Y.__webglTexture);const je=ge.source,Ie=y.get(je);delete Ie[Y.__cacheKey],o.memory.textures--}function V(ge){const Y=r.get(ge);if(ge.depthTexture&&(ge.depthTexture.dispose(),r.remove(ge.depthTexture)),ge.isWebGLCubeRen
vendor: 9,353 bytes, line 4472
4472derTarget)for(let Ie=0;Ie<6;Ie++){if(Array.isArray(Y.__webglFramebuffer[Ie]))for(let Ve=0;Ve<Y.__webglFramebuffer[Ie].length;Ve++)n.deleteFramebuffer(Y.__webglFramebuffer[Ie][Ve]);else n.deleteFramebuffer(Y.__webglFramebuffer[Ie]);Y.__webglDepthbuffer&&n.deleteRenderbuffer(Y.__webglDepthbuffer[Ie])}else{if(Array.isArray(Y.__webglFramebuffer))for(let Ie=0;Ie<Y.__webglFramebuffer.length;Ie++)n.deleteFramebuffer(Y.__webglFramebuffer[Ie]);else n.deleteFramebuffer(Y.__webglFramebuffer);if(Y.__webglDepthbuffer&&n.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&n.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let Ie=0;Ie<Y.__webglColorRenderbuffer.length;Ie++)Y.__webglColorRenderbuffer[Ie]&&n.deleteRenderbuffer(Y.__webglColorRenderbuffer[Ie]);Y.__webglDepthRenderbuffer&&n.deleteRenderbuffer(Y.__webglDepthRenderbuffer)}const je=ge.textures;for(let Ie=0,Ve=je.length;Ie<Ve;Ie++){const ft=r.get(je[Ie]);ft.__webglTexture&&(n.deleteTexture(ft.__webglTexture),o.memory.textures--),r.remove(je[Ie])}r.remove(ge)}let U=0;function $(){U=0}function X(){return U}function ee(ge){U=ge}function z(){const ge=U;return ge>=s.maxTextures&&$t("WebGLTextures: Trying to use "+ge+" texture units while this GPU supports only "+s.maxTextures),U+=1,ge}function K(ge){const Y=[];return Y.push(ge.wrapS),Y.push(ge.wrapT),Y.push(ge.wrapR||0),Y.push(ge.magFilter),Y.push(ge.minFilter),Y.push(ge.anisotropy),Y.push(ge.internalFormat),Y.push(ge.format),Y.push(ge.type),Y.push(ge.generateMipmaps),Y.push(ge.premultiplyAlpha),Y.push(ge.flipY),Y.push(ge.unpackAlignment),Y.push(ge.colorSpace),Y.join()}function ae(ge,Y){const je=r.get(ge);if(ge.isVideoTexture&&ve(ge),ge.isRenderTargetTexture===!1&&ge.isExternalTexture!==!0&&ge.version>0&&je.__version!==ge.version){const Ie=ge.image;if(Ie===null)$t("WebGLRenderer: Texture marked for update but no image data found.");else if(Ie.complete===!1)$t("WebGLRenderer: Texture marked for update but image is incomplete");else{me(je,ge,Y);return}}else ge.isExternalTexture&&(je.__webglTexture=ge.sourceTexture?ge.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,je.__webglTexture,n.TEXTURE0+Y)}function oe(ge,Y){const je=r.get(ge);if(ge.isRenderTargetTexture===!1&&ge.version>0&&je.__version!==ge.version){me(je,ge,Y);return}else ge.isExternalTexture&&(je.__webglTexture=ge.sourceTexture?ge.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,je.__webglTexture,n.TEXTURE0+Y)}function re(ge,Y){const je=r.get(ge);if(ge.isRenderTargetTexture===!1&&ge.version>0&&je.__version!==ge.version){me(je,ge,Y);return}t.bindTexture(n.TEXTURE_3D,je.__webglTexture,n.TEXTURE0+Y)}function F(ge,Y){const je=r.get(ge);if(ge.isCubeDepthTexture!==!0&&ge.version>0&&je.__version!==ge.version){ze(je,ge,Y);return}t.bindTexture(n.TEXTURE_CUBE_MAP,je.__webglTexture,n.TEXTURE0+Y)}const O={[bh]:n.REPEAT,[io]:n.CLAMP_TO_EDGE,[kx]:n.MIRRORED_REPEAT},J={[ri]:n.NEAREST,[_N]:n.NEAREST_MIPMAP_NEAREST,[Hm]:n.NEAREST_MIPMAP_LINEAR,[qr]:n.LINEAR,[_x]:n.LINEAR_MIPMAP_NEAREST,[Fl]:n.LINEAR_MIPMAP_LINEAR},q={[g8]:n.NEVER,[w8]:n.ALWAYS,[x8]:n.LESS,[RN]:n.LEQUAL,[b8]:n.EQUAL,[PN]:n.GEQUAL,[y8]:n.GREATER,[v8]:n.NOTEQUAL};function Q(ge,Y){if(Y.type===ao&&e.has("OES_texture_float_linear")===!1&&(Y.magFilter===qr||Y.magFilter===_x||Y.magFilter===Hm||Y.magFilter===Fl||Y.minFilter===qr||Y.minFilter===_x||Y.minFilter===Hm||Y.minFilter===Fl)&&$t("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(ge,n.TEXTURE_WRAP_S,O[Y.wrapS]),n.texParameteri(ge,n.TEXTURE_WRAP_T,O[Y.wrapT]),(ge===n.TEXTURE_3D||ge===n.TEXTURE_2D_ARRAY)&&n.texParameteri(ge,n.TEXTURE_WRAP_R,O[Y.wrapR]),n.texParameteri(ge,n.TEXTURE_MAG_FILTER,J[Y.magFilter]),n.texParameteri(ge,n.TEXTURE_MIN_FILTER,J[Y.minFilter]),Y.compareFunction&&(n.texParameteri(ge,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(ge,n.TEXTURE_COMPARE_FUNC,q[Y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Y.magFilter===ri||Y.minFilter!==Hm&&Y.minFilter!==Fl||Y.type===ao&&e.has("OES_texture_float_linear")===!1)return;if(Y.anisotropy>1||r.get(Y).__currentAnisotropy){const je=e.get("EXT_texture_filter_anisotropic");n.texParameterf(ge,je.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Y.anisotropy,s.getMaxAnisotropy())),r.get(Y).__currentAnisotropy=Y.anisotropy}}}function ne(ge,Y){let je=!1;ge.__webglInit===void 0&&(ge.__webglInit=!0,Y.addEventListener("dispose",B));const Ie=Y.source;let Ve=y.get(Ie);Ve===void 0&&(Ve={},y.set(Ie,Ve));const ft=K(Y);if(ft!==ge.__cacheKey){Ve[ft]===void 0&&(Ve[ft]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,je=!0),Ve[ft].usedTimes++;const vt=Ve[ge.__cacheKey];vt!==void 0&&(Ve[ge.__cacheKey].usedTimes--,vt.usedTimes===0&&k(Y)),ge.__cacheKey=ft,ge.__webglTexture=Ve[ft].texture}return je}function Z(ge,Y,je){return Math.floor(Math.floor(ge/je)/Y)}function se(ge,Y,je,Ie){const ft=ge.updateRanges;if(ft.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,Y.width,Y.height,je,Ie,Y.data);else{ft.sort((ie,Se)=>ie.start-Se.start);let vt=0;for(let ie=1;ie<ft.length;ie++){const Se=ft[vt],Ae=ft[ie],at=Se.start+Se.count,pe=Z(Ae.start,Y.width,4),Ke=Z(Se.start,Y.width,4);Ae.start<=at+1&&pe===Ke&&Z(Ae.start+Ae.count-1,Y.width,4)===pe?Se.count=Math.max(Se.count,Ae.start+Ae.count-Se.start):(++vt,ft[vt]=Ae)}ft.length=vt+1;const ce=t.getParameter(n.UNPACK_ROW_LENGTH),Me=t.getParameter(n.UNPACK_SKIP_PIXELS),Fe=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,Y.width);for(let ie=0,Se=ft.length;ie<Se;ie++){const Ae=ft[ie],at=Math.floor(Ae.start/4),pe=Math.ceil(Ae.count/4),Ke=at%Y.width,Ne=Math.floor(at/Y.width),Ye=pe,Te=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(n.UNPACK_SKIP_ROWS,Ne),t.texSubImage2D(n.TEXTURE_2D,0,Ke,Ne,Ye,Te,je,Ie,Y.data)}ge.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,ce),t.pixelStorei(n.UNPACK_SKIP_PIXELS,Me),t.pixelStorei(n.UNPACK_SKIP_ROWS,Fe)}}function me(ge,Y,je){let Ie=n.TEXTURE_2D;(Y.isDataArrayTexture||Y.isCompressedArrayTexture)&&(Ie=n.TEXTURE_2D_ARRAY),Y.isData3DTexture&&(Ie=n.TEXTURE_3D);const Ve=ne(ge,Y),ft=Y.source;t.bindTexture(Ie,ge.__webglTexture,n.TEXTURE0+je);const vt=r.get(ft);if(ft.version!==vt.__version||Ve===!0){if(t.activeTexture(n.TEXTURE0+je),(typeof ImageBitmap<"u"&&Y.image instanceof ImageBitmap)===!1){const Te=ur.getPrimaries(ur.workingColorSpace),st=Y.colorSpace===Td?null:ur.getPrimaries(Y.colorSpace),et=Y.colorSpace===Td||Te===st?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,Y.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,et)}t.pixelStorei(n.UNPACK_ALIGNMENT,Y.unpackAlignment);let Me=M(Y.image,!1,s.maxTextureSize);Me=mt(Y,Me);const Fe=a.convert(Y.format,Y.colorSpace),ie=a.convert(Y.type);let Se=C(Y.internalFormat,Fe,ie,Y.normalized,Y.colorSpace,Y.isVideoTexture);Q(Ie,Y);let Ae;const at=Y.mipmaps,pe=Y.isVideoTexture!==!0,Ke=vt.__version===void 0||Ve===!0,Ne=ft.dataReady,Ye=D(Y,Me);if(Y.isDepthTexture)Se=I(Y.format===rh,Y.type),Ke&&(pe?t.texStorage2D(n.TEXTURE_2D,1,Se,Me.width,Me.height):t.texImage2D(n.TEXTURE_2D,0,Se,Me.width,Me.height,0,Fe,ie,null));else if(Y.isDataTexture)if(at.length>0){pe&&Ke&&t.texStorage2D(n.TEXTURE_2D,Ye,Se,at[0].width,at[0].height);for(let Te=0,st=at.length;Te<st;Te++)Ae=at[Te],pe?Ne&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Ae.width,Ae.height,Fe,ie,Ae.data):t.texImage2D(n.TEXTURE_2D,Te,Se,Ae.width,Ae.height,0,Fe,ie,Ae.data);Y.generateMipmaps=!1}else pe?(Ke&&t.texStorage2D(n.TEXTURE_2D,Ye,Se,Me.width,Me.height),Ne&&se(Y,Me,Fe,ie)):t.texImage2D(n.TEXTURE_2D,0,Se,Me.width,Me.height,0,Fe,ie,Me.data);else if(Y.isCompressedTexture)if(Y.isCompressedArrayTexture){pe&&Ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ye,Se,at[0].width,at[0].height,Me.depth);for(let Te=0,st=at.length;Te<st;Te++)if(Ae=at[Te],Y.format!==Pa)if(Fe!==null)if(pe){if(Ne)if(Y.layerUpdates.size>0){const et=GT(Ae.width,Ae.height,Y.format,Y.type);for(const Qe of Y.layerUpdates){const Mt=Ae.data.subarray(Qe*et/Ae.data.BYTES_PER_ELEMENT,(Qe+1)*et/Ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,Qe,Ae.width,Ae.height,1,Fe,Mt)}Y.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,Ae.width,Ae.height,Me.depth,Fe,Ae.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Te,Se,Ae.width,Ae.height,Me.depth,0,Ae.data,0,0);else $t("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else pe?Ne&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Te,0,0,0,Ae.width,Ae.height,Me.depth,Fe,ie,Ae.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Te,Se,Ae.width,Ae.height,Me.depth,0,Fe,ie,Ae.data)}else{pe&&Ke&&t.texStorage2D(n.TEXTURE_2D,Ye,Se,at[0].width,at[0].height);for(let Te=0,st=at.length;Te<st;Te++)Ae=at[Te],Y.format!==Pa?Fe!==null?pe?Ne&&t.compressedTexSubImage2D(n.TEXTURE_2D,Te,0,0,Ae.width,Ae.height,Fe,Ae.data):t.compressedTexImage2D(n.TEXTURE_2D,Te,Se,Ae.width,Ae.height,0,Ae.data):$t("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):pe?Ne&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Ae.width,Ae.height,Fe,ie,Ae.data):t.texImage2D(n.TEXTURE_2D,Te,Se,Ae.width,Ae.height,0,Fe,ie,Ae.data)}else if(Y.isDataArrayTexture)if(pe){if(Ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ye,Se,Me.width,Me.he
4472ight,Me.depth),Ne)if(Y.layerUpdates.size>0){const Te=GT(Me.width,Me.height,Y.format,Y.type);for(const st of Y.layerUpdates){const et=Me.data.subarray(st*Te/Me.data.BYTES_PER_ELEMENT,(st+1)*Te/Me.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,st,Me.width,Me.height,1,Fe,ie,et)}Y.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Me.width,Me.height,Me.depth,Fe,ie,Me.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Se,Me.width,Me.height,Me.depth,0,Fe,ie,Me.data);else if(Y.isData3DTexture)pe?(Ke&&t.texStorage3D(n.TEXTURE_3D,Ye,Se,Me.width,Me.height,Me.depth),Ne&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Me.width,Me.height,Me.depth,Fe,ie,Me.data)):t.texImage3D(n.TEXTURE_3D,0,Se,Me.width,Me.height,Me.depth,0,Fe,ie,Me.data);else if(Y.isFramebufferTexture){if(Ke)if(pe)t.texStorage2D(n.TEXTURE_2D,Ye,Se,Me.width,Me.height);else{let Te=Me.width,st=Me.height;for(let et=0;et<Ye;et++)t.texImage2D(n.TEXTURE_2D,et,Se,Te,st,0,Fe,ie,null),Te>>=1,st>>=1}}else if(Y.isHTMLTexture){if("texElementImage2D"in n){const Te=n.canvas;if(Te.hasAttribute("layoutsubtree")||Te.setAttribute("layoutsubtree","true"),Me.parentNode!==Te){Te.appendChild(Me),p.add(Y),Te.onpaint=st=>{const et=st.changedElements;for(const Qe of p)et.includes(Qe.image)&&(Qe.needsUpdate=!0)},Te.requestPaint();return}if(n.texElementImage2D.length===3)n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,Me);else{const et=n.RGBA,Qe=n.RGBA,Mt=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,0,et,Qe,Mt,Me)}
vendor: 30,059 bytes, lines 4472-4496
4472n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(at.length>0){if(pe&&Ke){const Te=xt(at[0]);t.texStorage2D(n.TEXTURE_2D,Ye,Se,Te.width,Te.height)}for(let Te=0,st=at.length;Te<st;Te++)Ae=at[Te],pe?Ne&&t.texSubImage2D(n.TEXTURE_2D,Te,0,0,Fe,ie,Ae):t.texImage2D(n.TEXTURE_2D,Te,Se,Fe,ie,Ae);Y.generateMipmaps=!1}else if(pe){if(Ke){const Te=xt(Me);t.texStorage2D(n.TEXTURE_2D,Ye,Se,Te.width,Te.height)}Ne&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,Fe,ie,Me)}else t.texImage2D(n.TEXTURE_2D,0,Se,Fe,ie,Me);S(Y)&&A(Ie),vt.__version=ft.version,Y.onUpdate&&Y.onUpdate(Y)}ge.__version=Y.version}function ze(ge,Y,je){if(Y.image.length!==6)return;const Ie=ne(ge,Y),Ve=Y.source;t.bindTexture(n.TEXTURE_CUBE_MAP,ge.__webglTexture,n.TEXTURE0+je);const ft=r.get(Ve);if(Ve.version!==ft.__version||Ie===!0){t.activeTexture(n.TEXTURE0+je);const vt=ur.getPrimaries(ur.workingColorSpace),ce=Y.colorSpace===Td?null:ur.getPrimaries(Y.colorSpace),Me=Y.colorSpace===Td||vt===ce?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,Y.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,Y.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);const Fe=Y.isCompressedTexture||Y.image[0].isCompressedTexture,ie=Y.image[0]&&Y.image[0].isDataTexture,Se=[];for(let Qe=0;Qe<6;Qe++)!Fe&&!ie?Se[Qe]=M(Y.image[Qe],!0,s.maxCubemapSize):Se[Qe]=ie?Y.image[Qe].image:Y.image[Qe],Se[Qe]=mt(Y,Se[Qe]);const Ae=Se[0],at=a.convert(Y.format,Y.colorSpace),pe=a.convert(Y.type),Ke=C(Y.internalFormat,at,pe,Y.normalized,Y.colorSpace),Ne=Y.isVideoTexture!==!0,Ye=ft.__version===void 0||Ie===!0,Te=Ve.dataReady;let st=D(Y,Ae);Q(n.TEXTURE_CUBE_MAP,Y);let et;if(Fe){Ne&&Ye&&t.texStorage2D(n.TEXTURE_CUBE_MAP,st,Ke,Ae.width,Ae.height);for(let Qe=0;Qe<6;Qe++){et=Se[Qe].mipmaps;for(let Mt=0;Mt<et.length;Mt++){const ue=et[Mt];Y.format!==Pa?at!==null?Ne?Te&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt,0,0,ue.width,ue.height,at,ue.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt,Ke,ue.width,ue.height,0,ue.data):$t("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ne?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt,0,0,ue.width,ue.height,at,pe,ue.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt,Ke,ue.width,ue.height,0,at,pe,ue.data)}}}else{if(et=Y.mipmaps,Ne&&Ye){et.length>0&&st++;const Qe=xt(Se[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,st,Ke,Qe.width,Qe.height)}for(let Qe=0;Qe<6;Qe++)if(ie){Ne?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,0,0,Se[Qe].width,Se[Qe].height,at,pe,Se[Qe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,Ke,Se[Qe].width,Se[Qe].height,0,at,pe,Se[Qe].data);for(let Mt=0;Mt<et.length;Mt++){const Je=et[Mt].image[Qe].image;Ne?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt+1,0,0,Je.width,Je.height,at,pe,Je.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt+1,Ke,Je.width,Je.height,0,at,pe,Je.data)}}else{Ne?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,0,0,at,pe,Se[Qe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,Ke,at,pe,Se[Qe]);for(let Mt=0;Mt<et.length;Mt++){const ue=et[Mt];Ne?Te&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt+1,0,0,at,pe,ue.image[Qe]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,Mt+1,Ke,at,pe,ue.image[Qe])}}}S(Y)&&A(n.TEXTURE_CUBE_MAP),ft.__version=Ve.version,Y.onUpdate&&Y.onUpdate(Y)}ge.__version=Y.version}function Be(ge,Y,je,Ie,Ve,ft){const vt=a.convert(je.format,je.colorSpace),ce=a.convert(je.type),Me=C(je.internalFormat,vt,ce,je.normalized,je.colorSpace),Fe=r.get(Y),ie=r.get(je);if(ie.__renderTarget=Y,!Fe.__hasExternalTextures){const Se=Math.max(1,Y.width>>ft),Ae=Math.max(1,Y.height>>ft);Ve===n.TEXTURE_3D||Ve===n.TEXTURE_2D_ARRAY?t.texImage3D(Ve,ft,Me,Se,Ae,Y.depth,0,vt,ce,null):t.texImage2D(Ve,ft,Me,Se,Ae,0,vt,ce,null)}t.bindFramebuffer(n.FRAMEBUFFER,ge),ot(Y)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Ie,Ve,ie.__webglTexture,0,Ge(Y)):(Ve===n.TEXTURE_2D||Ve>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ve<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ie,Ve,ie.__webglTexture,ft),t.bindFramebuffer(n.FRAMEBUFFER,null)}function ye(ge,Y,je){if(n.bindRenderbuffer(n.RENDERBUFFER,ge),Y.depthBuffer){const Ie=Y.depthTexture,Ve=Ie&&Ie.isDepthTexture?Ie.type:null,ft=I(Y.stencilBuffer,Ve),vt=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;ot(Y)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ge(Y),ft,Y.width,Y.height):je?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ge(Y),ft,Y.width,Y.height):n.renderbufferStorage(n.RENDERBUFFER,ft,Y.width,Y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,vt,n.RENDERBUFFER,ge)}else{const Ie=Y.textures;for(let Ve=0;Ve<Ie.length;Ve++){const ft=Ie[Ve],vt=a.convert(ft.format,ft.colorSpace),ce=a.convert(ft.type),Me=C(ft.internalFormat,vt,ce,ft.normalized,ft.colorSpace);ot(Y)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ge(Y),Me,Y.width,Y.height):je?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ge(Y),Me,Y.width,Y.height):n.renderbufferStorage(n.RENDERBUFFER,Me,Y.width,Y.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Le(ge,Y,je){const Ie=Y.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,ge),!(Y.depthTexture&&Y.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const Ve=r.get(Y.depthTexture);if(Ve.__renderTarget=Y,(!Ve.__webglTexture||Y.depthTexture.image.width!==Y.width||Y.depthTexture.image.height!==Y.height)&&(Y.depthTexture.image.width=Y.width,Y.depthTexture.image.height=Y.height,Y.depthTexture.needsUpdate=!0),Ie){if(Ve.__webglInit===void 0&&(Ve.__webglInit=!0,Y.depthTexture.addEventListener("dispose",B)),Ve.__webglTexture===void 0){Ve.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,Ve.__webglTexture),Q(n.TEXTURE_CUBE_MAP,Y.depthTexture);const Fe=a.convert(Y.depthTexture.format),ie=a.convert(Y.depthTexture.type);let Se;Y.depthTexture.format===Fu?Se=n.DEPTH_COMPONENT24:Y.depthTexture.format===rh&&(Se=n.DEPTH24_STENCIL8);for(let Ae=0;Ae<6;Ae++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0,Se,Y.width,Y.height,0,Fe,ie,null)}}else ae(Y.depthTexture,0);const ft=Ve.__webglTexture,vt=Ge(Y),ce=Ie?n.TEXTURE_CUBE_MAP_POSITIVE_X+je:n.TEXTURE_2D,Me=Y.depthTexture.format===rh?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(Y.depthTexture.format===Fu)ot(Y)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Me,ce,ft,0,vt):n.framebufferTexture2D(n.FRAMEBUFFER,Me,ce,ft,0);else if(Y.depthTexture.format===rh)ot(Y)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Me,ce,ft,0,vt):n.framebufferTexture2D(n.FRAMEBUFFER,Me,ce,ft,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ce(ge){const Y=r.get(ge),je=ge.isWebGLCubeRenderTarget===!0;if(Y.__boundDepthTexture!==ge.depthTexture){const Ie=ge.depthTexture;if(Y.__depthDisposeCallback&&Y.__depthDisposeCallback(),Ie){const Ve=()=>{delete Y.__boundDepthTexture,delete Y.__depthDisposeCallback,Ie.removeEventListener("dispose",Ve)};Ie.addEventListener("dispose",Ve),Y.__depthDisposeCallback=Ve}Y.__boundDepthTexture=Ie}if(ge.depthTexture&&!Y.__autoAllocateDepthBuffer)if(je)for(let Ie=0;Ie<6;Ie++)Le(Y.__webglFramebuffer[Ie],ge,Ie);else{const Ie=ge.texture.mipmaps;Ie&&Ie.length>0?Le(Y.__webglFramebuffer[0],ge,0):Le(Y.__webglFramebuffer,ge,0)}else if(je){Y.__webglDepthbuffer=[];for(let Ie=0;Ie<6;Ie++)if(t.bindFramebuffer(n.FRAMEBUFFER,Y.__webglFramebuffer[Ie]),Y.__webglDepthbuffer[Ie]===void 0)Y.__webglDepthbuffer[Ie]=n.createRenderbuffer(),ye(Y.__webglDepthbuffer[Ie],ge,!1);else{const Ve=ge.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ft=Y.__webglDepthbuffer[Ie];n.bindRenderbuffer(n.RENDERBUFFER,ft),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ve,n.RENDERBUFFER,ft)}}else{const Ie=ge.texture.mipmaps;if(Ie&&Ie.length>0?t.bindFramebuffer(n.FRAMEBUFFER,Y.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,Y.__webglFramebuffer),Y.__webglDepthbuffer===void 0)Y.__webglDepthbuffer=n.createRenderbuffer(),ye(Y.__webglDepthbuffer,ge,!1);else{const Ve=ge.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ft=Y.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,ft),n.framebufferRenderbuffer(n.FRAMEBUFFER,Ve,n.RENDERBUFFER,ft)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Re(ge,Y,je){const Ie=r.get(ge);Y!==void 0&&Be(Ie.__webglFramebuffer,ge,ge.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),je!==void 0&&Ce(ge)}function De(ge){const Y=ge.texture,je=r.get(ge),Ie=r.get(Y);ge.addEventListener("dispose",P);const Ve=ge.textures,ft=ge.isWebGLCubeRenderTarget===!0,vt=Ve.length>1;if(vt||(Ie.__webglTexture===void 0&&(Ie.__webglTexture=n.createTexture()),Ie.__version=Y.version,o.memory.textures++),ft){je.__webglFramebuffer=[];for(let ce=0;ce<6;ce++)if(Y.mipmaps&&Y.mipmaps.length>0){je.__webglFramebuffer[ce]=[];for(let Me=0;Me<Y.mipmaps.length;Me++)je.__webglFramebuffer[ce][Me]=n.createFramebuffer()}else je.__webglFramebuffer[ce]=n.createFramebuffer()}else{if(Y.mipmaps&&Y.mipmaps.length>0){je.__webglFramebuffer=[];for(let ce=0;ce<Y.mipmaps.length;ce++)je.__webglFramebuffer[ce]=n.createFramebuffer()}else je.__webglFramebuffer=n.createFramebuffer();if(vt)for(let ce=0,Me=Ve.length;ce<Me;ce++){const Fe=r.get(Ve[ce]);Fe.__webglTexture===void 0&&(Fe.__webglTexture=n.createTexture(),o.memory.textures++)}if(ge.samples>0&&ot(ge)===!1){je.__webglMultisampledFramebuffer=n.createFramebuffer(),je.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,je.__webglMultisampledFramebuffer);for(let ce=0;ce<Ve.length;ce++){const Me=Ve[ce];je.__webglColorRenderbuffer[ce]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,je.__webglColorRenderbuffer[ce]);const Fe=a.convert(Me.format,Me.colorSpace),ie=a.convert(Me.type),Se=C(Me.internalFormat,Fe,ie,Me.normalized,Me.colorSpace,ge.isXRRenderTarget===!0),Ae=Ge(ge);n.renderbufferStorageMultisample(n.RENDERBUFFER,Ae,Se,ge.width,ge.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ce,n.RENDERBUFFER,je.__webglColorRenderbuffer[ce])}n.bindRenderbuffer(n.RENDERBUFFER,null),ge.depthBuffer&&(je.__webglDepthRenderbuffer=n.createRenderbuffer(),ye(je.__webglDepthRenderbuffer,ge,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(ft){t.bindTexture(n.TEXTURE_CUBE_MAP,Ie.__webglTexture),Q(n.TEXTURE_CUBE_MAP,Y);for(let ce=0;ce<6;ce++)if(Y.mipmaps&&Y.mipmaps.length>0)for(let Me=0;Me<Y.mipmaps.length;Me++)Be(je.__webglFramebuffer[ce][Me],ge,Y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Me);else Be(je.__webglFramebuffer[ce],ge,Y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0);S(Y)&&A(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(vt){for(let ce=0,Me=Ve.length;ce<Me;ce++){const Fe=Ve[ce],ie=r.get(Fe);let Se=n.TEXTURE_2D;(ge.isWebGL3DRenderTarget||ge.isWebGLArrayRenderTarget)&&(Se=ge.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(Se,ie.__webglTexture),Q(Se,Fe),Be(je.__webglFramebuffer,ge,Fe,n.COLOR_ATTACHMENT0+ce,Se,0),S(Fe)&&A(Se)}t.unbindTexture()}else{let ce=n.TEXTURE_2D;if((ge.isWebGL3DRenderTarget||ge.isWebGLArrayRenderTarget)&&(ce=ge.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ce,Ie.__webglTexture),Q(ce,Y),Y.mipmaps&&Y.mipmaps.length>0)for(let Me=0;Me<Y.mipmaps.length;Me++)Be(je.__webglFramebuffer[Me],ge,Y,n.COLOR_ATTACHMENT0,ce,Me);else Be(je.__webglFramebuffer,ge,Y,n.COLOR_ATTACHMENT0,ce,0);S(Y)&&A(ce),t.unbindTexture()}ge.depthBuffer&&Ce(ge)}function he(ge){const Y=ge.textures;for(let je=0,Ie=Y.length;je<Ie;je++){const Ve=Y[je];if(S(Ve)){const ft=E(ge),vt=r.get(Ve).__webglTexture;t.bindTexture(ft,vt),A(ft),t.unbindTexture()}}}const le=[],Xe=[];function qe(ge){if(ge.samples>0){if(ot(ge)===!1){const Y=ge.textures,je=ge.width,Ie=ge.height;let Ve=n.COLOR_BUFFER_BIT;const ft=ge.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,vt=r.get(ge),ce=Y.length>1;if(ce)for(let Fe=0;Fe<Y.length;Fe++)t.bindFramebuffer(n.FRAMEBUFFER,vt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,vt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,vt.__webglMultisampledFramebuffer);const Me=ge.texture.mipmaps;Me&&Me.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,vt.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,vt.__webglFramebuffer);for(let Fe=0;Fe<Y.length;Fe++){if(ge.resolveDepthBuffer&&(ge.depthBuffer&&(Ve|=n.DEPTH_BUFFER_BIT),ge.stencilBuffer&&ge.resolveStencilBuffer&&(Ve|=n.STENCIL_BUFFER_BIT)),ce){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,vt.__webglColorRenderbuffer[Fe]);const ie=r.get(Y[Fe]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,ie,0)}n.blitFramebuffer(0,0,je,Ie,0,0,je,Ie,Ve,n.NEAREST),u===!0&&(le.length=0,Xe.length=0,le.push(n.COLOR_ATTACHMENT0+Fe),ge.depthBuffer&&ge.resolveDepthBuffer===!1&&(le.push(ft),Xe.push(ft),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,Xe)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,le))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),ce)for(let Fe=0;Fe<Y.length;Fe++){t.bindFramebuffer(n.FRAMEBUFFER,vt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.RENDERBUFFER,vt.__webglColorRenderbuffer[Fe]);const ie=r.get(Y[Fe]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,vt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.TEXTURE_2D,ie,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,vt.__webglMultisampledFramebuffer)}else if(ge.depthBuffer&&ge.resolveDepthBuffer===!1&&u){const Y=ge.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[Y])}}}function Ge(ge){return Math.min(s.maxSamples,ge.samples)}function ot(ge){const Y=r.get(ge);return ge.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Y.__useRenderToTexture!==!1}function ve(ge){const Y=o.render.frame;h.get(ge)!==Y&&(h.set(ge,Y),ge.update())}function mt(ge,Y){const je=ge.colorSpace,Ie=ge.format,Ve=ge.type;return ge.isCompressedTexture===!0||ge.isVideoTexture===!0||je!==Fx&&je!==Td&&(ur.getTransfer(je)===$r?(Ie!==Pa||Ve!==eo)&&$t("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):fn("WebGLTextures: Unsupported texture color space:",je)),Y}function xt(ge){return typeof HTMLImageElement<"u"&&ge instanceof HTMLImageElement?(d.width=ge.naturalWidth||ge.width,d.height=ge.naturalHeight||ge.height):typeof VideoFrame<"u"&&ge instanceof VideoFrame?(d.width=ge.displayWidth,d.height=ge.displayHeight):(d.width=ge.width,d.height=ge.height),d}this.allocateTextureUnit=z,this.resetTextureUnits=$,this.getTextureUnits=X,this.setTextureUnits=ee,this.setTexture2D=ae,this.setTexture2DArray=oe,this.setTexture3D=re,this.setTextureCube=F,this.rebindTextures=Re,this.setupRenderTarget=De,this.updateRenderTargetMipmap=he,this.updateMultisampleRenderTarget=qe,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=Be,this.useMultisampledRTT=ot,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function C9(n,e){function t(r,s=Td){let a;const o=ur.getTransfer(s);if(r===eo)return n.UNSIGNED_BYTE;if(r===NN)return n.UNSIGNED_SHORT_4_4_4_4;if(r===AN)return n.UNSIGNED_SHORT_5_5_5_1;if(r===eR)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===tR)return n.UNSIGNED_INT_10F_11F_11F_REV;if(r===J3)return n.BYTE;if(r===Z3)return n.SHORT;if(r===Ix)return n.UNSIGNED_SHORT;if(r===MN)return n.INT;if(r===Wl)return n.UNSIGNED_INT;if(r===ao)return n.FLOAT;if(r===Ou)return n.HALF_FLOAT;if(r===nR)return n.ALPHA;if(r===rR)return n.RGB;if(r===Pa)return n.RGBA;if(r===Fu)return n.DEPTH_COMPONENT;if(r===rh)return n.DEPTH_STENCIL;if(r===CN)return n.RED;if(r===Mv)return n.RED_INTEGER;if(r===yh)return n.RG;if(r===EN)return n.RG_INTEGER;if(r===jN)return n.RGBA_INTEGER;if(r===vy||r===wy||r===Sy||r===_y)if(o===$r)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===vy)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===wy)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Sy)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===_y)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===vy)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===wy)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Sy)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===_y)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===$_||r===X_||r===q_||r===Y_)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===$_)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===X_)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===q_)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Y_)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===Q_||r===K_||r===J_||r===Z_||r===eM||r===Wy||r===tM)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Q_||r===K_)return o===$r?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===J_)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;if(r===Z_)return a.COMPRESSED_R11_EAC;if(r===eM)return a.COMPRESSED_SIGNED_R11_EAC;if(r===Wy)return a.COMPRESSED_RG11_EAC;if(r===tM)return a.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===nM||r===rM||r===sM||r===iM||r===aM||r===oM||r===lM||r===cM||r===uM||r===dM||r===fM||r===hM||r===mM||r===pM)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===nM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===rM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===sM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===iM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===aM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===oM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===lM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===cM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===uM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===dM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===fM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===hM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===mM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===pM)return o===$r?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===gM||r===xM||r===bM)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===gM)return o===$r?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===xM)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===bM)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===yM||r===vM||r===$y||r===wM)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===yM)return a.COMPRESSED_RED_RGTC1_EXT;if(r===vM)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===$y)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===wM)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Bx?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}const _me=`
4473void main() {
4474
4475	gl_Position = vec4( position, 1.0 );
4476
4477}`,Mme=`
4478uniform sampler2DArray depthColor;
4479uniform float depthWidth;
4480uniform float depthHeight;
4481
4482void main() {
4483
4484	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4485
4486	if ( coord.x >= 1.0 ) {
4487
4488		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4489
4490	} else {
4491
4492		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4493
4494	}
4495
4496}`;class Nme{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const r=new gR(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,r=new oo({vertexShader:_me,fragmentShader:Mme,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ns(new Yd(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ame extends Rc{constructor(e,t){super();const r=this;let s=null,a=1,o=null,l="local-floor",u=1,d=null,h=null,p=null,x=null,y=null,v=null;const _=typeof XRWebGLBinding<"u",M=new Nme,S={},A=t.getContextAttributes();let E=null,C=null;const I=[],D=[],B=new wt;let P=null;const G=new ti;G.viewport=new mr;const k=new ti;k.viewport=new mr;const V=[G,k],U=new d9;let $=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let Z=I[ne];return Z===void 0&&(Z=new l_,I[ne]=Z),Z.getTargetRaySpace()},this.getControllerGrip=function(ne){let Z=I[ne];return Z===void 0&&(Z=new l_,I[ne]=Z),Z.getGripSpace()},this.getHand=function(ne){let Z=I[ne];return Z===void 0&&(Z=new l_,I[ne]=Z),Z.getHandSpace()};function ee(ne){const Z=D.indexOf(ne.inputSource);if(Z===-1)return;const se=I[Z];se!==void 0&&(se.update(ne.inputSource,ne.frame,d||o),se.dispatchEvent({type:ne.type,data:ne.inputSource}))}function z(){s.removeEventListener("select",ee),s.removeEventListener("selectstart",ee),s.removeEventListener("selectend",ee),s.removeEventListener("squeeze",ee),s.removeEventListener("squeezestart",ee),s.removeEventListener("squeezeend",ee),s.removeEventListener("end",z),s.removeEventListener("inputsourceschange",K);for(let ne=0;ne<I.length;ne++){const Z=D[ne];Z!==null&&(D[ne]=null,I[ne].disconnect(Z))}$=null,X=null,M.reset();for(const ne in S)delete S[ne];e.setRenderTarget(E),y=null,x=null,p=null,s=null,C=null,Q.stop(),r.isPresenting=!1,e.setPixelRatio(P),e.setSize(B.width,B.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){a=ne,r.isPresenting===!0&&$t("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){l=ne,r.isPresenting===!0&&$t("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(ne){d=ne},this.getBaseLayer=function(){return x!==null?x:y},this.getBinding=function(){return p===null&&_&&(p=new XRWebGLBinding(s,t)),p},this.getFrame=function(){return v},this.getSession=function(){return s},this.setSession=async function(ne){if(s=ne,s!==null){if(E=e.getRenderTarget(),s.addEventListener("select",ee),s.addEventListener("selectstart",ee),s.addEventListener("selectend",ee),s.addEventListener("squeeze",ee),s.addEventListener("squeezestart",ee),s.addEventListener("squeezeend",ee),s.addEventListener("end",z),s.addEventListener("inputsourceschange",K),A.xrCompatible!==!0&&await t.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(B),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,me=null,ze=null;A.depth&&(ze=A.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=A.stencil?rh:Fu,me=A.stencil?Bx:Wl);const Be={colorFormat:t.RGBA8,depthFormat:ze,scaleFactor:a};p=this.getBinding(),x=p.createProjectionLayer(Be),s.updateRenderState({layers:[x]}),e.setPixelRatio(1),e.setSize(x.textureWidth,x.textureHeight,!1),C=new el(x.textureWidth,x.textureHeight,{format:Pa,type:eo,depthTexture:new gp(x.textureWidth,x.textureHeight,me,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:A.stencil,colorSpace:e.outputColorSpace,samples:A.antialias?4:0,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}else{const se={antialias:A.antialias,alpha:!0,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:a};y=new XRWebGLLayer(s,t,se),s.updateRenderState({baseLayer:y}),e.setPixelRatio(1),e.setSize(y.framebufferWidth,y.framebufferHeight,!1),C=new el(y.framebufferWidth,y.framebufferHeight,{format:Pa,type:eo,colorSpace:e.outputColorSpace,stencilBuffer:A.stencil,resolveDepthBuffer:y.ignoreDepthValues===!1,resolveStencilBuffer:y.ignoreDepthValues===!1})}C.isXRRenderTarget=!0,this.setFoveation(u),d=null,o=await s.requestReferenceSpace(l),Q.setContext(s),Q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function K(ne){for(let Z=0;Z<ne.removed.length;Z++){const se=ne.removed[Z],me=D.indexOf(se);me>=0&&(D[me]=null,I[me].disconnect(se))}for(let Z=0;Z<ne.added.length;Z++){const se=ne.added[Z];let me=D.indexOf(se);if(me===-1){for(let Be=0;Be<I.length;Be++)if(Be>=D.length){D.push(se),me=Be;break}else if(D[Be]===null){D[Be]=se,me=Be;break}if(me===-1)break}const ze=I[me];ze&&ze.connect(se)}}const ae=new we,oe=new we;function re(ne,Z,se){ae.setFromMatrixPosition(Z.matrixWorld),oe.setFromMatrixPosition(se.matrixWorld);const me=ae.distanceTo(oe),ze=Z.projectionMatrix.elements,Be=se.projectionMatrix.elements,ye=ze[14]/(ze[10]-1),Le=ze[14]/(ze[10]+1),Ce=(ze[9]+1)/ze[5],Re=(ze[9]-1)/ze[5],De=(ze[8]-1)/ze[0],he=(Be[8]+1)/Be[0],le=ye*De,Xe=ye*he,qe=me/(-De+he),Ge=qe*-De;if(Z.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ge),ne.translateZ(qe),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),ze[10]===-1)ne.projectionMatrix.copy(Z.projectionMatrix),ne.projectionMatrixInverse.copy(Z.projectionMatrixInverse);else{const ot=ye+qe,ve=Le+qe,mt=le-Ge,xt=Xe+(me-Ge),ge=Ce*Le/ve*ot,Y=Re*Le/ve*ot;ne.projectionMatrix.makePerspective(mt,xt,ge,Y,ot,ve),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function F(ne,Z){Z===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(Z.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(s===null)return;let Z=ne.near,se=ne.far;M.texture!==null&&(M.depthNear>0&&(Z=M.depthNear),M.depthFar>0&&(se=M.depthFar)),U.near=k.near=G.near=Z,U.far=k.far=G.far=se,($!==U.near||X!==U.far)&&(s.updateRenderState({depthNear:U.near,depthFar:U.far}),$=U.near,X=U.far),U.layers.mask=ne.layers.mask|6,G.layers.mask=U.layers.mask&-5,k.layers.mask=U.layers.mask&-3;const me=ne.parent,ze=U.cameras;F(U,me);for(let Be=0;Be<ze.length;Be++)F(ze[Be],me);ze.length===2?re(U,G,k):U.projectionMatrix.copy(G.projectionMatrix),O(ne,U,me)};function O(ne,Z,se){se===null?ne.matrix.copy(Z.matrixWorld):(ne.matrix.copy(se.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(Z.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(Z.projectionMatrix),ne.projectionMatrixInverse.copy(Z.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=Ux*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(x===null&&y===null))return u},this.setFoveation=function(ne){u=ne,x!==null&&(x.fixedFoveation=ne),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=ne)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(U)},this.getCameraTexture=function(ne){return S[ne]};let J=null;function q(ne,Z){if(h=Z.getViewerPose(d||o),v=Z,h!==null){const se=h.views;y!==null&&(e.setRenderTargetFramebuffer(C,y.framebuffer),e.setRenderTarget(C));let me=!1;se.length!==U.cameras.length&&(U.cameras.length=0,me=!0);for(let Le=0;Le<se.length;Le++){const Ce=se[Le];let Re=null;if(y!==null)Re=y.getViewport(Ce);else{const he=p.getViewSubImage(x,Ce);Re=he.viewport,Le===0&&(e.setRenderTargetTextures(C,he.colorTexture,he.depthStencilTexture),e.setRenderTarget(C))}let De=V[Le];De===void 0&&(De=new ti,De.layers.enable(Le),De.viewport=new mr,V[Le]=De),De.matrix.fromArray(Ce.transform.matrix),De.matrix.decompose(De.position,De.quaternion,De.scale),De.projectionMatrix.fromArray(Ce.projectionMatrix),De.projectionMatrixInverse.copy(De.projectionMatrix).invert(),De.viewport.set(Re.x,Re.y,Re.width,Re.height),Le===0&&(U.matrix.copy(De.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),me===!0&&U.cameras.push(De)}const ze=s.enabledFeatures;if(ze&&ze.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&_){p=r.getBinding();const Le=p.getDepthInformation(se[0]);Le&&Le.isValid&&Le.texture&&M.init(Le,s.renderState)}if(ze&&ze.includes("camera-access")&&_){e.state.unbindTexture(),p=r.getBinding();for(let Le=0;Le<se.length;Le++){const Ce=se[Le].camera;if(Ce){let Re=S[Ce];Re||(Re=new gR,S[Ce]=Re);const De=p.getCameraImage(Ce);Re.sourceTexture=De}}}}for(let se=0;se<I.length;se++){const me=D[se],ze=I[se];me!==null&&ze!==void 0&&ze.update(me,Z,d||o)}J&&J(ne,Z),Z.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:Z}),v=null}const Q=new w9;Q.setAnimationLoop(q),this.setAnimationLoop=function(ne){J=ne},this.dispose=function(){}}}const Cme=new yn,E9=new Ln;E9.set(-1,0,0,0,1,0,0,0,1);function Eme(n,e){function t(M,S){M.matrixAutoUpdate===!0&&M.updateMatrix(),S.value.copy(M.matrix)}function r(M,S){S.color.getRGB(M.fogColor.value,H8(n)),S.isFog?(M.fogNear.value=S.near,M.fogFar.value=S.far):S.isFogExp2&&(M.fogDensity.value=S.density)}function s(M,S,A,E,C){S.isNodeMaterial?S.uniformsNeedUpdate=!1:S.isMeshBasicMaterial?a(M,S):S.isMeshLambertMaterial?(a(M,S),S.envMap&&(M.envMapIntensity.value=S.envMapIntensity)):S.isMeshToonMaterial?(a(M,S),p(M,S)):S.isMeshPhongMaterial?(a(M,S),h(M,S),S.envMap&&(M.envMapIntensity.value=S.envMapIntensity)):S.isMeshStandardMaterial?(a(M,S),x(M,S),S.isMeshPhysicalMaterial&&y(M,S,C)):S.isMeshMat
4496capMaterial?(a(M,S),v(M,S)):S.isMeshDepthMaterial?a(M,S):S.isMeshDistanceMaterial?(a(M,S),_(M,S)):S.isMeshNormalMaterial?a(M,S):S.isLineBasicMaterial?(o(M,S),S.isLineDashedMaterial&&l(M,S)):S.isPointsMaterial?u(M,S,A,E):S.isSpriteMaterial?d(M,S):S.isShadowMaterial?(M.color.value.copy(S.color),M.opacity.value=S.opacity):S.isShaderMaterial&&(S.uniformsNeedUpdate=!1)}function a(M,S){M.opacity.value=S.opacity,S.color&&M.diffuse.value.copy(S.color),S.emissive&&M.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(M.map.value=S.map,t(S.map,M.mapTransform)),S.alphaMap&&(M.alphaMap.value=S.alphaMap,t(S.alphaMap,M.alphaMapTransform)),S.bumpMap&&(M.bumpMap.value=S.bumpMap,t(S.bumpMap,M.bumpMapTransform),M.bumpScale.value=S.bumpScale,S.side===Da&&(M.bumpScale.value*=-1)),S.normalMap&&(M.normalMap.value=S.normalMap,t(S.normalMap,M.normalMapTransform),M.normalScale.value.copy(S.normalScale),S.side===Da&&M.normalScale.value.negate()),S.displacementMap&&(M.displacementMap.value=S.displacementMap,t(S.displacementMap,M.displacementMapTransform),M.displacementScale.value=S.displacementScale,M.displacementBias.value=S.displacementBias),S.emissiveMap&&(M.emissiveMap.value=S.emissiveMap,t(S.emissiveMap,M.emissiveMapTransform)),S.specularMap&&(M.specularMap.value=S.specularMap,t(S.specularMap,M.specularMapTransform)),S.alphaTest>0&&(M.alphaTest.value=S.alphaTest);const A=e.get(S),E=A.envMap,C=A.envMapRotation;E&&(M.envMap.value=E,M.envMapRotation.value.setFromMatrix4(Cme.makeRotationFromEuler(C)).transpose(),E.isCubeTexture&&E.isRenderTargetTexture===!1&&M.envMapRotation.value.premultiply(E9),M.reflectivity.value=S.reflectivity,M.ior.value=S.ior,M.refractionRatio.value=S.refractionRatio),S.lightMap&&(M.lightMap.value=S.lightMap,M.lightMapIntensity.value=S.lightMapIntensity,t(S.lightMap,M.lightMapTransform)),S.aoMap&&(M.aoMap.value=S.aoMap,M.aoMapIntensity.value=S.aoMapIntensity,t(S.aoMap,M.aoMapTransform))}function o(M,S){M.diffuse.value.copy(S.color),M.opacity.value=S.opacity,S.map&&(M.map.value=S.map,t(S.map,M.mapTransform))}function l(M,S){M.dashSize.value=S.dashSize,M.totalSize.value=S.dashSize+S.gapSize,M.scale.value=S.scale}function u(M,S,A,E){M.diffuse.value.copy(S.color),M.opacity.value=S.opacity,M.size.value=S.size*A,M.scale.value=E*.5,S.map&&(M.map.value=S.map,t(S.map,M.uvTransform)),S.alphaMap&&(M.alphaMap.value=S.alphaMap,t(S.alphaMap,M.alphaMapTransform)),S.alphaTest>0&&(M.alphaTest.value=S.alphaTest)}function d(M,S){M.diffuse.value.copy(S.color),M.opacity.value=S.opacity,M.rotation.value=S.rotation,S.map&&(M.map.value=S.map,t(S.map,M.mapTransform)),S.alphaMap&&(M.alphaMap.value=S.alphaMap,t(S.alphaMap,M.alphaMapTransform)),S.alphaTest>0&&(M.alphaTest.value=S.alphaTest)}function h(M,S){M.specular.value.copy(S.specular),M.shininess.value=Math.max(S.shininess,1e-4)}function p(M,S){S.gradientMap&&(M.gradientMap.value=S.gradientMap)}function x(M,S){M.metalness.value=S.metalness,S.metalnessMap&&(M.metalnessMap.value=S.metalnessMap,t(S.metalnessMap,M.metalnessMapTransform)),M.roughness.value=S.roughness,S.roughnessMap&&(M.roughnessMap.value=S.roughnessMap,t(S.roughnessMap,M.roughnessMapTransform)),S.envMap&&(M.envMapIntensity.value=S.envMapIntensity)}function y(M,S,A){M.ior.value=S.ior,S.sheen>0&&(M.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),M.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(M.sheenColorMap.value=S.sheenColorMap,t(S.sheenColorMap,M.sheenColorMapTransform)),S.sheenRoughnessMap&&(M.sheenRoughnessMap.value=S.sheenRoughnessMap,t(S.sheenRoughnessMap,M.sheenRoughnessMapTransform))),S.clearcoat>0&&(M.clearcoat.value=S.clearcoat,M.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(M.clearcoatMap.value=S.clearcoatMap,t(S.clearcoatMap,M.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(M.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,t(S.clearcoatRoughnessMap,M.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(M.clearcoatNormalMap.value=S.clearcoatNormalMap,t(S.clearcoatNormalMap,M.clearcoatNormalMapTransform),M.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===Da&&M.clearcoatNormalScale.value.negate())),S.dispersion>0&&(M.dispersion.value=S.dispersion),S.iridescence>0&&(M.iridescence.value=S.iridescence,M.iridescenceIOR.value=S.iridescenceIOR,M.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],M.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(M.iridescenceMap.value=S.iridescenceMap,t(S.iridescenceMap,M.iridescenceMapTransform)),S.iridescenceThicknessMap&&(M.iridescenceThicknessMap.value=S.iridescenceThicknessMap,t(S.iridescenceThicknessMap,M.iridescenceThicknessMapTransform))),S.transmission>0&&(M.transmission.value=S.transmission,M.transmissionSamplerMap.value=A.texture,M.transmissionSamplerSize.value.set(A.width,A.height),S.transmissionMap&&(M.transmissionMap.value=S.transmissionMap,t(S.transmissionMap,M.transmissionMapTransform)),M.thickness.value=S.thickness,S.thicknessMap&&(M.thicknessMap.value=S.thicknessMap,t(S.thicknessMap,M.thicknessMapTransform)),M.attenuationDistance.value=S.attenuationDistance,M.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(M.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(M.anisotropyMap.value=S.anisotropyMap,t(S.anisotropyMap,M.anisotropyMapTransform))),M.specularIntensity.value=S.specularIntensity,M.specularColor.value.copy(S.specularColor),S.specularColorMap&&(M.specularColorMap.value=S.specularColorMap,t(S.specularColorMap,M.specularColorMapTransform)),S.specularIntensityMap&&(M.specularIntensityMap.value=S.specularIntensityMap,t(S.specularIntensityMap,M.specularIntensityMapTransform))}function v(M,S){S.matcap&&(M.matcap.value=S.matcap)}function _(M,S){const A=e.get(S).light;M.referencePosition.value.setFromMatrixPosition(A.matrixWorld),M.nearDistance.value=A.shadow.camera.near,M.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:s}}function jme(n,e,t,r){let s={},a={},o=[];const l=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function u(C,I){const D=I.program;r.uniformBlockBinding(C,D)}function d(C,I){let D=s[C.id];D===void 0&&(M(C),D=h(C),s[C.id]=D,C.addEventListener("dispose",A));const B=I.program;r.updateUBOMapping(C,B);const P=e.render.frame;a[C.id]!==P&&(x(C),a[C.id]=P)}function h(C){const I=p();C.__bindingPointIndex=I;const D=n.createBuffer(),B=C.__size,P=C.usage;return n.bindBuffer(n.UNIFORM_BUFFER,D),n.bufferData(n.UNIFORM_BUFFER,B,P),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,I,D),D}function p(){for(let C=0;C<l;C++)if(o.indexOf(C)===-1)return o.push(C),C;return fn("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(C){const I=s[C.id],D=C.uniforms,B=C.__cache;n.bindBuffer(n.UNIFORM_BUFFER,I);for(let P=0,G=D.length;P<G;P++){const k=D[P];if(Array.isArray(k))for(let V=0,U=k.length;V<U;V++)y(k[V],P,V,B);else y(k,P,0,B)}n.bindBuffer(n.UNIFORM_BUFFER,null)}function y(C,I,D,B){if(_(C,I,D,B)===!0){const P=C.__offset,G=C.value;if(Array.isArray(G)){let k=0;for(let V=0;V<G.length;V++){const U=G[V],$=S(U);v(U,C.__data,k),typeof U!="number"&&typeof U!="boolean"&&!U.isMatrix3&&!ArrayBuffer.isView(U)&&(k+=$.storage/Float32Array.BYTES_PER_ELEMENT)}}else v(G,C.__data,0);n.bufferSubData(n.UNIFORM_BUFFER,P,C.__data)}}function v(C,I,D){typeof C=="number"||typeof C=="boolean"?I[0]=C:C.isMatrix3?(I[0]=C.elements[0],I[1]=C.elements[1],I[2]=C.elements[2],I[3]=0,I[4]=C.elements[3],I[5]=C.elements[4],I[6]=C.elements[5],I[7]=0,I[8]=C.elements[6],I[9]=C.elements[7],I[10]=C.elements[8],I[11]=0):ArrayBuffer.isView(C)?I.set(new C.constructor(C.buffer,C.byteOffset,I.length)):C.toArray(I,D)}function _(C,I,D,B){const P=C.value,G=I+"_"+D;if(B[G]===void 0)return typeof P=="number"||typeof P=="boolean"?B[G]=P:ArrayBuffer.isView(P)?B[G]=P.slice():B[G]=P.clone(),!0;
4496{const k=B[G];if(typeof P=="number"||typeof P=="boolean"){if(k!==P)return B[G]=P,!0}else{if(ArrayBuffer.isView(P))return!0;if(k.equals(P)===!1)return k.copy(P),!0}}return!1}function M(C){const I=C.uniforms;let D=0;const B=16;for(let G=0,k=I.length;G<k;G++){const V=Array.isArray(I[G])?I[G]:[I[G]];for(let U=0,$=V.length;U<$;U++){const X=V[U],ee=Array.isArray(X.value)?X.value:[X.value];for(let z=0,K=ee.length;z<K;z++){const ae=ee[z],oe=S(ae),re=D%B,F=re%oe.boundary,O=re+F;D+=F,O!==0&&B-O<oe.storage&&(D+=B-O),X.__data=new Float32Array(oe.storage/Float32Array.BYTES_PER_ELEMENT),X.__offset=D,D+=oe.storage}}}const P=D%B;return P>0&&(D+=B-P),C.__size=D,C.__cache={},this}function S(C){const I={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(I.boundary=4,I.storage=4):C.isVector2?(I.boundary=8,I.storage=8):C.isVector3||C.isColor?(I.boundary=16,I.storage=12):C.isVector4?(I.boundary=16,I.storage=16):C.isMatrix3?(I.boundary=48,I.storage=48):C.isMatrix4?(I.boundary=64,I.storage=64):C.isTexture?$t("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(C)?(I.boundary=16,I.storage=C.byteLength):$t("WebGLRenderer: Unsupported uniform value type.",C),I}function A(C){const I=C.target;I.removeEventListener("dispose",A);const D=o.indexOf(I.__bindingPointIndex);o.splice(D,1),n.deleteBuffer(s[I.id]),delete s[I.id],delete a[I.id]}function E(){for(const C in s)n.deleteBuffer(s[C]);o=[],s={},a={}}return{bind:u,update:d,dispose:E}}const Tme=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
vendor: 4,274 bytes, line 4496
449614942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let pu=null;function Rme(){return pu===null&&(pu=new Hl(Tme,16,16,yh,Ou),pu.name="DFG_LUT",pu.minFilter=qr,pu.magFilter=qr,pu.wrapS=io,pu.wrapT=io,pu.generateMipmaps=!1,pu.needsUpdate=!0),pu}class j9{constructor(e={}){const{canvas:t=_8(),context:r=null,depth:s=!0,stencil:a=!1,alpha:o=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:d=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:x=!1,outputBufferType:y=eo}=e;this.isWebGLRenderer=!0;let v;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=r.getContextAttributes().alpha}else v=o;const _=y,M=new Set([jN,EN,Mv]),S=new Set([eo,Wl,Ix,Bx,NN,AN]),A=new Uint32Array(4),E=new Int32Array(4),C=new we;let I=null,D=null;const B=[],P=[];let G=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Gl,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const k=this;let V=!1,U=null,$=null,X=null,ee=null;this._outputColorSpace=Ra;let z=0,K=0,ae=null,oe=-1,re=null;const F=new mr,O=new mr;let J=null;const q=new Ut(0);let Q=0,ne=t.width,Z=t.height,se=1,me=null,ze=null;const Be=new mr(0,0,ne,Z),ye=new mr(0,0,ne,Z);let Le=!1;const Ce=new pp;let Re=!1,De=!1;const he=new yn,le=new we,Xe=new mr,qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ge=!1;function ot(){return ae===null?se:1}let ve=r;function mt(de,He){return t.getContext(de,He)}try{const de={alpha:!0,depth:s,stencil:a,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:d,powerPreference:h,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${i0}`),t.addEventListener("webglcontextlost",Je,!1),t.addEventListener("webglcontextrestored",it,!1),t.addEventListener("webglcontextcreationerror",Et,!1),ve===null){const He="webgl2";if(ve=mt(He,de),ve===null)throw mt(He)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(de){throw fn("WebGLRenderer: "+de.message),de}let xt,ge,Y,je,Ie,Ve,ft,vt,ce,Me,Fe,ie,Se,Ae,at,pe,Ke,Ne,Ye,Te,st,et,Qe;
vendor: 4,991 bytes, line 4496
4496function Mt(){xt=new Pfe(ve),xt.init(),st=new C9(ve,xt),ge=new Mfe(ve,xt,e,st),Y=new wme(ve,xt),ge.reversedDepthBuffer&&x&&Y.buffers.depth.setReversed(!0),$=ve.createFramebuffer(),X=ve.createFramebuffer(),ee=ve.createFramebuffer(),je=new Ife(ve),Ie=new ome,Ve=new Sme(ve,xt,Y,Ie,ge,st,je),ft=new Rfe(k),vt=new Fce(ve),et=new Sfe(ve,vt),ce=new Dfe(ve,vt,je,et),Me=new Lfe(ve,ce,vt,et,je),Ne=new Bfe(ve,ge,Ve),at=new Nfe(Ie),Fe=new ame(k,ft,xt,ge,et,at),ie=new Eme(k,Ie),Se=new cme,Ae=new pme(xt),Ke=new wfe(k,ft,Y,Me,v,u),pe=new vme(k,Me,ge),Qe=new jme(ve,je,ge,Y),Ye=new _fe(ve,xt,je),Te=new kfe(ve,xt,je),je.programs=Fe.programs,k.capabilities=ge,k.extensions=xt,k.properties=Ie,k.renderLists=Se,k.shadowMap=pe,k.state=Y,k.info=je}Mt(),_!==eo&&(G=new Ffe(_,t.width,t.height,l,s,a));const ue=new Ame(k,ve);this.xr=ue,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){const de=xt.get("WEBGL_lose_context");de&&de.loseContext()},this.forceContextRestore=function(){const de=xt.get("WEBGL_lose_context");de&&de.restoreContext()},this.getPixelRatio=function(){return se},this.setPixelRatio=function(de){de!==void 0&&(se=de,this.setSize(ne,Z,!1))},this.getSize=function(de){return de.set(ne,Z)},this.setSize=function(de,He,rt=!0){if(ue.isPresenting){$t("WebGLRenderer: Can't change size while VR device is presenting.");return}ne=de,Z=He,t.width=Math.floor(de*se),t.height=Math.floor(He*se),rt===!0&&(t.style.width=de+"px",t.style.height=He+"px"),G!==null&&G.setSize(t.width,t.height),this.setViewport(0,0,de,He)},this.getDrawingBufferSize=function(de){return de.set(ne*se,Z*se).floor()},this.setDrawingBufferSize=function(de,He,rt){ne=de,Z=He,se=rt,t.width=Math.floor(de*rt),t.height=Math.floor(He*rt),this.setViewport(0,0,de,He)},this.setEffects=function(de){if(_===eo){fn("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(de){for(let He=0;He<de.length;He++)if(de[He].isOutputPass===!0){$t("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}G.setEffects(de||[])},this.getCurrentViewport=function(de){return de.copy(F)},this.getViewport=function(de){return de.copy(Be)},this.setViewport=function(de,He,rt,Ze){de.isVector4?Be.set(de.x,de.y,de.z,de.w):Be.set(de,He,rt,Ze),Y.viewport(F.copy(Be).multiplyScalar(se).round())},this.getScissor=function(de){return de.copy(ye)},this.setScissor=function(de,He,rt,Ze){de.isVector4?ye.set(de.x,de.y,de.z,de.w):ye.set(de,He,rt,Ze),Y.scissor(O.copy(ye).multiplyScalar(se).round())},this.getScissorTest=function(){return Le},this.setScissorTest=function(de){Y.setScissorTest(Le=de)},this.setOpaqueSort=function(de){me=de},this.setTransparentSort=function(de){ze=de},this.getClearColor=function(de){return de.copy(Ke.getClearColor())},this.setClearColor=function(){Ke.setClearColor(...arguments)},this.getClearAlpha=function(){return Ke.getClearAlpha()},this.setClearAlpha=function(){Ke.setClearAlpha(...arguments)},this.clear=function(de=!0,He=!0,rt=!0){let Ze=0;if(de){let We=!1;if(ae!==null){const Ct=ae.texture.format;We=M.has(Ct)}if(We){const Ct=ae.texture.type,zt=S.has(Ct),Pt=Ke.getClearColor(),_t=Ke.getClearAlpha(),kt=Pt.r,Rt=Pt.g,qt=Pt.b;zt?(A[0]=kt,A[1]=Rt,A[2]=qt,A[3]=_t,ve.clearBufferuiv(ve.COLOR,0,A)):(E[0]=kt,E[1]=Rt,E[2]=qt,E[3]=_t,ve.clearBufferiv(ve.COLOR,0,E))}else Ze|=ve.COLOR_BUFFER_BIT}He&&(Ze|=ve.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),rt&&(Ze|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ze!==0&&ve.clear(Ze)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(de){de.setRenderer(this),U=de},this.dispose=function(){t.removeEventListener("webglcontextlost",Je,!1),t.removeEventListener("webglcontextrestored",it,!1),t.removeEventListener("webglcontextcreationerror",Et,!1),Ke.dispose(),Se.dispose(),Ae.dispose(),Ie.dispose(),ft.dispose(),Me.dispose(),et.dispose(),Qe.dispose(),Fe.dispose(),ue.dispose(),ue.removeEventListener("sessionstart",Wn),ue.removeEventListener("sessionend",jr),es.stop()};function Je(de){de.preventDefault(),Ky("WebGLRenderer: Context Lost."),V=!0}function it(){Ky("WebGLRenderer: Context Restored."),V=!1;const de=je.autoReset,He=pe.enabled,rt=pe.autoUpdate,Ze=pe.needsUpdate,We=pe.type;Mt(),je.autoReset=de,pe.enabled=He,pe.autoUpdate=rt,pe.needsUpdate=Ze,pe.type=We}function Et(de){fn("WebGLRenderer: A WebGL context could not be created. Reason: ",de.statusMessage)}function Wt(de){const He=de.target;He.removeEventListener("dispose",Wt),an(He)}function an(de){Sn(de),Ie.remove(de)}function Sn(de){const He=Ie.get(de).programs;He!==void 0&&(He.forEach(function(rt){Fe.releaseProgram(rt)}),de.isShaderMaterial&&Fe.releaseShaderCache(de))}this.renderBufferDirect=function(de,He,rt,Ze,We,Ct){He===null&&(He=qe);
vendor: 8,408 bytes, line 4496
4496const zt=We.isMesh&&We.matrixWorld.determinantAffine()<0,Pt=Yt(de,He,rt,Ze,We);Y.setMaterial(Ze,zt);let _t=rt.index,kt=1;if(Ze.wireframe===!0){if(_t=ce.getWireframeAttribute(rt),_t===void 0)return;kt=2}const Rt=rt.drawRange,qt=rt.attributes.position;let Qt=Rt.start*kt,nn=(Rt.start+Rt.count)*kt;Ct!==null&&(Qt=Math.max(Qt,Ct.start*kt),nn=Math.min(nn,(Ct.start+Ct.count)*kt)),_t!==null?(Qt=Math.max(Qt,0),nn=Math.min(nn,_t.count)):qt!=null&&(Qt=Math.max(Qt,0),nn=Math.min(nn,qt.count));const Cn=nn-Qt;if(Cn<0||Cn===1/0)return;et.setup(We,Ze,Pt,rt,_t);let Zt,Fn=Ye;if(_t!==null&&(Zt=vt.get(_t),Fn=Te,Fn.setIndex(Zt)),We.isMesh)Ze.wireframe===!0?(Y.setLineWidth(Ze.wireframeLinewidth*ot()),Fn.setMode(ve.LINES)):Fn.setMode(ve.TRIANGLES);else if(We.isLine){let _n=Ze.linewidth;_n===void 0&&(_n=1),Y.setLineWidth(_n*ot()),We.isLineSegments?Fn.setMode(ve.LINES):We.isLineLoop?Fn.setMode(ve.LINE_LOOP):Fn.setMode(ve.LINE_STRIP)}else We.isPoints?Fn.setMode(ve.POINTS):We.isSprite&&Fn.setMode(ve.TRIANGLES);if(We.isBatchedMesh)if(xt.get("WEBGL_multi_draw"))Fn.renderMultiDraw(We._multiDrawStarts,We._multiDrawCounts,We._multiDrawCount);else{const _n=We._multiDrawStarts,Gt=We._multiDrawCounts,Rr=We._multiDrawCount,mn=_t?vt.get(_t).bytesPerElement:1,Or=Ie.get(Ze).currentProgram.getUniforms();for(let os=0;os<Rr;os++)Or.setValue(ve,"_gl_DrawID",os),Fn.render(_n[os]/mn,Gt[os])}else if(We.isInstancedMesh)Fn.renderInstances(Qt,Cn,We.count);else if(rt.isInstancedBufferGeometry){const _n=rt._maxInstanceCount!==void 0?rt._maxInstanceCount:1/0,Gt=Math.min(rt.instanceCount,_n);Fn.renderInstances(Qt,Cn,Gt)}else Fn.render(Qt,Cn)};function Lr(de,He,rt){de.transparent===!0&&de.side===Ll&&de.forceSinglePass===!1?(de.side=Da,de.needsUpdate=!0,ps(de,He,rt),de.side=Bu,de.needsUpdate=!0,ps(de,He,rt),de.side=Ll):ps(de,He,rt)}this.compile=function(de,He,rt=null){rt===null&&(rt=de),D=Ae.get(rt),D.init(He),P.push(D),rt.traverseVisible(function(We){We.isLight&&We.layers.test(He.layers)&&(D.pushLight(We),We.castShadow&&D.pushShadow(We))}),de!==rt&&de.traverseVisible(function(We){We.isLight&&We.layers.test(He.layers)&&(D.pushLight(We),We.castShadow&&D.pushShadow(We))}),D.setupLights();const Ze=new Set;return de.traverse(function(We){if(!(We.isMesh||We.isPoints||We.isLine||We.isSprite))return;const Ct=We.material;if(Ct)if(Array.isArray(Ct))for(let zt=0;zt<Ct.length;zt++){const Pt=Ct[zt];Lr(Pt,rt,We),Ze.add(Pt)}else Lr(Ct,rt,We),Ze.add(Ct)}),D=P.pop(),Ze},this.compileAsync=function(de,He,rt=null){const Ze=this.compile(de,He,rt);return new Promise(We=>{function Ct(){if(Ze.forEach(function(zt){Ie.get(zt).currentProgram.isReady()&&Ze.delete(zt)}),Ze.size===0){We(de);return}setTimeout(Ct,10)}xt.get("KHR_parallel_shader_compile")!==null?Ct():setTimeout(Ct,10)})};let Gr=null;function Nr(de){Gr&&Gr(de)}function Wn(){es.stop()}function jr(){es.start()}const es=new w9;es.setAnimationLoop(Nr),typeof self<"u"&&es.setContext(self),this.setAnimationLoop=function(de){Gr=de,ue.setAnimationLoop(de),de===null?es.stop():es.start()},ue.addEventListener("sessionstart",Wn),ue.addEventListener("sessionend",jr),this.render=function(de,He){if(He!==void 0&&He.isCamera!==!0){fn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;U!==null&&U.renderStart(de,He);const rt=ue.enabled===!0&&ue.isPresenting===!0,Ze=G!==null&&(ae===null||rt)&&G.begin(k,ae);if(de.matrixWorldAutoUpdate===!0&&de.updateMatrixWorld(),He.parent===null&&He.matrixWorldAutoUpdate===!0&&He.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(G===null||G.isCompositing()===!1)&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(He),He=ue.getCamera()),de.isScene===!0&&de.onBeforeRender(k,de,He,ae),D=Ae.get(de,P.length),D.init(He),D.state.textureUnits=Ve.getTextureUnits(),P.push(D),he.multiplyMatrices(He.projectionMatrix,He.matrixWorldInverse),Ce.setFromProjectionMatrix(he,Ko,He.reversedDepth),De=this.localClippingEnabled,Re=at.init(this.clippingPlanes,De),I=Se.get(de,B.length),I.init(),B.push(I),ue.enabled===!0&&ue.isPresenting===!0){const zt=k.xr.getDepthSensingMesh();zt!==null&&Tr(zt,He,-1/0,k.sortObjects)}Tr(de,He,0,k.sortObjects),I.finish(),k.sortObjects===!0&&I.sort(me,ze,He.reversedDepth),Ge=ue.enabled===!1||ue.isPresenting===!1||ue.hasDepthSensing()===!1,Ge&&Ke.addToRenderList(I,de),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Re===!0&&at.beginShadows();const We=D.state.shadowsArray;if(pe.render(We,de,He),Re===!0&&at.endShadows(),(Ze&&G.hasRenderPass())===!1){const zt=I.opaque,Pt=I.transmissive;if(D.setupLights(),He.isArrayCamera){const _t=He.cameras;if(Pt.length>0)for(let kt=0,Rt=_t.length;kt<Rt;kt++){const qt=_t[kt];Ps(zt,Pt,de,qt)}Ge&&Ke.render(de);for(let kt=0,Rt=_t.length;kt<Rt;kt++){const qt=_t[kt];as(I,de,qt,qt.viewport)}}else Pt.length>0&&Ps(zt,Pt,de,He),Ge&&Ke.render(de),as(I,de,He)}ae!==null&&K===0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),Ze&&G.end(k),de.isScene===!0&&de.onAfterRender(k,de,He),et.resetDefaultState(),oe=-1,re=null,P.pop(),P.length>0?(D=P[P.length-1],Ve.setTextureUnits(D.state.textureUnits),Re===!0&&at.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,B.pop(),B.length>0?I=B[B.length-1]:I=null,U!==null&&U.renderEnd()};function Tr(de,He,rt,Ze){if(de.visible===!1)return;if(de.layers.test(He.layers)){if(de.isGroup)rt=de.renderOrder;else if(de.isLOD)de.autoUpdate===!0&&de.update(He);else if(de.isLightProbeGrid)D.pushLightProbeGrid(de);else if(de.isLight)D.pushLight(de),de.castShadow&&D.pushShadow(de);else if(de.isSprite){if(!de.frustumCulled||Ce.intersectsSprite(de)){Ze&&Xe.setFromMatrixPosition(de.matrixWorld).applyMatrix4(he);const zt=Me.update(de),Pt=de.material;Pt.visible&&I.push(de,zt,Pt,rt,Xe.z,null)}}else if((de.isMesh||de.isLine||de.isPoints)&&(!de.frustumCulled||Ce.intersectsObject(de))){const zt=Me.update(de),Pt=de.material;if(Ze&&(de.boundingSphere!==void 0?(de.boundingSphere===null&&de.computeBoundingSphere(),Xe.copy(de.boundingSphere.center)):(zt.boundingSphere===null&&zt.computeBoundingSphere(),Xe.copy(zt.boundingSphere.center)),Xe.applyMatrix4(de.matrixWorld).applyMatrix4(he)),Array.isArray(Pt)){const _t=zt.groups;for(let kt=0,Rt=_t.length;kt<Rt;kt++){const qt=_t[kt],Qt=Pt[qt.materialIndex];Qt&&Qt.visible&&I.push(de,zt,Qt,rt,Xe.z,qt)}}else Pt.visible&&I.push(de,zt,Pt,rt,Xe.z,null)}}const Ct=de.children;for(let zt=0,Pt=Ct.length;zt<Pt;zt++)Tr(Ct[zt],He,rt,Ze)}function as(de,He,rt,Ze){const{opaque:We,transmissive:Ct,transparent:zt}=de;D.setupLightsView(rt),Re===!0&&at.setGlobalState(k.clippingPlanes,rt),Ze&&Y.viewport(F.copy(Ze)),We.length>0&&gi(We,He,rt),Ct.length>0&&gi(Ct,He,rt),zt.length>0&&gi(zt,He,rt),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Ps(de,He,rt,Ze){if((rt.isScene===!0?rt.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Ze.id]===void 0){const Qt=xt.has("EXT_color_buffer_half_float")||xt.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Ze.id]=new el(1,1,{generateMipmaps:!0,type:Qt?Ou:eo,minFilter:Fl,samples:Math.max(4,ge.samples),stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ur.workingColorSpace})}const Ct=D.state.transmissionRenderTarget[Ze.id],zt=Ze.viewport||F;Ct.setSize(zt.z*k.transmissionResolutionScale,zt.w*k.transmissionResolutionScale);const Pt=k.getRenderTarget(),_t=k.getActiveCubeFace(),kt=k.getActiveMipmapLevel();k.setRenderTarget(Ct),k.getClearColor(q),Q=k.getClearAlpha(),Q<1&&k.setClearColor(16777215,.5),k.clear(),Ge&&Ke.render(rt);const Rt=k.toneMapping;k.toneMapping=Gl;const qt=Ze.viewport;if(Ze.viewport!==void 0&&(Ze.viewport=void 0),D.setupLightsView(Ze),Re===!0&&at.setGlobalState(k.clippingPlanes,Ze),gi(de,rt,Ze),Ve.updateMultisampleRenderTarget(Ct),Ve.updateRenderTargetMipmap(Ct),xt.has("WEBGL_multisampled_render_to_texture")===!1){let Qt=!1;for(let nn=0,Cn=He.length;nn<Cn;nn++){const Zt=He[nn],{object:Fn,geometry:_n,material:Gt,group:Rr}=Zt;if(Gt.side===Ll&&Fn.layers.test(Ze.layers)){const mn=Gt.side;Gt.side=Da,Gt.needsUpdate=!0,Xr(Fn,rt,Ze,_n,Gt,Rr),Gt.side=mn,Gt.needsUpdate=!0,Qt=!0}}Qt===!0&&(Ve.updateMultisampleRenderTarget(Ct),Ve.updateRenderTargetMipmap(Ct))}k.setRenderTarget(Pt,_t,kt),k.setClearColor(q,Q),qt!==void 0&&(Ze.viewport=qt),k.toneMapping=Rt}function gi(de,He,rt){const Ze=He.isScene===!0?He.overrideMaterial:null;for(let We=0,Ct=de.length;We<Ct;
4496We++){const zt=de[We],{object:Pt,geometry:_t,group:kt}=zt;let Rt=zt.material;Rt.allowOverride===!0&&Ze!==null&&(Rt=Ze),Pt.layers.test(rt.layers)&&Xr(Pt,He,rt,_t,Rt,kt)}}function Xr(de,He,rt,Ze,We,Ct){de.onBeforeRender(k,He,rt,Ze,We,Ct),de.modelViewMatrix.multiplyMatrices(rt.matrixWorldInverse,de.matrixWorld),de.normalMatrix.getNormalMatrix(de.modelViewMatrix),We.onBeforeRender(k,He,rt,Ze,de,Ct),We.transparent===!0&&We.side===Ll&&We.forceSinglePass===!1?(We.side=Da,We.needsUpdate=!0,k.renderBufferDirect(rt,He,Ze,We,de,Ct),We.side=Bu,We.needsUpdate=!0,k.renderBufferDirect(rt,He,Ze,We,de,Ct),We.side=Ll):k.renderBufferDirect(rt,He,Ze,We,de,Ct),de.onAfterRender(k,He,rt,Ze,We,Ct)}function ps(de,He,rt){He.isScene!==!0&&(He=qe);const Ze=Ie.get(de),We=D.state.lights,Ct=D.state.shadowsArray,zt=We.state.version,Pt=Fe.getParameters(de,We.state,Ct,He,rt,D.state.lightProbeGridArray),_t=Fe.getProgramCacheKey(Pt);let kt=Ze.programs;Ze.environment=de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial?He.environment:null,Ze.fog=He.fog;const Rt=de.isMeshStandardMaterial||de.isMeshLambertMaterial&&!de.envMap||de.isMeshPhongMaterial&&!de.envMap;Ze.envMap=ft.get(de.envMap||Ze.environment,Rt),Ze.envMapRotation=Ze.environment!==null&&de.envMap===null?He.environmentRotation:de.envMapRotation,kt===void 0&&(de.addEventListener("dispose",Wt),kt=new Map,Ze.programs=kt);let qt=kt.get(_t);if(qt!==void 0){if(Ze.currentProgram===qt&&Ze.lightsStateVersion===zt)return Ds(de,Pt),qt}else Pt.uniforms=Fe.getUniforms(de),U!==null&&de.isNodeMaterial&&U.build(de,rt,Pt),de.onBeforeCompile(Pt,k),qt=Fe.acquireProgram(Pt,_t),kt.set(_t,qt),Ze.uniforms=Pt.uniforms;const Qt=Ze.uniforms;return(!de.isShaderMaterial&&!de.isRawShaderMaterial||de.clipping===!0)&&(Qt.clippingPlanes=at.uniform),Ds(de,Pt),Ze.needsLights=ks(de),Ze.lightsStateVersion=zt,Ze.needsLights&&(Qt.ambientLightColor.value=We.state.ambient,Qt.lightProbe.value=We.state.probe,Qt.directionalLights.value=We.state.directional,Qt.directionalLightShadows.value=We.state.directionalShadow,Qt.spotLights.value=We.state.spot,Qt.spotLightShadows.value=We.state.spotShadow,Qt.rectAreaLights.value=We.state.rectArea,Qt.ltc_1.value=We.state.rectAreaLTC1,Qt.ltc_2.value=We.state.rectAreaLTC2,Qt.pointLights.value=We.state.point,Qt.pointLightShadows.value=We.state.pointShadow,Qt.hemisphereLights.value=We.state.hemi,Qt.directionalShadowMatrix.value=We.state.directionalShadowMatrix,Qt.spotLightMatrix.value=We.state.spotLightMatrix,Qt.spotLightMap.value=We.state.spotLightMap,Qt.pointShadowMatrix.value=We.state.pointShadowMatrix),Ze.lightProbeGrid=D.state.lightProbeGridArray.length>0,Ze.currentProgram=qt,Ze.uniformsList=null,qt}function xi(de){if(de.uniformsList===null){const He=de.currentProgram.getUniforms();de.uniformsList=c_.seqWithValue(He.seq,de.uniforms)}return de.uniformsList}function Ds(de,He){const rt=Ie.get(de);rt.outputColorSpace=He.outputColorSpace,rt.batching=He.batching,rt.batchingColor=He.batchingColor,rt.instancing=He.instancing,rt.instancingColor=He.instancingColor,rt.instancingMorph=He.instancingMorph,rt.skinning=He.skinning,rt.morphTargets=He.morphTargets,rt.morphNormals=He.morphNormals,rt.morphColors=He.morphColors,rt.morphTargetsCount=He.morphTargetsCount,rt.numClippingPlanes=He.numClippingPlanes,rt.numIntersection=He.numClipIntersection,rt.vertexAlphas=He.vertexAlphas,rt.vertexTangents=He.vertexTangents,rt.toneMapping=He.toneMapping}function Vs(de,He){if(de.length===0)return null;if(de.length===1)return de[0].texture!==null?de[0]:null;C.setFromMatrixPosition(He.matrixWorld);for(let rt=0,Ze=de.length;rt<Ze;rt++){const We=de[rt];if(We.texture!==null&&We.boundingBox.containsPoint(C))return We}return null}function Yt(de,He,rt,Ze,We){He.isScene!==!0&&(He=qe),Ve.resetTextureUnits();const Ct=He.fog,zt=Ze.isMeshStandardMaterial||Ze.isMeshLambertMaterial||Ze.isMeshPhongMaterial?He.environment:null,Pt=ae===null?k.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:ur.workingColorSpace,_t=Ze.isMeshStandardMaterial||Ze.isMeshLambertMaterial&&!Ze.envMap||Ze.isMeshPhongMaterial&&!Ze.envMap,kt=ft.get(Ze.envMap||zt,_t),Rt=Ze.vertexColors===!0&&!!rt.attributes.color&&rt.attributes.color.itemSize===4,qt=!!rt.attributes.tangent&&(!!Ze.normalMap||Ze.anisotropy>0),Qt=!!rt.morphAttributes.position,nn=!!rt.morphAttributes.normal,Cn=!!rt.morphAttributes.color;let Zt=Gl;Ze.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Zt=k.toneMapping);const Fn=rt.morphAttributes.position||rt.morphAttributes.normal||rt.morphAttributes.color,_n=Fn!==void 0?Fn.length:0,Gt=Ie.get(Ze),Rr=D.state.lights;if(Re===!0&&(De===!0||de!==re)){const In=de===re&&Ze.id===oe;at.setState(Ze,de,In)}let mn=!1;Ze.version===Gt.__version?(Gt.needsLights&&Gt.lightsStateVersion!==Rr.state.ver
vendor: 6,452 bytes, line 4496
4496sion||Gt.outputColorSpace!==Pt||We.isBatchedMesh&&Gt.batching===!1||!We.isBatchedMesh&&Gt.batching===!0||We.isBatchedMesh&&Gt.batchingColor===!0&&We.colorTexture===null||We.isBatchedMesh&&Gt.batchingColor===!1&&We.colorTexture!==null||We.isInstancedMesh&&Gt.instancing===!1||!We.isInstancedMesh&&Gt.instancing===!0||We.isSkinnedMesh&&Gt.skinning===!1||!We.isSkinnedMesh&&Gt.skinning===!0||We.isInstancedMesh&&Gt.instancingColor===!0&&We.instanceColor===null||We.isInstancedMesh&&Gt.instancingColor===!1&&We.instanceColor!==null||We.isInstancedMesh&&Gt.instancingMorph===!0&&We.morphTexture===null||We.isInstancedMesh&&Gt.instancingMorph===!1&&We.morphTexture!==null||Gt.envMap!==kt||Ze.fog===!0&&Gt.fog!==Ct||Gt.numClippingPlanes!==void 0&&(Gt.numClippingPlanes!==at.numPlanes||Gt.numIntersection!==at.numIntersection)||Gt.vertexAlphas!==Rt||Gt.vertexTangents!==qt||Gt.morphTargets!==Qt||Gt.morphNormals!==nn||Gt.morphColors!==Cn||Gt.toneMapping!==Zt||Gt.morphTargetsCount!==_n||!!Gt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(mn=!0):(mn=!0,Gt.__version=Ze.version);let Or=Gt.currentProgram;mn===!0&&(Or=ps(Ze,He,We),U&&Ze.isNodeMaterial&&U.onUpdateProgram(Ze,Or,Gt));let os=!1,gs=!1,As=!1;const At=Or.getUniforms(),Ht=Gt.uniforms;if(Y.useProgram(Or.program)&&(os=!0,gs=!0,As=!0),Ze.id!==oe&&(oe=Ze.id,gs=!0),Gt.needsLights){const In=Vs(D.state.lightProbeGridArray,We);Gt.lightProbeGrid!==In&&(Gt.lightProbeGrid=In,gs=!0)}if(os||re!==de){Y.buffers.depth.getReversed()&&de.reversedDepth!==!0&&(de._reversedDepth=!0,de.updateProjectionMatrix()),At.setValue(ve,"projectionMatrix",de.projectionMatrix),At.setValue(ve,"viewMatrix",de.matrixWorldInverse);const xs=At.map.cameraPosition;xs!==void 0&&xs.setValue(ve,le.setFromMatrixPosition(de.matrixWorld)),ge.logarithmicDepthBuffer&&At.setValue(ve,"logDepthBufFC",2/(Math.log(de.far+1)/Math.LN2)),(Ze.isMeshPhongMaterial||Ze.isMeshToonMaterial||Ze.isMeshLambertMaterial||Ze.isMeshBasicMaterial||Ze.isMeshStandardMaterial||Ze.isShaderMaterial)&&At.setValue(ve,"isOrthographic",de.isOrthographicCamera===!0),re!==de&&(re=de,gs=!0,As=!0)}if(Gt.needsLights&&(Rr.state.directionalShadowMap.length>0&&At.setValue(ve,"directionalShadowMap",Rr.state.directionalShadowMap,Ve),Rr.state.spotShadowMap.length>0&&At.setValue(ve,"spotShadowMap",Rr.state.spotShadowMap,Ve),Rr.state.pointShadowMap.length>0&&At.setValue(ve,"pointShadowMap",Rr.state.pointShadowMap,Ve)),We.isSkinnedMesh){At.setOptional(ve,We,"bindMatrix"),At.setOptional(ve,We,"bindMatrixInverse");const In=We.skeleton;In&&(In.boneTexture===null&&In.computeBoneTexture(),At.setValue(ve,"boneTexture",In.boneTexture,Ve))}We.isBatchedMesh&&(At.setOptional(ve,We,"batchingTexture"),At.setValue(ve,"batchingTexture",We._matricesTexture,Ve),At.setOptional(ve,We,"batchingIdTexture"),At.setValue(ve,"batchingIdTexture",We._indirectTexture,Ve),At.setOptional(ve,We,"batchingColorTexture"),We._colorsTexture!==null&&At.setValue(ve,"batchingColorTexture",We._colorsTexture,Ve));const Dn=rt.morphAttributes;if((Dn.position!==void 0||Dn.normal!==void 0||Dn.color!==void 0)&&Ne.update(We,rt,Or),(gs||Gt.receiveShadow!==We.receiveShadow)&&(Gt.receiveShadow=We.receiveShadow,At.setValue(ve,"receiveShadow",We.receiveShadow)),(Ze.isMeshStandardMaterial||Ze.isMeshLambertMaterial||Ze.isMeshPhongMaterial)&&Ze.envMap===null&&He.environment!==null&&(Ht.envMapIntensity.value=He.environmentIntensity),Ht.dfgLUT!==void 0&&(Ht.dfgLUT.value=Rme()),gs){if(At.setValue(ve,"toneMappingExposure",k.toneMappingExposure),Gt.needsLights&&or(Ht,As),Ct&&Ze.fog===!0&&ie.refreshFogUniforms(Ht,Ct),ie.refreshMaterialUniforms(Ht,Ze,se,Z,D.state.transmissionRenderTarget[de.id]),Gt.needsLights&&Gt.lightProbeGrid){const In=Gt.lightProbeGrid;Ht.probesSH.value=In.texture,Ht.probesMin.value.copy(In.boundingBox.min),Ht.probesMax.value.copy(In.boundingBox.max),Ht.probesResolution.value.copy(In.resolution)}c_.upload(ve,xi(Gt),Ht,Ve)}if(Ze.isShaderMaterial&&Ze.uniformsNeedUpdate===!0&&(c_.upload(ve,xi(Gt),Ht,Ve),Ze.uniformsNeedUpdate=!1),Ze.isSpriteMaterial&&At.setValue(ve,"center",We.center),At.setValue(ve,"modelViewMatrix",We.modelViewMatrix),At.setValue(ve,"normalMatrix",We.normalMatrix),At.setValue(ve,"modelMatrix",We.matrixWorld),Ze.uniformsGroups!==void 0){const In=Ze.uniformsGroups;for(let xs=0,ii=In.length;xs<ii;xs++){const Cs=In[xs];Qe.update(Cs,Or),Qe.bind(Cs,Or)}}return Or}function or(de,He){de.ambientLightColor.needsUpdate=He,de.lightProbe.needsUpdate=He,de.directionalLights.needsUpdate=He,de.directionalLightShadows.needsUpdate=He,de.pointLights.needsUpdate=He,de.pointLightShadows.needsUpdate=He,de.spotLights.needsUpdate=He,de.spotLightShadows.needsUpdate=He,de.rectAreaLights.needsUpdate=He,de.hemisphereLights.needsUpdate=He}function ks(de){return de.isMeshLambertMaterial||de.isMeshToonMaterial||de.isMeshPhongMaterial||de.isMeshStandardMaterial||de.isShadowMaterial||de.isShaderMaterial&&de.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return K},this.getRenderTarget=function(){return ae},this.setRenderTargetTextures=function(de,He,rt){const Ze=Ie.get(de);Ze.__autoAllocateDepthBuffer=de.resolveDepthBuffer===!1,Ze.__autoAllocateDepthBuffer===!1&&(Ze.__useRenderToTexture=!1),Ie.get(de.texture).__webglTexture=He,Ie.get(de.depthTexture).__webglTexture=Ze.__autoAllocateDepthBuffer?void 0:rt,Ze.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(de,He){const rt=Ie.get(de);rt.__webglFramebuffer=He,rt.__useDefaultFramebuffer=He===void 0},this.setRenderTarget=function(de,He=0,rt=0){ae=de,z=He,K=rt;let Ze=null,We=!1,Ct=!1;if(de){const Pt=Ie.get(de);if(Pt.__useDefaultFramebuffer!==void 0){Y.bindFramebuffer(ve.FRAMEBUFFER,Pt.__webglFramebuffer),F.copy(de.viewport),O.copy(de.scissor),J=de.scissorTest,Y.viewport(F),Y.scissor(O),Y.setScissorTest(J),oe=-1;return}else if(Pt.__webglFramebuffer===void 0)Ve.setupRenderTarget(de);else if(Pt.__hasExternalTextures)Ve.rebindTextures(de,Ie.get(de.texture).__webglTexture,Ie.get(de.depthTexture).__webglTexture);else if(de.depthBuffer){const Rt=de.depthTexture;if(Pt.__boundDepthTexture!==Rt){if(Rt!==null&&Ie.has(Rt)&&(de.width!==Rt.image.width||de.height!==Rt.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(de)}}const _t=de.texture;(_t.isData3DTexture||_t.isDataArrayTexture||_t.isCompressedArrayTexture)&&(Ct=!0);const kt=Ie.get(de).__webglFramebuffer;
vendor: 8,014 bytes, line 4496
4496de.isWebGLCubeRenderTarget?(Array.isArray(kt[He])?Ze=kt[He][rt]:Ze=kt[He],We=!0):de.samples>0&&Ve.useMultisampledRTT(de)===!1?Ze=Ie.get(de).__webglMultisampledFramebuffer:Array.isArray(kt)?Ze=kt[rt]:Ze=kt,F.copy(de.viewport),O.copy(de.scissor),J=de.scissorTest}else F.copy(Be).multiplyScalar(se).floor(),O.copy(ye).multiplyScalar(se).floor(),J=Le;if(rt!==0&&(Ze=$),Y.bindFramebuffer(ve.FRAMEBUFFER,Ze)&&Y.drawBuffers(de,Ze),Y.viewport(F),Y.scissor(O),Y.setScissorTest(J),We){const Pt=Ie.get(de.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+He,Pt.__webglTexture,rt)}else if(Ct){const Pt=He;for(let _t=0;_t<de.textures.length;_t++){const kt=Ie.get(de.textures[_t]);ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0+_t,kt.__webglTexture,rt,Pt)}}else if(de!==null&&rt!==0){const Pt=Ie.get(de.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,Pt.__webglTexture,rt)}oe=-1},this.readRenderTargetPixels=function(de,He,rt,Ze,We,Ct,zt,Pt=0){if(!(de&&de.isWebGLRenderTarget)){fn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _t=Ie.get(de).__webglFramebuffer;if(de.isWebGLCubeRenderTarget&&zt!==void 0&&(_t=_t[zt]),_t){Y.bindFramebuffer(ve.FRAMEBUFFER,_t);try{const kt=de.textures[Pt],Rt=kt.format,qt=kt.type;if(de.textures.length>1&&ve.readBuffer(ve.COLOR_ATTACHMENT0+Pt),!ge.textureFormatReadable(Rt)){fn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ge.textureTypeReadable(qt)){fn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}He>=0&&He<=de.width-Ze&&rt>=0&&rt<=de.height-We&&ve.readPixels(He,rt,Ze,We,st.convert(Rt),st.convert(qt),Ct)}finally{const kt=ae!==null?Ie.get(ae).__webglFramebuffer:null;Y.bindFramebuffer(ve.FRAMEBUFFER,kt)}}},this.readRenderTargetPixelsAsync=async function(de,He,rt,Ze,We,Ct,zt,Pt=0){if(!(de&&de.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let _t=Ie.get(de).__webglFramebuffer;if(de.isWebGLCubeRenderTarget&&zt!==void 0&&(_t=_t[zt]),_t)if(He>=0&&He<=de.width-Ze&&rt>=0&&rt<=de.height-We){Y.bindFramebuffer(ve.FRAMEBUFFER,_t);const kt=de.textures[Pt],Rt=kt.format,qt=kt.type;if(de.textures.length>1&&ve.readBuffer(ve.COLOR_ATTACHMENT0+Pt),!ge.textureFormatReadable(Rt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ge.textureTypeReadable(qt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Qt=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,Qt),ve.bufferData(ve.PIXEL_PACK_BUFFER,Ct.byteLength,ve.STREAM_READ),ve.readPixels(He,rt,Ze,We,st.convert(Rt),st.convert(qt),0);const nn=ae!==null?Ie.get(ae).__webglFramebuffer:null;Y.bindFramebuffer(ve.FRAMEBUFFER,nn);const Cn=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);return ve.flush(),await Vae(ve,Cn,4),ve.bindBuffer(ve.PIXEL_PACK_BUFFER,Qt),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,Ct),ve.deleteBuffer(Qt),ve.deleteSync(Cn),Ct}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(de,He=null,rt=0){const Ze=Math.pow(2,-rt),We=Math.floor(de.image.width*Ze),Ct=Math.floor(de.image.height*Ze),zt=He!==null?He.x:0,Pt=He!==null?He.y:0;Ve.setTexture2D(de,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,rt,0,0,zt,Pt,We,Ct),Y.unbindTexture()},this.copyTextureToTexture=function(de,He,rt=null,Ze=null,We=0,Ct=0){let zt,Pt,_t,kt,Rt,qt,Qt,nn,Cn;const Zt=de.isCompressedTexture?de.mipmaps[Ct]:de.image;if(rt!==null)zt=rt.max.x-rt.min.x,Pt=rt.max.y-rt.min.y,_t=rt.isBox3?rt.max.z-rt.min.z:1,kt=rt.min.x,Rt=rt.min.y,qt=rt.isBox3?rt.min.z:0;else{const Ht=Math.pow(2,-We);zt=Math.floor(Zt.width*Ht),Pt=Math.floor(Zt.height*Ht),de.isDataArrayTexture?_t=Zt.depth:de.isData3DTexture?_t=Math.floor(Zt.depth*Ht):_t=1,kt=0,Rt=0,qt=0}Ze!==null?(Qt=Ze.x,nn=Ze.y,Cn=Ze.z):(Qt=0,nn=0,Cn=0);const Fn=st.convert(He.format),_n=st.convert(He.type);let Gt;He.isData3DTexture?(Ve.setTexture3D(He,0),Gt=ve.TEXTURE_3D):He.isDataArrayTexture||He.isCompressedArrayTexture?(Ve.setTexture2DArray(He,0),Gt=ve.TEXTURE_2D_ARRAY):(Ve.setTexture2D(He,0),Gt=ve.TEXTURE_2D),Y.activeTexture(ve.TEXTURE0),Y.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,He.flipY),Y.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,He.premultiplyAlpha),Y.pixelStorei(ve.UNPACK_ALIGNMENT,He.unpackAlignment);const Rr=Y.getParameter(ve.UNPACK_ROW_LENGTH),mn=Y.getParameter(ve.UNPACK_IMAGE_HEIGHT),Or=Y.getParameter(ve.UNPACK_SKIP_PIXELS),os=Y.getParameter(ve.UNPACK_SKIP_ROWS),gs=Y.getParameter(ve.UNPACK_SKIP_IMAGES);Y.pixelStorei(ve.UNPACK_ROW_LENGTH,Zt.width),Y.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,Zt.height),Y.pixelStorei(ve.UNPACK_SKIP_PIXELS,kt),Y.pixelStorei(ve.UNPACK_SKIP_ROWS,Rt),Y.pixelStorei(ve.UNPACK_SKIP_IMAGES,qt);const As=de.isDataArrayTexture||de.isData3DTexture,At=He.isDataArrayTexture||He.isData3DTexture;if(de.isDepthTexture){const Ht=Ie.get(de),Dn=Ie.get(He),In=Ie.get(Ht.__renderTarget),xs=Ie.get(Dn.__renderTarget);Y.bindFramebuffer(ve.READ_FRAMEBUFFER,In.__webglFramebuffer),Y.bindFramebuffer(ve.DRAW_FRAMEBUFFER,xs.__webglFramebuffer);for(let ii=0;ii<_t;ii++)As&&(ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Ie.get(de).__webglTexture,We,qt+ii),ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Ie.get(He).__webglTexture,Ct,Cn+ii)),ve.blitFramebuffer(kt,Rt,zt,Pt,Qt,nn,zt,Pt,ve.DEPTH_BUFFER_BIT,ve.NEAREST);Y.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Y.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else if(We!==0||de.isRenderTargetTexture||Ie.has(de)){const Ht=Ie.get(de),Dn=Ie.get(He);Y.bindFramebuffer(ve.READ_FRAMEBUFFER,X),Y.bindFramebuffer(ve.DRAW_FRAMEBUFFER,ee);for(let In=0;In<_t;In++)As?ve.framebufferTextureLayer(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Ht.__webglTexture,We,qt+In):ve.framebufferTexture2D(ve.READ_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,Ht.__webglTexture,We),At?ve.framebufferTextureLayer(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,Dn.__webglTexture,Ct,Cn+In):ve.framebufferTexture2D(ve.DRAW_FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_2D,Dn.__webglTexture,Ct),We!==0?ve.blitFramebuffer(kt,Rt,zt,Pt,Qt,nn,zt,Pt,ve.COLOR_BUFFER_BIT,ve.NEAREST):At?ve.copyTexSubImage3D(Gt,Ct,Qt,nn,Cn+In,kt,Rt,zt,Pt):ve.copyTexSubImage2D(Gt,Ct,Qt,nn,kt,Rt,zt,Pt);Y.bindFramebuffer(ve.READ_FRAMEBUFFER,null),Y.bindFramebuffer(ve.DRAW_FRAMEBUFFER,null)}else At?de.isDataTexture||de.isData3DTexture?ve.texSubImage3D(Gt,Ct,Qt,nn,Cn,zt,Pt,_t,Fn,_n,Zt.data):He.isCompressedArrayTexture?ve.compressedTexSubImage3D(Gt,Ct,Qt,nn,Cn,zt,Pt,_t,Fn,Zt.data):ve.texSubImage3D(Gt,Ct,Qt,nn,Cn,zt,Pt,_t,Fn,_n,Zt):de.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,Ct,Qt,nn,zt,Pt,Fn,_n,Zt.data):de.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,Ct,Qt,nn,Zt.width,Zt.height,Fn,Zt.data):ve.texSubImage2D(ve.TEXTURE_2D,Ct,Qt,nn,zt,Pt,Fn,_n,Zt);Y.pixelStorei(ve.UNPACK_ROW_LENGTH,Rr),Y.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,mn),Y.pixelStorei(ve.UNPACK_SKIP_PIXELS,Or),Y.pixelStorei(ve.UNPACK_SKIP_ROWS,os),Y.pixelStorei(ve.UNPACK_SKIP_IMAGES,gs),Ct===0&&He.generateMipmaps&&ve.generateMipmap(Gt),Y.unbindTexture()},this.initRenderTarget=function(de){Ie.get(de).__webglFramebuffer===void 0&&Ve.setupRenderTarget(de)},this.initTexture=function(de){de.isCubeTexture?Ve.setTextureCube(de,0):de.isData3DTexture?Ve.setTexture3D(de,0):de.isDataArrayTexture||de.isCompressedArrayTexture?Ve.setTexture2DArray(de,0):Ve.setTexture2D(de,0),Y.unbindTexture()},this.resetState=function(){z=0,K=0,ae=null,Y.reset(),et.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ko}get outputColorSpace(){return this._outputColorSpace}
4496set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=ur._getDrawingBufferColorSpace(e),t.unpackColorSpace=ur._getUnpackColorSpace()}}const Pme=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:wN,AddEquation:Kf,AddOperation:o8,AdditiveAnimationBlendMode:sR,AdditiveBlending:ET,AgXToneMapping:Q3,AlphaFormat:nR,AlwaysCompare:w8,AlwaysDepth:U_,AlwaysStencilFunc:DT,AmbientLight:i9,AnimationAction:p9,AnimationClip:Xx,AnimationLoader:Ble,AnimationMixer:uce,AnimationObjectGroup:lce,AnimationUtils:Ple,ArcCurve:k8,ArrayCamera:d9,ArrowHelper:Tce,AttachedBindMode:RT,Audio:h9,AudioAnalyser:Jle,AudioContext:DR,AudioListener:Yle,AudioLoader:Wle,AxesHelper:Rce,BackSide:Da,BasicDepthPacking:h8,BasicShadowMap:z6,BatchedMesh:T8,BezierInterpolant:e9,Bone:ON,BooleanKeyframeTrack:Tp,Box2:b9,Box3:hi,Box3Helper:Ece,BoxGeometry:Ep,BoxHelper:Cce,BufferAttribute:Er,BufferGeometry:Bn,BufferGeometryLoader:l9,ByteType:J3,Cache:Eu,Camera:rA,CameraHelper:Ace,CanvasTexture:Koe,CapsuleGeometry:GN,CatmullRomCurve3:$N,CineonToneMapping:q3,CircleGeometry:HN,ClampToEdgeWrapping:io,Clock:x9,Color:Ut,ColorKeyframeTrack:AR,ColorManagement:ur,Compatibility:Fae,CompressedArrayTexture:Yoe,CompressedCubeTexture:Qoe,CompressedTexture:zN,CompressedTextureLoader:Lle,ConeGeometry:jv,ConstantAlphaFactor:s8,ConstantColorFactor:n8,Controls:Dce,CubeCamera:u9,CubeDepthTexture:P8,CubeReflectionMapping:Lu,CubeRefractionMapping:xh,CubeTexture:Cv,CubeTextureLoader:Ole,CubeUVReflectionMapping:a0,CubicBezierCurve:bR,CubicBezierCurve3:I8,CubicInterpolant:J8,CullFaceBack:CT,CullFaceFront:U6,CullFaceFrontBack:tae,CullFaceNone:F6,Curve:Dc,CurvePath:L8,CustomBlending:G6,CustomToneMapping:Y3,CylinderGeometry:Ev,Cylindrical:pce,Data3DTexture:IN,DataArrayTexture:kN,DataTexture:Hl,DataTextureLoader:Fle,DataUtils:woe,DecrementStencilOp:gae,DecrementWrapStencilOp:bae,DefaultLoadingManager:n9,DepthFormat:Fu,DepthStencilFormat:rh,DepthTexture:gp,DetachedBindMode:l8,DirectionalLight:RR,DirectionalLightHelper:Nce,DiscreteInterpolant:Z8,DodecahedronGeometry:VN,DoubleSide:Ll,DstAlphaFactor:K6,DstColorFactor:Z6,DynamicCopyUsage:Dae,DynamicDrawUsage:Cae,DynamicReadUsage:Tae,EdgesGeometry:D8,EllipseCurve:WN,EqualCompare:b8,EqualDepth:G_,EqualStencilFunc:Sae,EquirectangularReflectionMapping:by,EquirectangularRefractionMapping:yy,Euler:Ac,EventDispatcher:Rc,ExternalTexture:gR,ExtrudeGeometry:XN,FileLoader:rl,Float16BufferAttribute:Eoe,Float32BufferAttribute:tn,FloatType:ao,Fog:LN,FogExp2:BN,FramebufferTexture:qoe,FrontSide:Bu,Frustum:pp,FrustumArray:FN,GLBufferAttribute:mce,GLSL1:Iae,GLSL3:kT,GreaterCompare:y8,GreaterDepth:V_,GreaterEqualCompare:PN,GreaterEqualDepth:H_,GreaterEqualStencilFunc:Aae,GreaterStencilFunc:Mae,GridHelper:_ce,Group:Dd,HTMLTexture:Joe,HalfFloatType:Ou,HemisphereLight:s9,HemisphereLightHelper:Sce,IcosahedronGeometry:qN,ImageBitmapLoader:c9,ImageLoader:rv,ImageUtils:N8,IncrementStencilOp:pae,IncrementWrapStencilOp:xae,InstancedBufferAttribute:wh,InstancedBufferGeometry:iA,InstancedInterleavedBuffer:AM,InstancedMesh:hR,Int16BufferAttribute:Aoe,Int32BufferAttribute:Coe,Int8BufferAttribute:_oe,IntType:MN,InterleavedBuffer:Nv,InterleavedBufferAttribute:Do,Interpolant:jp,InterpolateBezier:PT,InterpolateDiscrete:Lx,InterpolateLinear:Ox,InterpolateSmooth:o_,InterpolationSamplingMode:Oae,InterpolationSamplingType:Lae,InvertStencilOp:yae,KeepStencilOp:Dm,KeyframeTrack:Xl,LOD:j8,LatheGeometry:YN,Layers:zx,LessCompare:x8,LessDepth:z_,LessEqualCompare:RN,LessEqualDepth:hp,LessEqualStencilFunc:_ae,LessStencilFunc:wae,Light:Rh,LightProbe:o9,Line:Vd,Line3:y9,LineBasicMaterial:ka,LineCurve:yR,LineCurve3:B8,LineDashedMaterial:Y8,LineLoop:mR,LineSegments:Pc,LinearFilter:qr,LinearInterpolant:NR,LinearMipMapLinearFilter:aae,LinearMipMapNearestFilter:iae,LinearMipmapLinearFilter:Fl,LinearMipmapNearestFilter:_x,LinearSRGBColorSpace:Fx,LinearToneMapping:$3,LinearTransfer:qy,Loader:Ia,LoaderUtils:oh,LoadingManager:CR,LoopOnce:c8,LoopPingPong:d8,LoopRepeat:u8,MOUSE:Su,Material:Ci,MaterialBlending:nae,MaterialLoader:sA,MathUtils:DN,Matrix2:zT,Matr
4496ix3:Ln,Matrix4:yn,MaxEquation:$6,Mesh:Ns,MeshBasicMaterial:ko,MeshDepthMaterial:tA,MeshDistanceMaterial:nA,MeshLambertMaterial:X8,MeshMatcapMaterial:q8,MeshNormalMaterial:$8,MeshPhongMaterial:V8,MeshPhysicalMaterial:$l,MeshStandardMaterial:Dv,MeshToonMaterial:W8,MinEquation:W6,MirroredRepeatWrapping:kx,MixOperation:a8,MultiplyBlending:TT,MultiplyOperation:_v,NearestFilter:ri,NearestMipMapLinearFilter:sae,NearestMipMapNearestFilter:rae,NearestMipmapLinearFilter:Hm,NearestMipmapNearestFilter:_N,NeutralToneMapping:K3,NeverCompare:g8,NeverDepth:F_,NeverStencilFunc:vae,NoBlending:Tu,NoColorSpace:Td,NoNormalPacking:uae,NoToneMapping:Gl,NormalAnimationBlendMode:TN,NormalBlending:tp,NormalGAPacking:fae,NormalRGPacking:dae,NotEqualCompare:v8,NotEqualDepth:W_,NotEqualStencilFunc:Nae,NumberKeyframeTrack:Wx,Object3D:vr,ObjectLoader:Hle,ObjectSpaceNormalMap:p8,OctahedronGeometry:Rv,OneFactor:q6,OneMinusConstantAlphaFactor:i8,OneMinusConstantColorFactor:r8,OneMinusDstAlphaFactor:J6,OneMinusDstColorFactor:e8,OneMinusSrcAlphaFactor:O_,OneMinusSrcColorFactor:Q6,OrthographicCamera:Ru,PCFShadowMap:Sx,PCFSoftShadowMap:xy,PMREMGenerator:HT,Path:Jy,PerspectiveCamera:ti,Plane:_u,PlaneGeometry:Yd,PlaneHelper:jce,PointLight:TR,PointLightHelper:vce,Points:pR,PointsMaterial:UN,PolarGridHelper:Mce,PolyhedronGeometry:Th,PositionalAudio:Kle,PropertyBinding:_r,PropertyMixer:m9,QuadraticBezierCurve:vR,QuadraticBezierCurve3:wR,Quaternion:Oi,QuaternionKeyframeTrack:$x,QuaternionLinearInterpolant:t9,R11_EAC_Format:Z_,RED_GREEN_RGTC2_Format:$y,RED_RGTC1_Format:yM,REVISION:i0,RG11_EAC_Format:Wy,RGBADepthPacking:m8,RGBAFormat:Pa,RGBAIntegerFormat:jN,RGBA_ASTC_10x10_Format:hM,RGBA_ASTC_10x5_Format:uM,RGBA_ASTC_10x6_Format:dM,RGBA_ASTC_10x8_Format:fM,RGBA_ASTC_12x10_Format:mM,RGBA_ASTC_12x12_Format:pM,RGBA_ASTC_4x4_Format:nM,RGBA_ASTC_5x4_Format:rM,RGBA_ASTC_5x5_Format:sM,RGBA_ASTC_6x5_Format:iM,RGBA_ASTC_6x6_Format:aM,RGBA_ASTC_8x5_Format:oM,RGBA_ASTC_8x6_Format:lM,RGBA_ASTC_8x8_Format:cM,RGBA_BPTC_Format:gM,RGBA_ETC2_EAC_Format:J_,RGBA_PVRTC_2BPPV1_Format:Y_,RGBA_PVRTC_4BPPV1_Format:q_,RGBA_S3TC_DXT1_Format:wy,RGBA_S3TC_DXT3_Format:Sy,RGBA_S3TC_DXT5_Format:_y,RGBDepthPacking:lae,RGBFormat:rR,RGBIntegerFormat:oae,RGB_BPTC_SIGNED_Format:xM,RGB_BPTC_UNSIGNED_Format:bM,RGB_ETC1_Format:Q_,RGB_ETC2_Format:K_,RGB_PVRTC_2BPPV1_Format:X_,RGB_PVRTC_4BPPV1_Format:$_,RGB_S3TC_DXT1_Format:vy,RGDepthPacking:cae,RGFormat:yh,RGIntegerFormat:EN,RawShaderMaterial:MR,Ray:Cp,Raycaster:g9,RectAreaLight:a9,RedFormat:CN,RedIntegerFormat:Mv,ReinhardToneMapping:X3,RenderTarget:oR,RenderTarget3D:dce,RepeatWrapping:bh,ReplaceStencilOp:mae,ReverseSubtractEquation:V6,RingGeometry:QN,SIGNED_R11_EAC_Format:eM,SIGNED_RED_GREEN_RGTC2_Format:wM,SIGNED_RED_RGTC1_Format:vM,SIGNED_RG11_EAC_Format:tM,SRGBColorSpace:Ra,SRGBTransfer:$r,Scene:lR,ShaderChunk:Yn,ShaderLib:wc,ShaderMaterial:oo,ShadowMaterial:G8,Shape:Tv,ShapeGeometry:KN,ShapePath:Pce,ShapeUtils:Sc,ShortType:Z3,Skeleton:Av,SkeletonHelper:yce,SkinnedMesh:fR,Source:sh,Sphere:mi,SphereGeometry:Pv,Spherical:UT,SphericalHarmonics3:PR,SplineCurve:SR,SpotLight:jR,SpotLightHelper:bce,Sprite:E8,SpriteMaterial:dR,SrcAlphaFactor:L_,SrcAlphaSaturateFactor:t8,SrcColorFactor:Y6,StaticCopyUsage:Pae,StaticDrawUsage:Yy,StaticReadUsage:jae,StereoCamera:$le,StreamCopyUsage:kae,StreamDrawUsage:Eae,StreamReadUsage:Rae,StringKeyframeTrack:Rp,SubtractEquation:H6,SubtractiveBlending:jT,TOUCH:Pm,TangentSpaceNormalMap:Hd,TetrahedronGeometry:JN,Texture:ms,TextureLoader:r9,TextureUtils:Oce,Timer:f9,TimestampQuery:Bae,TorusGeometry:ZN,TorusKnotGeometry:eA,Triangle:Po,TriangleFanDrawMode:SM,TriangleStripDrawMode:iR,TrianglesDrawMode:f8,TubeGeometry:bp,UVMapping:SN,Uint16BufferAttribute:cR,Uint32BufferAttribute:uR,Uint8BufferAttribute:Moe,Uint8ClampedBufferAttribute:Noe,Uniform:aA,UniformsGroup:hce,UniformsLib:Xt,UniformsUtils:Vx,UnsignedByteType:eo,UnsignedInt101111Type:tR,UnsignedInt248Type:Bx,UnsignedInt5999Type:eR,UnsignedIntType:Wl,UnsignedShort4444Type:NN,UnsignedShort5551Type:AN,UnsignedShortType:Ix,VSMShadowMap:Gm,Vector2:wt,Vector3:we,Vector4:mr,VectorKeyframeTrack:nv,VideoFrameTexture:Xoe,VideoTexture:R8,WebGL3DRenderTarget:foe,WebGLArrayRenderTarget:doe,WebGLCoordinateSystem:Ko,WebGLCubeRen
4496derTarget:BR,WebGLRenderTarget:el,WebGLRenderer:j9,WebGLUtils:C9,WebGPUCoordinateSystem:mp,WebXRController:l_,WireframeGeometry:_R,WrapAroundEnding:Xy,ZeroCurvatureEnding:Vm,ZeroFactor:X6,ZeroSlopeEnding:Wm,ZeroStencilOp:hae,createCanvasElement:_8,error:fn,getConsoleFunction:Hae,log:Ky,setConsoleFunction:Gae,warn:$t,warnOnce:ah},Symbol.toStringTag,{value:"Module"}));var BE={exports:{}},LE={};var P4;function Dme(){if(P4)return LE;P4=1;var n=lv(),e=SF();function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,a=n.useRef,o=n.useEffect,l=n.useMemo,u=n.useDebugValue;return LE.useSyncExternalStoreWithSelector=function(d,h,p,x,y){var v=a(null);if(v.current===null){var _={hasValue:!1,value:null};v.current=_}else _=v.current;v=l(function(){function S(D){if(!A){if(A=!0,E=D,D=x(D),y!==void 0&&_.hasValue){var B=_.value;if(y(B,D))return C=B}return C=D}if(B=C,r(E,D))return B;var P=x(D);return y!==void 0&&y(B,P)?(E=D,B):(E=D,C=P)}var A=!1,E,C,I=p===void 0?null:p;return[function(){return S(h())},I===null?void 0:function(){return S(I())}]},[h,p,x,y]);var M=s(d,v[0],v[1]);return o(function(){_.hasValue=!0,_.value=M},[M]),u(M),M},LE}var D4;function kme(){return D4||(D4=1,BE.exports=Dme()),BE.exports}var Ime=kme();const Bme=LM(Ime),k4=n=>{let e;const t=new Set,r=(d,h)=>{const p=typeof d=="function"?d(e):d;if(!Object.is(p,e)){const x=e;e=h??(typeof p!="object"||p===null)?p:Object.assign({},e,p),t.forEach(y=>y(e,x))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(t.add(d),()=>t.delete(d))},u=e=n(r,s,l);return l},Lme=(n=>n?k4(n):k4),{useSyncExternalStoreWithSelector:Ome}=Bme,Fme=n=>n;function Ume(n,e=Fme,t){const r=Ome(n.subscribe,n.getState,n.getInitialState,e,t);return Ft.useDebugValue(r),r}const I4=(n,e)=>{const t=Lme(n),r=(s,a=e)=>Ume(t,s,a);return Object.assign(r,t),r},zme=((n,e)=>n?I4(n,e):I4),Gme=n=>typeof n=="object"&&typeof n.then=="function",Xm=[];function T9(n,e,t=(r,s)=>r===s){if(n===e)return!0;if(!n||!e)return!1;const r=n.length;if(e.length!==r)return!1;for(let s=0;s<r;s++)if(!t(n[s],e[s]))return!1;return!0}function R9(n,e=null,t=!1,r={}){e===null&&(e=[n]);for(const a of Xm)if(T9(e,a.keys,a.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(a,"error"))throw a.error;if(Object.prototype.hasOwnProperty.call(a,"response"))return r.lifespan&&r.lifespan>0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!t)throw a.promise}const s={keys:e,equal:r.equal,remove:()=>{const a=Xm.indexOf(s);a!==-1&&Xm.splice(a,1)},promise:(Gme(n)?n:n(...e)).then(a=>{s.response=a,r.lifespan&&r.lifespan>0&&(s.timeout=setTimeout(s.remove,r.lifespan))}).catch(a=>s.error=a)};if(Xm.push(s),!t)throw s.promise}const P9=(n,e,t)=>R9(n,e,!1,t),Hme=(n,e,t)=>{R9(n,e,!0,t)},Vme=n=>{if(n===void 0||n.length===0)Xm.splice(0,Xm.length);else{const e=Xm.find(t=>T9(n,t.keys,t.equal));e&&e.remove()}};var Cd=RL();const Wme=LM(Cd);function LR(n,e,t){if(!n)return;if(t(n)===!0)return n;let r=e?n.return:n.child;for(;r;){const s=LR(r,e,t);if(s)return s;r=e?null:r.sibling}}function D9(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const OR=D9(T.createContext(null));class k9 extends T.Component{render(){return T.createElement(OR.Provider,{value:this._reactInternals},this.props.children)}}function I9(){const n=T.useContext(OR);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=T.useId();return T.useMemo(()=>{for(const t of[n,n?.alternate]){if(!t)continue;const r=LR(t,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[n,e])}const $me=Symbol.for("react.context"),Xme=n=>n!==null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===$me;function qme(){const n=I9(),[e]=T.useState(()=>new Map);e.clear();let t=n;for(;t;){const r=t.type;Xme(r)&&r!==OR&&!e.has(r)&&e.set(r,T.use(D9(r))),t=t.return}return e}function Yme(){const n=qme();return T.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>
4496r=>T.createElement(e,null,T.createElement(t.Provider,{...r,value:n.get(t)})),e=>T.createElement(k9,{...e})),[n])}function FR(n){let e=n.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const B9=n=>n&&n.isOrthographicCamera,Qme=n=>n&&n.hasOwnProperty("current"),Kme=n=>n!=null&&(typeof n=="string"||typeof n=="number"||n.isColor),kv=((n,e)=>typeof window<"u"&&(((n=window.document)==null?void 0:n.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?T.useLayoutEffect:T.useEffect;function L9(n){const e=T.useRef(n);return kv(()=>{e.current=n},[n]),e}function Jme(){const n=I9(),e=Yme();return T.useMemo(()=>({children:t})=>{const s=!!LR(n,!0,a=>a.type===T.StrictMode)?T.StrictMode:T.Fragment;return i.jsx(s,{children:i.jsx(e,{children:t})})},[n,e])}function Zme({set:n}){return kv(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}const epe=(n=>(n=class extends T.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},n.getDerivedStateFromError=()=>({error:!0}),n))();function O9(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}function ix(n){var e;return(e=n.__r3f)==null?void 0:e.root.getState()}const hs={obj:n=>n===Object(n)&&!hs.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,nul:n=>n===null,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:r="reference",strict:s=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(hs.str(n)||hs.num(n)||hs.boo(n))return n===e;const a=hs.obj(n);if(a&&r==="reference")return n===e;const o=hs.arr(n);if(o&&t==="reference")return n===e;if((o||a)&&n===e)return!0;let l;for(l in n)if(!(l in e))return!1;if(a&&t==="shallow"&&r==="shallow"){for(l in s?e:n)if(!hs.equ(n[l],e[l],{strict:s,objects:"reference"}))return!1}else for(l in s?e:n)if(n[l]!==e[l])return!1;if(hs.und(l)){if(o&&n.length===0&&e.length===0||a&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function tpe(n){const e={nodes:{},materials:{},meshes:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function npe(n){n.type!=="Scene"&&(n.dispose==null||n.dispose());for(const e in n){const t=n[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const F9=["children","key","ref"];function $T(n){const e={};for(const t in n)F9.includes(t)||(e[t]=n[t]);return e}function CM(n,e,t,r){const s=n;let a=s?.__r3f;return a||(a={root:e,type:t,parent:null,children:[],props:$T(r),object:s,eventCount:0,handlers:{},isHidden:!1},s&&(s.__r3f=a)),a}function sv(n,e){if(!e.includes("-"))return{root:n,key:e,target:n[e]};if(e in n)return{root:n,key:e,target:n[e]};let t=n;const r=e.split("-");for(const s of r){if(typeof t!="object"||t===null){if(t!==void 0){const a=r.slice(r.indexOf(s)).join("-");return{root:t,key:a,target:void 0}}return{root:n,key:e,target:void 0}}e=s,n=t,t=t[e]}return{root:n,key:e,target:t}}const B4=/-\d+$/;function EM(n,e){if(hs.str(e.props.attach)){if(B4.test(e.props.attach)){const s=e.props.attach.replace(B4,""),{root:a,key:o}=sv(n.object,s);Array.isArray(a[o])||(a[o]=[])}const{root:t,key:r}=sv(n.object,e.props.attach);e.previousAttach=t[r],t[r]=e.object}else hs.fun(e.props.attach)&&(e.previousAttach=e.props.attach(n.object,e.object))}function jM(n,e){if(hs.str(e.props.attach)){const{root:t,key:r}=sv(n.object,e.props.attach),s=e.previousAttach;s===void 0?delete t[r]:t[r]=s}else e.previousAttach==null||e.previousAttach(n.object,e.object);delete e.previousAttach}const XT=[...F9,"args","dispose","attach","object","onUpdate","dispose"],L4=new Map;function rpe(n){let e=L4.get(n.constructor);try{e||(e=new n.constructor,L4.set(n.constructor,e))}catch{}return e}function spe(n,e){const t={};for(const r in e)if(!XT.includes(r)&&!hs.equ(e[r],n.props[r])){t[r]=e[r];for(const s in e)s.startsWith(`${r}-`)&&(t[s]=e[s])}for(const r in n.props){if(XT.includes(r)||e.hasOwnProperty(r))continue;const{root:s,key:a}=sv(n.object,r);
4496if(s.constructor&&s.constructor.length===0){const o=rpe(s);hs.und(o)||(t[r]=o[a])}else t[r]=0}return t}const ipe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],ape=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Jf(n,e){var t;const r=n.__r3f,s=r&&FR(r).getState(),a=r?.eventCount;for(const l in e){let u=e[l];if(XT.includes(l))continue;if(r&&ape.test(l)){typeof u=="function"?r.handlers[l]=u:delete r.handlers[l],r.eventCount=Object.keys(r.handlers).length;continue}if(u===void 0)continue;let{root:d,key:h,target:p}=sv(n,l);if(p===void 0&&(typeof d!="object"||d===null))throw Error(`R3F: Cannot set "${l}". Ensure it is an object before setting "${h}".`);if(p instanceof zx&&u instanceof zx)p.mask=u.mask;else if(p instanceof Ut&&Kme(u))p.set(u);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&typeof p.copy=="function"&&u!=null&&u.constructor&&p.constructor===u.constructor)p.copy(u);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&Array.isArray(u))typeof p.fromArray=="function"?p.fromArray(u):p.set(...u);else if(p!==null&&typeof p=="object"&&typeof p.set=="function"&&typeof u=="number")typeof p.setScalar=="function"?p.setScalar(u):p.set(u);else if(d instanceof oo&&h==="uniforms"&&hs.obj(u)){hs.obj(d.uniforms)||(d.uniforms={});const x=d.uniforms,y=u;for(const v in y){const _=y[v],M=x[v];M?Object.assign(M,_):x[v]={..._}}}else{var o;d[h]=u,s&&!s.linear&&ipe.includes(h)&&(o=d[h])!=null&&o.isTexture&&d[h].format===Pa&&d[h].type===eo&&(d[h].colorSpace
4496=Ra)}}if(r!=null&&r.parent&&s!=null&&s.internal&&(t=r.object)!=null&&t.isObject3D&&a!==r.eventCount){const l=r.object,u=s.internal.interaction.indexOf(l);u>-1&&s.internal.interaction.splice(u,1),r.eventCount&&l.raycast!==null&&s.internal.interaction.push(l)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&l0(r),n}function l0(n){var e;if(!n.parent)return;n.props.onUpdate==null||n.props.onUpdate(n.object);const t=(e=n.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function ope(n,e){n.manual||(B9(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix())}const Ya=n=>n?.isObject3D;function ry(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function U9(n,e,t,r){const s=t.get(e);s&&(t.delete(e),t.size===0&&(n.delete(r),s.target.releasePointerCapture(r)))}function lpe(n,e,t){const{internal:r}=n.getState();for(let s=0;s<r.interaction.length;s++)r.interaction[s]===e&&(r.interaction[s]=t);for(let s=0;s<r.initialHits.length;s++)r.initialHits[s]===e&&(r.initialHits[s]=t);r.hovered.forEach((s,a)=>
vendor: 5,430 bytes, line 4496
4496{if(s.eventObject===e||s.object===e){r.hovered.delete(a);const o={...s,eventObject:s.eventObject===e?t:s.eventObject,object:s.object===e?t:s.object};r.hovered.set(ry(o),o)}}),r.capturedMap.forEach(s=>{const a=s.get(e);a&&(s.delete(e),s.set(t,a))})}function cpe(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(r=>r!==e),t.initialHits=t.initialHits.filter(r=>r!==e),t.hovered.forEach((r,s)=>{(r.eventObject===e||r.object===e)&&t.hovered.delete(s)}),t.capturedMap.forEach((r,s)=>{U9(t.capturedMap,e,r,s)})}function upe(n){function e(u){const{internal:d}=n.getState(),h=u.offsetX-d.initialClick[0],p=u.offsetY-d.initialClick[1];return Math.round(Math.sqrt(h*h+p*p))}function t(u){return u.filter(d=>["Move","Over","Enter","Out","Leave"].some(h=>{var p;return(p=d.__r3f)==null?void 0:p.handlers["onPointer"+h]}))}function r(u,d){const h=n.getState(),p=new Set,x=[],y=d?d(h.internal.interaction):h.internal.interaction;for(let S=0;S<y.length;S++){const A=ix(y[S]);A&&(A.raycaster.camera=void 0)}h.previousRoot||h.events.compute==null||h.events.compute(u,h);function v(S){const A=ix(S);if(!A||!A.events.enabled||A.raycaster.camera===null)return[];if(A.raycaster.camera===void 0){var E;A.events.compute==null||A.events.compute(u,A,(E=A.previousRoot)==null?void 0:E.getState()),A.raycaster.camera===void 0&&(A.raycaster.camera=null)}return A.raycaster.camera?A.raycaster.intersectObject(S,!0):[]}let _=y.flatMap(v).sort((S,A)=>{const E=ix(S.object),C=ix(A.object);return!E||!C?S.distance-A.distance:C.events.priority-E.events.priority||S.distance-A.distance}).filter(S=>{const A=ry(S);return p.has(A)?!1:(p.add(A),!0)});h.events.filter&&(_=h.events.filter(_,h));for(const S of _){let A=S.object;for(;A;){var M;(M=A.__r3f)!=null&&M.eventCount&&x.push({...S,eventObject:A}),A=A.parent}}if("pointerId"in u&&h.internal.capturedMap.has(u.pointerId))for(let S of h.internal.capturedMap.get(u.pointerId).values())p.has(ry(S.intersection))||x.push(S.intersection);return x}function s(u,d,h,p){if(u.length){const x={stopped:!1};for(const y of u){let v=ix(y.object);if(v||y.object.traverseAncestors(_=>{const M=ix(_);if(M)return v=M,!1}),v){const{raycaster:_,pointer:M,camera:S,internal:A}=v,E=new we(M.x,M.y,0).unproject(S),C=G=>{var k,V;return(k=(V=A.capturedMap.get(G))==null?void 0:V.has(y.eventObject))!=null?k:!1},I=G=>{const k={intersection:y,target:d.target};A.capturedMap.has(G)?A.capturedMap.get(G).set(y.eventObject,k):A.capturedMap.set(G,new Map([[y.eventObject,k]])),d.target.setPointerCapture(G)},D=G=>{const k=A.capturedMap.get(G);k&&U9(A.capturedMap,y.eventObject,k,G)};let B={};for(let G in d){let k=d[G];typeof k!="function"&&(B[G]=k)}let P={...y,...B,pointer:M,intersections:u,stopped:x.stopped,delta:h,unprojectedPoint:E,ray:_.ray,camera:S,stopPropagation(){const G="pointerId"in d&&A.capturedMap.get(d.pointerId);if((!G||G.has(y.eventObject))&&(P.stopped=x.stopped=!0,A.hovered.size&&Array.from(A.hovered.values()).find(k=>k.eventObject===y.eventObject))){const k=u.slice(0,u.indexOf(y));a([...k,y])}},target:{hasPointerCapture:C,setPointerCapture:I,releasePointerCapture:D},currentTarget:{hasPointerCapture:C,setPointerCapture:I,releasePointerCapture:D},nativeEvent:d};if(p(P),x.stopped===!0)break}}}return u}function a(u){const{internal:d}=n.getState();for(const h of d.hovered.values())if(!u.length||!u.find(p=>p.object===h.object&&p.index===h.index&&p.instanceId===h.instanceId)){const x=h.eventObject.__r3f;if(d.hovered.delete(ry(h)),x!=null&&x.eventCount){const y=x.handlers,v={...h,intersections:u};y.onPointerOut==null||y.onPointerOut(v),y.onPointerLeave==null||y.onPointerLeave(v)}}}function o(u,d){for(let h=0;h<d.length;h++){const p=d[h].__r3f;p==null||p.handlers.onPointerMissed==null||p.handlers.onPointerMissed(u)}}function l(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>a([]);case"onLostPointerCapture":return d=>{const{internal:h}=n.getState();"pointerId"in d&&h.capturedMap.has(d.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(d.pointerId)&&(h.capturedMap.delete(d.pointerId),a([]))})}}return function(h){const{onPointerMissed:p,internal:x}=n.getState();x.lastEvent.current=h;const y=u==="onPointerMove",v=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",M=r(h,y?t:void 0),S=v?e(h):0;u==="onPointerDown"&&(x.initialClick=[h.offsetX,h.offsetY],x.initialHits=M.map(E=>E.eventObject)),v&&!M.length&&S<=2&&(o(h,x.interaction),p&&p(h)),y&&a(M);function A(E){const C=E.eventObject,I=C.__r3f;if(!(I!=null&&I.eventCount))return;const D=I.handlers;if(y){if(D.onPointerOver||D.onPointerEnter||D.onPointerOut||D.onPointerLeave){const B=ry(E),P=x.hovered.get(B);P?P.stopped&&E.stopPropagation():(x.hovered.set(B,E),D.onPointerOver==null||D.onPointerOver(E),D.onPointerEnter==null||D.onPointerEnter(E))}D.onPointerMove==null||D.onPointerMove(E)}else{const B=D[u];B?(!v||x.initialHits.includes(C))&&(o(h,x.interaction.filter(P=>!x.initialHits.includes(P))),B(E)):v&&x.initialHits.includes(C)&&o(h,x.interaction.filter(P=>!x.initialHits.includes(P)))}}s(M,h,S,A)}}return{handlePointer:l}}const O4=n=>!!(n!=null&&n.render),z9=T.createContext(null),dpe=(n,e)=>{const t=zme((l,u)=>{const d=new we,h=new we,p=new we;function x(S=u().camera,A=h,E=u().size){const{width:C,height:I,top:D,left:B}=E,P=C/I;A.isVector3?p.copy(A):p.set(...A);const G=S.getWorldPosition(d).distanceTo(p);if(B9(S))return{width:C/S.zoom,height:I/S.zoom,top:D,left:B,factor:1,distance:G,aspect:P};
4496{const k=S.fov*Math.PI/180,V=2*Math.tan(k/2)*G,U=V*(C/I);return{width:U,height:V,top:D,left:B,factor:C/U,distance:G,aspect:P}}}let y;const v=S=>l(A=>({performance:{...A.performance,current:S}})),_=new wt;return{set:l,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(S=1)=>n(u(),S),advance:(S,A)=>e(S,A,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new x9,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=u();y&&clearTimeout(y),S.performance.current!==S.performance.min&&v(S.performance.min),y=setTimeout(()=>v(u().performance.max),S.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:x},setEvents:S=>l(A=>({...A,events:{...A.events,...S}})),setSize:(S,A,E=0,C=0)=>{const I=u().camera,D={width:S,height:A,top:E,left:C};l(B=>({size:D,viewport:{...B.viewport,...x(I,h,D)}}))},setDpr:S=>l(A=>{const E=O9(S);return{viewport:{...A.viewport,dpr:E,initialDpr:A.viewport.initialDpr||E}}}),setFrameloop:(S="always")=>{const A=u().clock;A.stop(),A.elapsedTime=0,S!=="never"&&(A.start(),A.elapsedTime=0),l(()=>({frameloop:S}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:T.createRef(),active:!1,frames:0,priority:0,subscribe:(S,A,E)=>{const C=u().internal;return C.priority=C.priority+(A>0?1:0),C.subscribers.push({ref:S,priority:A,store:E}),C.subscribers=C.subscribers.sort((I,D)=>I.priority-D.priority),()=>{const I=u().internal;I!=null&&I.subscribers&&(I.priority=I.priority-(A>0?1:0),I.subscribers=I.subscribers.filter(D=>D.ref!==S))}}}}}),r=t.getState();let s=r.size,a=r.viewport.dpr,o=r.camera;return t.subscribe(()=>{const{camera:l,size:u,viewport:d,gl:h,set:p}=t.getState();if(u.width!==s.width||u.height!==s.height||d.dpr!==a){s=u,a=d.dpr,ope(l,u),d.dpr>0&&h.setPixelRatio(d.dpr);const x=typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(u.width,u.height,x)}l!==o&&(o=l,p(x=>({viewport:{...x.viewport,...x.viewport.getCurrentViewport(l)}})))}),t.subscribe(l=>n(l)),t};function G9(){const n=T.useContext(z9);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function yu(n=t=>t,e){return G9()(n,e)}function Iv(n,e=0){const t=G9(),r=t.getState().internal.subscribe,s=L9(n);return kv(()=>r(s,e,t),[e,r,t]),null}const F4=new WeakMap,fpe=n=>{var e;return typeof n=="function"&&(n==null||(e=n.prototype)==null?void 0:e.constructor)===n};function H9(n,e){return function(t,...r){let s;return fpe(t)?(s=F4.get(t),s||(s=new t,F4.set(t,s))):s=t,n&&n(s),Promise.all(r.map(a=>new Promise((o,l)=>s.load(a,u=>{Ya(u?.scene)&&Object.assign(u,tpe(u.scene)),o(u)},e,u=>l(new Error(`Could not load ${a}: ${u?.message}`))))))}}function Bv(n,e,t,r){const s=Array.isArray(e)?e:[e],a=P9(H9(t,r),[n,...s],{equal:hs.equ});return Array.isArray(e)?a:a[0]}Bv.preload=function(n,e,t){const r=Array.isArray(e)?e:[e];return Hme(H9(t),[n,...r])};Bv.clear=function(n,e){const t=Array.isArray(e)?e:[e];return Vme([n,...t])};const hpe=1,U4=8,u_=32,z4=2,mpe=268435456;var ppe={version:"9.7.0"};function gpe(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var G4={exports:{}},H4={exports:{}},V4;function xpe(){return V4||(V4=1,(function(n){n.exports=function(e){function t(m,g,N,j){return new E0(m,g,N,j)}function r(){}function s(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var N=2;N<arguments.length;N++)g+="&args[]="+encodeURIComponent(arguments[N])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(m){var g=m,N=m;if(m.alternate)for(;g.return;)g=g.return;else{m=g;do g=m,(g.flags&4098)!==0&&(N=g.return),m=g.return;while(m)}return g.tag===3?N:null}function o(m){if(a(m)!==m)throw Error(s(188))}function l(m){var g=m.alternate;if(!g){if(g=a(m),g===null)throw Error(s(188));return g!==m?null:m}for(var N=m,j=g;;){var H=N.return;if(H===null)break;var W=H.alternate;if(W===null){if(j=H.return,j!==null){N=j;continue}break}if(H.child===W.child){for(W=H.child;W;){if(W===N)return o(H),m;if(W===j)return o(H),g;W=W.sibling}throw Error(s(188))}if(N.return!==j.return)N=H,j=W;else{for(var fe=!1,Ue=H.child;Ue;){if(Ue===N){fe=!0,N=H,j=W;break}if(Ue===j){fe=!0,j=H,N=W;break}Ue=Ue.sibling}if(!fe){for(Ue=W.child;Ue;){if(Ue===N){fe=!0,N=W,j=H;break}if(Ue===j){fe=!0,j=W,N=H;break}Ue=Ue.sibling}if(!fe)throw Error(s(189))}}if(N.alternate!==j)throw Error(s(190))}if(N.tag!==3)throw Error(s(188));return N.stateNode.current===N?m:g}function u(m){var g=m.tag;if(g===5||g===26||g===27||g===6)return m;for(m=m.child;m!==null;){if(g=u(m),g!==null)return g;m=m.sibling}return null}function d(m){var g=m.tag;if(g===5||g===26||g===27||g===6)return m;for(m=m.child;m!==null;){if(m.tag!==4&&(g=d(m),g!==null))return g;m=m.sibling}return null}function h(m){return m===null||typeof m!="object"?null:(m=nc&&m[nc]||m["@@iterator"],typeof m=="function"?m:null)}function p(m){if(m==null)return null;
vendor: 16,298 bytes, lines 4496-4503
4496if(typeof m=="function")return m.$$typeof===Yc?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case Zu:return"Fragment";case td:return"Profiler";case ed:return"StrictMode";case eg:return"Suspense";case tc:return"SuspenseList";case Xh:return"Activity"}if(typeof m=="object")switch(m.$$typeof){case Ju:return"Portal";case xo:return m.displayName||"Context";case $h:return(m._context.displayName||"Context")+".Consumer";case hf:var g=m.render;return m=m.displayName,m||(m=g.displayName||g.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case tg:return g=m.displayName||null,g!==null?g:p(m.type)||"Memo";case ta:g=m._payload,m=m._init;try{return p(m(g))}catch{}}return null}function x(m){return{current:m}}function y(m){0>ad||(m.current=mg[ad],mg[ad]=null,ad--)}function v(m,g){ad++,mg[ad]=m.current,m.current=g}function _(m){return m>>>=0,m===0?32:31-(pg(m)/$1|0)|0}function M(m){var g=m&42;if(g!==0)return g;switch(m&-m){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return m&261888;case 262144:case 524288:case 1048576:case 2097152:return m&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return m&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return m}}function S(m,g,N){var j=m.pendingLanes;if(j===0)return 0;var H=0,W=m.suspendedLanes,fe=m.pingedLanes;m=m.warmLanes;var Ue=j&134217727;return Ue!==0?(j=Ue&~W,j!==0?H=M(j):(fe&=Ue,fe!==0?H=M(fe):N||(N=Ue&~m,N!==0&&(H=M(N))))):(Ue=j&~W,Ue!==0?H=M(Ue):fe!==0?H=M(fe):N||(N=j&~m,N!==0&&(H=M(N)))),H===0?0:g!==0&&g!==H&&(g&W)===0&&(W=H&-H,N=g&-g,W>=N||W===32&&(N&4194048)!==0)?g:H}function A(m,g){return(m.pendingLanes&~(m.suspendedLanes&~m.pingedLanes)&g)===0}function E(m,g){switch(m){case 1:case 2:case 4:case 8:case 64:return g+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function C(){var m=vf;return vf<<=1,(vf&62914560)===0&&(vf=4194304),m}function I(m){for(var g=[],N=0;31>N;N++)g.push(m);return g}function D(m,g){m.pendingLanes|=g,g!==268435456&&(m.suspendedLanes=0,m.pingedLanes=0,m.warmLanes=0)}function B(m,g,N,j,H,W){var fe=m.pendingLanes;m.pendingLanes=N,m.suspendedLanes=0,m.pingedLanes=0,m.warmLanes=0,m.expiredLanes&=N,m.entangledLanes&=N,m.errorRecoveryDisabledLanes&=N,m.shellSuspendCounter=0;var Ue=m.entanglements,pt=m.expirationTimes,Tt=m.hiddenUpdates;for(N=fe&~N;0<N;){var Lt=31-wa(N),Dt=1<<Lt;Ue[Lt]=0,pt[Lt]=-1;var Kt=Tt[Lt];if(Kt!==null)for(Tt[Lt]=null,Lt=0;Lt<Kt.length;Lt++){var On=Kt[Lt];On!==null&&(On.lane&=-536870913)}N&=~Dt}j!==0&&P(m,j,0),W!==0&&H===0&&m.tag!==0&&(m.suspendedLanes|=W&~(fe&~g))}function P(m,g,N){m.pendingLanes|=g,m.suspendedLanes&=~g;var j=31-wa(g);m.entangledLanes|=g,m.entanglements[j]=m.entanglements[j]|1073741824|N&261930}function G(m,g){var N=m.entangledLanes|=g;for(m=m.entanglements;N;){var j=31-wa(N),H=1<<j;H&g|m[j]&g&&(m[j]|=g),N&=~H}}function k(m,g){var N=g&-g;return N=(N&42)!==0?1:V(N),(N&(m.suspendedLanes|g))!==0?0:N}function V(m){switch(m){case 2:m=1;break;case 8:m=4;break;case 32:m=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:m=128;break;case 268435456:m=134217728;break;default:m=0}return m}function U(m){return m&=-m,2<m?8<m?(m&134217727)!==0?32:268435456:8:2}function $(m){if(typeof hb=="function"&&Y1(m),Sa&&typeof Sa.setStrictMode=="function")try{Sa.setStrictMode(ld,m)}catch{}}function X(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function ee(m){if(wg===void 0)try{throw Error()}catch(N){var g=N.stack.trim().match(/\n( *(at )?)/);wg=g&&g[1]||"",Sl=-1<N.stack.indexOf(`
4497    at`)?" (<anonymous>)":-1<N.stack.indexOf("@")?"@unknown:0:0":""}return`
4498`+wg+m+Sl}function z(m,g){if(!m||nm)return"";nm=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var j={DetermineComponentFrameRoot:function(){try{if(g){var Dt=function(){throw Error()};if(Object.defineProperty(Dt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Dt,[])}catch(On){var Kt=On}Reflect.construct(m,[],Dt)}else{try{Dt.call()}catch(On){Kt=On}m.call(Dt.prototype)}}else{try{throw Error()}catch(On){Kt=On}(Dt=m())&&typeof Dt.catch=="function"&&Dt.catch(function(){})}}catch(On){if(On&&Kt&&typeof On.stack=="string")return[On.stack,Kt.stack]}return[null,null]}};j.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var H=Object.getOwnPropertyDescriptor(j.DetermineComponentFrameRoot,"name");H&&H.configurable&&Object.defineProperty(j.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var W=j.DetermineComponentFrameRoot(),fe=W[0],Ue=W[1];if(fe&&Ue){var pt=fe.split(`
4499`),Tt=Ue.split(`
4500`);for(H=j=0;j<pt.length&&!pt[j].includes("DetermineComponentFrameRoot");)j++;for(;H<Tt.length&&!Tt[H].includes("DetermineComponentFrameRoot");)H++;if(j===pt.length||H===Tt.length)for(j=pt.length-1,H=Tt.length-1;1<=j&&0<=H&&pt[j]!==Tt[H];)H--;for(;1<=j&&0<=H;j--,H--)if(pt[j]!==Tt[H]){if(j!==1||H!==1)do if(j--,H--,0>H||pt[j]!==Tt[H]){var Lt=`
4501`+pt[j].replace(" at new "," at ");return m.displayName&&Lt.includes("<anonymous>")&&(Lt=Lt.replace("<anonymous>",m.displayName)),Lt}while(1<=j&&0<=H);break}}}finally{nm=!1,Error.prepareStackTrace=N}return(N=m?m.displayName||m.name:"")?ee(N):""}function K(m,g){switch(m.tag){case 26:case 27:case 5:return ee(m.type);case 16:return ee("Lazy");case 13:return m.child!==g&&g!==null?ee("Suspense Fallback"):ee("Suspense");case 19:return ee("SuspenseList");case 0:case 15:return z(m.type,!1);case 11:return z(m.type.render,!1);case 1:return z(m.type,!0);case 31:return ee("Activity");default:return""}}function ae(m){try{var g="",N=null;do g+=K(m,N),N=m,m=m.return;while(m);return g}catch(j){return`
4502Error generating stack: `+j.message+`
4503`+j.stack}}function oe(m,g){if(typeof m=="object"&&m!==null){var N=mb.get(m);return N!==void 0?N:(g={value:m,source:g,stack:ae(g)},mb.set(m,g),g)}return{value:m,source:g,stack:ae(g)}}function re(m,g){ic[_l++]=rm,ic[_l++]=Wr,Wr=m,rm=g}function F(m,g,N){vo[za++]=Ri,vo[za++]=Uo,vo[za++]=wo,wo=m;var j=Ri;m=Uo;var H=32-wa(j)-1;j&=~(1<<H),N+=1;var W=32-wa(g)+H;if(30<W){var fe=H-H%5;W=(j&(1<<fe)-1).toString(32),j>>=fe,H-=fe,Ri=1<<32-wa(g)+H|N<<H|j,Uo=W+m}else Ri=1<<W|N<<H|j,Uo=m}function O(m){m.return!==null&&(re(m,1),F(m,1,0))}function J(m){for(;m===Wr;)Wr=ic[--_l],ic[_l]=null,rm=ic[--_l],ic[_l]=null;for(;m===wo;)wo=vo[--za],vo[za]=null,Uo=vo[--za],vo[za]=null,Ri=vo[--za],vo[za]=null}function q(m,g){vo[za++]=Ri,vo[za++]=Uo,vo[za++]=wo,Ri=g.id,Uo=g.overflow,wo=m}function Q(m,g){v(Pi,g),v(ac,m),v(wi,null),m=l1(g),y(wi),v(wi,m)}function ne(){y(wi),y(ac),y(Pi)}function Z(m){m.memoizedState!==null&&v(sm,m);var g=wi.current,N=gf(g,m.type);g!==N&&(v(ac,m),v(wi,N))}function se(m){ac.current===m&&(y(wi),y(ac)),sm.current===m&&(y(sm),Bs?sd._currentValue=rd:sd._currentValue2=rd)}function me(m){var g=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Re(oe(g,m)),Sg}function ze(m,g){if(!us)throw Error(s(175));k1(m.stateNode,m.type,m.memoizedProps,g,m)||me(m,!0)}function Be(m){for(li=m.return;li;)switch(li.tag){case 5:case 31:case 13:ra=!1;return;case 27:case 3:ra=!0;return;default:li=li.return}}function ye(m){if(!us||m!==li)return!1;if(!sr)return Be(m),sr=!0,!1;var g=m.tag;if(oi?g!==3&&g!==27&&(g!==5||yf(m.type)&&!na(m.type,m.memoizedProps))&&ds&&me(m):g!==3&&(g!==5||yf(m.type)&&!na(m.type,m.memoizedProps))&&ds&&me(m),Be(m),g===13){if(!us)throw Error(s(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));ds=nb(m)}else if(g===31){if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));ds=B1(m)}else ds=oi&&g===27?A1(m.type,ds):li?N1(m.stateNode):null;return!0}function Le(){us&&(ds=li=null,sr=!1)}function Ce(){var m=Ml;return m!==null&&(Na===null?Na=m:Na.push.apply(Na,m),Ml=null),m}function Re(m){Ml===null?Ml=[m]:Ml.push(m)}function De(m,g,N){Bs?(v(So,g._currentValue),g._currentValue=N):(v(So,g._currentValue2),g._currentValue2=N)}function he(m){var g=So.current;Bs?m._currentValue=g:m._currentValue2=g,y(So)}function le(m,g,N){for(;m!==null;){var j=m.alternate;if((m.childLanes&g)!==g?(m.childLanes|=g,j!==null&&(j.childLanes|=g)):j!==null&&(j.childLanes&g)!==g&&(j.childLanes|=g),m===N)break;m=m.return}}function Xe(m,g,N,j){var H=m.child;for(H!==null&&(H.return=m);H!==null;){var W=H.dependencies;if(W!==null){var fe=H.child;W=W.firstContext;e:for(;W!==null;){var Ue=W;W=H;for(var pt=0;pt<g.length;pt++)if(Ue.context===g[pt]){W.lanes|=N,Ue=W.alternate,Ue!==null&&(Ue.lanes|=N),le(W.return,N,m),j||(fe=null);break e}W=Ue.next}}else if(H.tag===18){if(fe=H.return,fe===null)throw Error(s(341));fe.lanes|=N,W=fe.alternate,W!==null&&(W.lanes|=N),le(fe,N,m),fe=null}else fe=H.child;if(fe!==null)fe.return=H;else for(fe=H;fe!==null;){if(fe===m){fe=null;break}if(H=fe.sibling,H!==null){H.return=fe.return,fe=H;break}fe=fe.return}H=fe}}function qe(m,g,N,j){m=null;for(var H=g,W=!1;H!==null;){if(!W){if((H.flags&524288)!==0)W=!0;else if((H.flags&262144)!==0)break}if(H.tag===10){var fe=H.alternate;if(fe===null)throw Error(s(387));if(fe=fe.memoizedProps,fe!==null){var Ue=H.type;Os(H.pendingProps.value,fe.value)||(m!==null?m.push(Ue):m=[Ue])}}else if(H===sm.current){if(fe=H.alternate,fe===null)throw Error(s(387));fe.memoizedState.memoizedState!==H.memoizedState.memoizedState&&(m!==null?m.push(sd):m=[sd])}H=H.return}m!==null&&Xe(g,m,N,j),g.flags|=262144}function Ge(m){for(m=m.firstContext;m!==null;){var g=m.context;if(!Os(Bs?g._currentValue:g._currentValue2,m.memoizedValue))return!0;m=m.next}return!1}function ot(m){Kr=m,zo=null,m=m.dependencies,m!==null&&(m.firstContext=null)}function ve(m){return xt(Kr,m)}function mt(m,g){return Kr===null&&ot(m),xt(m,g)}function xt(m,g){var N=Bs?g._currentValue:g._currentValue2;if(g={context:g,memoizedValue:N,next:null},zo===null){if(m===null)throw Error(s(308));zo=g,m.dependencies={lanes:0,firstContext:g},m.flags|=524288}else zo=zo.next=g;return N}function ge(){return{controller:new Q1,data:new Map,refCount:0}}function Y(m){m.refCount--,m.refCount===0&&Si(CA,function(){m.controller.abort()})}function je(){}function Ie(m){m!==Fr&&m.next===null&&(Fr===null?im=Fr=m:Fr=Fr.next=m),_o=!0,Wi||(Wi=!0,ie())}function Ve(m,g){if(!_g&&_o){_g=!0;do for(var N=!1,j=im;j!==null;){if(m!==0){var H=j.pendingLanes;if(H===0)var W=0;else{var fe=j.suspendedLanes,Ue=j.pingedLanes;W=(1<<31-wa(42|m)+1)-1,W&=H&~(fe&~Ue),W=W&201326741?W&201326741|1:W?W|2:0}W!==0&&(N=!0,Fe(j,W))}else W=ir,W=S(j,j===qn?W:0,j.cancelPendingCommit!==null||j.timeoutHandle!==va),(W&3)===0||A(j,W)||(N=!0,Fe(j,W));j=j.next}while(N);_g=!1}}function ft(){vt()}function vt(){_o=Wi=!1;var m=0;eu!==0&&nd()&&(m=eu);for(var g=Vi(),N=null,j=im;j!==null;){var H=j.next,W=ce(j,g);W===0?(j.next=null,N===null?im=H:N.next=H,H===null&&(Fr=N)):(N=j,(m!==0||(W&3)!==0)&&(_o=!0)),j=H}Ys!==0&&Ys!==5||Ve(m),eu!==0&&(eu=0)}function ce(m,g){for(var N=m.suspendedLanes,j=m.pingedLanes,H=m.expirationTimes,W=m.pendingLanes&-62914561;0<W;){var fe=31-wa(W),Ue=1<<fe,pt=H[fe];pt===-1?((Ue&N)===0||(Ue&j)!==0)&&(H[fe]=E(Ue,g)):pt<=g&&(m.expiredLanes|=Ue),W&=~Ue}if(g=qn,N=ir,N=S(m,m===g?N:0,m.cancelPendingCommit!==null||m.timeoutHandle!==va),j=m.callbackNode,N===0||m===g&&(zr===2||zr===9)||m.cancelPendingCommit!==null)return j!==null&&j!==null&&xg(j),m.callbackNode=null,m.callbackPriority=0;if((N&3)===0||A(m,N)){if(g=N&-N,g===m.callbackPriority)return g;switch(j!==null&&xg(j),U(N)){case 2:case 8:N=q1;break;case 32:N=tm;break;case 268435456:N=yg;break;default:N=tm}return j=Me.bind(null,m),N=em(N,j),m.callbackPriority=g,m.callbackNode=N,g}return j!==null&&j!==null&&xg(j),m.callbackPriority=2,m.callbackNode=null,2}function Me(m,g){if(Ys!==0&&Ys!==5)return m.callbackNode=null,m.callbackPriority=0,null;var N=m.callbackNode;if(yl()&&m.callbackNode!==N)return null;var j=ir;return j=S(m,m===qn?j:0,m.cancelPendingCommit!==null||m.timeoutHandle!==va),j===0?null:(Fo(m,j,g),ce(m,Vi()),m.callbackNode!=null&&m.callbackNode===N?Me.bind(null,m):null)}function Fe(m,g){if(yl())return null;Fo(m,g,!0)}function ie(){U0?z0(function(){(er&6)!==0?em(bg,ft):vt()}):em(bg,ft)}function Se(){if(eu===0){var m=oc;m===0&&(m=gg,gg<<=1,(gg&261888)===0&&(gg=256)),eu=m}return eu}function Ae(m,g){if(wf===null){var N=wf=[];pb=0,oc=Se(),ci={status:"pending",value:void 0,then:function(j){N.push(j)}}}return pb++,g.then(at,at),g}function at(){if(--pb===0&&wf!==null){ci!==null&&(ci.status="fulfilled");var m=wf;wf=null,oc=0,ci=null;for(var g=0;g<m.length;g++)(0,m[g])()}}function pe(m,g){var N=[],j={status:"pending",value:null,reason:null,then:function(H){N.push(H)}};return m.then(function(){j.status="fulfilled",j.value=g;for(var H=0;H<N.length;H++)(0,N[H])(g)},function(H){for(j.status="rejected",j.reason=H,H=0;H<N.length;H++)(0,N[H])(void 0)}),j}function Ke(){var m=tu.current;return m!==null?m:qn.pooledCache}function Ne(m,g){g===null?v(tu,tu.current):v(tu,g.pool)}function Ye(){var m=Ke();return m===null?null:{parent:Bs?fs._currentValue:fs._currentValue2,pool:m}}function Te(m,g){if(Os(m,g))return!0;if(typeof m!="object"||m===null||typeof g!="object"||g===null)return!1;var N=Object.keys(m),j=Object.keys(g);if(N.length!==j.length)return!1;for(j=0;j<N.length;j++){var H=N[j];if(!AA.call(g,H)||!Os(m[H],g[H]))return!1}return!0}function st(m){return m=m.status,m==="fulfilled"||m==="rejected"}function et(m,g,N){switch(N=m[N],N===void 0?m.push(g):N!==g&&(g.then(je,je),g=N),g.status){case"fulfilled":return g.value;case"rejected":throw m=g.reason,ue(m),m;default:if(typeof g.status=="string")g.then(je,je);else{if(m=qn,m!==null&&100<m.shellSuspendCounter)throw Error(s(482));m=g,m.status="pending",m.then(function(j){if(g.status==="pending"){var H=g;H.status="fulfilled",H.value=j}},function(j){if(g.status==="pending"){var H=g;H.status="rejected",H.reason=j}})}switch(g.status){case"fulfilled":return g.value;case"rejected":throw m=g.reason,ue(m),m}throw sa=g,ui}}function Qe(m){try{var g=m._init;return g(m._payload)}catch(N){throw N!==null&&typeof N=="object"&&typeof N.then=="function"?(sa=N,ui):N}}function Mt(){if(sa===null)throw Error(s(459));var m=sa;return sa=null,m}function ue(m){if(m===ui||m===No)throw Error(s(483))}function Je(m){var g=cd;return cd+=1,nu===null&&(nu=[]),et(nu,m,g)}function it(m,g){g=g.props.ref,m.ref=g!==void 0?g:null}function Et(m,g){throw g.$$typeof===Ku?Error(s(525)):(m=Object.prototype.toString.call(g),Error(s(31,m==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":m)))}function Wt(m){function g(ut,nt){if(m){var ht=ut.deletions;ht===null?(ut.deletions=[nt],ut.flags|=16):ht.push(nt)}}function N(ut,nt){if(!m)return null;for(;nt!==null;)g(ut,nt),nt=nt.sibling;return null}function j(ut){for(var nt=new Map;ut!==null;)ut.key!==null?nt.set(ut.key,ut):nt.set(ut.index,ut),ut=ut.sibling;return nt}function H(ut,nt){return ut=Fa(ut,nt),ut.index=0,ut.sibling=null,ut}function W(ut,nt,ht){return ut.index=ht,m?(ht=ut.alternate,ht!==null?(ht=ht.index,ht<nt?(ut.flags|=67108866,nt):ht):(ut.flags|=67108866,nt)):(ut.flags|=1048576,nt)}function fe(ut){return m&&ut.alternate===null&&(ut.flags|=67108866),ut}function Ue(ut,nt,ht,Bt){return nt===null||nt.tag!==6?(nt=j0(ht,ut.mode,Bt),nt.return=ut,nt):(nt=H(nt,ht),nt.return=ut,nt)}function pt(ut,nt,ht,Bt){var xn=ht.type;return xn===Zu?Lt(ut,nt,ht.props.children,Bt,ht.key):nt!==null&&(nt.elementType===xn||typeof xn=="object"&&xn!==null&&xn.$$typeof===ta&&Qe(xn)===nt.type)?(nt=H(nt,ht.props),it(nt,ht),nt.return=ut,nt):(nt=ec(ht.type,ht.key,ht.props,null,ut.mode,Bt),it(nt,ht),nt.return=ut,nt)}function Tt(ut,nt,ht,Bt){return nt===null||nt.tag!==4||nt.stateNode.containerInfo!==ht.containerInfo||nt.
vendor: 7,255 bytes, line 4503
4503stateNode.implementation!==ht.implementation?(nt=R0(ht,ut.mode,Bt),nt.return=ut,nt):(nt=H(nt,ht.children||[]),nt.return=ut,nt)}function Lt(ut,nt,ht,Bt,xn){return nt===null||nt.tag!==7?(nt=go(ht,ut.mode,Bt,xn),nt.return=ut,nt):(nt=H(nt,ht),nt.return=ut,nt)}function Dt(ut,nt,ht){if(typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint")return nt=j0(""+nt,ut.mode,ht),nt.return=ut,nt;if(typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case vl:return ht=ec(nt.type,nt.key,nt.props,null,ut.mode,ht),it(ht,nt),ht.return=ut,ht;case Ju:return nt=R0(nt,ut.mode,ht),nt.return=ut,nt;case ta:return nt=Qe(nt),Dt(ut,nt,ht)}if(Qc(nt)||h(nt))return nt=go(nt,ut.mode,ht,null),nt.return=ut,nt;if(typeof nt.then=="function")return Dt(ut,Je(nt),ht);if(nt.$$typeof===xo)return Dt(ut,mt(ut,nt),ht);Et(ut,nt)}return null}function Kt(ut,nt,ht,Bt){var xn=nt!==null?nt.key:null;if(typeof ht=="string"&&ht!==""||typeof ht=="number"||typeof ht=="bigint")return xn!==null?null:Ue(ut,nt,""+ht,Bt);if(typeof ht=="object"&&ht!==null){switch(ht.$$typeof){case vl:return ht.key===xn?pt(ut,nt,ht,Bt):null;case Ju:return ht.key===xn?Tt(ut,nt,ht,Bt):null;case ta:return ht=Qe(ht),Kt(ut,nt,ht,Bt)}if(Qc(ht)||h(ht))return xn!==null?null:Lt(ut,nt,ht,Bt,null);if(typeof ht.then=="function")return Kt(ut,nt,Je(ht),Bt);if(ht.$$typeof===xo)return Kt(ut,nt,mt(ut,ht),Bt);Et(ut,ht)}return null}function On(ut,nt,ht,Bt,xn){if(typeof Bt=="string"&&Bt!==""||typeof Bt=="number"||typeof Bt=="bigint")return ut=ut.get(ht)||null,Ue(nt,ut,""+Bt,xn);if(typeof Bt=="object"&&Bt!==null){switch(Bt.$$typeof){case vl:return ut=ut.get(Bt.key===null?ht:Bt.key)||null,pt(nt,ut,Bt,xn);case Ju:return ut=ut.get(Bt.key===null?ht:Bt.key)||null,Tt(nt,ut,Bt,xn);case ta:return Bt=Qe(Bt),On(ut,nt,ht,Bt,xn)}if(Qc(Bt)||h(Bt))return ut=ut.get(ht)||null,Lt(nt,ut,Bt,xn,null);if(typeof Bt.then=="function")return On(ut,nt,ht,Je(Bt),xn);if(Bt.$$typeof===xo)return On(ut,nt,ht,mt(nt,Bt),xn);Et(nt,Bt)}return null}function zs(ut,nt,ht,Bt){for(var xn=null,Ms=null,vn=nt,pr=nt=0,_i=null;vn!==null&&pr<ht.length;pr++){vn.index>pr?(_i=vn,vn=null):_i=vn.sibling;var Sr=Kt(ut,vn,ht[pr],Bt);if(Sr===null){vn===null&&(vn=_i);break}m&&vn&&Sr.alternate===null&&g(ut,vn),nt=W(Sr,nt,pr),Ms===null?xn=Sr:Ms.sibling=Sr,Ms=Sr,vn=_i}if(pr===ht.length)return N(ut,vn),sr&&re(ut,pr),xn;if(vn===null){for(;pr<ht.length;pr++)vn=Dt(ut,ht[pr],Bt),vn!==null&&(nt=W(vn,nt,pr),Ms===null?xn=vn:Ms.sibling=vn,Ms=vn);return sr&&re(ut,pr),xn}for(vn=j(vn);pr<ht.length;pr++)_i=On(vn,ut,pr,ht[pr],Bt),_i!==null&&(m&&_i.alternate!==null&&vn.delete(_i.key===null?pr:_i.key),nt=W(_i,nt,pr),Ms===null?xn=_i:Ms.sibling=_i,Ms=_i);return m&&vn.forEach(function(Eo){return g(ut,Eo)}),sr&&re(ut,pr),xn}function jf(ut,nt,ht,Bt){if(ht==null)throw Error(s(151));for(var xn=null,Ms=null,vn=nt,pr=nt=0,_i=null,Sr=ht.next();vn!==null&&!Sr.done;pr++,Sr=ht.next()){vn.index>pr?(_i=vn,vn=null):_i=vn.sibling;var Eo=Kt(ut,vn,Sr.value,Bt);if(Eo===null){vn===null&&(vn=_i);break}m&&vn&&Eo.alternate===null&&g(ut,vn),nt=W(Eo,nt,pr),Ms===null?xn=Eo:Ms.sibling=Eo,Ms=Eo,vn=_i}if(Sr.done)return N(ut,vn),sr&&re(ut,pr),xn;if(vn===null){for(;!Sr.done;pr++,Sr=ht.next())Sr=Dt(ut,Sr.value,Bt),Sr!==null&&(nt=W(Sr,nt,pr),Ms===null?xn=Sr:Ms.sibling=Sr,Ms=Sr);return sr&&re(ut,pr),xn}for(vn=j(vn);!Sr.done;pr++,Sr=ht.next())Sr=On(vn,ut,pr,Sr.value,Bt),Sr!==null&&(m&&Sr.alternate!==null&&vn.delete(Sr.key===null?pr:Sr.key),nt=W(Sr,nt,pr),Ms===null?xn=Sr:Ms.sibling=Sr,Ms=Sr);return m&&vn.forEach(function(EA){return g(ut,EA)}),sr&&re(ut,pr),xn}function uu(ut,nt,ht,Bt){if(typeof ht=="object"&&ht!==null&&ht.type===Zu&&ht.key===null&&(ht=ht.props.children),typeof ht=="object"&&ht!==null){switch(ht.$$typeof){case vl:e:{for(var xn=ht.key;nt!==null;){if(nt.key===xn){if(xn=ht.type,xn===Zu){if(nt.tag===7){N(ut,nt.sibling),Bt=H(nt,ht.props.children),Bt.return=ut,ut=Bt;break e}}else if(nt.elementType===xn||typeof xn=="object"&&xn!==null&&xn.$$typeof===ta&&Qe(xn)===nt.type){N(ut,nt.sibling),Bt=H(nt,ht.props),it(Bt,ht),Bt.return=ut,ut=Bt;break e}N(ut,nt);break}else g(ut,nt);nt=nt.sibling}ht.type===Zu?(Bt=go(ht.props.children,ut.mode,Bt,ht.key),Bt.return=ut,ut=Bt):(Bt=ec(ht.type,ht.key,ht.props,null,ut.mode,Bt),it(Bt,ht),Bt.return=ut,ut=Bt)}return fe(ut);case Ju:e:{for(xn=ht.key;nt!==null;){if(nt.key===xn)if(nt.tag===4&&nt.stateNode.containerInfo===ht.containerInfo&&nt.stateNode.implementation===ht.implementation){N(ut,nt.sibling),Bt=H(nt,ht.children||[]),Bt.return=ut,ut=Bt;break e}else{N(ut,nt);break}else g(ut,nt);nt=nt.sibling}Bt=R0(ht,ut.mode,Bt),Bt.return=ut,ut=Bt}return fe(ut);case ta:return ht=Qe(ht),uu(ut,nt,ht,Bt)}if(Qc(ht))return zs(ut,nt,ht,Bt);if(h(ht)){if(xn=h(ht),typeof xn!="function")throw Error(s(150));return ht=xn.call(ht),jf(ut,nt,ht,Bt)}if(typeof ht.then=="function")return uu(ut,nt,Je(ht),Bt);if(ht.$$typeof===xo)return uu(ut,nt,mt(ut,ht),Bt);Et(ut,ht)}return typeof ht=="string"&&ht!==""||typeof ht=="number"||typeof ht=="bigint"?(ht=""+ht,nt!==null&&nt.tag===6?(N(ut,nt.sibling),Bt=H(nt,ht),Bt.return=ut,ut=Bt):(N(ut,nt),Bt=j0(ht,ut.mode,Bt),Bt.return=ut,ut=Bt),fe(ut)):N(ut,nt)}return function(ut,nt,ht,Bt){try{cd=0;var xn=uu(ut,nt,ht,Bt);return nu=null,xn}catch(vn){if(vn===ui||vn===No)throw vn;var Ms=t(29,vn,null,ut.mode);return Ms.lanes=Bt,Ms.return=ut,Ms}}}function an(){for(var m=Al,g=ud=Al=0;g<m;){var N=ki[g];ki[g++]=null;var j=ki[g];ki[g++]=null;var H=ki[g];ki[g++]=null;var W=ki[g];if(ki[g++]=null,j!==null&&H!==null){var fe=j.pending;fe===null?H.next=H:(H.next=fe.next,fe.next=H),j.pending=H}W!==0&&Nr(N,H,W)}}function Sn(m,g,N,j){ki[Al++]=m,ki[Al++]=g,ki[Al++]=N,ki[Al++]=j,ud|=j,m.lanes|=j,m=m.alternate,m!==null&&(m.lanes|=j)}function Lr(m,g,N,j){return Sn(m,g,N,j),Wn(m)}function Gr(m,g){return Sn(m,null,null,g),Wn(m)}function Nr(m,g,N){m.lanes|=N;var j=m.alternate;j!==null&&(j.lanes|=N);for(var H=!1,W=m.return;W!==null;)W.childLanes|=N,j=W.alternate,j!==null&&(j.childLanes|=N),W.tag===22&&(m=W.stateNode,m===null||m._visibility&1||(H=!0)),m=W,W=W.return;return m.tag===3?(W=m.stateNode,H&&g!==null&&(H=31-wa(N),m=W.hiddenUpdates,j=m[H],j===null?m[H]=[g]:j.push(g),g.lane=N|536870912),W):null}function Wn(m){if(50<yr)throw yr=0,dm=null,Error(s(185));for(var g=m.return;g!==null;)m=g,g=m.return;return m.tag===3?m.stateNode:null}function jr(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function es(m,g){m=m.updateQueue,g.updateQueue===m&&(g.updateQueue={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,callbacks:null})}function Tr(m){return{lane:m,tag:0,payload:null,callback:null,next:null}}function as(m,g,N){var j=m.updateQueue;if(j===null)return null;if(j=j.shared,(er&2)!==0){var H=j.pending;return H===null?g.next=g:(g.next=H.next,H.next=g),j.pending=g,g=Wn(m),Nr(m,null,N),g}return Sn(m,j,g,N),Wn(m)}function Ps(m,g,N){if(g=g.updateQueue,g!==null&&(g=g.shared,(N&4194048)!==0)){var j=g.lanes;j&=m.pendingLanes,N|=j,g.lanes=N,G(m,N)}}function gi(m,g){var N=m.updateQueue,j=m.alternate;if(j!==null&&(j=j.updateQueue,N===j)){var H=null,W=null;if(N=N.firstBaseUpdate,N!==null){do{var fe={lane:N.lane,tag:N.tag,payload:N.payload,callback:null,next:null};
vendor: 5,776 bytes, line 4503
4503W===null?H=W=fe:W=W.next=fe,N=N.next}while(N!==null);W===null?H=W=g:W=W.next=g}else H=W=g;N={baseState:j.baseState,firstBaseUpdate:H,lastBaseUpdate:W,shared:j.shared,callbacks:j.callbacks},m.updateQueue=N;return}m=N.lastBaseUpdate,m===null?N.firstBaseUpdate=g:m.next=g,N.lastBaseUpdate=g}function Xr(){if(Ng){var m=ci;if(m!==null)throw m}}function ps(m,g,N,j){Ng=!1;var H=m.updateQueue;Ga=!1;var W=H.firstBaseUpdate,fe=H.lastBaseUpdate,Ue=H.shared.pending;if(Ue!==null){H.shared.pending=null;var pt=Ue,Tt=pt.next;pt.next=null,fe===null?W=Tt:fe.next=Tt,fe=pt;var Lt=m.alternate;Lt!==null&&(Lt=Lt.updateQueue,Ue=Lt.lastBaseUpdate,Ue!==fe&&(Ue===null?Lt.firstBaseUpdate=Tt:Ue.next=Tt,Lt.lastBaseUpdate=pt))}if(W!==null){var Dt=H.baseState;fe=0,Lt=Tt=pt=null,Ue=W;do{var Kt=Ue.lane&-536870913,On=Kt!==Ue.lane;if(On?(ir&Kt)===Kt:(j&Kt)===Kt){Kt!==0&&Kt===oc&&(Ng=!0),Lt!==null&&(Lt=Lt.next={lane:0,tag:Ue.tag,payload:Ue.payload,callback:null,next:null});e:{var zs=m,jf=Ue;Kt=g;var uu=N;switch(jf.tag){case 1:if(zs=jf.payload,typeof zs=="function"){Dt=zs.call(uu,Dt,Kt);break e}Dt=zs;break e;case 3:zs.flags=zs.flags&-65537|128;case 0:if(zs=jf.payload,Kt=typeof zs=="function"?zs.call(uu,Dt,Kt):zs,Kt==null)break e;Dt=Zp({},Dt,Kt);break e;case 2:Ga=!0}}Kt=Ue.callback,Kt!==null&&(m.flags|=64,On&&(m.flags|=8192),On=H.callbacks,On===null?H.callbacks=[Kt]:On.push(Kt))}else On={lane:Kt,tag:Ue.tag,payload:Ue.payload,callback:Ue.callback,next:null},Lt===null?(Tt=Lt=On,pt=Dt):Lt=Lt.next=On,fe|=Kt;if(Ue=Ue.next,Ue===null){if(Ue=H.shared.pending,Ue===null)break;On=Ue,Ue=On.next,On.next=null,H.lastBaseUpdate=On,H.shared.pending=null}}while(!0);Lt===null&&(pt=Dt),H.baseState=pt,H.firstBaseUpdate=Tt,H.lastBaseUpdate=Lt,W===null&&(H.shared.lanes=0),cc|=fe,m.lanes=fe,m.memoizedState=Dt}}function xi(m,g){if(typeof m!="function")throw Error(s(191,m));m.call(g)}function Ds(m,g){var N=m.callbacks;if(N!==null)for(m.callbacks=null,m=0;m<N.length;m++)xi(N[m],g)}function Vs(m,g){m=El,v(ru,m),v(dd,g),El=m|g.baseLanes}function Yt(){v(ru,El),v(dd,dd.current)}function or(){El=ru.current,y(dd),y(ru)}function ks(m){var g=m.alternate;v(js,js.current&1),v(_a,m),Ma===null&&(g===null||dd.current!==null||g.memoizedState!==null)&&(Ma=m)}function de(m){v(js,js.current),v(_a,m),Ma===null&&(Ma=m)}function He(m){m.tag===22?(v(js,js.current),v(_a,m),Ma===null&&(Ma=m)):rt()}function rt(){v(js,js.current),v(_a,_a.current)}function Ze(m){y(_a),Ma===m&&(Ma=null),y(js)}function We(m){for(var g=m;g!==null;){if(g.tag===13){var N=g.memoizedState;if(N!==null&&(N=N.dehydrated,N===null||Jc(N)||og(N)))return g}else if(g.tag===19&&(g.memoizedProps.revealOrder==="forwards"||g.memoizedProps.revealOrder==="backwards"||g.memoizedProps.revealOrder==="unstable_legacy-backwards"||g.memoizedProps.revealOrder==="together")){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}function Ct(){throw Error(s(321))}function zt(m,g){if(g===null)return!1;for(var N=0;N<g.length&&N<m.length;N++)if(!Os(m[N],g[N]))return!1;return!0}function Pt(m,g,N,j,H,W){return lc=W,Gn=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,pn.H=m===null||m.memoizedState===null?ws:Cl,dr=!1,W=N(j,H),dr=!1,Vn&&(W=kt(g,N,j,H)),_t(m),W}function _t(m){pn.H=Ha;var g=dn!==null&&dn.next!==null;if(lc=0,kn=dn=Gn=null,Xn=!1,Ao=0,Go=null,g)throw Error(s(300));m===null||ns||(m=m.dependencies,m!==null&&Ge(m)&&(ns=!0))}function kt(m,g,N,j){Gn=m;var H=0;do{if(Vn&&(Go=null),Ao=0,Vn=!1,25<=H)throw Error(s(301));if(H+=1,kn=dn=null,m.updateQueue!=null){var W=m.updateQueue;W.lastEffect=null,W.events=null,W.stores=null,W.memoCache!=null&&(W.memoCache.index=0)}pn.H=su,W=g(N,j)}while(Vn);return W}function Rt(){var m=pn.H,g=m.useState()[0];return g=typeof g.then=="function"?_n(g):g,m=m.useState()[0],(dn!==null?dn.memoizedState:null)!==m&&(Gn.flags|=1024),g}function qt(){var m=$i!==0;return $i=0,m}function Qt(m,g,N){g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~N}function nn(m){if(Xn){for(m=m.memoizedState;m!==null;){var g=m.queue;g!==null&&(g.pending=null),m=m.next}Xn=!1}lc=0,kn=dn=Gn=null,Vn=!1,Ao=$i=0,Go=null}function Cn(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?Gn.memoizedState=kn=m:kn=kn.next=m,kn}function Zt(){if(dn===null){var m=Gn.alternate;m=m!==null?m.memoizedState:null}else m=dn.next;var g=kn===null?Gn.memoizedState:kn.next;if(g!==null)kn=g,dn=m;else{if(m===null)throw Gn.alternate===null?Error(s(467)):Error(s(310));dn=m,m={memoizedState:dn.memoizedState,baseState:dn.baseState,baseQueue:dn.baseQueue,queue:dn.queue,next:null},kn===null?Gn.memoizedState=kn=m:kn=kn.next=m}return kn}function Fn(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function _n(m){var g=Ao;return Ao+=1,Go===null&&(Go=[]),m=et(Go,m,g),g=Gn,(kn===null?g.memoizedState:kn.next)===null&&(g=g.alternate,pn.H=g===null||g.memoizedState===null?ws:Cl),m}function Gt(m){if(m!==null&&typeof m=="object"){if(typeof m.then=="function")return _n(m);if(m.$$typeof===xo)return ve(m)}throw Error(s(438,String(m)))}function Rr(m){var g=null,N=Gn.updateQueue;if(N!==null&&(g=N.memoCache),g==null){var j=Gn.alternate;j!==null&&(j=j.updateQueue,j!==null&&(j=j.memoCache,j!=null&&(g={data:j.data.map(function(H){return H.slice()}),index:0})))}if(g==null&&(g={data:[],index:0}),N===null&&(N=Fn(),Gn.updateQueue=N),N.memoCache=g,N=g.data[g.index],N===void 0)for(N=g.data[g.index]=Array(m),j=0;j<m;j++)N[j]=D0;return g.index++,N}function mn(m,g){return typeof g=="function"?g(m):g}function Or(m){var g=Zt();return os(g,dn,m)}function os(m,g,N){var j=m.queue;if(j===null)throw Error(s(311));j.lastRenderedReducer=N;
vendor: 8,065 bytes, line 4503
4503var H=m.baseQueue,W=j.pending;if(W!==null){if(H!==null){var fe=H.next;H.next=W.next,W.next=fe}g.baseQueue=H=W,j.pending=null}if(W=m.baseState,H===null)m.memoizedState=W;else{g=H.next;var Ue=fe=null,pt=null,Tt=g,Lt=!1;do{var Dt=Tt.lane&-536870913;if(Dt!==Tt.lane?(ir&Dt)===Dt:(lc&Dt)===Dt){var Kt=Tt.revertLane;if(Kt===0)pt!==null&&(pt=pt.next={lane:0,revertLane:0,gesture:null,action:Tt.action,hasEagerState:Tt.hasEagerState,eagerState:Tt.eagerState,next:null}),Dt===oc&&(Lt=!0);else if((lc&Kt)===Kt){Tt=Tt.next,Kt===oc&&(Lt=!0);continue}else Dt={lane:0,revertLane:Tt.revertLane,gesture:null,action:Tt.action,hasEagerState:Tt.hasEagerState,eagerState:Tt.eagerState,next:null},pt===null?(Ue=pt=Dt,fe=W):pt=pt.next=Dt,Gn.lanes|=Kt,cc|=Kt;Dt=Tt.action,dr&&N(W,Dt),W=Tt.hasEagerState?Tt.eagerState:N(W,Dt)}else Kt={lane:Dt,revertLane:Tt.revertLane,gesture:Tt.gesture,action:Tt.action,hasEagerState:Tt.hasEagerState,eagerState:Tt.eagerState,next:null},pt===null?(Ue=pt=Kt,fe=W):pt=pt.next=Kt,Gn.lanes|=Dt,cc|=Dt;Tt=Tt.next}while(Tt!==null&&Tt!==g);if(pt===null?fe=W:pt.next=Ue,!Os(W,m.memoizedState)&&(ns=!0,Lt&&(N=ci,N!==null)))throw N;m.memoizedState=W,m.baseState=fe,m.baseQueue=pt,j.lastRenderedState=W}return H===null&&(j.lanes=0),[m.memoizedState,j.dispatch]}function gs(m){var g=Zt(),N=g.queue;if(N===null)throw Error(s(311));N.lastRenderedReducer=m;var j=N.dispatch,H=N.pending,W=g.memoizedState;if(H!==null){N.pending=null;var fe=H=H.next;do W=m(W,fe.action),fe=fe.next;while(fe!==H);Os(W,g.memoizedState)||(ns=!0),g.memoizedState=W,g.baseQueue===null&&(g.baseState=W),N.lastRenderedState=W}return[W,j]}function As(m,g,N){var j=Gn,H=Zt(),W=sr;if(W){if(N===void 0)throw Error(s(407));N=N()}else N=g();var fe=!Os((dn||H).memoizedState,N);if(fe&&(H.memoizedState=N,ns=!0),H=H.queue,co(Dn.bind(null,j,H,m),[m]),H.getSnapshot!==g||fe||kn!==null&&kn.memoizedState.tag&1){if(j.flags|=2048,ln(9,{destroy:void 0},Ht.bind(null,j,H,N,g),null),qn===null)throw Error(s(349));W||(lc&127)!==0||At(j,g,N)}return N}function At(m,g,N){m.flags|=16384,m={getSnapshot:g,value:N},g=Gn.updateQueue,g===null?(g=Fn(),Gn.updateQueue=g,g.stores=[m]):(N=g.stores,N===null?g.stores=[m]:N.push(m))}function Ht(m,g,N,j){g.value=N,g.getSnapshot=j,In(g)&&xs(m)}function Dn(m,g,N){return N(function(){In(g)&&xs(m)})}function In(m){var g=m.getSnapshot;m=m.value;try{var N=g();return!Os(m,N)}catch{return!0}}function xs(m){var g=Gr(m,2);g!==null&&ys(g,m,2)}function ii(m){var g=Cn();if(typeof m=="function"){var N=m;if(m=N(),dr){$(!0);try{N()}finally{$(!1)}}}return g.memoizedState=g.baseState=m,g.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mn,lastRenderedState:m},g}function Cs(m,g,N,j){return m.baseState=N,os(m,dn,typeof j=="function"?j:mn)}function ts(m,g,N,j,H){if(Dp(m))throw Error(s(485));if(m=g.action,m!==null){var W={payload:H,action:m,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(fe){W.listeners.push(fe)}};pn.T!==null?N(!0):W.isTransition=!1,j(W),N=g.pending,N===null?(W.next=g.pending=W,pa(g,W)):(W.next=N.next,g.pending=N.next=W)}}function pa(m,g){var N=g.action,j=g.payload,H=m.state;if(g.isTransition){var W=pn.T,fe={};pn.T=fe;try{var Ue=N(H,j),pt=pn.S;pt!==null&&pt(fe,Ue),Bo(m,g,Ue)}catch(Tt){Ei(m,g,Tt)}finally{W!==null&&fe.types!==null&&(W.types=fe.types),pn.T=W}}else try{W=N(H,j),Bo(m,g,W)}catch(Tt){Ei(m,g,Tt)}}function Bo(m,g,N){N!==null&&typeof N=="object"&&typeof N.then=="function"?N.then(function(j){zi(m,g,j)},function(j){return Ei(m,g,j)}):zi(m,g,N)}function zi(m,g,N){g.status="fulfilled",g.value=N,il(g),m.state=N,g=m.pending,g!==null&&(N=g.next,N===g?m.pending=null:(N=N.next,g.next=N,pa(m,N)))}function Ei(m,g,N){var j=m.pending;if(m.pending=null,j!==null){j=j.next;do g.status="rejected",g.reason=N,il(g),g=g.next;while(g!==j)}m.action=null}function il(m){m=m.listeners;for(var g=0;g<m.length;g++)(0,m[g])()}function wr(m,g){return g}function Is(m,g){if(sr){var N=qn.formState;if(N!==null){e:{var j=Gn;if(sr){if(ds){var H=M1(ds,ra);if(H){ds=N1(H),j=J0(H);break e}}me(j)}j=!1}j&&(g=N[0])}}N=Cn(),N.memoizedState=N.baseState=g,j={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:g},N.queue=j,N=Oo.bind(null,Gn,j),j.dispatch=N,j=ii(!1);var W=Pp.bind(null,Gn,!1,j.queue);return j=Cn(),H={state:g,dispatch:null,action:m,pending:null},j.queue=H,N=ts.bind(null,Gn,H,W,N),H.dispatch=N,j.memoizedState=m,[g,N,!1]}function lo(m){var g=Zt();return be(g,dn,m)}function be(m,g,N){if(g=os(m,g,wr)[0],m=Or(mn)[0],typeof g=="object"&&g!==null&&typeof g.then=="function")try{var j=_n(g)}catch(fe){throw fe===ui?No:fe}else j=g;g=Zt();var H=g.queue,W=H.dispatch;return N!==g.memoizedState&&(Gn.flags|=2048,ln(9,{destroy:void 0},It.bind(null,H,N),null)),[j,W,m]}function It(m,g){m.action=g}function en(m){var g=Zt(),N=dn;if(N!==null)return be(g,N,m);Zt(),g=g.memoizedState,N=Zt();var j=N.queue.dispatch;return N.memoizedState=m,[g,j,!1]}function ln(m,g,N,j){return m={tag:m,create:N,deps:j,inst:g,next:null},g=Gn.updateQueue,g===null&&(g=Fn(),Gn.updateQueue=g),N=g.lastEffect,N===null?g.lastEffect=m.next=m:(j=N.next,N.next=m,m.next=j,g.lastEffect=m),m}function Un(){return Zt().memoizedState}function Zn(m,g,N,j){var H=Cn();Gn.flags|=m,H.memoizedState=ln(1|g,{destroy:void 0},N,j===void 0?null:j)}function Hr(m,g,N,j){var H=Zt();j=j===void 0?null:j;var W=H.memoizedState.inst;dn!==null&&j!==null&&zt(j,dn.memoizedState.deps)?H.memoizedState=ln(g,W,N,j):(Gn.flags|=m,H.memoizedState=ln(1|g,W,N,j))}function kc(m,g){Zn(8390656,8,m,g)}function co(m,g){Hr(2048,8,m,g)}function Ic(m){Gn.flags|=4;var g=Gn.updateQueue;if(g===null)g=Fn(),Gn.updateQueue=g,g.events=[m];else{var N=g.events;N===null?g.events=[m]:N.push(m)}}function ls(m){var g=Zt().memoizedState;return Ic({ref:g,nextImpl:m}),function(){if((er&2)!==0)throw Error(s(440));return g.impl.apply(void 0,arguments)}}function Lo(m,g){return Hr(4,2,m,g)}function ql(m,g){return Hr(4,4,m,g)}function al(m,g){if(typeof g=="function"){m=m();var N=g(m);return function(){typeof N=="function"?N():g(null)}}if(g!=null)return m=m(),g.current=m,function(){g.current=null}}function Bc(m,g,N){N=N!=null?N.concat([m]):null,Hr(4,4,al.bind(null,g,m),N)}function Lc(){}function ol(m,g){var N=Zt();g=g===void 0?null:g;var j=N.memoizedState;return g!==null&&zt(g,j[1])?j[0]:(N.memoizedState=[m,g],m)}function ll(m,g){var N=Zt();g=g===void 0?null:g;var j=N.memoizedState;if(g!==null&&zt(g,j[1]))return j[0];if(j=m(),dr){$(!0);try{m()}finally{$(!1)}}return N.memoizedState=[j,g],j}function Ws(m,g,N){return N===void 0||(lc&1073741824)!==0&&(ir&261930)===0?m.memoizedState=g:(m.memoizedState=N,m=Kl(),Gn.lanes|=m,cc|=m,N)}function Ph(m,g,N,j){return Os(N,g)?N:dd.current!==null?(m=Ws(m,N,j),Os(m,g)||(ns=!0),m):(lc&42)===0||(lc&1073741824)!==0&&(ir&261930)===0?(ns=!0,m.memoizedState=N):(m=Kl(),Gn.lanes|=m,cc|=m,g)}function Gu(m,g,N,j,H){var W=bo();rr(W!==0&&8>W?W:8);var fe=pn.T,Ue={};pn.T=Ue,Pp(m,!1,g,N);try{var pt=H(),Tt=pn.S;if(Tt!==null&&Tt(Ue,pt),pt!==null&&typeof pt=="object"&&typeof pt.then=="function"){var Lt=pe(pt,j);Oc(m,g,Lt,cs(m))}else Oc(m,g,j,cs(m))}catch(Dt){Oc(m,g,{then:function(){},status:"rejected",reason:Dt},cs())}finally{rr(W),fe!==null&&Ue.types!==null&&(fe.types=Ue.types),pn.T=fe}}function Hu(m){var g=m.memoizedState;if(g!==null)return g;g={memoizedState:rd,baseState:rd,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mn,lastRenderedState:rd},next:null};var N={};return g.next={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mn,lastRenderedState:N},next:null},m.memoizedState=g,m=m.alternate,m!==null&&(m.memoizedState=g),g}function Qd(){return ve(sd)}function Kd(){return Zt().memoizedState}function ji(){return Zt().memoizedState}function Ba(m){for(var g=m.return;g!==null;){switch(g.tag){case 24:case 3:var N=cs();m=Tr(N);var j=as(g,m,N);j!==null&&(ys(j,g,N),Ps(j,g,N)),g={cache:ge()},m.payload=g;return}g=g.return}}function Gi(m,g,N){var j=cs();N={lane:j,revertLane:0,gesture:null,action:N,hasEagerState:!1,eagerState:null,next:null}
vendor: 16,417 bytes, line 4503
4503,Dp(m)?Lv(g,N):(N=Lr(m,g,N,j),N!==null&&(ys(N,m,j),Ov(N,g,j)))}function Oo(m,g,N){var j=cs();Oc(m,g,N,j)}function Oc(m,g,N,j){var H={lane:j,revertLane:0,gesture:null,action:N,hasEagerState:!1,eagerState:null,next:null};if(Dp(m))Lv(g,H);else{var W=m.alternate;if(m.lanes===0&&(W===null||W.lanes===0)&&(W=g.lastRenderedReducer,W!==null))try{var fe=g.lastRenderedState,Ue=W(fe,N);if(H.hasEagerState=!0,H.eagerState=Ue,Os(Ue,fe))return Sn(m,g,H,0),qn===null&&an(),!1}catch{}if(N=Lr(m,g,H,j),N!==null)return ys(N,m,j),Ov(N,g,j),!0}return!1}function Pp(m,g,N,j){if(j={lane:2,revertLane:Se(),gesture:null,action:j,hasEagerState:!1,eagerState:null,next:null},Dp(m)){if(g)throw Error(s(479))}else g=Lr(m,N,j,2),g!==null&&ys(g,m,2)}function Dp(m){var g=m.alternate;return m===Gn||g!==null&&g===Gn}function Lv(m,g){Vn=Xn=!0;var N=m.pending;N===null?g.next=g:(g.next=N.next,N.next=g),m.pending=g}function Ov(m,g,N){if((N&4194048)!==0){var j=g.lanes;j&=m.pendingLanes,N|=j,g.lanes=N,G(m,N)}}function u0(m,g,N,j){g=m.memoizedState,N=N(j,g),N=N==null?g:Zp({},g,N),m.memoizedState=N,m.lanes===0&&(m.updateQueue.baseState=N)}function kp(m,g,N,j,H,W,fe){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(j,W,fe):g.prototype&&g.prototype.isPureReactComponent?!Te(N,j)||!Te(H,W):!0}function Fv(m,g,N,j){m=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(N,j),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(N,j),g.state!==m&&am.enqueueReplaceState(g,g.state,null)}function Vu(m,g){var N=g;if("ref"in g){N={};for(var j in g)j!=="ref"&&(N[j]=g[j])}if(m=m.defaultProps){N===g&&(N=Zp({},N));for(var H in m)N[H]===void 0&&(N[H]=m[H])}return N}function Ip(m,g){try{var N=m.onUncaughtError;N(g.value,{componentStack:g.stack})}catch(j){setTimeout(function(){throw j})}}function d0(m,g,N){try{var j=m.onCaughtError;j(N.value,{componentStack:N.stack,errorBoundary:g.tag===1?g.stateNode:null})}catch(H){setTimeout(function(){throw H})}}function f0(m,g,N){return N=Tr(N),N.tag=3,N.payload={element:null},N.callback=function(){Ip(m,g)},N}function Uv(m){return m=Tr(m),m.tag=3,m}function zv(m,g,N,j){var H=N.type.getDerivedStateFromError;if(typeof H=="function"){var W=j.value;m.payload=function(){return H(W)},m.callback=function(){d0(g,N,j)}}var fe=N.stateNode;fe!==null&&typeof fe.componentDidCatch=="function"&&(m.callback=function(){d0(g,N,j),typeof H!="function"&&(uc===null?uc=new Set([this]):uc.add(this));var Ue=j.stack;this.componentDidCatch(j.value,{componentStack:Ue!==null?Ue:""})})}function bA(m,g,N,j,H){if(N.flags|=32768,j!==null&&typeof j=="object"&&typeof j.then=="function"){if(g=N.alternate,g!==null&&qe(g,N,H,!0),N=_a.current,N!==null){switch(N.tag){case 31:case 13:return Ma===null?cf():N.alternate===null&&_s===0&&(_s=3),N.flags&=-257,N.flags|=65536,N.lanes=H,j===Nl?N.flags|=16384:(g=N.updateQueue,g===null?N.updateQueue=new Set([j]):g.add(j),ff(m,j,H)),!1;case 22:return N.flags|=65536,j===Nl?N.flags|=16384:(g=N.updateQueue,g===null?(g={transitions:null,markerInstances:null,retryQueue:new Set([j])},N.updateQueue=g):(N=g.retryQueue,N===null?g.retryQueue=new Set([j]):N.add(j)),ff(m,j,H)),!1}throw Error(s(435,N.tag))}return ff(m,j,H),cf(),!1}if(sr)return g=_a.current,g!==null?((g.flags&65536)===0&&(g.flags|=256),g.flags|=65536,g.lanes=H,j!==Sg&&(m=Error(s(422),{cause:j}),Re(oe(m,N)))):(j!==Sg&&(g=Error(s(423),{cause:j}),Re(oe(g,N))),m=m.current.alternate,m.flags|=65536,H&=-H,m.lanes|=H,j=oe(j,N),H=f0(m.stateNode,j,H),gi(m,H),_s!==4&&(_s=2)),!1;var W=Error(s(520),{cause:j});if(W=oe(W,N),lm===null?lm=[W]:lm.push(W),_s!==4&&(_s=2),g===null)return!0;j=oe(j,N),N=g;do{switch(N.tag){case 3:return N.flags|=65536,m=H&-H,N.lanes|=m,m=f0(N.stateNode,j,m),gi(N,m),!1;case 1:if(g=N.type,W=N.stateNode,(N.flags&128)===0&&(typeof g.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(uc===null||!uc.has(W))))return N.flags|=65536,H&=-H,N.lanes|=H,H=Uv(H),zv(H,m,N,j),gi(N,H),!1}N=N.return}while(N!==null);return!1}function Ti(m,g,N,j){g.child=m===null?gb(g,null,N,j):Di(g,m.child,N,j)}function Gv(m,g,N,j,H){N=N.render;var W=g.ref;if("ref"in j){var fe={};for(var Ue in j)Ue!=="ref"&&(fe[Ue]=j[Ue])}else fe=j;return ot(g),j=Pt(m,g,N,fe,W,H),Ue=qt(),m!==null&&!ns?(Qt(m,g,H),cl(m,g,H)):(sr&&Ue&&O(g),g.flags|=1,Ti(m,g,j,H),g.child)}function Hv(m,g,N,j,H){if(m===null){var W=N.type;return typeof W=="function"&&!Yu(W)&&W.defaultProps===void 0&&N.compare===null?(g.tag=15,g.type=W,Vv(m,g,W,j,H)):(m=ec(N.type,null,j,g,g.mode,H),m.ref=g.ref,m.return=g,g.child=m)}if(W=m.child,!kh(m,H)){var fe=W.memoizedProps;if(N=N.compare,N=N!==null?N:Te,N(fe,j)&&m.ref===g.ref)return cl(m,g,H)}return g.flags|=1,m=Fa(W,j),m.ref=g.ref,m.return=g,g.child=m}function Vv(m,g,N,j,H){if(m!==null){var W=m.memoizedProps;if(Te(W,j)&&m.ref===g.ref)if(ns=!1,g.pendingProps=j=W,kh(m,H))(m.flags&131072)!==0&&(ns=!0);else return g.lanes=m.lanes,cl(m,g,H)}return Lp(m,g,N,j,H)}function Wv(m,g,N,j){var H=j.children,W=m!==null?m.memoizedState:null;if(m===null&&g.stateNode===null&&(g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),j.mode==="hidden"){if((g.flags&128)!==0){if(W=W!==null?W.baseLanes|N:N,m!==null){for(j=g.child=m.child,H=0;j!==null;)H=H|j.lanes|j.childLanes,j=j.sibling;j=H&~W}else j=0,g.child=null;return Jd(m,g,W,N,j)}if((N&536870912)!==0)g.memoizedState={baseLanes:0,cachePool:null},m!==null&&Ne(g,W!==null?W.cachePool:null),W!==null?Vs(g,W):Yt(),He(g);else return j=g.lanes=536870912,Jd(m,g,W!==null?W.baseLanes|N:N,N,j)}else W!==null?(Ne(g,W.cachePool),Vs(g,W),rt(),g.memoizedState=null):(m!==null&&Ne(g,null),Yt(),rt());return Ti(m,g,H,N),g.child}function Wu(m,g){return m!==null&&m.tag===22||g.stateNode!==null||(g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.sibling}function Jd(m,g,N,j,H){var W=Ke();return W=W===null?null:{parent:Bs?fs._currentValue:fs._currentValue2,pool:W},g.memoizedState={baseLanes:N,cachePool:W},m!==null&&Ne(g,null),Yt(),He(g),m!==null&&qe(m,g,j,!0),g.childLanes=H,null}function Bp(m,g){return g=Fc({mode:g.mode,children:g.children},m.mode),g.ref=m.ref,m.child=g,g.return=m,g}function h0(m,g,N){return Di(g,m.child,null,N),m=Bp(g,g.pendingProps),m.flags|=2,Ze(g),g.memoizedState=null,m}function $v(m,g,N){var j=g.pendingProps,H=(g.flags&128)!==0;if(g.flags&=-129,m===null){if(sr){if(j.mode==="hidden")return m=Bp(g,j),g.lanes=536870912,Wu(null,m);if(de(g),(m=ds)?(m=eb(m,ra),m!==null&&(g.memoizedState={dehydrated:m,treeContext:wo!==null?{id:Ri,overflow:Uo}:null,retryLane:536870912,hydrationErrors:null},N=T0(m),N.return=g,g.child=N,li=g,ds=null)):m=null,m===null)throw me(g);return g.lanes=536870912,null}return Bp(g,j)}var W=m.memoizedState;if(W!==null){var fe=W.dehydrated;if(de(g),H)if(g.flags&256)g.flags&=-257,g=h0(m,g,N);else if(g.memoizedState!==null)g.child=m.child,g.flags|=128,g=null;else throw Error(s(558));else if(ns||qe(m,g,N,!1),H=(N&m.childLanes)!==0,ns||H){if(j=qn,j!==null&&(fe=k(j,N),fe!==0&&fe!==W.retryLane))throw W.retryLane=fe,Gr(m,fe),ys(j,m,fe),ia;cf(),g=h0(m,g,N)}else m=W.treeContext,us&&(ds=j1(fe),li=g,sr=!0,Ml=null,ra=!1,m!==null&&q(g,m)),g=Bp(g,j),g.flags|=4096;return g}return m=Fa(m.child,{mode:j.mode,children:j.children}),m.ref=g.ref,g.child=m,m.return=g,m}function Dh(m,g){var N=g.ref;if(N===null)m!==null&&m.ref!==null&&(g.flags|=4194816);else{if(typeof N!="function"&&typeof N!="object")throw Error(s(284));(m===null||m.ref!==N)&&(g.flags|=4194816)}}function Lp(m,g,N,j,H){return ot(g),N=Pt(m,g,N,j,void 0,H),j=qt(),m!==null&&!ns?(Qt(m,g,H),cl(m,g,H)):(sr&&j&&O(g),g.flags|=1,Ti(m,g,N,H),g.child)}function m0(m,g,N,j,H,W){return ot(g),g.updateQueue=null,N=kt(g,j,N,H),_t(m),j=qt(),m!==null&&!ns?(Qt(m,g,W),cl(m,g,W)):(sr&&j&&O(g),g.flags|=1,Ti(m,g,N,W),g.child)}function $u(m,g,N,j,H){if(ot(g),g.stateNode===null){var W=wl,fe=N.contextType;typeof fe=="object"&&fe!==null&&(W=ve(fe)),W=new N(j,W),g.memoizedState=W.state!==null&&W.state!==void 0?W.state:null,W.updater=am,g.stateNode=W,W._reactInternals=g,W=g.stateNode,W.props=j,W.state=g.memoizedState,W.refs={},jr(g),fe=N.contextType,W.context=typeof fe=="object"&&fe!==null?ve(fe):wl,W.state=g.memoizedState,fe=N.getDerivedStateFromProps,typeof fe=="function"&&(u0(g,N,fe,j),W.state=g.memoizedState),typeof N.getDerivedStateFromProps=="function"||typeof W.getSnapshotBeforeUpdate=="function"||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(fe=W.state,typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount(),fe!==W.state&&am.enqueueReplaceState(W,W.state,null),ps(g,j,W,H),Xr(),W.state=g.memoizedState),typeof W.componentDidMount=="function"&&(g.flags|=4194308),j=!0}else if(m===null){W=g.stateNode;var Ue=g.memoizedProps,pt=Vu(N,Ue);W.props=pt;var Tt=W.context,Lt=N.contextType;fe=wl,typeof Lt=="object"&&Lt!==null&&(fe=ve(Lt));var Dt=N.getDerivedStateFromProps;Lt=typeof Dt=="function"||typeof W.getSnapshotBeforeUpdate=="function",Ue=g.pendingProps!==Ue,Lt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(Ue||Tt!==fe)&&Fv(g,W,j,fe),Ga=!1;var Kt=g.memoizedState;W.state=Kt,ps(g,j,W,H),Xr(),Tt=g.memoizedState,Ue||Kt!==Tt||Ga?(typeof Dt=="function"&&(u0(g,N,Dt,j),Tt=g.memoizedState),(pt=Ga||kp(g,N,pt,j,Kt,Tt,fe))?(Lt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(g.flags|=4194308)):(typeof W.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=j,g.memoizedState=Tt),W.props=j,W.state=Tt,W.context=fe,j=pt):(typeof W.componentDidMount=="function"&&(g.flags|=4194308),j=!1)}else{W=g.stateNode,es(m,g),fe=g.memoizedProps,Lt=Vu(N,fe),W.props=Lt,Dt=g.pendingProps,Kt=W.context,Tt=N.contextType,pt=wl,typeof Tt=="object"&&Tt!==null&&(pt=ve(Tt)),Ue=N.getDerivedStateFromProps,(Tt=typeof Ue=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(fe!==Dt||Kt!==pt)&&Fv(g,W,j,pt),Ga=!1,Kt=g.memoizedState,W.state=Kt,ps(g,j,W,H),Xr();var On=g.memoizedState;fe!==Dt||Kt!==On||Ga||m!==null&&m.dependencies!==null&&Ge(m.dependencies)?(typeof Ue=="function"&&(u0(g,N,Ue,j),On=g.memoizedState),(Lt=Ga||kp(g,N,Lt,j,Kt,On,pt)||m!==null&&m.dependencies!==null&&Ge(m.dependencies))?(Tt||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(j,On,pt),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(j,On,pt)),typeof W.componentDidUpdate=="function"&&(g.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof W.componentDidUpdate!="function"||fe===m.memoizedProps&&Kt===m.memoizedState||(g.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||fe===m.memoizedProps&&Kt===m.memoizedState||(g.flags|=1024),g.memoizedProps=j,g.memoizedState=On),W.props=j,W.state=On,W.context=pt,j=Lt):(typeof W.componentDidUpdate!="function"||fe===m.memoizedProps&&Kt===m.memoizedState||(g.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||fe===m.memoizedProps&&Kt===m.memoizedState||(g.flags|=1024),j=!1)}return W=j,Dh(m,g),j=(g.flags&128)!==0,W||j?(W=g.stateNode,N=j&&typeof N.getDerivedStateFromError!="function"?null:W.render(),g.flags|=1,m!==null&&j?(g.child=Di(g,m.child,null,H),g.child=Di(g,null,N,H)):Ti(m,g,N,H),g.memoizedState=W.state,m=g.child):m=cl(m,g,H),m}function Xv(m,g,N,j){return Le(),g.flags|=256,Ti(m,g,N,j),g.child}function p0(m){return{baseLanes:m,cachePool:Ye()}}function g0(m,g,N){return m=m!==null?m.childLanes&~N:0,g&&(m|=aa),m}function x0(m,g,N){var j=g.pendingProps,H=!1,W=(g.flags&128)!==0,fe;if((fe=W)||(fe=m!==null&&m.memoizedState===null?!1:(js.current&2)!==0),fe&&(H=!0,g.flags&=-129),fe=(g.flags&32)!==0,g.flags&=-33,m===null){if(sr){if(H?ks(g):rt(),(m=ds)?(m=D1(m,ra),m!==null&&(g.memoizedState={dehydrated:m,treeContext:wo!==null?{id:Ri,overflow:Uo}:null,retryLane:536870912,hydrationErrors:null},N=T0(m),N.return=g,g.child=N,li=g,ds=null)):m=null,m===null)throw me(g);return og(m)?g.lanes=32:g.lanes=536870912,null}var Ue=j.children;return j=j.fallback,H?(rt(),H=g.mode,Ue=Fc({mode:"hidden",children:Ue},H),j=go(j,H,N,null),Ue.return=g,j.return=g,Ue.sibling=j,g.child=Ue,j=g.child,j.memoizedState=p0(N),j.childLanes=g0(m,fe,N),g.memoizedState=fd,Wu(null,j)):(ks(g),Op(g,Ue))}var pt=m.memoizedState;if(pt!==null&&(Ue=pt.dehydrated,Ue!==null)){if(W)g.flags&256?(ks(g),g.flags&=-257,g=Xu(m,g,N)):g.memoizedState!==null?(rt(),g.child=m.child,g.flags|=128,g=null):(rt(),Ue=j.fallback,H=g.mode,j=Fc({mode:"visible",children:j.children},H),Ue=go(Ue,H,N,null),Ue.flags|=2,j.return=g,Ue.return=g,j.sibling=Ue,g.child=j,Di(g,m.child,null,N),j=g.child,j.memoizedState=p0(N),j.childLanes=g0(m,fe,N),g.memoizedState=fd,g=Wu(null,j));else if(ks(g),og(Ue))fe=lg(Ue).digest,j=Error(s(419)),j.stack="",j.digest=fe,Re({value:j,source:null,stack:null}),g=Xu(m,g,N);else if(ns||qe(m,g,N,!1),fe=(N&m.childLanes)!==0,ns||fe){if(fe=qn,fe!==null&&(j=k(fe,N),j!==0&&j!==pt.retryLane))throw pt.retryLane=j,Gr(m,j),ys(fe,m,j),ia;Jc(Ue)||cf(),g=Xu(m,g,N)}else Jc(Ue)?(g.flags|=192,g.child=m.child,g=null):(m=pt.treeContext,us&&(ds=T1(Ue),li=g,sr=!0,Ml=null,ra=!1,m!==null&&q(g,m)),g=Op(g,j.children),g.flags|=4096);return g}return H?(rt(),Ue=j.fallback,H=g.mode,pt=m.child,W=pt.sibling,j=Fa(pt,{mode:"hidden",children:j.children}),j.subtreeFlags=pt.subtreeFlags&65011712,W!==null?Ue=Fa(W,Ue):(Ue=go(Ue,H,N,null),Ue.flags|=2),Ue.return=g,j.return=g,j.sibling=Ue,g.child=j,Wu(null,j),j=g.child,Ue=m.child.memoizedState,Ue===null?Ue=p0(N):(H=Ue.cachePool,H!==null?(pt=Bs?fs._currentValue:fs._currentValue2,H=H.parent!==pt?{parent:pt,pool:pt}:H):H=Ye(),Ue={baseLanes:Ue.baseLanes|N,cachePool:H}),j.memoizedState=Ue,j.childLanes=g0(m,fe,N),g.memoizedState=fd,Wu(m.child,j)):(ks(g),N=m.child,m=N.sibling,N=Fa(N,{mode:"visible",children:j.children}),N.return=g,N.sibling=null,m!==null&&(fe=g.deletions,fe===null?(g.deletions=[m],g.flags|=16):fe.push(m)),g.child=N,g.memoizedState=null,N)}function Op(m,g){return g=Fc({mode:"visible",children:g},m.mode),g.return=m,m.child=g}function Fc(m,g){return m=t(22,m,null,g),m.lanes=0,m}function Xu(m,g,N){return Di(g,m.child,null,N),m=Op(g,g.pendingProps.children),m.flags|=2,g.memoizedState=null,m}function qv(m,g,N){m.lanes|=g;var j=m.alternate;j!==null&&(j.lanes|=g),le(m.return,g,N)}function Zd(m,g,N,j,H,W){var fe=m.memoizedState;fe===null?m.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:j,tail:N,tailMode:H,treeForkCount:W}:(fe.isBackwards=g,fe.rendering=null,fe.renderingStartTime=0,fe.last=j,fe.tail=N,fe.tailMode=H,fe.treeForkCount=W)}function b0(m,g,N){var j=g.pendingProps,H=j.revealOrder,W=j.tail;j=j.children;var fe=js.current,Ue=(fe&2)!==0;if(Ue?(fe=fe&1|2,g.flags|=128):fe&=1,v(js,fe),Ti(m,g,j,N),j=sr?rm:0,!Ue&&m!==null&&(m.flags&128)!==0)e:for(m=g.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&qv(m,N,g);else if(m.tag===19)qv(m,N,g);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===g)break e;for(;m.sibling===null;){if(m.return===null||m.return===g)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}switch(H){case"forwards":for(N=g.child,H=null;N!==null;)m=N.alternate,m!==null&&We(m)===null&&(H=N),N=N.sibling;N=H,N===null?(H=g.child,g.child=null):(H=N.sibling,N.sibling=null),Zd(g,!1,H,N,W,j);break;case"backwards":case"unstable_legacy-backwards":for(N=null,H=g.child,g.child=null;H!==null;){if(m=H.alternate,m!==null&&We(m)===null){g.child=H;break}m=H.sibling,H.sibling=N,N=H,H=m}Zd(g,!0,N,null,W,j);break;case"together":Zd(g,!1,null,null,void 0,j);break;default:g.memoizedState=null}return g.child}function cl(m,g,N){if(m!==null&&(g.dependencies=m.dependencies),cc|=g.lanes,(N&g.childLanes)===0)if(m!==null){if(qe(m,g,N,!1),(N&g.childLanes)===0)return null}else return null;if(m!==null&&g.child!==m.child)throw Error(s(153));if(g.child!==null){for(m=g.child,N=Fa(m,m.pendingProps),g.child=N,N.return=g;m.sibling!==null;)m=m.sibling,N=N.sibling=Fa(m,m.pendingProps),N.return=g;N.sibling=null}return g.child}
4503function kh(m,g){return(m.lanes&g)!==0?!0:(m=m.dependencies,!!(m!==null&&Ge(m)))}function y0(m,g,N){switch(g.tag){case 3:Q(g,g.stateNode.containerInfo),De(g,fs,m.memoizedState.cache),Le();break;case 27:case 5:Z(g);break;case 4:Q(g,g.stateNode.containerInfo);break;case 10:De(g,g.type,g.memoizedProps.value);break;case 31:if(g.memoizedState!==null)return g.flags|=128,de(g),null;break;case 13:var j=g.memoizedState;if(j!==null)return j.dehydrated!==null?(ks(g),g.flags|=128,null):(N&g.child.childLanes)!==0?x0(m,g,N):(ks(g),m=cl(m,g,N),m!==null?m.sibling:null);ks(g);break;case 19:var H=(m.flags&128)!==0;if(j=(N&g.childLanes)!==0,j||(qe(m,g,N,!1),j=(N&g.childLanes)!==0),H){if(j)return b0(m,g,N);g.flags|=128}if(H=g.memoizedState,H!==null&&(H.rendering=null,H.tail=null,H.lastEffect=null),v(js,js.current),j)break;return null;case 22:return g.lanes=0,Wv(m,g,N,g.pendingProps);case 24:De(g,fs,m.memoizedState.cache)}return cl(m,g,N)}function v0(m,g,N){if(m!==null)if(m.memoizedProps!==g.pendingProps)ns=!0;else{if(!kh(m,N)&&(g.flags&128)===0)return ns=!1,y0(m,g,N);ns=(m.flags&131072)!==0}else ns=!1,sr&&(g.flags&1048576)!==0&&F(g,rm,g.index);switch(g.lanes=0,g.tag){case 16:e:{var j=g.pendingProps;if(m=Qe(g.elementType),g.type=m,typeof m=="function")Yu(m)?(j=Vu(m,j),g.tag=1,g=$u(null,g,m,j,N)):(g.tag=0,g=Lp(null,g,m,j,N));else{if(m!=null){var H=m.$$typeof;if(H===hf){g.tag=11,g=Gv(null,g,m,j,N);break e}else if(H===tg){g.tag=14,g=Hv(null,g,m,j,N);break e}}throw g=p(m)||m,Error(s(306,g,""))}}return g;case 0:return Lp(m,g,g.type,g.pendingProps,N);case 1:return j=g.type,H=Vu(j,g.pendingProps),$u(m,g,j,H,N);case 3:e:{if(Q(g,g.stateNode.containerInfo),m===null)throw Error(s(387));var W=g.pendingProps;H=g.memoizedState,j=H.element,es(m,g),ps(g,W,null,N);var fe=g.memoizedState;if(W=fe.cache,De(g,fs,W),W!==H.cache&&Xe(g,[fs],N,!0),Xr(),W=fe.element,us&&H.isDehydrated)if(H={element:W,isDehydrated:!1,cache:fe.cache},g.updateQueue.baseState=H,g.memoizedState=H,g.flags&256){g=Xv(m,g,W,N);break e}else if(W!==j){j=oe(Error(s(424)),g),Re(j),g=Xv(m,g,W,N);break e}else for(us&&(ds=E1(g.stateNode.containerInfo),li=g,sr=!0,Ml=null,ra=!0),N=gb(g,null,W,N),g.child=N;N;)N.flags=N.flags&-3|4096,N=N.sibling;else{if(Le(),W===j){g=cl(m,g,N);break e}Ti(m,g,W,N)}g=g.child}return g;case 26:if(yo)return Dh(m,g),m===null?(N=ib(g.type,null,g.pendingProps,null))?g.memoizedState=N:sr||(g.stateNode=fg(g.type,g.pendingProps,Pi.current,g)):g.memoizedState=ib(g.type,m.memoizedProps,g.pendingProps,m.memoizedState),null;case 27:if(oi)return Z(g),m===null&&oi&&sr&&(j=g.stateNode=hg(g.type,g.pendingProps,Pi.current,wi.current,!1),li=g,ra=!0,ds=Z0(g.type,j,ds)),Ti(m,g,g.pendingProps.children,N),Dh(m,g),m===null&&(g.flags|=4194304),g.child;case 5:return m===null&&sr&&(G1(g.type,g.pendingProps,wi.current),(H=j=ds)&&(j=R1(j,g.type,g.pendingProps,ra),j!==null?(g.stateNode=j,li=g,ds=C1(j),ra=!1,H=!0):H=!1),H||me(g)),Z(g),H=g.type,W=g.pendingProps,fe=m!==null?m.memoizedProps:null,j=W.children,na(H,W)?j=null:fe!==null&&na(H,fe)&&(g.flags|=32),g.memoizedState!==null&&(H=Pt(m,g,Rt,null,null,N),Bs?sd._currentValue=H:sd._currentValue2=H),Dh(m,g),Ti(m,g,j,N),g.child;case 6:return m===null&&sr&&(sb(g.pendingProps,wi.current),(m=N=ds)&&(N=P1(N,g.pendingProps,ra),N!==null?(g.stateNode=N,li=g,ds=null,m=!0):m=!1),m||me(g)),null;case 13:return x0(m,g,N);case 4:return Q(g,g.stateNode.containerInfo),j=g.pendingProps,m===null?g.child=Di(g,null,j,N):Ti(m,g,j,N),g.child;case 11:return Gv(m,g,g.type,g.pendingProps,N);case 7:return Ti(m,g,g.pendingProps,N),g.child;case 8:return Ti(m,g,g.pendingProps.children,N),g.child;case 12:return Ti(m,g,g.pendingProps.children,N),g.child;case 10:return j=g.pendingProps,De(g,g.type,j.value),Ti(m,g,j.children,N),g.child;case 9:return H=g.type._context,j=g.pendingProps.children,ot(g),H=ve(H),j=j(H),g.flags|=1,Ti(m,g,j,N),g.child;case 14:return Hv(m,g,g.type,g.pendingProps,N);case 15:return Vv(m,g,g.type,g.pendingProps,N);case 19:return b0(m,g,N);case 31:return $v(m,g,N);case 22:return Wv(m,g,N,g.pendingProps);case 24:return ot(g),j=ve(fs),m===null?(H=Ke(),H===null&&(H=qn,W=ge(),H.pooledCache=W,W.refCount++,W!==null&&(H.pooledCacheLanes|=N),H=W),g.memoizedState={parent:j,cache:H},jr(g),De(g,fs,H)):((m.lanes&N)!==0&&(es(m,g),ps(g,null,null,N),Xr()),H=m.memoizedState,W=g.memoizedState,H.parent!==j?(H={parent:j,cache:j},g.memoizedState=H,g.lanes===0&&(g.memoizedState=g.updateQueue.baseState=H),De(g,fs,j)):(j=W.cache,De(g,fs,j),j!==H.cache&&Xe(g,[fs],N,!0))),Ti(m,g,g.pendingProps.children,N),g.child;case 29:throw g.pendingProps}throw Error(s(156,g.tag))}function uo(m){m.flags|=4}function Ih(m){Ua&&(m.flags|=8)}function Yv(m,g){if(m!==null&&m.child===g.child)return!1;if((g.flags&16)!==0)return!0;for(m=g.child;m!==null;){if((m.flags&8218)!==0||(m.subtreeFlags&8218)!==0)return!0;m=m.sibling}return!1}function w0(m,g,N,j){if(cr)for(N=g.child;N!==null;){if(N.tag===5||N.tag===6)Yh(m,N.stateNode);else if(!(N.tag===4||oi&&N.tag===27)&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===g)break;for(;N.sibling===null;){if(N.return===null||N.return===g)return;N=N.return}N.sibling.return=N.return,N=N.sibling}else if(Ua)for(var H=g.child;H!==null;){if(H.tag===5){var W=H.stateNode;N&&j&&(W=_1(W,H.type,H.memoizedProps)),Yh(m,W)}else if(H.tag===6)W=H.stateNode,N&&j&&(W=K0(W,H.memoizedProps)),Yh(m,W);else if(H.tag!==4){if(H.tag===22&&H.memoizedState!==null)W=H.child,W!==null&&(W.return=H),w0(m,H,!0,!0);else if(H.child!==null){H.child.return=H,H=H.child;continue}}if(H===g)break;for(;H.sibling===null;){if(H.return===null||H.return===g)return;H=H.return}H.sibling.return=H.return,H=H.sibling}}function Qv(m,g,N,j){var H=!1;if(Ua)for(var W=g.child;W!==null;){if(W.tag===5){var fe=W.stateNode;N&&j&&(fe=_1(fe,W.type,W.memoizedProps)),Y0(m,fe)}else if(W.tag===6)fe=W.stateNode,N&&j&&(fe=K0(fe,W.memoizedProps)),Y0(m,fe);else if(W.tag!==4){if(W.tag===22&&W.memoizedState!==null)H=W.child,H!==null&&(H.return=W),Qv(m,W,!0,!0),H=!0;else if(W.child!==null){W.child.return=W,W=W.child;continue}}if(W===g)break;for(;W.sibling===null;){if(W.return===null||W.return===g)return H;W=W.return}W.sibling.return=W.return,W=W.sibling}return H}function Kv(m,g){if(Ua&&Yv(m,g)){m=g.stateNode;var N=m.containerInfo,j=q0();Qv(j,g,!1,!1),m.pendingChildren=j,uo(g),S1(N,j)}}function S0(m,g,N,j){if(cr)m.memoizedProps!==j&&uo(g);else if(Ua){var H=m.stateNode,W=m.memoizedProps;
4503if((m=Yv(m,g))||W!==j){var fe=wi.current;W=w1(H,N,W,j,!m,null),W===H?g.stateNode=H:(Ih(g),ya(W,N,j,fe)&&uo(g),g.stateNode=W,m&&w0(W,g,!1,!1))}else g.stateNode=H}}function Zi(m,g,N,j,H){if((m.mode&32)!==0&&(N===null?Qh(g,j):bf(g,N,j))){if(m.flags|=16777216,(H&335544128)===H||L0(g,j))if(vs(m.stateNode,g,j))m.flags|=8192;else if(lr())m.flags|=8192;else throw sa=Nl,Mg}else m.flags&=-16777217}function ef(m,g){if(cb(g)){if(m.flags|=16777216,!ub(g))if(lr())m.flags|=8192;else throw sa=Nl,Mg}else m.flags&=-16777217}function Bh(m,g){g!==null&&(m.flags|=4),m.flags&16384&&(g=m.tag!==22?C():536870912,m.lanes|=g,Cf|=g)}function tf(m,g){if(!sr)switch(m.tailMode){case"hidden":g=m.tail;for(var N=null;g!==null;)g.alternate!==null&&(N=g),g=g.sibling;N===null?m.tail=null:N.sibling=null;break;case"collapsed":N=m.tail;for(var j=null;N!==null;)N.alternate!==null&&(j=N),N=N.sibling;j===null?g||m.tail===null?m.tail=null:m.tail.sibling=null:j.sibling=null}}function Yr(m){var g=m.alternate!==null&&m.alternate.child===m.child,N=0,j=0;if(g)for(var H=m.child;H!==null;)N|=H.lanes|H.childLanes,j|=H.subtreeFlags&65011712,j|=H.flags&65011712,H.return=m,H=H.sibling;else for(H=m.child;H!==null;)N|=H.lanes|H.childLanes,j|=H.subtreeFlags,j|=H.flags,H.return=m,H=H.sibling;return m.subtreeFlags|=j,m.childLanes=N,g}function Jv(m,g,N){var j=g.pendingProps;switch(J(g),g.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yr(g),null;case 1:return Yr(g),null;case 3:return N=g.stateNode,j=null,m!==null&&(j=m.memoizedState.cache),g.memoizedState.cache!==j&&(g.flags|=2048),he(fs),ne(),N.pendingContext&&(N.context=N.pendingContext,N.pendingContext=null),(m===null||m.child===null)&&(ye(g)?uo(g):m===null||m.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,Ce())),Kv(m,g),Yr(g),null;case 26:if(yo){var H=g.type,W=g.memoizedState;return m===null?(uo(g),W!==null?(Yr(g),ef(g,W)):(Yr(g),Zi(g,H,null,j,N))):W?W!==m.memoizedState?(uo(g),Yr(g),ef(g,W)):(Yr(g),g.flags&=-16777217):(W=m.memoizedProps,cr?W!==j&&uo(g):S0(m,g,H,j),Yr(g),Zi(g,H,W,j,N)),null}case 27:if(oi){if(se(g),N=Pi.current,H=g.type,m!==null&&g.stateNode!=null)cr?m.memoizedProps!==j&&uo(g):S0(m,g,H,j);else{if(!j){if(g.stateNode===null)throw Error(s(166));return Yr(g),null}m=wi.current,ye(g)?ze(g,m):(m=hg(H,j,N,m,!0),g.stateNode=m,uo(g))}return Yr(g),null}case 5:if(se(g),H=g.type,m!==null&&g.stateNode!=null)S0(m,g,H,j);else{if(!j){if(g.stateNode===null)throw Error(s(166));return Yr(g),null}if(W=wi.current,ye(g))ze(g,W),F1(g.stateNode,H,j,W)&&(g.flags|=64);else{var fe=I0(H,j,Pi.current,W,g);Ih(g),w0(fe,g,!1,!1),g.stateNode=fe,ya(fe,H,j,W)&&uo(g)}}return Yr(g),Zi(g,g.type,m===null?null:m.memoizedProps,g.pendingProps,N),null;case 6:if(m&&g.stateNode!=null)N=m.memoizedProps,cr?N!==j&&uo(g):Ua&&(N!==j?(m=Pi.current,N=wi.current,Ih(g),g.stateNode=rc(j,m,N,g)):g.stateNode=m.stateNode);else{if(typeof j!="string"&&g.stateNode===null)throw Error(s(166));if(m=Pi.current,N=wi.current,ye(g)){if(!us)throw Error(s(176));if(m=g.stateNode,N=g.memoizedProps,j=null,H=li,H!==null)switch(H.tag){case 27:case 5:j=H.memoizedProps}_A(m,N,g,j)||me(g,!0)}else Ih(g),g.stateNode=rc(j,m,N,g)}return Yr(g),null;case 31:if(N=g.memoizedState,m===null||m.memoizedState!==null){if(j=ye(g),N!==null){if(m===null){if(!j)throw Error(s(318));if(!us)throw Error(s(556));if(m=g.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(557));tb(m,g)}else Le(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Yr(g),m=!1}else N=Ce(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=N),m=!0;if(!m)return g.flags&256?(Ze(g),g):(Ze(g),null);if((g.flags&128)!==0)throw Error(s(558))}return Yr(g),null;case 13:if(j=g.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if(H=ye(g),j!==null&&j.dehydrated!==null){if(m===null){if(!H)throw Error(s(318));if(!us)throw Error(s(344));if(H=g.memoizedState,H=H!==null?H.dehydrated:null,!H)throw Error(s(317));I1(H,g)}else Le(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Yr(g),H=!1}else H=Ce(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=H),H=!0;if(!H)return g.flags&256?(Ze(g),g):(Ze(g),null)}return Ze(g),(g.flags&128)!==0?(g.lanes=N,g):(N=j!==null,m=m!==null&&m.memoizedState!==null,N&&(j=g.child,H=null,j.alternate!==null&&j.alternate.memoizedState!==null&&j.alternate.memoizedState.cachePool!==null&&(H=j.alternate.memoizedState.cachePool.pool),W=null,j.memoizedState!==null&&j.memoizedState.cachePool!==null&&(W=j.memoizedState.cachePool.pool),W!==H&&(j.flags|=2048)),N!==m&&N&&(g.child.flags|=8192),Bh(g,g.updateQueue),Yr(g),null);case 4:return ne(),Kv(m,g),m===null&&Vr(g.stateNode.containerInfo),Yr(g),null;case 10:return he(g.type),Yr(g),null;case 19:if(y(js),j=g.memoizedState,j===null)return Yr(g),null;if(H=(g.flags&128)!==0,W=j.rendering,W===null)if(H)tf(j,!1);else{if(_s!==0||m!==null&&(m.flags&128)!==0)for(m=g.child;m!==null;){if(W=We(m),W!==null){for(g.flags|=128,tf(j,!1),m=W.updateQueue,g.updateQueue=m,Bh(g,m),g.subtreeFlags=0,m=N,N=g.child;N!==null;)Qp(N,m),N=N.sibling;
vendor: 2,623 bytes, line 4503
4503return v(js,js.current&1|2),sr&&re(g,j.treeForkCount),g.child}m=m.sibling}j.tail!==null&&Vi()>cu&&(g.flags|=128,H=!0,tf(j,!1),g.lanes=4194304)}else{if(!H)if(m=We(W),m!==null){if(g.flags|=128,H=!0,m=m.updateQueue,g.updateQueue=m,Bh(g,m),tf(j,!0),j.tail===null&&j.tailMode==="hidden"&&!W.alternate&&!sr)return Yr(g),null}else 2*Vi()-j.renderingStartTime>cu&&N!==536870912&&(g.flags|=128,H=!0,tf(j,!1),g.lanes=4194304);j.isBackwards?(W.sibling=g.child,g.child=W):(m=j.last,m!==null?m.sibling=W:g.child=W,j.last=W)}return j.tail!==null?(m=j.tail,j.rendering=m,j.tail=m.sibling,j.renderingStartTime=Vi(),m.sibling=null,N=js.current,v(js,H?N&1|2:N&1),sr&&re(g,j.treeForkCount),m):(Yr(g),null);case 22:case 23:return Ze(g),or(),j=g.memoizedState!==null,m!==null?m.memoizedState!==null!==j&&(g.flags|=8192):j&&(g.flags|=8192),j?(N&536870912)!==0&&(g.flags&128)===0&&(Yr(g),g.subtreeFlags&6&&(g.flags|=8192)):Yr(g),N=g.updateQueue,N!==null&&Bh(g,N.retryQueue),N=null,m!==null&&m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(N=m.memoizedState.cachePool.pool),j=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(j=g.memoizedState.cachePool.pool),j!==N&&(g.flags|=2048),m!==null&&y(tu),null;case 24:return N=null,m!==null&&(N=m.memoizedState.cache),g.memoizedState.cache!==N&&(g.flags|=2048),he(fs),Yr(g),null;case 25:return null;case 30:return null}throw Error(s(156,g.tag))}function _0(m,g){switch(J(g),g.tag){case 1:return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return he(fs),ne(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 26:case 27:case 5:return se(g),null;case 31:if(g.memoizedState!==null){if(Ze(g),g.alternate===null)throw Error(s(340));Le()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 13:if(Ze(g),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(s(340));Le()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return y(js),null;case 4:return ne(),null;case 10:return he(g.type),null;case 22:case 23:return Ze(g),or(),m!==null&&y(tu),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 24:return he(fs),null;case 25:return null;default:return null}}function Zv(m,g){switch(J(g),g.tag){case 3:he(fs),ne();break;case 26:case 27:case 5:se(g);break;case 4:ne();break;case 31:g.memoizedState!==null&&Ze(g);break;case 13:Ze(g);break;case 19:y(js);break;case 10:he(g.type);break;case 22:case 23:Ze(g),or(),m!==null&&y(tu);break;case 24:he(fs)}}function ul(m,g){try{var N=g.updateQueue,j=N!==null?N.lastEffect:null;if(j!==null){var H=j.next;N=H;do{if((N.tag&m)===m){j=void 0;var W=N.create,fe=N.inst;
4503j=W(),fe.destroy=j}N=N.next}while(N!==H)}}catch(Ue){An(g,g.return,Ue)}}function dl(m,g,N){try{var j=g.updateQueue,H=j!==null?j.lastEffect:null;if(H!==null){var W=H.next;j=W;do{if((j.tag&m)===m){var fe=j.inst,Ue=fe.destroy;if(Ue!==void 0){fe.destroy=void 0,H=g;var pt=N,Tt=Ue;try{Tt()}catch(Lt){An(H,pt,Lt)}}}j=j.next}while(j!==W)}}catch(Lt){An(g,g.return,Lt)}}function nf(m){var g=m.updateQueue;if(g!==null){var N=m.stateNode;try{Ds(g,N)}catch(j){An(m,m.return,j)}}}function Fp(m,g,N){N.props=Vu(m.type,m.memoizedProps),N.state=m.memoizedState;try{N.componentWillUnmount()}catch(j){An(m,g,j)}}function rf(m,g){try{var N=m.ref;if(N!==null){switch(m.tag){case 26:case 27:case 5:var j=pf(m.stateNode);break;case 30:j=m.stateNode;break;default:j=m.stateNode}typeof N=="function"?m.refCleanup=N(j):N.current=j}}catch(H){An(m,g,H)}}function Hi(m,g){var N=m.ref,j=m.refCleanup;if(N!==null)if(typeof j=="function")try{j()}catch(H){An(m,g,H)}finally{m.refCleanup=null,m=m.alternate,m!=null&&(m.refCleanup=null)}else if(typeof N=="function")try{N(null)}catch(H){An(m,g,H)}else N.current=null}function qu(m){var g=m.type,N=m.memoizedProps,j=m.stateNode;try{h1(j,g,N,m)}catch(H){An(m,m.return,H)}}function Lh(m,g,N){try{m1(m.stateNode,m.type,N,g,m)}catch(j){An(m,m.return,j)}}function M0(m){return m.tag===5||m.tag===3||(yo?m.tag===26:!1)||(oi?m.tag===27&&id(m.type):!1)||m.tag===4}function Yl(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||M0(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(oi&&m.tag===27&&id(m.type)||m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function Up(m,g,N){var j=m.tag;if(j===5||j===6)m=m.stateNode,g?g1(N,m,g):V0(N,m);else if(j!==4&&(oi&&j===27&&id(m.type)&&(N=m.stateNode,g=null),m=m.child,m!==null))for(Up(m,g,N),m=m.sibling;m!==null;)Up(m,g,N),m=m.sibling}function Oh(m,g,N){var j=m.tag;if(j===5||j===6)m=m.stateNode,g?p1(N,m,g):H0(N,m);else if(j!==4&&(oi&&j===27&&id(m.type)&&(N=m.stateNode),m=m.child,m!==null))for(Oh(m,g,N),m=m.sibling;m!==null;)Oh(m,g,N),m=m.sibling}function N0(m,g,N){m=m.containerInfo;try{Q0(m,N)}catch(j){An(g,g.return,j)}}function e1(m){var g=m.stateNode,N=m.memoizedProps;try{Xs(m.type,N,g,m)}catch(j){An(m,m.return,j)}}function yA(m,g){for(ng(m.containerInfo),Fs=g;Fs!==null;)if(m=Fs,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,Fs=g;else for(;Fs!==null;){m=Fs;var N=m.alternate;switch(g=m.flags,m.tag){case 0:if((g&4)!==0&&(g=m.updateQueue,g=g!==null?g.events:null,g!==null))for(var j=0;j<g.length;j++){var H=g[j];H.ref.impl=H.nextImpl}break;case 11:case 15:break;case 1:if((g&1024)!==0&&N!==null){g=void 0,j=m,H=N.memoizedProps,N=N.memoizedState;var W=j.stateNode;try{var fe=Vu(j.type,H);g=W.getSnapshotBeforeUpdate(fe,N),W.__reactInternalSnapshotBeforeUpdate=g}catch(Ue){An(j,j.return,Ue)}}break;case 3:(g&1024)!==0&&cr&&X0(m.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((g&1024)!==0)throw Error(s(163))}if(g=m.sibling,g!==null){g.return=m.return,Fs=g;break}Fs=m.return}}function t1(m,g,N){var j=N.flags;switch(N.tag){case 0:case 11:case 15:ea(m,N),j&4&&ul(5,N);break;case 1:if(ea(m,N),j&4)if(m=N.stateNode,g===null)try{m.componentDidMount()}catch(fe){An(N,N.return,fe)}else{var H=Vu(N.type,g.memoizedProps);g=g.memoizedState;try{m.componentDidUpdate(H,g,m.__reactInternalSnapshotBeforeUpdate)}catch(fe){An(N,N.return,fe)}}j&64&&nf(N),j&512&&rf(N,N.return);break;case 3:if(ea(m,N),j&64&&(j=N.updateQueue,j!==null)){if(m=null,N.child!==null)switch(N.child.tag){case 27:case 5:m=pf(N.child.stateNode);break;case 1:m=N.child.stateNode}try{Ds(j,m)}catch(fe){An(N,N.return,fe)}}break;case 27:oi&&g===null&&j&4&&e1(N);case 26:case 5:if(ea(m,N),g===null){if(j&4)qu(N);else if(j&64){m=N.type,g=N.memoizedProps,H=N.stateNode;try{L1(H,m,g,N)}catch(fe){An(N,N.return,fe)}}}j&512&&rf(N,N.return);break;case 12:ea(m,N);break;case 31:ea(m,N),j&4&&ho(m,N);break;case 13:ea(m,N),j&4&&Uh(m,N),j&64&&(j=N.memoizedState,j!==null&&(j=j.dehydrated,j!==null&&(N=vA.bind(null,N),cg(j,N))));break;case 22:if(j=N.memoizedState!==null||Ts,!j){g=g!==null&&g.memoizedState!==null||Rs,H=Ts;var W=Rs;Ts=j,(Rs=g)&&!W?po(m,N,(N.subtreeFlags&8772)!==0):ea(m,N),Ts=H,Rs=W}break;case 30:break;default:ea(m,N)}}function A0(m){var g=m.alternate;g!==null&&(m.alternate=null,A0(g)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(g=m.stateNode,g!==null&&rg(g)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pen
4503dingProps=null,m.stateNode=null,m.updateQueue=null}function fo(m,g,N){for(N=N.child;N!==null;)Fh(m,g,N),N=N.sibling}function Fh(m,g,N){if(Sa&&typeof Sa.onCommitFiberUnmount=="function")try{Sa.onCommitFiberUnmount(ld,N)}catch{}switch(N.tag){case 26:if(yo){Rs||Hi(N,g),fo(m,g,N),N.memoizedState?Zc(N.memoizedState):N.stateNode&&lb(N.stateNode);break}case 27:if(oi){Rs||Hi(N,g);var j=Ss,H=Us;id(N.type)&&(Ss=N.stateNode,Us=!1),fo(m,g,N),vi(N.stateNode),Ss=j,Us=H;break}case 5:Rs||Hi(N,g);case 6:if(cr){if(j=Ss,H=Us,Ss=null,fo(m,g,N),Ss=j,Us=H,Ss!==null)if(Us)try{W0(Ss,N.stateNode)}catch(W){An(N,g,W)}else try{x1(Ss,N.stateNode)}catch(W){An(N,g,W)}}else fo(m,g,N);break;case 18:cr&&Ss!==null&&(Us?ug(Ss,N.stateNode):rb(Ss,N.stateNode));break;case 4:cr?(j=Ss,H=Us,Ss=N.stateNode.containerInfo,Us=!0,fo(m,g,N),Ss=j,Us=H):(Ua&&N0(N.stateNode,N,q0()),fo(m,g,N));break;case 0:case 11:case 14:case 15:dl(2,N,g),Rs||dl(4,N,g),fo(m,g,N);break;case 1:Rs||(Hi(N,g),j=N.stateNode,typeof j.componentWillUnmount=="function"&&Fp(N,g,j)),fo(m,g,N);break;case 21:fo(m,g,N);break;case 22:Rs=(j=Rs)||N.memoizedState!==null,fo(m,g,N),Rs=j;break;default:fo(m,g,N)}}function ho(m,g){if(us&&g.memoizedState===null&&(m=g.alternate,m!==null&&(m=m.memoizedState,m!==null))){m=m.dehydrated;try{MA(m)}catch(N){An(g,g.return,N)}}}function Uh(m,g){if(us&&g.memoizedState===null&&(m=g.alternate,m!==null&&(m=m.memoizedState,m!==null&&(m=m.dehydrated,m!==null))))try{NA(m)}catch(N){An(g,g.return,N)}}function mo(m){switch(m.tag){case 31:case 13:case 19:var g=m.stateNode;return g===null&&(g=m.stateNode=new bb),g;case 22:return m=m.stateNode,g=m._retryCache,g===null&&(g=m._retryCache=new bb),g;default:throw Error(s(435,m.tag))}}function Ql(m,g){var N=mo(m);g.forEach(function(j){if(!N.has(j)){N.add(j);var H=wA.bind(null,m,j);j.then(H,H)}})}function bi(m,g){var N=g.deletions;if(N!==null)for(var j=0;j<N.length;j++){var H=N[j],W=m,fe=g;if(cr){var Ue=fe;e:for(;Ue!==null;){switch(Ue.tag){case 27:if(oi){if(id(Ue.type)){Ss=Ue.stateNode,Us=!1;break e}break}case 5:Ss=Ue.stateNode,Us=!1;break e;case 3:case 4:Ss=Ue.stateNode.containerInfo,Us=!0;break e}Ue=Ue.return}if(Ss===null)throw Error(s(160));Fh(W,fe,H),Ss=null,Us=!1}else Fh(W,fe,H);W=H.alternate,W!==null&&(W.return=null),H.return=null}if(g.subtreeFlags&13886)for(g=g.child;g!==null;)zh(g,m),g=g.sibling}function zh(m,g){var N=m.alternate,j=m.flags;switch(m.tag){case 0:case 11:case 14:case 15:bi(g,m),yi(m),j&4&&(dl(3,m,m.return),ul(3,m),dl(5,m,m.return));break;case 1:bi(g,m),yi(m),j&512&&(Rs||N===null||Hi(N,N.return)),j&64&&Ts&&(m=m.updateQueue,m!==null&&(j=m.callbacks,j!==null&&(N=m.shared.hiddenCallbacks,m.shared.hiddenCallbacks=N===null?j:N.concat(j))));break;case 26:if(yo){var H=Ur;if(bi(g,m),yi(m),j&512&&(Rs||N===null||Hi(N,N.return)),j&4){j=N!==null?N.memoizedState:null;var W=m.memoizedState;N===null?W===null?m.stateNode===null?m.stateNode=H1(H,m.type,m.memoizedProps,m):ob(H,m.type,m.stateNode):m.stateNode=ab(H,W,m.memoizedProps):j!==W?(j===null?N.stateNode!==null&&lb(N.stateNode):Zc(j),W===null?ob(H,m.type,m.stateNode):ab(H,W,m.memoizedProps)):W===null&&m.stateNode!==null&&Lh(m,m.memoizedProps,N.memoizedProps)}break}case 27:if(oi){bi(g,m),yi(m),j&512&&(Rs||N===null||Hi(N,N.return)),N!==null&&j&4&&Lh(m,m.memoizedProps,N.memoizedProps);break}case 5:if(bi(g,m),yi(m),j&512&&(Rs||N===null||Hi(N,N.return)),cr){if(m.flags&32){H=m.stateNode;try{$0(H)}catch(Dt){An(m,m.return,Dt)}}j&4&&m.stateNode!=null&&(H=m.memoizedProps,Lh(m,H,N!==null?N.memoizedProps:H)),j&1024&&(Sf=!0)}else Ua&&m.alternate!==null&&(m.alternate.stateNode=m.stateNode);break;case 6:if(bi(g,m),yi(m),j&4&&cr){if(m.stateNode===null)throw Error(s(162));j=m.memoizedProps,N=N!==null?N.memoizedProps:j,H=m.stateNode;try{f1(H,N,j)}catch(Dt){An(m,m.return,Dt)}}break;case 3:if(yo?(V1(),H=Ur,Ur=Zh(g.containerInfo),bi(g,m),Ur=H):bi(g,m),yi(m),j&4){if(cr&&us&&N!==null&&N.memoizedState.isDehydrated)try{O1(g.containerInfo)}catch(Dt){An(m,m.return,Dt)}if(Ua){j=g.containerInfo,N=g.pendingChildren;try{Q0(j,N)}catch(Dt){An(m,m.return,Dt)}}}Sf&&(Sf=!1,zp(m));break;case 4:yo?(N=Ur,Ur=Zh(m.stateNode.containerInfo),bi(g,m),yi(m),Ur=N):(bi(g,m),yi(m)),j&4&&Ua&&N0(m.stateNode,m,m.stateNode.pendingChildren);break;case 12:bi(g,m),yi(m);break;case 31:bi(g,m),yi(m),j&4&&(j=m.updateQueue,j!==null&&(m.updateQueue=null,Ql(m,j)));break;case 13:bi(g,m),yi(m),m.child.flags&8192&&m.memoizedState!==null!=(N!==null&&N.memoizedState!==null)&&(cm=Vi()),j&4&&(j=m.updateQueue,j!==null&&(m.updateQueue=null,Ql(m,j)));break;case 22:H=m.memoizedState!==null;var fe=N!==null&&N.memoizedState!==null,Ue=Ts,pt=Rs;if(Ts=Ue||H,Rs=pt||fe,bi(g,m),Rs=pt,Ts=Ue,yi(m),j&8192&&(g=m.stateNode,g._visibility=H?g._visibility&-2:g._visibility|1,H&&(N===null||fe||Ts||Rs||Uc(m)),cr)){e:if(N=null,cr)for(g=m;;
4503){if(g.tag===5||yo&&g.tag===26){if(N===null){fe=N=g;try{W=fe.stateNode,H?SA(W):y1(fe.stateNode,fe.memoizedProps)}catch(Dt){An(fe,fe.return,Dt)}}}else if(g.tag===6){if(N===null){fe=g;try{var Tt=fe.stateNode;H?b1(Tt):v1(Tt,fe.memoizedProps)}catch(Dt){An(fe,fe.return,Dt)}}}else if(g.tag===18){if(N===null){fe=g;try{var Lt=fe.stateNode;H?U1(Lt):z1(fe.stateNode)}catch(Dt){An(fe,fe.return,Dt)}}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===m)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===m)break e;for(;g.sibling===null;){if(g.return===null||g.return===m)break e;N===g&&(N=null),g=g.return}N===g&&(N=null),g.sibling.return=g.return,g=g.sibling}}j&4&&(j=m.updateQueue,j!==null&&(N=j.retryQueue,N!==null&&(j.retryQueue=null,Ql(m,N))));break;case 19:bi(g,m),yi(m),j&4&&(j=m.updateQueue,j!==null&&(m.updateQueue=null,Ql(m,j)));break;case 30:break;case 21:break;default:bi(g,m),yi(m)}}function yi(m){var g=m.flags;if(g&2){try{for(var N,j=m.return;j!==null;){if(M0(j)){N=j;break}j=j.return}if(cr){if(N==null)throw Error(s(160));switch(N.tag){case 27:if(oi){var H=N.stateNode,W=Yl(m);Oh(m,W,H);break}case 5:var fe=N.stateNode;N.flags&32&&($0(fe),N.flags&=-33);var Ue=Yl(m);Oh(m,Ue,fe);break;case 3:case 4:var pt=N.stateNode.containerInfo,Tt=Yl(m);Up(m,Tt,pt);break;default:throw Error(s(161))}}}catch(Lt){An(m,m.return,Lt)}m.flags&=-3}g&4096&&(m.flags&=-4097)}function zp(m){if(m.subtreeFlags&1024)for(m=m.child;m!==null;){var g=m;zp(g),g.tag===5&&g.flags&1024&&F0(g.stateNode),m=m.sibling}}function ea(m,g){if(g.subtreeFlags&8772)for(g=g.child;g!==null;)t1(m,g.alternate,g),g=g.sibling}function Uc(m){for(m=m.child;m!==null;){var g=m;switch(g.tag){case 0:case 11:case 14:case 15:dl(4,g,g.return),Uc(g);break;case 1:Hi(g,g.return);var N=g.stateNode;typeof N.componentWillUnmount=="function"&&Fp(g,g.return,N),Uc(g);break;case 27:oi&&vi(g.stateNode);case 26:case 5:Hi(g,g.return),Uc(g);break;case 22:g.memoizedState===null&&Uc(g);break;case 30:Uc(g);break;default:Uc(g)}m=m.sibling}}function po(m,g,N){for(N=N&&(g.subtreeFlags&8772)!==0,g=g.child;g!==null;){var j=g.alternate,H=m,W=g,fe=W.flags;switch(W.tag){case 0:case 11:case 15:po(H,W,N),ul(4,W);break;case 1:if(po(H,W,N),j=W,H=j.stateNode,typeof H.componentDidMount=="function")try{H.componentDidMount()}catch(Tt){An(j,j.return,Tt)}if(j=W,H=j.updateQueue,H!==null){var Ue=j.stateNode;try{var pt=H.shared.hiddenCallbacks;if(pt!==null)for(H.shared.hiddenCallbacks=null,H=0;H<pt.length;H++)xi(pt[H],Ue)}catch(Tt){An(j,j.return,Tt)}}N&&fe&64&&nf(W),rf(W,W.return);break;case 27:oi&&e1(W);case 26:case 5:po(H,W,N),N&&j===null&&fe&4&&qu(W),rf(W,W.return);break;case 12:po(H,W,N);break;case 31:po(H,W,N),N&&fe&4&&ho(H,W);break;case 13:po(H,W,N),N&&fe&4&&Uh(H,W);break;case 22:W.memoizedState===null&&po(H,W,N),rf(W,W.return);break;case 30:break;default:po(H,W,N)}g=g.sibling}}function zc(m,g){var N=null;m!==null&&m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(N=m.memoizedState.cachePool.pool),m=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(m=g.memoizedState.cachePool.pool),m!==N&&(m!=null&&m.refCount++,N!=null&&Y(N))}function C0(m,g){m=null,g.alternate!==null&&(m=g.alternate.memoizedState.cache),g=g.memoizedState.cache,g!==m&&(g.refCount++,m!=null&&Y(m))}function bs(m,g,N,j){if(g.subtreeFlags&10256)for(g=g.child;g!==null;)Gp(m,g,N,j),g=g.sibling}function Gp(m,g,N,j){var H=g.flags;switch(g.tag){case 0:case 11:case 15:bs(m,g,N,j),H&2048&&ul(9,g);break;case 1:bs(m,g,N,j);break;case 3:bs(m,g,N,j),H&2048&&(m=null,g.alternate!==null&&(m=g.alternate.memoizedState.cache),g=g.memoizedState.cache,g!==m&&(g.refCount++,m!=null&&Y(m)));break;case 12:if(H&2048){bs(m,g,N,j),m=g.stateNode;try{var W=g.memoizedProps,fe=W.id,Ue=W.onPostCommit;typeof Ue=="function"&&Ue(fe,g.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(pt){An(g,g.return,pt)}}else bs(m,g,N,j);break;case 31:bs(m,g,N,j);break;case 13:bs(m,g,N,j);break;case 23:break;case 22:W=g.stateNode,fe=g.alternate,g.memoizedState!==null?W._visibility&2?bs(m,g,N,j):sf(m,g):W._visibility&2?bs(m,g,N,j):(W._visibility|=2,ga(m,g,N,j,(g.subtreeFlags&10256)!==0||!1)),H&2048&&zc(fe,g);break;
4503case 24:bs(m,g,N,j),H&2048&&C0(g.alternate,g);break;default:bs(m,g,N,j)}}function ga(m,g,N,j,H){for(H=H&&((g.subtreeFlags&10256)!==0||!1),g=g.child;g!==null;){var W=m,fe=g,Ue=N,pt=j,Tt=fe.flags;switch(fe.tag){case 0:case 11:case 15:ga(W,fe,Ue,pt,H),ul(8,fe);break;case 23:break;case 22:var Lt=fe.stateNode;fe.memoizedState!==null?Lt._visibility&2?ga(W,fe,Ue,pt,H):sf(W,fe):(Lt._visibility|=2,ga(W,fe,Ue,pt,H)),H&&Tt&2048&&zc(fe.alternate,fe);break;case 24:ga(W,fe,Ue,pt,H),H&&Tt&2048&&C0(fe.alternate,fe);break;default:ga(W,fe,Ue,pt,H)}g=g.sibling}}function sf(m,g){if(g.subtreeFlags&10256)for(g=g.child;g!==null;){var N=m,j=g,H=j.flags;switch(j.tag){case 22:sf(N,j),H&2048&&zc(j.alternate,j);break;case 24:sf(N,j),H&2048&&C0(j.alternate,j);break;default:sf(N,j)}g=g.sibling}}function fl(m,g,N){if(m.subtreeFlags&Va)for(m=m.child;m!==null;)Gc(m,g,N),m=m.sibling}function Gc(m,g,N){switch(m.tag){case 26:if(fl(m,g,N),m.flags&Va)if(m.memoizedState!==null)W1(N,Ur,m.memoizedState,m.memoizedProps);else{var j=m.stateNode,H=m.type;m=m.memoizedProps,((g&335544128)===g||L0(H,m))&&sg(N,j,H,m)}break;case 5:fl(m,g,N),m.flags&Va&&(j=m.stateNode,H=m.type,m=m.memoizedProps,((g&335544128)===g||L0(H,m))&&sg(N,j,H,m));break;case 3:case 4:yo?(j=Ur,Ur=Zh(m.stateNode.containerInfo),fl(m,g,N),Ur=j):fl(m,g,N);break;case 22:m.memoizedState===null&&(j=m.alternate,j!==null&&j.memoizedState!==null?(j=Va,Va=16777216,fl(m,g,N),Va=j):fl(m,g,N));break;default:fl(m,g,N)}}function Hp(m){var g=m.alternate;if(g!==null&&(m=g.child,m!==null)){g.child=null;do g=m.sibling,m.sibling=null,m=g;while(m!==null)}}function af(m){var g=m.deletions;if((m.flags&16)!==0){if(g!==null)for(var N=0;N<g.length;N++){var j=g[N];Fs=j,La(j,m)}Hp(m)}if(m.subtreeFlags&10256)for(m=m.child;m!==null;)Vp(m),m=m.sibling}function Vp(m){switch(m.tag){case 0:case 11:case 15:af(m),m.flags&2048&&dl(9,m,m.return);break;case 3:af(m);break;case 12:af(m);break;case 22:var g=m.stateNode;m.memoizedState!==null&&g._visibility&2&&(m.return===null||m.return.tag!==13)?(g._visibility&=-3,Gh(m)):af(m);break;default:af(m)}}function Gh(m){var g=m.deletions;if((m.flags&16)!==0){if(g!==null)for(var N=0;N<g.length;N++){var j=g[N];Fs=j,La(j,m)}Hp(m)}for(m=m.child;m!==null;){switch(g=m,g.tag){case 0:case 11:case 15:dl(8,g,g.return),Gh(g);break;case 22:N=g.stateNode,N._visibility&2&&(N._visibility&=-3,Gh(g));break;default:Gh(g)}m=m.sibling}}function La(m,g){for(;Fs!==null;){var N=Fs;switch(N.tag){case 0:case 11:case 15:dl(8,N,g);break;case 23:case 22:if(N.memoizedState!==null&&N.memoizedState.cachePool!==null){var j=N.memoizedState.cachePool.pool;j!=null&&j.refCount++}break;case 24:Y(N.memoizedState.cache)}if(j=N.child,j!==null)j.return=N,Fs=j;else e:for(N=m;Fs!==null;){j=Fs;var H=j.sibling,W=j.return;if(A0(j),j===N){Fs=null;break e}if(H!==null){H.return=W,Fs=H;break e}Fs=W}}}function Hc(m){var g=zn(m);if(g!=null){if(typeof g.memoizedProps["data-testname"]!="string")throw Error(s(364));return g}if(m=Ls(m),m===null)throw Error(s(362));return m.stateNode.current}function Vc(m,g){var N=m.tag;switch(g.$$typeof){case Co:if(m.type===g.value)return!0;break;case Mf:e:{for(g=g.value,m=[m,0],N=0;N<m.length;){var j=m[N++],H=j.tag,W=m[N++],fe=g[W];if(H!==5&&H!==26&&H!==27||!Kc(j)){for(;fe!=null&&Vc(j,fe);)W++,fe=g[W];if(W===g.length){g=!0;break e}else for(j=j.child;j!==null;)m.push(j,W),j=j.sibling}}g=!1}return g;case Nf:if((N===5||N===26||N===27)&&G0(m.stateNode,g.value))return!0;break;case iu:if((N===5||N===6||N===26||N===27)&&(m=Kh(m),m!==null&&0<=m.indexOf(g.value)))return!0;break;case om:if((N===5||N===26||N===27)&&(m=m.memoizedProps["data-testname"],typeof m=="string"&&m.toLowerCase()===g.value.toLowerCase()))return!0;break;default:throw Error(s(365))}return!1}function of(m){switch(m.$$typeof){case Co:return"<"+(p(m.value)||"Unknown")+">";case Mf:return":has("+(of(m)||"")+")";case Nf:return'[role="'+m.value+'"]';case iu:return'"'+m.value+'"';case om:return'[data-testname="'+m.value+'"]';default:throw Error(s(365))}}function lf(m,g){var N=[];m=[m,0];for(var j=0;j<m.length;){var H=m[j++],W=H.tag,fe=m[j++],Ue=g[fe];if(W!==5&&W!==26&&W!==27||!Kc(H)){for(;
vendor: 4,742 bytes, line 4503
4503Ue!=null&&Vc(H,Ue);)fe++,Ue=g[fe];if(fe===g.length)N.push(H);else for(H=H.child;H!==null;)m.push(H,fe),H=H.sibling}}return N}function xa(m,g){if(!ai)throw Error(s(363));m=Hc(m),m=lf(m,g),g=[],m=Array.from(m);for(var N=0;N<m.length;){var j=m[N++],H=j.tag;if(H===5||H===26||H===27)Kc(j)||g.push(j.stateNode);else for(j=j.child;j!==null;)m.push(j),j=j.sibling}return g}function cs(){return(er&2)!==0&&ir!==0?ir&-ir:pn.T!==null?Se():xf()}function Kl(){if(aa===0)if((ir&536870912)===0||sr){var m=od;od<<=1,(od&3932160)===0&&(od=262144),aa=m}else aa=536870912;return m=_a.current,m!==null&&(m.flags|=32),aa}function ys(m,g,N){(m===qn&&(zr===2||zr===9)||m.cancelPendingCommit!==null)&&(Es(m,0),ml(m,ir,aa,!1)),D(m,N),((er&2)===0||m!==qn)&&(m===qn&&((er&2)===0&&(lu|=N),_s===4&&ml(m,ir,aa,!1)),Ie(m))}function Fo(m,g,N){if((er&6)!==0)throw Error(s(327));var j=!N&&(g&127)===0&&(g&m.expiredLanes)===0||A(m,g),H=j?s1(m,g):pl(m,g,!0),W=j;do{if(H===0){au&&!j&&ml(m,g,0,!1);break}else{if(N=m.current.alternate,W&&!n1(N)){H=pl(m,g,!1),W=!1;continue}if(H===2){if(W=g,m.errorRecoveryDisabledLanes&W)var fe=0;else fe=m.pendingLanes&-536870913,fe=fe!==0?fe:fe&536870912?536870912:0;if(fe!==0){g=fe;e:{var Ue=m;H=lm;var pt=us&&Ue.current.memoizedState.isDehydrated;if(pt&&(Es(Ue,fe).flags|=256),fe=pl(Ue,fe,!1),fe!==2){if(ou&&!pt){Ue.errorRecoveryDisabledLanes|=W,lu|=W,H=4;break e}W=Na,Na=H,W!==null&&(Na===null?Na=W:Na.push.apply(Na,W))}H=fe}if(W=!1,H!==2)continue}}if(H===1){Es(m,0),ml(m,g,0,!0);break}e:{switch(j=m,W=H,W){case 0:case 1:throw Error(s(345));case 4:if((g&4194048)!==g)break;case 6:ml(j,g,aa,!Ho);break e;case 2:Na=null;break;case 3:case 5:break;default:throw Error(s(329))}if((g&62914560)===g&&(H=cm+300-Vi(),10<H)){if(ml(j,g,aa,!Ho),S(j,0,!0)!==0)break e;jl=g,j.timeoutHandle=B0(hl.bind(null,j,N,Na,um,Ag,g,aa,lu,Cf,Ho,W,"Throttled",-0,0),H);break e}hl(j,N,Na,um,Ag,g,aa,lu,Cf,Ho,W,null,-0,0)}}break}while(!0);Ie(m)}function hl(m,g,N,j,H,W,fe,Ue,pt,Tt,Lt,Dt,Kt,On){if(m.timeoutHandle=va,Dt=g.subtreeFlags,Dt&8192||(Dt&16785408)===16785408){Dt=O0(),Gc(g,W,Dt);var zs=(W&62914560)===W?cm-Vi():(W&4194048)===W?md-Vi():0;if(zs=d1(Dt,zs),zs!==null){jl=W,m.cancelPendingCommit=zs(xl.bind(null,m,g,W,N,j,H,fe,Ue,pt,Lt,Dt,null,Kt,On)),ml(m,W,fe,!Tt);return}}xl(m,g,W,N,j,H,fe,Ue,pt)}function n1(m){for(var g=m;;){var N=g.tag;if((N===0||N===11||N===15)&&g.flags&16384&&(N=g.updateQueue,N!==null&&(N=N.stores,N!==null)))for(var j=0;j<N.length;j++){var H=N[j],W=H.getSnapshot;H=H.value;try{if(!Os(W(),H))return!1}catch{return!1}}if(N=g.child,g.subtreeFlags&16384&&N!==null)N.return=g,g=N;else{if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function ml(m,g,N,j){g&=~Af,g&=~lu,m.suspendedLanes|=g,m.pingedLanes&=~g,j&&(m.warmLanes|=g),j=m.expirationTimes;for(var H=g;0<H;){var W=31-wa(H),fe=1<<W;j[W]=-1,H&=~fe}N!==0&&P(m,N,g)}function Wp(){return(er&6)===0?(Ve(0),!1):!0}function $p(){if(tr!==null){if(zr===0)var m=tr.return;else m=tr,zo=Kr=null,nn(m),nu=null,cd=0,m=tr;for(;m!==null;)Zv(m.alternate,m),m=m.return;tr=null}}function Es(m,g){var N=m.timeoutHandle;N!==va&&(m.timeoutHandle=va,u1(N)),N=m.cancelPendingCommit,N!==null&&(m.cancelPendingCommit=null,N()),jl=0,$p(),qn=m,tr=N=Fa(m.current,null),ir=g,zr=0,qs=null,Ho=!1,au=A(m,g),ou=!1,Cf=aa=Af=lu=cc=_s=0,Na=lm=null,Ag=!1,(g&8)!==0&&(g|=g&32);var j=m.entangledLanes;if(j!==0)for(m=m.entanglements,j&=g;0<j;){var H=31-wa(j),W=1<<H;g|=m[H],j&=~W}return El=g,an(),N}function Qr(m,g){Gn=null,pn.H=Ha,g===ui||g===No?(g=Mt(),zr=3):g===Mg?(g=Mt(),zr=4):zr=g===ia?8:g!==null&&typeof g=="object"&&typeof g.then=="function"?6:1,qs=g,tr===null&&(_s=1,Ip(m,oe(g,m.current)))}function lr(){var m=_a.current;return m===null?!0:(ir&4194048)===ir?Ma===null:(ir&62914560)===ir||(ir&536870912)!==0?m===Ma:!1}function Jl(){var m=pn.H;return pn.H=Ha,m===null?Ha:m}function Oa(){var m=pn.A;return pn.A=_f,m}function cf(){_s=4,Ho||(ir&4194048)!==ir&&_a.current!==null||(au=!0),(cc&134217727)===0&&(lu&134217727)===0||qn===null||ml(qn,ir,aa,!1)}function pl(m,g,N){var j=er;er|=2;var H=Jl(),W=Oa();(qn!==m||ir!==g)&&(um=null,Es(m,g)),g=!1;var fe=_s;e:do try{if(zr!==0&&tr!==null){var Ue=tr,pt=qs;switch(zr){case 8:$p(),fe=6;break e;case 3:case 2:case 9:case 6:_a.current===null&&(g=!0);var Tt=zr;if(zr=0,qs=null,gl(m,Ue,pt,Tt),N&&au){fe=0;break e}break;default:Tt=zr,zr=0,qs=null,gl(m,Ue,pt,Tt)}}r1(),fe=_s;break}catch(Lt){Qr(m,Lt)}while(!0);return g&&m.shellSuspendCounter++,zo=Kr=null,er=j,pn.H=H,pn.A=W,tr===null&&(qn=null,ir=0,an()),fe}function r1(){for(;tr!==null;)Wc(tr)}function s1(m,g){var N=er;er|=2;var j=Jl(),H=Oa();qn!==m||ir!==g?(um=null,cu=Vi()+500,Es(m,g)):au=A(m,g);e:do try{if(zr!==0&&tr!==null){g=tr;var W=qs;
vendor: 5,006 bytes, line 4503
4503t:switch(zr){case 1:zr=0,qs=null,gl(m,g,W,1);break;case 2:case 9:if(st(W)){zr=0,qs=null,Xp(g);break}g=function(){zr!==2&&zr!==9||qn!==m||(zr=7),Ie(m)},W.then(g,g);break e;case 3:zr=7;break e;case 4:zr=5;break e;case 7:st(W)?(zr=0,qs=null,Xp(g)):(zr=0,qs=null,gl(m,g,W,7));break;case 5:var fe=null;switch(tr.tag){case 26:fe=tr.memoizedState;case 5:case 27:var Ue=tr,pt=Ue.type,Tt=Ue.pendingProps;if(fe?ub(fe):vs(Ue.stateNode,pt,Tt)){zr=0,qs=null;var Lt=Ue.sibling;if(Lt!==null)tr=Lt;else{var Dt=Ue.return;Dt!==null?(tr=Dt,df(Dt)):tr=null}break t}}zr=0,qs=null,gl(m,g,W,5);break;case 6:zr=0,qs=null,gl(m,g,W,6);break;case 8:$p(),_s=6;break e;default:throw Error(s(462))}}uf();break}catch(Kt){Qr(m,Kt)}while(!0);return zo=Kr=null,pn.H=j,pn.A=H,er=N,tr!==null?0:(qn=null,ir=0,an(),_s)}function uf(){for(;tr!==null&&!X1();)Wc(tr)}function Wc(m){var g=v0(m.alternate,m,El);m.memoizedProps=m.pendingProps,g===null?df(m):tr=g}function Xp(m){var g=m,N=g.alternate;switch(g.tag){case 15:case 0:g=m0(N,g,g.pendingProps,g.type,void 0,ir);break;case 11:g=m0(N,g,g.pendingProps,g.type.render,g.ref,ir);break;case 5:nn(g);default:Zv(N,g),g=tr=Qp(g,El),g=v0(N,g,El)}m.memoizedProps=m.pendingProps,g===null?df(m):tr=g}function gl(m,g,N,j){zo=Kr=null,nn(g),nu=null,cd=0;var H=g.return;try{if(bA(m,H,g,N,ir)){_s=1,Ip(m,oe(N,m.current)),tr=null;return}}catch(W){if(H!==null)throw tr=H,W;_s=1,Ip(m,oe(N,m.current)),tr=null;return}g.flags&32768?(sr||j===1?m=!0:au||(ir&536870912)!==0?m=!1:(Ho=m=!0,(j===2||j===9||j===3||j===6)&&(j=_a.current,j!==null&&j.tag===13&&(j.flags|=16384))),$c(g,m)):df(g)}function df(m){var g=m;do{if((g.flags&32768)!==0){$c(g,Ho);return}m=g.return;var N=Jv(g.alternate,g,El);if(N!==null){tr=N;return}if(g=g.sibling,g!==null){tr=g;return}tr=g=m}while(g!==null);_s===0&&(_s=5)}function $c(m,g){do{var N=_0(m.alternate,m);if(N!==null){N.flags&=32767,tr=N;return}if(N=m.return,N!==null&&(N.flags|=32768,N.subtreeFlags=0,N.deletions=null),!g&&(m=m.sibling,m!==null)){tr=m;return}tr=m=N}while(m!==null);_s=6,tr=null}function xl(m,g,N,j,H,W,fe,Ue,pt){m.cancelPendingCommit=null;do yl();while(Ys!==0);if((er&6)!==0)throw Error(s(327));if(g!==null){if(g===m.current)throw Error(s(177));if(W=g.lanes|g.childLanes,W|=ud,B(m,N,W,fe,Ue,pt),m===qn&&(tr=qn=null,ir=0),pd=g,dc=m,jl=N,Ef=W,Cg=H,yb=j,(g.subtreeFlags&10256)!==0||(g.flags&10256)!==0?(m.callbackNode=null,m.callbackPriority=0,$s(tm,function(){return Hh(),null})):(m.callbackNode=null,m.callbackPriority=0),j=(g.flags&13878)!==0,(g.subtreeFlags&13878)!==0||j){j=pn.T,pn.T=null,H=bo(),rr(2),fe=er,er|=4;try{yA(m,g,N)}finally{er=fe,rr(H),pn.T=j}}Ys=1,Zl(),bl(),qp()}}function Zl(){if(Ys===1){Ys=0;var m=dc,g=pd,N=(g.flags&13878)!==0;if((g.subtreeFlags&13878)!==0||N){N=pn.T,pn.T=null;var j=bo();rr(2);var H=er;er|=4;try{zh(g,m),c1(m.containerInfo)}finally{er=H,rr(j),pn.T=N}}m.current=g,Ys=2}}function bl(){if(Ys===2){Ys=0;var m=dc,g=pd,N=(g.flags&8772)!==0;if((g.subtreeFlags&8772)!==0||N){N=pn.T,pn.T=null;var j=bo();rr(2);var H=er;er|=4;try{t1(m,g.alternate,g)}finally{er=H,rr(j),pn.T=N}}Ys=3}}function qp(){if(Ys===4||Ys===3){Ys=0,fb();var m=dc,g=pd,N=jl,j=yb;(g.subtreeFlags&10256)!==0||(g.flags&10256)!==0?Ys=5:(Ys=0,pd=dc=null,Yp(m,m.pendingLanes));var H=m.pendingLanes;if(H===0&&(uc=null),U(N),g=g.stateNode,Sa&&typeof Sa.onCommitFiberRoot=="function")try{Sa.onCommitFiberRoot(ld,g,void 0,(g.current.flags&128)===128)}catch{}if(j!==null){g=pn.T,H=bo(),rr(2),pn.T=null;try{for(var W=m.onRecoverableError,fe=0;fe<j.length;fe++){var Ue=j[fe];W(Ue.value,{componentStack:Ue.stack})}}finally{pn.T=g,rr(H)}}(jl&3)!==0&&yl(),Ie(m),H=m.pendingLanes,(N&261930)!==0&&(H&42)!==0?m===dm?yr++:(yr=0,dm=m):yr=0,us&&Jh(),Ve(0)}}function Yp(m,g){(m.pooledCacheLanes&=g)===0&&(g=m.pooledCache,g!=null&&(m.pooledCache=null,Y(g)))}function yl(){return Zl(),bl(),qp(),Hh()}function Hh(){if(Ys!==5)return!1;var m=dc,g=Ef;Ef=0;var N=U(jl),j=32>N?32:N;N=pn.T;var H=bo();try{rr(j),pn.T=null,j=Cg,Cg=null;var W=dc,fe=jl;if(Ys=0,pd=dc=null,jl=0,(er&6)!==0)throw Error(s(331));var Ue=er;if(er|=4,Vp(W.current),Gp(W,W.current,fe,j),er=Ue,Ve(0,!1),Sa&&typeof Sa.onPostCommitFiberRoot=="function")try{Sa.onPostCommitFiberRoot(ld,W)}catch{}return!0}finally{rr(H),pn.T=N,Yp(m,g)}}function Xc(m,g,N){g=oe(N,g),g=f0(m.stateNode,g,2),m=as(m,g,2),m!==null&&(D(m,2),Ie(m))}function An(m,g,N){if(m.tag===3)Xc(m,m,N);else for(;g!==null;){if(g.tag===3){Xc(g,m,N);break}else if(g.tag===1){var j=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof j.componentDidCatch=="function"&&(uc===null||!uc.has(j))){m=oe(N,m),N=Uv(2),j=as(g,N,2),j!==null&&(zv(N,j,g,m),D(j,2),Ie(j));break}}g=g.return}}function ff(m,g,N){var j=m.pingCache;if(j===null){j=m.pingCache=new Wa;var H=new Set;j.set(g,H)}else H=j.get(g),H===void 0&&(H=new Set,j.set(g,H));H.has(N)||(ou=!0,H.add(N),m=i1.bind(null,m,g,N),g.then(m,m))}function i1(m,g,N){var j=m.pingCache;j!==null&&j.delete(g),m.pingedLanes|=m.suspendedLanes&N,m.warmLanes&=~N,qn===m&&(ir&N)===N&&(_s===4||_s===3&&(ir&62914560)===ir&&300>
vendor: 1,356 bytes, line 4503
4503Vi()-cm?(er&2)===0&&Es(m,0):Af|=N,Cf===ir&&(Cf=0)),Ie(m)}function a1(m,g){g===0&&(g=C()),m=Gr(m,g),m!==null&&(D(m,g),Ie(m))}function vA(m){var g=m.memoizedState,N=0;g!==null&&(N=g.retryLane),a1(m,N)}function wA(m,g){var N=0;switch(m.tag){case 31:case 13:var j=m.stateNode,H=m.memoizedState;H!==null&&(N=H.retryLane);break;case 19:j=m.stateNode;break;case 22:j=m.stateNode._retryCache;break;default:throw Error(s(314))}j!==null&&j.delete(g),a1(m,N)}function $s(m,g){return em(m,g)}function E0(m,g,N,j){this.tag=m,this.key=N,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yu(m){return m=m.prototype,!(!m||!m.isReactComponent)}function Fa(m,g){var N=m.alternate;return N===null?(N=t(m.tag,g,m.key,m.mode),N.elementType=m.elementType,N.type=m.type,N.stateNode=m.stateNode,N.alternate=m,m.alternate=N):(N.pendingProps=g,N.type=m.type,N.flags=0,N.subtreeFlags=0,N.deletions=null),N.flags=m.flags&65011712,N.childLanes=m.childLanes,N.lanes=m.lanes,N.child=m.child,N.memoizedProps=m.memoizedProps,N.memoizedState=m.memoizedState,N.updateQueue=m.updateQueue,g=m.depen
4503dencies,N.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},N.sibling=m.sibling,N.index=m.index,N.ref=m.ref,N.refCleanup=m.refCleanup,N}function Qp(m,g){m.flags&=65011714;var N=m.alternate;return N===null?(m.childLanes=0,m.lanes=g,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=N.childLanes,m.lanes=N.lanes,m.child=N.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=N.memoizedProps,m.memoizedState=N.memoizedState,m.updateQueue=N.updateQueue,m.type=N.type,g=N.dependencies,m.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext}),m}function ec(m,g,N,j,H,W){var fe=0;if(j=m,typeof m=="function")Yu(m)&&(fe=1);else if(typeof m=="string")fe=yo&&oi?dg(m,N,wi.current)?26:db(m)?27:5:yo?dg(m,N,wi.current)?26:5:oi&&db(m)?27:5;else e:switch(m){case Xh:return m=t(31,N,g,H),m.elementType=Xh,m.lanes=W,m;case Zu:return go(N.children,H,W,g);case ed:fe=8,H|=24;break;case td:return m=t(12,N,g,H|2),m.elementType=td,m.lanes=W,m;case eg:return m=t(13,N,g,H),m.elementType=eg,m.lanes=W,m;case tc:return m=t(19,N,g,H),m.elementType=tc,m.lanes=W,m;default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case xo:fe=10;break e;case $h:fe=9;break e;case hf:fe=11;break e;case tg:fe=14;break e;case ta:fe=16,j=null;break e}fe=29,N=Error(s(130,m===null?"null":typeof m,"")),j=null}return g=t(fe,N,g,H),g.elementType=m,g.type=j,g.lanes=W,g}function go(m,g,N,j){return m=t(7,m,j,g),m.lanes=N,m}function j0(m,g,N){return m=t(6,m,null,g),m.lanes=N,m}function T0(m){var g=t(18,null,null,0);return g.stateNode=m,g}function R0(m,g,N){return g=t(4,m.children!==null?m.children:[],m.key,g),g.lanes=N,g.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},g}function o1(m,g,N,j,H,W,fe,Ue,pt){this.tag=1,this.containerInfo=m,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=va,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=I(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=I(0),this.hiddenUpdates=I(null),this.identifierPrefix=j,this.onUncaughtError=H,this.onCaughtError=W,this.onRecoverableError=fe,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=pt,this.incompleteTransitions=new Map}function qc(m,g,N,j,H,W,fe,Ue,pt,Tt,Lt,Dt){return m=new o1(m,g,N,fe,pt,Tt,Lt,Dt,Ue),g=1,W===!0&&(g|=24),W=t(3,null,null,g),m.current=W,W.stateNode=m,g=ge(),g.refCount++,m.pooledCache=g,g.refCount++,W.memoizedState={element:j,isDehydrated:N,cache:g},jr(W),m}function Kp(m){return m?(m=wl,m):wl}function Vh(m){var g=m._reactInternals;if(g===void 0)throw typeof m.render=="function"?Error(s(188)):(m=Object.keys(m).join(","),Error(s(268,m)));return m=l(g),m=m!==null?u(m):null,m===null?null:pf(m.stateNode)}function P0(m,g,N,j,H,W){H=Kp(H),j.context===null?j.context=H:j.pendingContext=H,j=Tr(g),j.payload={element:N},W=W===void 0?null:W,W!==null&&(j.callback=W),N=as(m,j,g),N!==null&&(ys(N,m,g),Ps(N,m,g))}function Qu(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var N=m.retryLane;m.retryLane=N!==0&&N<g?N:g}}function Wh(m,g){Qu(m,g),(m=m.alternate)&&Qu(m,g)}var $n={},Jp=Ft,ba=Wme,Zp=Object.assign,Ku=Symbol.for("react.element"),vl=Symbol.for("react.transitional.element"),Ju=Symbol.for("react.portal"),Zu=Symbol.for("react.fragment"),ed=Symbol.for("react.strict_mode"),td=Symbol.for("react.profiler"),$h=Symbol.for("react.consumer"),xo=Symbol.for("react.context"),hf=Symbol.for("react.forward_ref"),eg=Symbol.for("react.suspense"),tc=Symbol.for("react.suspense_list"),tg=Symbol.for("react.memo"),ta=Symbol.for("react.lazy"),Xh=Symbol.for("react.activity"),D0=Symbol.for("react.memo_cache_sentinel"),nc=Symbol.iterator,Yc=Symbol.for("react.client.reference"),Qc=Array.isArray,pn=Jp.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,k0=e.rendererVersion,qh=e.rendererPackageName,mf=e.extraDevToolsConfig,pf=e.getPublicInstance,l1=e.getRootHostContext,gf=e.getChildHostContext,ng=e.prepareForCommit,c1=e.resetAfterCommit,I0=e.createInstance;e.cloneMutableInstance;
4503var Yh=e.appendInitialChild,ya=e.finalizeInitialChildren,na=e.shouldSetTextContent,rc=e.createTextInstance;e.cloneMutableTextInstance;var B0=e.scheduleTimeout,u1=e.cancelTimeout,va=e.noTimeout,Bs=e.isPrimaryRenderer;e.warnsIfNotActing;var cr=e.supportsMutation,Ua=e.supportsPersistence,us=e.supportsHydration,zn=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Vr=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var rr=e.setCurrentUpdatePriority,bo=e.getCurrentUpdatePriority,xf=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var nd=e.shouldAttemptEagerTransition,rg=e.detachDeletedInstance;e.requestPostPaintCallback;var Qh=e.maySuspendCommit,bf=e.maySuspendCommitOnUpdate,L0=e.maySuspendCommitInSyncRender,vs=e.preloadInstance,O0=e.startSuspendingCommit,sg=e.suspendInstance;e.suspendOnActiveViewTransition;var d1=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var rd=e.NotPendingTransition,sd=e.HostTransitionContext,F0=e.resetFormInstance;e.bindToConsole;var U0=e.supportsMicrotasks,z0=e.scheduleMicrotask,ai=e.supportsTestSelectors,Ls=e.findFiberRoot,ig=e.getBoundingRect,Kh=e.getTextContent,Kc=e.isHiddenSubtree,G0=e.matchAccessibilityRole,sc=e.setFocusIfFocusable,ag=e.setupIntersectionObserver,H0=e.appendChild,V0=e.appendChildToContainer,f1=e.commitTextUpdate,h1=e.commitMount,m1=e.commitUpdate,p1=e.insertBefore,g1=e.insertInContainerBefore,x1=e.removeChild,W0=e.removeChildFromContainer,$0=e.resetTextContent,SA=e.hideInstance,b1=e.hideTextInstance,y1=e.unhideInstance,v1=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var X0=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var w1=e.cloneInstance,q0=e.createContainerChildSet,Y0=e.appendChildToContainerChildSet,S1=e.finalizeContainerChildren,Q0=e.replaceContainerChildren,_1=e.cloneHiddenInstance,K0=e.cloneHiddenTextInstance,Jc=e.isSuspenseInstancePending,og=e.isSuspenseInstanceFallback,lg=e.getSuspenseInstanceFallbackErrorDetails,cg=e.registerSuspenseInstanceRetry,M1=e.canHydrateFormStateMarker,J0=e.isFormStateMarkerMatching,N1=e.getNextHydratableSibling,A1=e.getNextHydratableSiblingAfterSingleton,C1=e.getFirstHydratableChild,E1=e.getFirstHydratableChildWithinContainer,j1=e.getFirstHydratableChildWithinActivityInstance,T1=e.getFirstHydratableChildWithinSuspenseInstance,Z0=e.getFirstHydratableChildWithinSingleton,R1=e.canHydrateInstance,P1=e.canHydrateTextInstance,eb=e.canHydrateActivityInstance,D1=e.canHydrateSuspenseInstance,k1=e.hydrateInstance,_A=e.hydrateTextInstance,tb=e.hydrateActivityInstance,I1=e.hydrateSuspenseInstance,B1=e.getNextHydratableInstanceAfterActivityInstance,nb=e.getNextHydratableInstanceAfterSuspenseInstance,L1=e.commitHydratedInstance,O1=e.commitHydratedContainer,MA=e.commitHydratedActivityInstance,NA=e.commitHydratedSuspenseInstance,F1=e.finalizeHydratedChildren,Jh=e.flushHydrationEvents;e.clearActivityBoundary;var rb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var ug=e.clearSuspenseBoundaryFromContainer,U1=e.hideDehydratedBoundary,z1=e.unhideDehydratedBoundary,yf=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var G1=e.validateHydratableInstance,sb=e.validateHydratableTextInstance,yo=e.supportsResources,dg=e.isHostHoistableType,Zh=e.getHoistableRoot,ib=e.getResource,ab=e.acquireResource,Zc=e.releaseResource,H1=e.hydrateHoistable,ob=e.mountHoistable,lb=e.unmountHoistable,fg=e.createHoistableInstance,V1=e.prepareToCommitHoistables,cb=e.mayResourceSuspendCommit,ub=e.preloadResource,W1=e.suspendResource,oi=e.supportsSingletons,hg=e.resolveSingletonInstance,Xs=e.acquireSingletonInstance,vi=e.releaseSingletonInstance,db=e.isHostSingletonType,id=e.isSingletonScope,mg=[],ad=-1,wl={}
vendor: 5,354 bytes, line 4503
4503,wa=Math.clz32?Math.clz32:_,pg=Math.log,$1=Math.LN2,gg=256,od=262144,vf=4194304,em=ba.unstable_scheduleCallback,xg=ba.unstable_cancelCallback,X1=ba.unstable_shouldYield,fb=ba.unstable_requestPaint,Vi=ba.unstable_now,bg=ba.unstable_ImmediatePriority,q1=ba.unstable_UserBlockingPriority,tm=ba.unstable_NormalPriority,yg=ba.unstable_IdlePriority,hb=ba.log,Y1=ba.unstable_setDisableYieldValue,ld=null,Sa=null,Os=typeof Object.is=="function"?Object.is:X,vg=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var g=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(g))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},AA=Object.prototype.hasOwnProperty,wg,Sl,nm=!1,mb=new WeakMap,ic=[],_l=0,Wr=null,rm=0,vo=[],za=0,wo=null,Ri=1,Uo="",wi=x(null),ac=x(null),Pi=x(null),sm=x(null),li=null,ds=null,sr=!1,Ml=null,ra=!1,Sg=Error(s(519)),So=x(null),Kr=null,zo=null,Q1=typeof AbortController<"u"?AbortController:function(){var m=[],g=this.signal={aborted:!1,addEventListener:function(N,j){m.push(j)}};this.abort=function(){g.aborted=!0,m.forEach(function(N){return N()})}},Si=ba.unstable_scheduleCallback,CA=ba.unstable_NormalPriority,fs={$$typeof:xo,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},im=null,Fr=null,Wi=!1,_o=!1,_g=!1,eu=0,wf=null,pb=0,oc=0,ci=null,Mo=pn.S;pn.S=function(m,g){md=Vi(),typeof g=="object"&&g!==null&&typeof g.then=="function"&&Ae(m,g),Mo!==null&&Mo(m,g)};var tu=x(null),ui=Error(s(460)),Mg=Error(s(474)),No=Error(s(542)),Nl={then:function(){}},sa=null,nu=null,cd=0,Di=Wt(!0),gb=Wt(!1),ki=[],Al=0,ud=0,Ga=!1,Ng=!1,dd=x(null),ru=x(0),_a=x(null),Ma=null,js=x(0),lc=0,Gn=null,dn=null,kn=null,Xn=!1,Vn=!1,dr=!1,$i=0,Ao=0,Go=null,xb=0,Ha={readContext:ve,use:Gt,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};Ha.useEffectEvent=Ct;var ws={readContext:ve,use:Gt,useCallback:function(m,g){return Cn().memoizedState=[m,g===void 0?null:g],m},useContext:ve,useEffect:kc,useImperativeHandle:function(m,g,N){N=N!=null?N.concat([m]):null,Zn(4194308,4,al.bind(null,g,m),N)},useLayoutEffect:function(m,g){return Zn(4194308,4,m,g)},useInsertionEffect:function(m,g){Zn(4,2,m,g)},useMemo:function(m,g){var N=Cn();g=g===void 0?null:g;var j=m();if(dr){$(!0);try{m()}finally{$(!1)}}return N.memoizedState=[j,g],j},useReducer:function(m,g,N){var j=Cn();if(N!==void 0){var H=N(g);if(dr){$(!0);try{N(g)}finally{$(!1)}}}else H=g;return j.memoizedState=j.baseState=H,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:H},j.queue=m,m=m.dispatch=Gi.bind(null,Gn,m),[j.memoizedState,m]},useRef:function(m){var g=Cn();return m={current:m},g.memoizedState=m},useState:function(m){m=ii(m);var g=m.queue,N=Oo.bind(null,Gn,g);return g.dispatch=N,[m.memoizedState,N]},useDebugValue:Lc,useDeferredValue:function(m,g){var N=Cn();return Ws(N,m,g)},useTransition:function(){var m=ii(!1);return m=Gu.bind(null,Gn,m.queue,!0,!1),Cn().memoizedState=m,[!1,m]},useSyncExternalStore:function(m,g,N){var j=Gn,H=Cn();if(sr){if(N===void 0)throw Error(s(407));N=N()}else{if(N=g(),qn===null)throw Error(s(349));(ir&127)!==0||At(j,g,N)}H.memoizedState=N;var W={value:N,getSnapshot:g};return H.queue=W,kc(Dn.bind(null,j,W,m),[m]),j.flags|=2048,ln(9,{destroy:void 0},Ht.bind(null,j,W,N,g),null),N},useId:function(){var m=Cn(),g=qn.identifierPrefix;if(sr){var N=Uo,j=Ri;N=(j&~(1<<32-wa(j)-1)).toString(32)+N,g="_"+g+"R_"+N,N=$i++,0<N&&(g+="H"+N.toString(32)),g+="_"}else N=xb++,g="_"+g+"r_"+N.toString(32)+"_";return m.memoizedState=g},useHostTransitionStatus:Qd,useFormState:Is,useActionState:Is,useOptimistic:function(m){var g=Cn();g.memoizedState=g.baseState=m;var N={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return g.queue=N,g=Pp.bind(null,Gn,!0,N),N.dispatch=g,[m,g]},useMemoCache:Rr,useCacheRefresh:function(){return Cn().memoizedState=Ba.bind(null,Gn)},useEffectEvent:function(m){var g=Cn(),N={impl:m};return g.memoizedState=N,function(){if((er&2)!==0)throw Error(s(440));return N.impl.apply(void 0,arguments)}}},Cl={readContext:ve,use:Gt,useCallback:ol,useContext:ve,useEffect:co,useImperativeHandle:Bc,useInsertionEffect:Lo,useLayoutEffect:ql,useMemo:ll,useReducer:Or,useRef:Un,useState:function(){return Or(mn)},useDebugValue:Lc,useDeferredValue:function(m,g){var N=Zt();return Ph(N,dn.memoizedState,m,g)},useTransition:function(){var m=Or(mn)[0],g=Zt().memoizedState;return[typeof m=="boolean"?m:_n(m),g]},useSyncExternalStore:As,useId:Kd,useHostTransitionStatus:Qd,useFormState:lo,useActionState:lo,useOptimistic:function(m,g){var N=Zt();return Cs(N,dn,m,g)},useMemoCache:Rr,useCacheRefresh:ji};Cl.useEffectEvent=ls;var su={readContext:ve,use:Gt,useCallback:ol,useContext:ve,useEffect:co,useImperativeHandle:Bc,useInsertionEffect:Lo,useLayoutEffect:ql,useMemo:ll,useReducer:gs,useRef
4503:Un,useState:function(){return gs(mn)},useDebugValue:Lc,useDeferredValue:function(m,g){var N=Zt();return dn===null?Ws(N,m,g):Ph(N,dn.memoizedState,m,g)},useTransition:function(){var m=gs(mn)[0],g=Zt().memoizedState;return[typeof m=="boolean"?m:_n(m),g]},useSyncExternalStore:As,useId:Kd,useHostTransitionStatus:Qd,useFormState:en,useActionState:en,useOptimistic:function(m,g){var N=Zt();return dn!==null?Cs(N,dn,m,g):(N.baseState=m,[m,N.queue.dispatch])},useMemoCache:Rr,useCacheRefresh:ji};su.useEffectEvent=ls;var am={enqueueSetState:function(m,g,N){m=m._reactInternals;var j=cs(),H=Tr(j);H.payload=g,N!=null&&(H.callback=N),g=as(m,H,j),g!==null&&(ys(g,m,j),Ps(g,m,j))},enqueueReplaceState:function(m,g,N){m=m._reactInternals;var j=cs(),H=Tr(j);H.tag=1,H.payload=g,N!=null&&(H.callback=N),g=as(m,H,j),g!==null&&(ys(g,m,j),Ps(g,m,j))},enqueueForceUpdate:function(m,g){m=m._reactInternals;var N=cs(),j=Tr(N);j.tag=2,g!=null&&(j.callback=g),g=as(m,j,N),g!==null&&(ys(g,m,N),Ps(g,m,N))}},ia=Error(s(461)),ns=!1,fd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Ts=!1,Rs=!1,Sf=!1,bb=typeof WeakSet=="function"?WeakSet:Set,Fs=null,Ss=null,Us=!1,Ur=null,Va=8192,_f={getCacheForType:function(m){var g=ve(fs),N=g.data.get(m);return N===void 0&&(N=m(),g.data.set(m,N)),N},cacheSignal:function(){return ve(fs).controller.signal}},Co=0,Mf=1,Nf=2,om=3,iu=4;if(typeof Symbol=="function"&&Symbol.for){var hd=Symbol.for;Co=hd("selector.component"),Mf=hd("selector.has_pseudo_class"),Nf=hd("selector.role"),om=hd("selector.test_id"),iu=hd("selector.text")}var Wa=typeof WeakMap=="function"?WeakMap:Map,er=0,qn=null,tr=null,ir=0,zr=0,qs=null,Ho=!1,au=!1,ou=!1,El=0,_s=0,cc=0,lu=0,Af=0,aa=0,Cf=0,lm=null,Na=null,Ag=!1,cm=0,md=0,cu=1/0,um=null,uc=null,Ys=0,dc=null,pd=null,jl=0,Ef=0,Cg=null,yb=null,yr=0,dm=null;return $n.attemptContinuousHydration=function(m){if(m.tag===13||m.tag===31){var g=Gr(m,67108864);g!==null&&ys(g,m,67108864),Wh(m,67108864)}},$n.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13||m.tag===31){var g=cs();g=V(g);var N=Gr(m,g);N!==null&&ys(N,m,g),Wh(m,g)}},$n.attemptSynchronousHydration=function(m){switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var g=M(m.pendingLanes);if(g!==0){for(m.pendingLanes|=2,m.entangledLanes|=2;g;){var N=1<<31-wa(g);m.entanglements[1]|=N,g&=~N}Ie(m),(er&6)===0&&(cu=Vi()+500,Ve(0))}}break;case 31:case 13:g=Gr(m,2),g!==null&&ys(g,m,2),Wp(),Wh(m,2)}},$n.batchedUpdates=function(m,g){return m(g)},$n.createComponentSelector=function(m){return{$$typeof:Co,value:m}},$n.createContainer=function(m,g,N,j,H,W,fe,Ue,pt,Tt){return qc(m,g,!1,null,N,j,W,null,fe,Ue,pt,Tt)},$n.createHasPseudoClassSelector=function(m){return{$$typeof:Mf,value:m}},$n.createHydrationContainer=function(m,g,N,j,H,W,fe,Ue,pt,Tt,Lt,Dt,Kt,On){var zs;return m=qc(N,j,!0,m,H,W,Ue,On,pt,Tt,Lt,Dt),m.context=Kp(null),N=m.current,j=cs(),j=V(j),H=Tr(j),H.callback=(zs=g)!=null?zs:null,as(N,H,j),g=j,m.current.lanes=g,D(m,g),Ie(m),m},$n.createPortal=function(m,g,N){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ju,key:j==null?null:""+j,children:m,containerInfo:g,implementation:N}},$n.createRoleSelector=function(m){return{$$typeof:Nf,value:m}},$n.createTestNameSelector=function(m){return{$$typeof:om,value:m}},$n.createTextSelector=function(m){return{$$typeof:iu,value:m}},$n.defaultOnCaughtError=function(m){console.error(m)},$n.defaultOnRecoverableError=function(m){vg(m)},$n.defaultOnUncaughtError=function(m){vg(m)},$n.deferredUpdates=function(m){var g=pn.T,N=bo();try{return rr(32),pn.T=null,m()}finally{rr(N),pn.T=g}},$n.discreteUpdates=function(m,g,N,j,H){var W=pn.T,fe=bo();try{return rr(2),pn.T=null,m(g,N,j,H)}finally{rr(fe),pn.T=W,er===0&&(cu=Vi()+500)}},$n.findAllNodes=xa,$n.findBoundingRects=function(m,g){if(!ai)throw Error(s(363));g=xa(m,g),m=[];for(var N=0;N<g.length;N++)m.push(ig(g[N]));for(g=m.length-1;0<g;g--){N=m[g];for(var j=N.x,H=j+N.width,W=N.y,fe=W+N.height,Ue=g-1;0<=Ue;Ue--)if(g!==Ue){var pt=m[Ue],Tt=pt.x,Lt=Tt+pt.width,Dt=pt.y,Kt=Dt+pt.height;if(j>=Tt&&W>=Dt&&H<=Lt&&fe<=Kt){m.splice(g,1);break}else if(j!==Tt||N.width!==pt.width||Kt<W||Dt>fe){if(!(W!==Dt||N.height!==pt.height||Lt<j||Tt>H)){Tt>j&&(pt.width+=Tt-j,pt.x=j),Lt<H&&(pt.width=H-Tt),m.splice(g,1);break}}else{Dt>W&&(pt.height+=Dt-W,pt.y=W),Kt<fe&&(pt.height=fe-Dt),m.splice(g,1);break}}}return m},$n.findHostInstance=Vh,$n.findHostInstanceWithNoPortals=function(m){return m=l(m),m=m!==null?d(m):null,m===null?null:pf(m.stateNode)},$n.findHostInstanceWithWarning=function(m){return Vh(m)},$n.flushPassiveEffects=yl,$n.flushSyncFromReconciler=function(m){var g=er;er|=1;var N=pn.T,j=bo();try{if(rr(2),pn.T=null,m)return m()}finally{rr(j),pn.T=N,er=g,(er&6)===0&&Ve(0)}},$n.flushSyncWork=Wp,$n.focusWithin=function(m,g){if(!ai)throw Error(s(363));for(m=Hc(m),g=lf(m,g),g=Array.from(g),m=0;m<g.length;){var N=g[m++],j=N.tag;if(!Kc(N)){if((j===5||j===26||j===27)&&sc(N.stateNode))return!0;for(N=N.child;N!==null;)g.push(N),N=N.sibling}}return!1},$n.getFindAllNodesFailureDescription=function(m,g){if(!ai)throw Error(s(363));var N=0,j=[];m=[Hc(m),0];for(var H=0;H<m.length;){var W=m[H++],fe=W.tag,Ue=m[H++],pt=g[Ue];if((fe!==5&&fe!==26&&fe!==27||!Kc(W))&&(Vc(W,pt)&&(j.push(of(pt)),Ue++,Ue>N&&(N=Ue)),Ue<g.length))for(W=W.child;W!==null;)m.push(W,Ue),W=W.sibling}if(N<g.length){for(m=[];N<g.length;N++)m.push(of(g[N]));return`findAllNodes was able to match part of the selector:
4504  `+(j.join(" > ")+`
4505
4506No matching component was found for:
4507  `)+m.join(" > ")}return null},$n.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 27:case 5:return pf(m.child.stateNode);default:return m.child.stateNode}},$n.injectIntoDevTools=function(){var m={bundleType:0,version:k0,rendererPackageName:qh,currentDispatcherRef:pn,reconcilerVersion:"19.2.0"};if(mf!==null&&(m.rendererConfig=mf),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)m=!0;else{try{ld=g.inject(m),Sa=g}catch{}m=!!g.checkDCE}}return m},$n.isAlreadyRendering=function(){return(er&6)!==0},$n.observeVisibleRects=function(m,g,N,j){if(!ai)throw Error(s(363));m=xa(m,g);var H=ag(m,N,j).disconnect;return{disconnect:function(){H()}}},$n.shouldError=function(){return null},$n.shouldSuspend=function(){return!1},$n.startHostTransition=function(m,g,N,j){if(m.tag!==5)throw Error(s(476));var H=Hu(m).queue;Gu(m,H,g,rd,N===null?r:function(){var W=Hu(m);return W.next===null&&(W=m.alternate.memoizedState),Oc(m,W.next.queue,{},cs()),N(j)})},$n.updateContainer=function(m,g,N,j){var H=g.current,W=cs();return P0(H,W,m,g,N,j),W},$n.updateContainerSync=function(m,g,N,j){return P0(g.current,2,m,g,N,j),2},$n},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})})(H4)),H4.exports}var W4;function bpe(){return W4||(W4=1,G4.exports=xpe()),G4.exports}var ype=bpe();const vpe=gpe(ype);function wpe(n){const e=vpe(n);return e.injectIntoDevTools(),e}const V9=0,qx={},Spe=/^three(?=[A-Z])/,cA=n=>`${n[0].toUpperCase()}${n.slice(1)}`;let _pe=0;const Mpe=n=>typeof n=="function";function W9(n){if(Mpe(n)){const e=`${_pe++}`;return qx[e]=n,e}else Object.assign(qx,n)}function $9(n,e){const t=cA(n),r=qx[t];if(n!=="primitive"&&!r)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(n==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function Npe(n,e,t){var r;return n=cA(n)in qx?n:n.replace(Spe,""),$9(n,e),n==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,C
4507M(e.object,t,n,e)}function Ape(n){if(!n.isHidden){var e;n.props.attach&&(e=n.parent)!=null&&e.object?jM(n.parent,n):Ya(n.object)&&(n.object.visible=!1),n.isHidden=!0,l0(n)}}function X9(n){if(n.isHidden){var e;n.props.attach&&(e=n.parent)!=null&&e.object?EM(n.parent,n):Ya(n.object)&&n.props.visible!==!1&&(n.object.visible=!0),n.isHidden=!1,l0(n)}}function UR(n,e,t){const r=e.root.getState();if(!(!n.parent&&n.object!==r.scene)){if(!e.object){var s,a;const o=qx[cA(e.type)];e.object=(s=e.props.object)!=null?s:new o(...(a=e.props.args)!=null?a:[]),e.object.__r3f=e}if(Jf(e.object,e.props),e.props.attach)EM(n,e);else if(Ya(e.object)&&Ya(n.object)){const o=n.object.children.indexOf(t?.object);if(t&&o!==-1){const l=n.object.children.indexOf(e.object);if(l!==-1){n.object.children.splice(l,1);const u=l<o?o-1:o;n.object.children.splice(u,0,e.object)}else e.object.parent=n.object,n.object.children.splice(o,0,e.object),e.object.dispatchEvent({type:"added"}),n.object.dispatchEvent({type:"childadded",child:e.object})}else n.object.add(e.object)}for(const o of e.children)UR(e,o);l0(e)}}function OE(n,e){if(e){if(e.parent===n){const t=n.children.indexOf(e);t!==-1&&n.children.splice(t,1)}e.parent=n,n.children.push(e),UR(n,e)}}function $4(n,e,t){if(!e||!t)return;if(e.parent===n){const s=n.children.indexOf(e);s!==-1&&n.children.splice(s,1)}e.parent=n;const r=n.children.indexOf(t);r!==-1?n.children.splice(r,0,e):n.children.push(e),UR(n,e,t)}function q9(n){if(typeof n.dispose=="function"){const e=()=>{try{n.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():Cd.unstable_scheduleCallback(Cd.unstable_IdlePriority,e)}}function qT(n,e,t){if(!e)return;e.parent=null;const r=n.children.indexOf(e);r!==-1&&n.children.splice(r,1),e.props.attach?jM(n,e):Ya(e.object)&&Ya(n.object)&&(n.object.remove(e.object),cpe(FR(e),e.object));const s=e.props.dispose!==null&&t!==!1;for(let a=e.children.length-1;a>=0;a--){const o=e.children[a];qT(e,o,s)}e.children.length=0,delete e.object.__r3f,s&&e.type!=="primitive"&&e.object.type!=="Scene"&&q9(e.object),t===void 0&&l0(e)}function Cpe(n,e){for(const t of[n,n.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const r=t.ref(e);typeof r=="function"&&(t.refCleanup=r)}else t.ref&&(t.ref.current=e)}const iv=[];function Epe(){if(iv.length!==0)try{jpe()}finally{iv.length=0}}function jpe(){for(const[t]of iv){const r=t.parent;if(r){t.props.attach?jM(r,t):Ya(t.object)&&Ya(r.object)&&r.object.remove(t.object);for(const s of t.children)s.props.attach?jM(t,s):Ya(s.object)&&Ya(t.object)&&t.object.remove(s.object)}t.isHidden&&X9(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&q9(t.object)}for(const[t,r,s]of iv){t.props=r;const a=t.parent;if(a){var n,e;const o=qx[cA(t.type)],l=t.object;
4507t.object=(n=t.props.object)!=null?n:new o(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,Cpe(s,t.object),lpe(FR(t),l,t.object),Jf(t.object,t.props),t.props.attach?EM(a,t):Ya(t.object)&&Ya(a.object)&&a.object.add(t.object);for(const u of t.children)u.props.attach?EM(t,u):Ya(u.object)&&Ya(t.object)&&t.object.add(u.object);l0(t)}}}const FE=()=>{},X4={};let ES=V9;function Tpe(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return z4;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return U4;case"message":switch(Cd.unstable_getCurrentPriorityLevel()){case Cd.unstable_ImmediatePriority:return z4;case Cd.unstable_UserBlockingPriority:return U4;case Cd.unstable_NormalPriority:case Cd.unstable_LowPriority:return u_;case Cd.unstable_IdlePriority:return mpe;default:return u_}default:return u_}}function Rpe(n){typeof queueMicrotask=="function"?queueMicrotask(n):typeof Promise<"u"?Promise.resolve().then(n).catch(e=>{setTimeout(()=>{throw e})}):setTimeout(n)}const YT=wpe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:Npe,removeChild:qT,appendChild:OE,appendInitialChild:OE,insertBefore:$4,appendChildToContainer(n,e){const t=n.getState().scene.__r3f;!e||!t||OE(t,e)},removeChildFromContainer(n,e){const t=n.getState().scene.__r3f;!e||!t||qT(t,e)},insertInContainerBefore(n,e,t){const r=n.getState().scene.__r3f;!e||!t||!r||$4(r,e,t)},getRootHostContext:()=>X4,getChildHostContext:()=>X4,commitUpdate(n,e,t,r,s){var a,o,l;$9(e,r);let u=!1;if((n.type==="primitive"&&t.object!==r.object||((a=r.args)==null?void 0:a.length)!==((o=t.args)==null?void 0:o.length)||(l=r.args)!=null&&l.some((d,h)=>{var p;return d!==((p=t.args)==null?void 0:p[h])}))&&(u=!0),u)iv.push([n,$T(r),s]);else{const d=spe(n,r),h=n.props.attach;n.props=$T(r),h!==void 0?n.props.attach=h:delete n.props.attach,Object.keys(d).length&&Jf(n.object,d)}},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:n=>n?.object,prepareForCommit:()=>null,preparePortalMount:n=>CM(n.getState().scene,n,"",{}),resetAfterCommit:Epe,shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:Ape,unhideInstance:X9,createTextInstance:FE,hideTextInstance:FE,unhideTextInstance:FE,supportsMicrotasks:!0,scheduleMicrotask:Rpe,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:T.createContext(null),setCurrentUpdatePriority(n){ES=n},getCurrentUpdatePriority(){return ES},resolveUpdatePriority(){var n;if(ES!==V9)return ES;const e=typeof window<"u"?(n=window.event)==null?void 0:n.type:void 0;return e===void 0?u_:Tpe(e)},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:ppe.version,applyViewTransitionName(n,e,t){},restoreViewTransitionName(n,e){},cancelViewTransitionName(n,e,t){},cancelRootViewTransitionName(n){},restoreRootViewTransitionName(n){},InstanceMeasurement:null,measureInstance:n=>null,wasInstanceInViewport:n=>!0,hasInstanceChanged:(n,e)=>!1,hasInstanceAffectedParent:(n,e)=>!1,suspendOnActiveViewTransition(n,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(n){},createViewTransitionInstance:n=>null,getCurrentGestureOffset(n){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(n,e){return n},cloneMutableTextInstance(n){return n},cloneRootViewTransitionContainer(n){throw new Error("Not implemented.")},removeRootViewTransitionClone(n,e){throw new Error("Not implemented.")},createFragmentInstance:n=>null,updateFragmentInstanceFiber(n,e){},commitNewChildToFragmentInstance(n,e){},deleteChildFromFragmentInstance(n,e){},measureClonedInstance:n=>null,maySuspendCommitOnUpdate:(n,e,t)=>!1,maySuspendCommitInSyncRender:(n,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(n,e)=>null}),yp=new Map,ax={objects:"shallow",strict:!1};function Ppe(n,e){if(!e&&typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:r,top:s,left:a}=n.parentElement.getBoundingClientRect();return{width:t,height:r,top:s,left:a}}else if(!e&&typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function Dpe(n){const e=yp.get(n),t=e?.fiber,r=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const s=typeof reportError=="function"?reportError:console.error,a=r||dpe(JT,Y4),o=t||YT.createContainer(a,hpe,null,!1,null,"",s,s,s,null);e||yp.set(n,{fiber:o,store:a});let l,u,d=!1,h=null;return{async configure(p={}){let x;h=new Promise(F=>x=F);let{gl:y,size:v,scene:_,events:M,onCreated:S,shadows:A=!1,linear:E=!1,flat:C=!1,legacy:I=!1,orthographic:D=!1,frameloop:B="always",dpr:P=[1,2],performance:G,raycaster:k,camera:V,onPointerMissed:U}
4507=p,$=a.getState(),X=$.gl;if(!$.gl){const F={canvas:n,powerPreference:"high-performance",antialias:!0,alpha:!0},O=typeof y=="function"?await y(F):y;O4(O)?X=O:X=new j9({...F,...y}),$.set({gl:X})}let ee=$.raycaster;ee||$.set({raycaster:ee=new g9});const{params:z,...K}=k||{};if(hs.equ(K,ee,ax)||Jf(ee,{...K}),hs.equ(z,ee.params,ax)||Jf(ee,{params:{...ee.params,...z}}),!$.camera||$.camera===u&&!hs.equ(u,V,ax)){u=V;const F=V?.isCamera,O=F?V:D?new Ru(0,0,0,0,.1,1e3):new ti(75,0,.1,1e3);F||(O.position.z=5,V&&(Jf(O,V),O.manual||("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&(O.manual=!0,O.updateProjectionMatrix())),!$.camera&&!(V!=null&&V.rotation)&&O.lookAt(0,0,0)),$.set({camera:O}),ee.camera=O}if(!$.scene){let F;_!=null&&_.isScene?(F=_,CM(F,a,"",{})):(F=new lR,CM(F,a,"",{}),_&&Jf(F,_)),$.set({scene:F})}M&&!$.events.handlers&&$.set({events:M(a)});const ae=Ppe(n,v);if(hs.equ(ae,$.size,ax)||$.setSize(ae.width,ae.height,ae.top,ae.left),P&&$.viewport.dpr!==O9(P)&&$.setDpr(P),$.frameloop!==B&&$.setFrameloop(B),$.onPointerMissed||$.set({onPointerMissed:U}),G&&!hs.equ(G,$.performance,ax)&&$.set(F=>({performance:{...F.performance,...G}})),!$.xr){var oe;const F=(q,Q)=>{const ne=a.getState();ne.frameloop!=="never"&&Y4(q,!0,ne,Q)},O=()=>{const q=a.getState();q.gl.xr.enabled=q.gl.xr.isPresenting,q.gl.xr.setAnimationLoop(q.gl.xr.isPresenting?F:null),q.gl.xr.isPresenting||JT(q)},J={connect(){const q=a.getState().gl;q.xr.addEventListener("sessionstart",O),q.xr.addEventListener("sessionend",O)},disconnect(){const q=a.getState().gl;q.xr.removeEventListener("sessionstart",O),q.xr.removeEventListener("sessionend",O)}};typeof((oe=X.xr)==null?void 0:oe.addEventListener)=="function"&&J.connect(),$.set({xr:J})}if(X.shadowMap){const F=X.shadowMap.enabled,O=X.shadowMap.type;if(X.shadowMap.enabled=!!A,hs.boo(A))X.shadowMap.type=xy;else if(hs.str(A)){var re;const J={basic:z6,percentage:Sx,soft:xy,variance:Gm};X.shadowMap.type=(re=J[A])!=null?re:xy}else hs.obj(A)&&Object.assign(X.shadowMap,A);(F!==X.shadowMap.enabled||O!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}return ur.enabled=!I,d||(X.outputColorSpace=E?Fx:Ra,X.toneMapping=C?Gl:wN),$.legacy!==I&&$.set(()=>({legacy:I})),$.linear!==E&&$.set(()=>({linear:E})),$.flat!==C&&$.set(()=>({flat:C})),y&&!hs.fun(y)&&!O4(y)&&!hs.equ(y,X,ax)&&Jf(X,y),l=S,d=!0,x(),this},render(p){return!d&&!h&&this.configure(),h.then(()=>{YT.updateContainer(i.jsx(kpe,{store:a,children:p,onCreated:l,rootElement:n}),o,null,()=>{})}),a},unmount(){Y9(n)}}}function kpe({store:n,children:e,onCreated:t,rootElement:r}){return kv(()=>{const s=n.getState();s.set(a=>({internal:{...a.internal,active:!0}})),t&&t(s),n.getState().events.connected||s.events.connect==null||s.events.connect(r)},[]),i.jsx(z9.Provider,{value:n,children:e})}function Y9(n,e){const t=yp.get(n),r=t?.fiber;if(r){const s=t?.store.getState();s&&(s.internal.active=!1),YT.updateContainer(null,r,null,()=>{s&&setTimeout(()=>{try{var a,o,l,u;s.events.disconnect==null||s.events.disconnect(),(a=s.gl)==null||(o=a.renderLists)==null||o.dispose==null||o.dispose(),(l=s.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(u=s.gl)!=null&&u.xr&&s.xr.disconnect(),npe(s.scene),yp.delete(n)}catch{}},500)})}}const Ipe=new Set,Bpe=new Set,Lpe=new Set;function UE(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function Cy(n,e){switch(n){case"before":return UE(Ipe,e);case"after":return UE(Bpe,e);case"tail":return UE(Lpe,e)}}let zE,GE;function QT(n,e,t){let r=e.clock.getDelta();e.frameloop==="never"&&typeof n=="number"&&(r=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),zE=e.internal.subscribers;for(let s=0;s<zE.length;s++)GE=zE[s],GE.ref.current(GE.store.getState(),r,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let TM=!1,KT=!1,HE,q4,ox;function Q9(n){q4=requestAnimationFrame(Q9),TM=!0,HE=0,Cy("before",n),KT=!0;for(const t of yp.values()){var e;ox=t.store.getState(),ox.internal.active&&(ox.frameloop==="always"||ox.internal.frames>0)&&!((e=ox.gl.xr)!=null&&e.isPresenting)&&(HE+=QT(n,ox))}if(KT=!1,Cy("after",n),HE===0)return Cy("tail",n),TM=!1,cancelAnimationFrame(q4)}function JT(n,e=1){var t;
4507if(!n)return yp.forEach(r=>JT(r.store.getState(),e));(t=n.gl.xr)!=null&&t.isPresenting||!n.internal.active||n.frameloop==="never"||(e>1?n.internal.frames=Math.min(60,n.internal.frames+e):KT?n.internal.frames=2:n.internal.frames=1,TM||(TM=!0,requestAnimationFrame(Q9)))}function Y4(n,e=!0,t,r){if(e&&Cy("before",n),t)QT(n,t,r);else for(const s of yp.values())QT(n,s.store.getState());e&&Cy("after",n)}const VE={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Ope(n){const{handlePointer:e}=upe(n);return{priority:1,enabled:!0,compute(t,r,s){r.pointer.set(t.offsetX/r.size.width*2-1,-(t.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(VE).reduce((t,r)=>({...t,[r]:e(r)}),{}),update:()=>{var t;const{events:r,internal:s}=n.getState();(t=s.lastEvent)!=null&&t.current&&r.handlers&&r.handlers.onPointerMove(s.lastEvent.current)},connect:t=>{const{set:r,events:s}=n.getState();if(s.disconnect==null||s.disconnect(),r(a=>({events:{...a.events,connected:t}})),s.handlers)for(const a in s.handlers){const o=s.handlers[a],[l,u]=VE[a];t.addEventListener(l,o,{passive:u})}},disconnect:()=>{const{set:t,events:r}=n.getState();if(r.connected){if(r.handlers)for(const s in r.handlers){const a=r.handlers[s],[o]=VE[s];r.connected.removeEventListener(o,a)}t(s=>({events:{...s.events,connected:void 0}}))}}}}function Q4(n,e){let t;return(...r)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...r),e)}}function Fpe({debounce:n,scroll:e,polyfill:t,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const s=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,o]=T.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=T.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a,orientationHandler:null}),u=n?typeof n=="number"?n:n.scroll:null,d=n?typeof n=="number"?n:n.resize:null,h=T.useRef(!1);T.useEffect(()=>(h.current=!0,()=>{h.current=!1}));const[p,x,y]=T.useMemo(()=>{const S=()=>{if(!l.current.element)return;const{left:A,top:E,width:C,height:I,bottom:D,right:B,x:P,y:G}=l.current.element.getBoundingClientRect(),k={left:A,top:E,width:C,height:I,bottom:D,right:B,x:P,y:G};l.current.element instanceof HTMLElement&&r&&(k.height=l.current.element.offsetHeight,k.width=l.current.element.offsetWidth),Object.freeze(k),h.current&&!Hpe(l.current.lastBounds,k)&&o(l.current.lastBounds=k)};return[S,d?Q4(S,d):S,u?Q4(S,u):S]},[o,r,u,d]);function v(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",y,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null),l.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",l.current.orientationHandler))}function _(){l.current.element&&(l.current.resizeObserver=new s(y),l.current.resizeObserver.observe(l.current.element),e&&l.current.scrollContainers&&l.current.scrollContainers.forEach(S=>S.addEventListener("scroll",y,{capture:!0,passive:!0})),l.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",l.current.orientationHandler))}const M=S=>{!S||S===l.current.element||(v(),l.current.element=S,l.current.scrollContainers=K9(S),_())};return zpe(y,!!e),Upe(x),T.useEffect(()=>{v(),_()},[e,y,x]),T.useEffect(()=>v,[]),[M,a,p]}function Upe(n){T.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[n])}function zpe(n,e){T.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[n,e])}function K9(n){const e=[];
4507if(!n||n===document.body)return e;const{overflow:t,overflowX:r,overflowY:s}=window.getComputedStyle(n);return[t,r,s].some(a=>a==="auto"||a==="scroll")&&e.push(n),[...e,...K9(n.parentElement)]}const Gpe=["x","y","top","bottom","left","right","width","height"],Hpe=(n,e)=>Gpe.every(t=>n[t]===e[t]);function Vpe({ref:n,children:e,fallback:t,resize:r,style:s,gl:a,events:o=Ope,eventSource:l,eventPrefix:u,shadows:d,linear:h,flat:p,legacy:x,orthographic:y,frameloop:v,dpr:_,performance:M,raycaster:S,camera:A,scene:E,onPointerMissed:C,onCreated:I,...D}){T.useMemo(()=>W9(Pme),[]);const B=Jme(),[P,G]=Fpe({scroll:!0,debounce:{scroll:50,resize:0},...r}),k=T.useRef(null),V=T.useRef(null);T.useImperativeHandle(n,()=>k.current);const U=L9(C),[$,X]=T.useState(!1),[ee,z]=T.useState(!1);if($)throw $;if(ee)throw ee;const K=T.useRef(null);kv(()=>{const oe=k.current;if(G.width>0&&G.height>0&&oe){K.current||(K.current=Dpe(oe));async function re(){await K.current.configure({gl:a,scene:E,events:o,shadows:d,linear:h,flat:p,legacy:x,orthographic:y,frameloop:v,dpr:_,performance:M,raycaster:S,camera:A,size:G,onPointerMissed:(...F)=>U.current==null?void 0:U.current(...F),onCreated:F=>{F.events.connect==null||F.events.connect(l?Qme(l)?l.current:l:V.current),u&&F.setEvents({compute:(O,J)=>{const q=O[u+"X"],Q=O[u+"Y"];J.pointer.set(q/J.size.width*2-1,-(Q/J.size.height)*2+1),J.raycaster.setFromCamera(J.pointer,J.camera)}}),I?.(F)}}),K.current.render(i.jsx(B,{children:i.jsx(epe,{set:z,children:i.jsx(T.Suspense,{fallback:i.jsx(Zme,{set:X}),children:e??null})})}))}re()}}),T.useEffect(()=>{const oe=k.current;if(oe)return()=>Y9(oe)},[]);const ae=l?"none":"auto";return i.jsx("div",{ref:V,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ae,...s},...D,children:i.jsx("div",{ref:P,style:{width:"100%",height:"100%"},children:i.jsx("canvas",{ref:k,style:{display:"block"},children:t})})})}function Wpe(n){return i.jsx(k9,{children:i.jsx(Vpe,{...n})})}function Sh(){return Sh=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Sh.apply(null,arguments)}const zR=parseInt(i0.replace(/\D+/g,"")),J9=zR>=125?"uv1":"uv2";function K4(n,e){if(e===f8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===SM||e===iR){let t=n.getIndex();if(t===null){const o=[],l=n.getAttribute("position");if(l!==void 0){for(let u=0;u<l.count;u++)o.push(u);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const r=t.count-2,s=[];if(t)if(e===SM)for(let o=1;o<=r;o++)s.push(t.getX(0)),s.push(t.getX(o)),s.push(t.getX(o+1));else for(let o=0;o<r;o++)o%2===0?(s.push(t.getX(o)),s.push(t.getX(o+1)),s.push(t.getX(o+2))):(s.push(t.getX(o+2)),s.push(t.getX(o+1)),s.push(t.getX(o)));s.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=n.clone();return a.setIndex(s),a.clearGroups(),a}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}var $pe=Object.defineProperty,Xpe=(n,e,t)=>e in n?$pe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qpe=(n,e,t)=>(Xpe(n,e+"",t),t);class Ype{constructor(){qpe(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const s=r.slice(0);for(let a=0,o=s.length;a<o;a++)s[a].call(this,e);e.target=null}}}var Qpe=Object.defineProperty,Kpe=(n,e,t)=>e in n?Qpe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,wn=(n,e,t)=>(Kpe(n,typeof e!="symbol"?e+"":e,t),t);
4507const jS=new Cp,J4=new _u,Jpe=Math.cos(70*(Math.PI/180)),Z4=(n,e)=>(n%e+e)%e;let Zpe=class extends Ype{constructor(e,t){super(),wn(this,"object"),wn(this,"domElement"),wn(this,"enabled",!0),wn(this,"target",new we),wn(this,"minDistance",0),wn(this,"maxDistance",1/0),wn(this,"minZoom",0),wn(this,"maxZoom",1/0),wn(this,"minPolarAngle",0),wn(this,"maxPolarAngle",Math.PI),wn(this,"minAzimuthAngle",-1/0),wn(this,"maxAzimuthAngle",1/0),wn(this,"enableDamping",!1),wn(this,"dampingFactor",.05),wn(this,"enableZoom",!0),wn(this,"zoomSpeed",1),wn(this,"enableRotate",!0),wn(this,"rotateSpeed",1),wn(this,"enablePan",!0),wn(this,"panSpeed",1),wn(this,"screenSpacePanning",!0),wn(this,"keyPanSpeed",7),wn(this,"zoomToCursor",!1),wn(this,"autoRotate",!1),wn(this,"autoRotateSpeed",2),wn(this,"reverseOrbit",!1),wn(this,"reverseHorizontalOrbit",!1),wn(this,"reverseVerticalOrbit",!1),wn(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),wn(this,"mouseButtons",{LEFT:Su.ROTATE,MIDDLE:Su.DOLLY,RIGHT:Su.PAN}),wn(this,"touches",{ONE:Pm.ROTATE,TWO:Pm.DOLLY_PAN}),wn(this,"target0"),wn(this,"position0"),wn(this,"zoom0"),wn(this,"_domElementKeyEvents",null),wn(this,"getPolarAngle"),wn(this,"getAzimuthalAngle"),wn(this,"setPolarAngle"),wn(this,"setAzimuthalAngle"),wn(this,"getDistance"),wn(this,"getZoomScale"),wn(this,"listenToKeyEvents"),wn(this,"stopListenToKeyEvents"),wn(this,"saveState"),wn(this,"reset"),wn(this,"update"),wn(this,"connect"),wn(this,"dispose"),wn(this,"dollyIn"),wn(this,"dollyOut"),wn(this,"getScale"),wn(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>h.phi,this.getAzimuthalAngle=()=>h.theta,this.setPolarAngle=ie=>{let Se=Z4(ie,2*Math.PI),Ae=h.phi;Ae<0&&(Ae+=2*Math.PI),Se<0&&(Se+=2*Math.PI);let at=Math.abs(Se-Ae);2*Math.PI-at<at&&(Se<Ae?Se+=2*Math.PI:Ae+=2*Math.PI),p.phi=Se-Ae,r.update()},this.setAzimuthalAngle=ie=>{let Se=Z4(ie,2*Math.PI),Ae=h.theta;Ae<0&&(Ae+=2*Math.PI),Se<0&&(Se+=2*Math.PI);let at=Math.abs(Se-Ae);2*Math.PI-at<at&&(Se<Ae?Se+=2*Math.PI:Ae+=2*Math.PI),p.theta=Se-Ae,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=ie=>{ie.addEventListener("keydown",je),this._domElementKeyEvents=ie},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",je),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(s),r.update(),u=l.NONE},this.update=(()=>{const ie=new we,Se=new we(0,1,0),Ae=new Oi().setFromUnitVectors(e.up,Se),at=Ae.clone().invert(),pe=new we,Ke=new Oi,Ne=2*Math.PI;return function(){const Te=r.object.position;Ae.setFromUnitVectors(e.up,Se),at.copy(Ae).invert(),ie.copy(Te).sub(r.target),ie.applyQuaternion(Ae),h.setFromVector3(ie),r.autoRotate&&u===l.NONE&&X(U()),r.enableDamping?(h.theta+=p.theta*r.dampingFactor,h.phi+=p.phi*r.dampingFactor):(h.theta+=p.theta,h.phi+=p.phi);let st=r.minAzimuthAngle,et=r.maxAzimuthAngle;isFinite(st)&&isFinite(et)&&(st<-Math.PI?st+=Ne:st>Math.PI&&(st-=Ne),et<-Math.PI?et+=Ne:et>Math.PI&&(et-=Ne),st<=et?h.theta=Math.max(st,Math.min(et,h.theta)):h.theta=h.theta>(st+et)/2?Math.max(st,h.theta):Math.min(et,h.theta)),h.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,h.phi)),h.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&G||r.object.isOrthographicCamera?h.radius=J(h.radius):h.radius=J(h.radius*x),ie.setFromSpherical(h),ie.applyQuaternion(at),Te.copy(r.target).add(ie),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(p.theta*=1-r.dampingFactor,p.phi*=1-r.dampingFactor,y.multiplyScalar(1-r.dampingFactor)):(p.set(0,0,0),y.set(0,0,0));let Qe=!1;if(r.zoomToCursor&&G){let Mt=null;if(r.object instanceof ti&&r.object.isPerspectiveCamera){const ue=ie.length();Mt=J(ue*x);const Je=ue-Mt;r.object.position.addScaledVector(B,Je),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const ue=new we(P.x,P.y,0);ue.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/x)),r.object.updateProjectionMatrix(),Qe=!0;const Je=new we(P.x,P.y,0);Je.unproject(r.object),r.object.position.sub(Je).add(ue),r.object.updateMatrixWorld(),Mt=ie.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Mt!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Mt).add(r.object.position):(jS.origin.copy(r.object.position),jS.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(jS.direction))<Jpe?e.lookAt(r.target):(J4.setFromNormalAndCoplanarPoint(r.object.up,r.target),jS.intersectPlane(J4,r.target))))}else r.object instanceof Ru&&r.object.isOrthographicCamera&&(Qe=x!==1,Qe&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/x)),r.object.updateProjectionMatrix()));return x=1,G=!1,Qe||pe.distanceToSquared(r.object.position)>d||8*(1-Ke.dot(r.object.quaternion))>d?(r.dispatchEvent(s),pe.copy(r.object.position),Ke.copy(r.object.quaternion),Qe=!1,!0):!1}})(),this.connect=ie=>{r.domElement=ie,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ft),r.domElement.addEventListener("pointerdown",ot),r.domElement.addEventListener("pointercancel",mt),r.domElement.addEventListener("wheel",Y)},this.dispose=()=>{var ie,Se,Ae,at,pe,Ke;r.domElement&&(r.domElement.style.touchAction="auto"),(ie=r.domElement)==null||ie.removeEventListener("contextmenu",ft),(Se=r.domElement)==null||Se.removeEventListener("pointerdown",ot),(Ae=r.domElement)==null||Ae.removeEventListener("pointercancel",mt),(at=r.domElement)==null||at.removeEventListener("wheel",Y),(pe=r.domElement)==null||pe.ownerDocument.removeEventListener("pointermove",ve),(Ke=r.domElement)==null||Ke.ownerDocument.removeEventListener("pointerup",mt),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",je)};const r=this,s={type:"change"},a={type:"start"},o={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=l.NONE;const d=1e-6,h=new UT,p=new UT;let x=1;const y=new we,v=new wt,_=new wt,M=new wt,S=new wt,A=new wt,E=new wt,C=new wt,I=new wt,D=new wt,B=new we,P=new wt;let G=!1;const k=[],V={};function U(){return 2*Math.PI/60/60*r.autoRotateSpeed}function $(){return Math.pow(.95,r.zoomSpeed)}function X(ie){r.reverseOrbit||r.reverseHorizontalOrbit?p.theta+=ie:p.theta-=ie}function ee(ie){r.reverseOrbit||r.reverseVerticalOrbit?p.phi+=ie:p.phi-=ie}const z=(()=>{const ie=new we;return function(Ae,at){ie.setFromMatrixColumn(at,0),ie.multiplyScalar(-Ae),y.add(ie)}})(),K=(()=>{const ie=new we;return function(Ae,at){r.screenSpacePanning===!0?ie.setFromMatrixColumn(at,1):(ie.setFromMatrixColumn(at,0),ie.crossVectors(r.object.up,ie)),ie.multiplyScalar(Ae),y.add(ie)}})(),ae=(()=>{const ie=new we;return function(Ae,at){const pe=r.domElement;if(pe&&r.object instanceof ti&&r.object.isPerspectiveCamera){const Ke=r.object.position;ie.copy(Ke).sub(r.target);let Ne=ie.length();
4507Ne*=Math.tan(r.object.fov/2*Math.PI/180),z(2*Ae*Ne/pe.clientHeight,r.object.matrix),K(2*at*Ne/pe.clientHeight,r.object.matrix)}else pe&&r.object instanceof Ru&&r.object.isOrthographicCamera?(z(Ae*(r.object.right-r.object.left)/r.object.zoom/pe.clientWidth,r.object.matrix),K(at*(r.object.top-r.object.bottom)/r.object.zoom/pe.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function oe(ie){r.object instanceof ti&&r.object.isPerspectiveCamera||r.object instanceof Ru&&r.object.isOrthographicCamera?x=ie:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function re(ie){oe(x/ie)}function F(ie){oe(x*ie)}function O(ie){if(!r.zoomToCursor||!r.domElement)return;G=!0;const Se=r.domElement.getBoundingClientRect(),Ae=ie.clientX-Se.left,at=ie.clientY-Se.top,pe=Se.width,Ke=Se.height;P.x=Ae/pe*2-1,P.y=-(at/Ke)*2+1,B.set(P.x,P.y,1).unproject(r.object).sub(r.object.position).normalize()}function J(ie){return Math.max(r.minDistance,Math.min(r.maxDistance,ie))}function q(ie){v.set(ie.clientX,ie.clientY)}function Q(ie){O(ie),C.set(ie.clientX,ie.clientY)}function ne(ie){S.set(ie.clientX,ie.clientY)}function Z(ie){_.set(ie.clientX,ie.clientY),M.subVectors(_,v).multiplyScalar(r.rotateSpeed);const Se=r.domElement;Se&&(X(2*Math.PI*M.x/Se.clientHeight),ee(2*Math.PI*M.y/Se.clientHeight)),v.copy(_),r.update()}function se(ie){I.set(ie.clientX,ie.clientY),D.subVectors(I,C),D.y>0?re($()):D.y<0&&F($()),C.copy(I),r.update()}function me(ie){A.set(ie.clientX,ie.clientY),E.subVectors(A,S).multiplyScalar(r.panSpeed),ae(E.x,E.y),S.copy(A),r.update()}function ze(ie){O(ie),ie.deltaY<0?F($()):ie.deltaY>0&&re($()),r.update()}function Be(ie){let Se=!1;switch(ie.code){case r.keys.UP:ae(0,r.keyPanSpeed),Se=!0;break;case r.keys.BOTTOM:ae(0,-r.keyPanSpeed),Se=!0;break;case r.keys.LEFT:ae(r.keyPanSpeed,0),Se=!0;break;case r.keys.RIGHT:ae(-r.keyPanSpeed,0),Se=!0;break}Se&&(ie.preventDefault(),r.update())}function ye(){if(k.length==1)v.set(k[0].pageX,k[0].pageY);else{const ie=.5*(k[0].pageX+k[1].pageX),Se=.5*(k[0].pageY+k[1].pageY);
4507v.set(ie,Se)}}function Le(){if(k.length==1)S.set(k[0].pageX,k[0].pageY);else{const ie=.5*(k[0].pageX+k[1].pageX),Se=.5*(k[0].pageY+k[1].pageY);S.set(ie,Se)}}function Ce(){const ie=k[0].pageX-k[1].pageX,Se=k[0].pageY-k[1].pageY,Ae=Math.sqrt(ie*ie+Se*Se);C.set(0,Ae)}function Re(){r.enableZoom&&Ce(),r.enablePan&&Le()}function De(){r.enableZoom&&Ce(),r.enableRotate&&ye()}function he(ie){if(k.length==1)_.set(ie.pageX,ie.pageY);else{const Ae=Fe(ie),at=.5*(ie.pageX+Ae.x),pe=.5*(ie.pageY+Ae.y);_.set(at,pe)}M.subVectors(_,v).multiplyScalar(r.rotateSpeed);const Se=r.domElement;Se&&(X(2*Math.PI*M.x/Se.clientHeight),ee(2*Math.PI*M.y/Se.clientHeight)),v.copy(_)}function le(ie){if(k.length==1)A.set(ie.pageX,ie.pageY);else{const Se=Fe(ie),Ae=.5*(ie.pageX+Se.x),at=.5*(ie.pageY+Se.y);A.set(Ae,at)}E.subVectors(A,S).multiplyScalar(r.panSpeed),ae(E.x,E.y),S.copy(A)}function Xe(ie){const Se=Fe(ie),Ae=ie.pageX-Se.x,at=ie.pageY-Se.y,pe=Math.sqrt(Ae*Ae+at*at);I.set(0,pe),D.set(0,Math.pow(I.y/C.y,r.zoomSpeed)),re(D.y),C.copy(I)}function qe(ie){r.enableZoom&&Xe(ie),r.enablePan&&le(ie)}function Ge(ie){r.enableZoom&&Xe(ie),r.enableRotate&&he(ie)}function ot(ie){var Se,Ae;r.enabled!==!1&&(k.length===0&&((Se=r.domElement)==null||Se.ownerDocument.addEventListener("pointermove",ve),(Ae=r.domElement)==null||Ae.ownerDocument.addEventListener("pointerup",mt)),vt(ie),ie.pointerType==="touch"?Ie(ie):xt(ie))}function ve(ie){r.enabled!==!1&&(ie.pointerType==="touch"?Ve(ie):ge(ie))}function mt(ie){var Se,Ae,at;ce(ie),k.length===0&&((Se=r.domElement)==null||Se.releasePointerCapture(ie.pointerId),(Ae=r.domElement)==null||Ae.ownerDocument.removeEventListener("pointermove",ve),(at=r.domElement)==null||at.ownerDocument.removeEventListener("pointerup",mt)),r.dispatchEvent(o),u=l.NONE}function xt(ie){let Se;switch(ie.button){case 0:Se=r.mouseButtons.LEFT;break;case 1:Se=r.mouseButtons.MIDDLE;break;case 2:Se=r.mouseButtons.RIGHT;break;default:Se=-1}switch(Se){case Su.DOLLY:if(r.enableZoom===!1)return;Q(ie),u=l.DOLLY;break;case Su.ROTATE:if(ie.ctrlKey||ie.metaKey||ie.shiftKey){if(r.enablePan===!1)return;ne(ie),u=l.PAN}else{if(r.enableRotate===!1)return;q(ie),u=l.ROTATE}break;case Su.PAN:if(ie.ctrlKey||ie.metaKey||ie.shiftKey){if(r.enableRotate===!1)return;q(ie),u=l.ROTATE}else{if(r.enablePan===!1)return;ne(ie),u=l.PAN}break;default:u=l.NONE}u!==l.NONE&&r.dispatchEvent(a)}function ge(ie){if(r.enabled!==!1)switch(u){case l.ROTATE:if(r.enableRotate===!1)return;Z(ie);break;case l.DOLLY:if(r.enableZoom===!1)return;se(ie);break;case l.PAN:if(r.enablePan===!1)return;me(ie);break}}function Y(ie){r.enabled===!1||r.enableZoom===!1||u!==l.NONE&&u!==l.ROTATE||(ie.preventDefault(),r.dispatchEvent(a),ze(ie),r.dispatchEvent(o))}function je(ie){r.enabled===!1||r.enablePan===!1||Be(ie)}function Ie(ie){switch(Me(ie),k.length){case 1:switch(r.touches.ONE){case Pm.ROTATE:if(r.enableRotate===!1)return;ye(),u=l.TOUCH_ROTATE;break;case Pm.PAN:if(r.enablePan===!1)return;Le(),u=l.TOUCH_PAN;break;default:u=l.NONE}break;case 2:switch(r.touches.TWO){case Pm.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Re(),u=l.TOUCH_DOLLY_PAN;break;case Pm.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;De(),u=l.TOUCH_DOLLY_ROTATE;break;default:u=l.NONE}break;default:u=l.NONE}u!==l.NONE&&r.dispatchEvent(a)}function Ve(ie){switch(Me(ie),u){case l.TOUCH_ROTATE:if(r.enableRotate===!1)return;he(ie),r.update();break;case l.TOUCH_PAN:if(r.enablePan===!1)return;le(ie),r.update();break;case l.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;qe(ie),r.update();break;case l.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ge(ie),r.update();break;default:u=l.NONE}}function ft(ie){r.enabled!==!1&&ie.preventDefault()}function vt(ie){k.push(ie)}function ce(ie){delete V[ie.pointerId];for(let Se=0;Se<k.length;Se++)if(k[Se].pointerId==ie.pointerId){k.splice(Se,1);return}}function Me(ie){let Se=V[ie.pointerId];Se===void 0&&(Se=new wt,V[ie.pointerId]=Se),Se.set(ie.pageX,ie.pageY)}function Fe(ie){const Se=ie.pointerId===k[0].pointerId?k[1]:k[0];return V[Se.pointerId]}this.dollyIn=(ie=$())=>
vendor: 16,384 bytes, line 4507
4507{F(ie),r.update()},this.dollyOut=(ie=$())=>{re(ie),r.update()},this.getScale=()=>x,this.setScale=ie=>{oe(ie),r.update()},this.getZoomScale=()=>$(),t!==void 0&&this.connect(t),this.update()}};function RM(n){if(typeof TextDecoder<"u")return new TextDecoder().decode(n);let e="";for(let t=0,r=n.length;t<r;t++)e+=String.fromCharCode(n[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const qm="srgb",Od="srgb-linear",eB=3001,ege=3e3;class GR extends Ia{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new ige(t)}),this.register(function(t){return new age(t)}),this.register(function(t){return new pge(t)}),this.register(function(t){return new gge(t)}),this.register(function(t){return new xge(t)}),this.register(function(t){return new lge(t)}),this.register(function(t){return new cge(t)}),this.register(function(t){return new uge(t)}),this.register(function(t){return new dge(t)}),this.register(function(t){return new sge(t)}),this.register(function(t){return new fge(t)}),this.register(function(t){return new oge(t)}),this.register(function(t){return new mge(t)}),this.register(function(t){return new hge(t)}),this.register(function(t){return new nge(t)}),this.register(function(t){return new bge(t)}),this.register(function(t){return new yge(t)})}load(e,t,r,s){const a=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const d=oh.extractUrlBase(e);o=oh.resolveURL(d,this.path)}else o=oh.extractUrlBase(e);this.manager.itemStart(e);const l=function(d){s?s(d):console.error(d),a.manager.itemError(e),a.manager.itemEnd(e)},u=new rl(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(d){try{a.parse(d,o,function(h){t(h),a.manager.itemEnd(e)},l)}catch(h){l(h)}},r,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let a;const o={},l={};if(typeof e=="string")a=JSON.parse(e);else if(e instanceof ArrayBuffer)if(RM(new Uint8Array(e.slice(0,4)))===Z9){try{o[hr.KHR_BINARY_GLTF]=new vge(e)}catch(h){s&&s(h);return}a=JSON.parse(o[hr.KHR_BINARY_GLTF].content)}else a=JSON.parse(RM(new Uint8Array(e)));else a=e;if(a.asset===void 0||a.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new Dge(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const h=this.pluginCallbacks[d](u);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[h.name]=h,o[h.name]=!0}if(a.extensionsUsed)for(let d=0;d<a.extensionsUsed.length;++d){const h=a.extensionsUsed[d],p=a.extensionsRequired||[];switch(h){case hr.KHR_MATERIALS_UNLIT:o[h]=new rge;break;case hr.KHR_DRACO_MESH_COMPRESSION:o[h]=new wge(a,this.dracoLoader);break;case hr.KHR_TEXTURE_TRANSFORM:o[h]=new Sge;break;case hr.KHR_MESH_QUANTIZATION:o[h]=new _ge;break;default:p.indexOf(h)>=0&&l[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}u.setExtensions(o),u.setPlugins(l),u.parse(r,s)}parseAsync(e,t){const r=this;return new Promise(function(s,a){r.parse(e,t,s,a)})}}function tge(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const hr={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class nge{constructor(e){this.parser=e,this.name=hr.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const a=t[r];a.extensions&&a.extensions[this.name]&&a.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const a=t.json,u=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e];let d;const h=new Ut(16777215);u.color!==void 0&&h.setRGB(u.color[0],u.color[1],u.color[2],Od);const p=u.range!==void 0?u.range:0;switch(u.type){case"directional":d=new RR(h),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new TR(h),d.distance=p;break;case"spot":d=new jR(h),d.distance=p,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,d.angle=u.spot.outerConeAngle,d.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return d.position.set(0,0,0),d.decay=2,Ad(d,u),u.intensity!==void 0&&(d.intensity=u.intensity),d.name=t.createUniqueName(u.name||"light_"+e),s=Promise.resolve(d),t.cache.add(r,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,a=r.json.nodes[e],l=(a.extensions&&a.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(u){return r._getNodeRef(t.cache,l,u)})}}class rge{constructor(){this.name=hr.KHR_MATERIALS_UNLIT}getMaterialType(){return ko}extendParams(e,t,r){const s=[];e.color=new Ut(1,1,1),e.opacity=1;const a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){const o=a.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Od),e.opacity=o[3]}a.baseColorTexture!==void 0&&s.push(r.assignTexture(e,"map",a.baseColorTexture,qm))}return Promise.all(s)}}class sge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=s.extensions[this.name].emissiveStrength;return a!==void 0&&(t.emissiveIntensity=a),Promise.resolve()}}class ige{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&a.push(r.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(a.push(r.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const l=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new wt(l,l)}return Promise.all(a)}}class age{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_DISPERSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=s.extensions[this.name];return t.dispersion=a.dispersion!==void 0?a.dispersion:0,Promise.resolve()}}class oge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&a.push(r.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&a.push(r.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(a)}}class lge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[];t.sheenColor=new Ut(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=s.extensions[this.name];if(o.sheenColorFactor!==void 0){const l=o.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],Od)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&a.push(r.assignTexture(t,"sheenColorMap",o.sheenColorTexture,qm)),o.sheenRoughnessTexture!==void 0&&a.push(r.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(a)}}class cge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&a.push(r.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(a)}}class uge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&a.push(r.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const l=o.attenuationColor||[1,1,1];return t.attenuationColor=new Ut().setRGB(l[0],l[1],l[2],Od),Promise.all(a)}}class dge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=s.extensions[this.name];return t.ior=a.ior!==void 0?a.ior:1.5,Promise.resolve()}}class fge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&a.push(r.assignTexture(t,"specularIntensityMap",o.specularTexture));const l=o.specularColorFactor||[1,1,1];return t.specularColor=new Ut().setRGB(l[0],l[1],l[2],Od),o.specularColorTexture!==void 0&&a.push(r.assignTexture(t,"specularColorMap",o.specularColorTexture,qm)),Promise.all(a)}}class hge{constructor(e){this.parser=e,this.name=hr.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&a.push(r.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(a)}}class mge{constructor(e){this.parser=e,this.name=hr.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:$l}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const a=[],o=s.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&a.push(r.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(a)}}class pge{constructor(e){this.parser=e,this.name=hr.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const a=s.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a.source,o)}}class gge{constructor(e){this.parser=e,this.name=hr.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,a=s.textures[e];if(!a.extensions||!a.extensions[t])return null;const o=a.extensions[t],l=s.images[o.source];let u=r.textureLoader;if(l.uri){const d=r.options.manager.getHandler(l.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return r.loadTextureImage(e,o.source,u);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class xge{constructor(e){this.parser=e,this.name=hr.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,a=s.textures[e];if(!a.extensions||!a.extensions[t])return null;const o=a.extensions[t],l=s.images[o.source];let u=r.textureLoader;if(l.uri){const d=r.options.manager.getHandler(l.uri);d!==null&&(u=d)}return this.detectSupport().then(function(d){if(d)return r.loadTextureImage(e,o.source,u);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAA
4507AoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class bge{constructor(e){this.name=hr.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const s=r.extensions[this.name],a=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return a.then(function(l){const u=s.byteOffset||0,d=s.byteLength||0,h=s.count,p=s.byteStride,x=new Uint8Array(l,u,d);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,p,x,s.mode,s.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(h*p);return o.decodeGltfBuffer(new Uint8Array(y),h,p,x,s.mode,s.filter),y})})}else return null}}
vendor: 33,810 bytes, lines 4507-4508
4507class yge{constructor(e){this.name=hr.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const s=t.meshes[r.mesh];for(const d of s.primitives)if(d.mode!==Il.TRIANGLES&&d.mode!==Il.TRIANGLE_STRIP&&d.mode!==Il.TRIANGLE_FAN&&d.mode!==void 0)return null;const o=r.extensions[this.name].attributes,l=[],u={};for(const d in o)l.push(this.parser.getDependency("accessor",o[d]).then(h=>(u[d]=h,u[d])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(d=>{const h=d.pop(),p=h.isGroup?h.children:[h],x=d[0].count,y=[];for(const v of p){const _=new yn,M=new we,S=new Oi,A=new we(1,1,1),E=new hR(v.geometry,v.material,x);for(let C=0;C<x;C++)u.TRANSLATION&&M.fromBufferAttribute(u.TRANSLATION,C),u.ROTATION&&S.fromBufferAttribute(u.ROTATION,C),u.SCALE&&A.fromBufferAttribute(u.SCALE,C),E.setMatrixAt(C,_.compose(M,S,A));for(const C in u)if(C==="_COLOR_0"){const I=u[C];E.instanceColor=new wh(I.array,I.itemSize,I.normalized)}else C!=="TRANSLATION"&&C!=="ROTATION"&&C!=="SCALE"&&v.geometry.setAttribute(C,u[C]);vr.prototype.copy.call(E,v),this.parser.assignFinalMaterial(E),y.push(E)}return h.isGroup?(h.clear(),h.add(...y),h):y[0]}))}}const Z9="glTF",Yb=12,tB={JSON:1313821514,BIN:5130562};class vge{constructor(e){this.name=hr.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Yb);if(this.header={magic:RM(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Z9)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-Yb,s=new DataView(e,Yb);let a=0;for(;a<r;){const o=s.getUint32(a,!0);a+=4;const l=s.getUint32(a,!0);if(a+=4,l===tB.JSON){const u=new Uint8Array(e,Yb+a,o);this.content=RM(u)}else if(l===tB.BIN){const u=Yb+a;this.body=e.slice(u,u+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wge{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=hr.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,a=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},u={},d={};for(const h in o){const p=ZT[h]||h.toLowerCase();l[p]=o[h]}for(const h in e.attributes){const p=ZT[h]||h.toLowerCase();if(o[h]!==void 0){const x=r.accessors[e.attributes[h]],y=Nx[x.componentType];d[p]=y.name,u[p]=x.normalized===!0}}return t.getDependency("bufferView",a).then(function(h){return new Promise(function(p,x){s.decodeDracoFile(h,function(y){for(const v in y.attributes){const _=y.attributes[v],M=u[v];M!==void 0&&(_.normalized=M)}p(y)},l,d,Od,x)})})}}class Sge{constructor(){this.name=hr.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class _ge{constructor(){this.name=hr.KHR_MESH_QUANTIZATION}}class eG extends jp{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,a=e*s*3+s;for(let o=0;o!==s;o++)t[o]=r[a+o];return t}interpolate_(e,t,r,s){const a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,u=l*2,d=l*3,h=s-t,p=(r-t)/h,x=p*p,y=x*p,v=e*d,_=v-d,M=-2*y+3*x,S=y-x,A=1-M,E=S-x+p;for(let C=0;C!==l;C++){const I=o[_+C+l],D=o[_+C+u]*h,B=o[v+C+l],P=o[v+C]*h;a[C]=A*I+E*D+M*B+S*P}return a}}const Mge=new Oi;class Nge extends eG{interpolate_(e,t,r,s){const a=super.interpolate_(e,t,r,s);return Mge.fromArray(a).normalize().toArray(a),a}}const Il={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Nx={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},nB={9728:ri,9729:qr,9984:_N,9985:_x,9986:Hm,9987:Fl},rB={33071:io,33648:kx,10497:bh},WE={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ZT={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...zR>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Xf={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Age={CUBICSPLINE:void 0,LINEAR:Ox,STEP:Lx},$E={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Cge(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Dv({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Bu})),n.DefaultMaterial}function Cm(n,e,t){for(const r in t.extensions)n[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function Ad(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ege(n,e,t){let r=!1,s=!1,a=!1;for(let d=0,h=e.length;d<h;d++){const p=e[d];if(p.POSITION!==void 0&&(r=!0),p.NORMAL!==void 0&&(s=!0),p.COLOR_0!==void 0&&(a=!0),r&&s&&a)break}if(!r&&!s&&!a)return Promise.resolve(n);const o=[],l=[],u=[];for(let d=0,h=e.length;d<h;d++){const p=e[d];if(r){const x=p.POSITION!==void 0?t.getDependency("accessor",p.POSITION):n.attributes.position;o.push(x)}if(s){const x=p.NORMAL!==void 0?t.getDependency("accessor",p.NORMAL):n.attributes.normal;l.push(x)}if(a){const x=p.COLOR_0!==void 0?t.getDependency("accessor",p.COLOR_0):n.attributes.color;u.push(x)}}return Promise.all([Promise.all(o),Promise.all(l),Promise.all(u)]).then(function(d){const h=d[0],p=d[1],x=d[2];return r&&(n.morphAttributes.position=h),s&&(n.morphAttributes.normal=p),a&&(n.morphAttributes.color=x),n.morphTargetsRelative=!0,n})}function jge(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,r=e.weights.length;t<r;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let r=0,s=t.length;r<s;r++)n.morphTargetDictionary[t[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Tge(n){let e;const t=n.extensions&&n.extensions[hr.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+XE(t.attributes):e=n.indices+":"+XE(n.attributes)+":"+n.mode,n.targets!==void 0)for(let r=0,s=n.targets.length;r<s;r++)e+=":"+XE(n.targets[r]);return e}function XE(n){let e="";const t=Object.keys(n).sort();for(let r=0,s=t.length;r<s;r++)e+=t[r]+":"+n[t[r]]+";";return e}function e2(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Rge(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Pge=new yn;class Dge{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new tge,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,s=!1,a=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,a=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||s&&a<98?this.textureLoader=new r9(this.options.manager):this.textureLoader=new c9(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new rl(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,a=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const l={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:r,userData:{}};return Cm(a,l,s),Ad(l,s),Promise.all(r._invokeAll(function(u){return u.afterRoot&&u.afterRoot(l)})).then(function(){for(const u of l.scenes)u.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let s=0,a=t.length;s<a;s++){const o=t[s].joints;for(let l=0,u=o.length;l<u;l++)e[o[l]].isBone=!0}for(let s=0,a=e.length;s<a;s++){const o=e[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(r[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),a=(o,l)=>{const u=this.associations.get(o);u!=null&&this.associations.set(l,u);for(const[d,h]of o.children.entries())a(h,l.children[d])};return a(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const a=e(t[s]);a&&r.push(a)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(a){return a.loadNode&&a.loadNode(t)});break;case"mesh":s=this._invokeOne(function(a){return a.loadMesh&&a.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(a){return a.loadBufferView&&a.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(a){return a.loadMaterial&&a.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(a){return a.loadTexture&&a.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(a){return a.loadAnimation&&a.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(a){return a!=this&&a.getDependency&&a.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(a,o){return r.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[hr.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(a,o){r.load(oh.resolveURL(t.uri,s.path),a,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(r){const s=t.byteLength||0,a=t.byteOffset||0;return r.slice(a,a+s)})}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const o=WE[s.type],l=Nx[s.componentType],u=s.normalized===!0,d=new l(s.count*o);return Promise.resolve(new Er(d,o,u))}const a=[];return s.bufferView!==void 0?a.push(this.getDependency("bufferView",s.bufferView)):a.push(null),s.sparse!==void 0&&(a.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(a).then(function(o){const l=o[0],u=WE[s.type],d=Nx[s.componentType],h=d.BYTES_PER_ELEMENT,p=h*u,x=s.byteOffset||0,y=s.bufferView!==void 0?r.bufferViews[s.bufferView].byteStride:void 0,v=s.normalized===!0;let _,M;if(y&&y!==p){const S=Math.floor(x/y),A="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+S+":"+s.count;let E=t.cache.get(A);E||(_=new d(l,S*y,s.count*y/h),E=new Nv(_,y/h),t.cache.add(A,E)),M=new Do(E,u,x%y/h,v)}else l===null?_=new d(s.count*u):_=new d(l,x,s.count*u),M=new Er(_,u,v);if(s.sparse!==void 0){const S=WE.SCALAR,A=Nx[s.sparse.indices.componentType],E=s.sparse.indices.byteOffset||0,C=s.sparse.values.byteOffset||0,I=new A(o[1],E,s.sparse.count*S),D=new d(o[2],C,s.sparse.count*u);l!==null&&(M=new Er(M.array.slice(),M.itemSize,M.normalized));for(let B=0,P=I.length;B<P;B++){const G=I[B];if(M.setX(G,D[B*u]),u>=2&&M.setY(G,D[B*u+1]),u>=3&&M.setZ(G,D[B*u+2]),u>=4&&M.setW(G,D[B*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return M})}loadTexture(e){const t=this.json,r=this.options,a=t.textures[e].source,o=t.images[a];let l=this.textureLoader;if(o.uri){const u=r.manager.getHandler(o.uri);u!==null&&(l=u)}return this.loadTextureImage(e,a,l)}loadTextureImage(e,t,r){const s=this,a=this.json,o=a.textures[e],l=a.images[t],u=(l.uri||l.bufferView)+":"+o.sampler;if(this.textureCache[u])return this.textureCache[u];const d=this.loadImageSource(t,r).then(function(h){h.flipY=!1,h.name=o.name||l.name||"",h.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(h.name=l.uri);const x=(a.samplers||{})[o.sampler]||{};return h.magFilter=nB[x.magFilter]||qr,h.minFilter=nB[x.minFilter]||Fl,h.wrapS=rB[x.wrapS]||bh,h.wrapT=rB[x.wrapT]||bh,s.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[u]=d,d}loadImageSource(e,t){const r=this,s=this.json,a=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(p=>p.clone());const o=s.images[e],l=self.URL||self.webkitURL;let u=o.uri||"",d=!1;if(o.bufferView!==void 0)u=r.getDependency("bufferView",o.bufferView).then(function(p){d=!0;const x=new Blob([p],{type:o.mimeType});return u=l.createObjectURL(x),u});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(u).then(function(p){return new Promise(function(x,y){let v=x;t.isImageBitmapLoader===!0&&(v=function(_){const M=new ms(_);M.needsUpdate=!0,x(M)}),t.load(oh.resolveURL(p,a.path),v,void 0,y)})}).then(function(p){return d===!0&&l.revokeObjectURL(u),Ad(p,o),p.userData.mimeType=o.mimeType||Rge(o.uri),p}).catch(function(p){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),p});return this.sourceCache[e]=h,h}assignTexture(e,t,r,s){const a=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),a.extensions[hr.KHR_TEXTURE_TRANSFORM]){const l=r.extensions!==void 0?r.extensions[hr.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const u=a.associations.get(o);o=a.extensions[hr.KHR_TEXTURE_TRANSFORM].extendTexture(o,l),a.associations.set(o,u)}}return s!==void 0&&(typeof s=="number"&&(s=s===eB?qm:Od),"colorSpace"in o?o.colorSpace=s:o.encoding=s===qm?eB:ege),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=t.attributes.tangent===void 0,a=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+r.uuid;let u=this.cache.get(l);u||(u=new UN,Ci.prototype.copy.call(u,r),u.color.copy(r.color),u.map=r.map,u.sizeAttenuation=!1,this.cache.add(l,u)),r=u}else if(e.isLine){const l="LineBasicMaterial:"+r.uuid;let u=this.cache.get(l);u||(u=new ka,Ci.prototype.copy.call(u,r),u.color.copy(r.color),u.map=r.map,this.cache.add(l,u)),r=u}if(s||a||o){let l="ClonedMaterial:"+r.uuid+":";s&&(l+="derivative-tangents:"),a&&(l+="vertex-colors:"),o&&(l+="flat-shading:");let u=this.cache.get(l);u||(u=r.clone(),a&&(u.vertexColors=!0),o&&(u.flatShading=!0),s&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(l,u),this.associations.set(u,this.associations.get(r))),r=u}e.material=r}getMaterialType(){return Dv}loadMaterial(e){const t=this,r=this.json,s=this.extensions,a=r.materials[e];let o;const l={},u=a.extensions||{},d=[];if(u[hr.KHR_MATERIALS_UNLIT]){const p=s[hr.KHR_MATERIALS_UNLIT];o=p.getMaterialType(),d.push(p.extendParams(l,a,t))}else{const p=a.pbrMetallicRoughness||{};if(l.color=new Ut(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){const x=p.baseColorFactor;l.color.setRGB(x[0],x[1],x[2],Od),l.opacity=x[3]}p.baseColorTexture!==void 0&&d.push(t.assignTexture(l,"map",p.baseColorTexture,qm)),l.metalness=p.metallicFactor!==void 0?p.metallicFactor:1,l.roughness=p.roughnessFactor!==void 0?p.roughnessFactor:1,p.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),d.push(t.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),o=this._invokeOne(function(x){return x.getMaterialType&&x.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(x){return x.extendMaterialParams&&x.extendMaterialParams(e,l)})))}a.doubleSided===!0&&(l.side=Ll);const h=a.alphaMode||$E.OPAQUE;if(h===$E.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,h===$E.MASK&&(l.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&o!==ko&&(d.push(t.assignTexture(l,"normalMap",a.normalTexture)),l.normalScale=new wt(1,1),a.normalTexture.scale!==void 0)){const p=a.normalTexture.scale;l.normalScale.set(p,p)}if(a.occlusionTexture!==void 0&&o!==ko&&(d.push(t.assignTexture(l,"aoMap",a.occlusionTexture)),a.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&o!==ko){const p=a.emissiveFactor;l.emissive=new Ut().setRGB(p[0],p[1],p[2],Od)}return a.emissiveTexture!==void 0&&o!==ko&&d.push(t.assignTexture(l,"emissiveMap",a.emissiveTexture,qm)),Promise.all(d).then(function(){const p=new o(l);return a.name&&(p.name=a.name),Ad(p,a),t.associations.set(p,{materials:e}),a.extensions&&Cm(s,p,a),p})}createUniqueName(e){const t=_r.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function a(l){return r[hr.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(u){return sB(u,l,t)})}const o=[];for(let l=0,u=e.length;l<u;l++){const d=e[l],h=Tge(d),p=s[h];if(p)o.push(p.promise);else{let x;d.extensions&&d.extensions[hr.KHR_DRACO_MESH_COMPRESSION]?x=a(d):x=sB(new Bn,d,t),s[h]={primitive:d,promise:x},o.push(x)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,s=this.extensions,a=r.meshes[e],o=a.primitives,l=[];for(let u=0,d=o.length;u<d;u++){const h=o[u].material===void 0?Cge(this.cache):this.getDependency("material",o[u].material);l.push(h)}return l.push(t.loadGeometries(o)),Promise.all(l).then(function(u){const d=u.slice(0,u.length-1),h=u[u.length-1],p=[];for(let y=0,v=h.length;y<v;y++){const _=h[y],M=o[y];let S;const A=d[y];if(M.mode===Il.TRIANGLES||M.mode===Il.TRIANGLE_STRIP||M.mode===Il.TRIANGLE_FAN||M.mode===void 0)S=a.isSkinnedMesh===!0?new fR(_,A):new Ns(_,A),S.isSkinnedMesh===!0&&S.normalizeSkinWeights(),M.mode===Il.TRIANGLE_STRIP?S.geometry=K4(S.geometry,iR):M.mode===Il.TRIANGLE_FAN&&(S.geometry=K4(S.geometry,SM));else if(M.mode===Il.LINES)S=new Pc(_,A);else if(M.mode===Il.LINE_STRIP)S=new Vd(_,A);else if(M.mode===Il.LINE_LOOP)S=new mR(_,A);else if(M.mode===Il.POINTS)S=new pR(_,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+M.mode);Object.keys(S.geometry.morphAttributes).length>0&&jge(S,a),S.name=t.createUniqueName(a.name||"mesh_"+e),Ad(S,a),M.extensions&&Cm(s,S,M),t.assignFinalMaterial(S),p.push(S)}for(let y=0,v=p.length;y<v;y++)t.associations.set(p[y],{meshes:e,primitives:y});if(p.length===1)return a.extensions&&Cm(s,p[0],a),p[0];const x=new Dd;a.extensions&&Cm(s,x,a),t.associations.set(x,{meshes:e});for(let y=0,v=p.length;y<v;y++)x.add(p[y]);return x})}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?t=new ti(DN.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):r.type==="orthographic"&&(t=new Ru(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),Ad(t,r),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],r=[];for(let s=0,a=t.joints.length;s<a;s++)r.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(s){const a=s.pop(),o=s,l=[],u=[];for(let d=0,h=o.length;d<h;d++){const p=o[d];if(p){l.push(p);const x=new yn;a!==null&&x.fromArray(a.array,d*16),u.push(x)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new Av(l,u)})}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],a=s.name?s.name:"animation_"+e,o=[],l=[],u=[],d=[],h=[];for(let p=0,x=s.channels.length;p<x;p++){const y=s.channels[p],v=s.samplers[y.sampler],_=y.target,M=_.node,S=s.parameters!==void 0?s.parameters[v.input]:v.input,A=s.parameters!==void 0?s.parameters[v.output]:v.output;_.node!==void 0&&(o.push(this.getDependency("node",M)),l.push(this.getDependency("accessor",S)),u.push(this.getDependency("accessor",A)),d.push(v),h.push(_))}return Promise.all([Promise.all(o),Promise.all(l),Promise.all(u),Promise.all(d),Promise.all(h)]).then(function(p){const x=p[0],y=p[1],v=p[2],_=p[3],M=p[4],S=[];for(let A=0,E=x.length;A<E;A++){const C=x[A],I=y[A],D=v[A],B=_[A],P=M[A];if(C===void 0)continue;C.updateMatrix&&C.updateMatrix();const G=r._createAnimationTracks(C,I,D,B,P);if(G)for(let k=0;k<G.length;k++)S.push(G[k])}return new Xx(a,void 0,S)})}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return s.mesh===void 0?null:r.getDependency("mesh",s.mesh).then(function(a){const o=r._getNodeRef(r.meshCache,s.mesh,a);return s.weights!==void 0&&o.traverse(function(l){if(l.isMesh)for(let u=0,d=s.weights.length;u<d;u++)l.morphTargetInfluences[u]=s.weights[u]}),o})}loadNode(e){const t=this.json,r=this,s=t.nodes[e],a=r._loadNodeShallow(e),o=[],l=s.children||[];for(let d=0,h=l.length;d<h;d++)o.push(r.getDependency("node",l[d]));const u=s.skin===void 0?Promise.resolve(null):r.getDependency("skin",s.skin);return Promise.all([a,Promise.all(o),u]).then(function(d){const h=d[0],p=d[1],x=d[2];x!==null&&h.traverse(function(y){y.isSkinnedMesh&&y.bind(x,Pge)});for(let y=0,v=p.length;y<v;y++)h.add(p[y]);return h})}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const a=t.nodes[e],o=a.name?s.createUniqueName(a.name):"",l=[],u=s._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return u&&l.push(u),a.camera!==void 0&&l.push(s.getDependency("camera",a.camera).then(function(d){return s._getNodeRef(s.cameraCache,a.camera,d)})),s._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){l.push(d)}),this.nodeCache[e]=Promise.all(l).then(function(d){let h;if(a.isBone===!0?h=new ON:d.length>1?h=new Dd:d.length===1?h=d[0]:h=new vr,h!==d[0])for(let p=0,x=d.length;p<x;p++)h.add(d[p]);if(a.name&&(h.userData.name=a.name,h.name=o),Ad(h,a),a.extensions&&Cm(r,h,a),a.matrix!==void 0){const p=new yn;p.fromArray(a.matrix),h.applyMatrix4(p)}else a.translation!==void 0&&h.position.fromArray(a.translation),a.rotation!==void 0&&h.quaternion.fromArray(a.rotation),a.scale!==void 0&&h.scale.fromArray(a.scale);return s.associations.has(h)||s.associations.set(h,{}),s.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,a=new Dd;r.name&&(a.name=s.createUniqueName(r.name)),Ad(a,r),r.extensions&&Cm(t,a,r);const o=r.nodes||[],l=[];for(let u=0,d=o.length;u<d;u++)l.push(s.getDependency("node",o[u]));return Promise.all(l).then(function(u){for(let h=0,p=u.length;h<p;h++)a.add(u[h]);const d=h=>{const p=new Map;for(const[x,y]of s.associations)(x instanceof Ci||x instanceof ms)&&p.set(x,y);return h.traverse(x=>{const y=s.associations.get(x);y!=null&&p.set(x,y)}),p};return s.associations=d(a),a})}_createAnimationTracks(e,t,r,s,a){const o=[],l=e.name?e.name:e.uuid,u=[];Xf[a.path]===Xf.weights?e.traverse(function(x){x.morphTargetInfluences&&u.push(x.name?x.name:x.uuid)}):u.push(l);let d;switch(Xf[a.path]){case Xf.weights:d=Wx;break;case Xf.rotation:d=$x;break;case Xf.position:case Xf.scale:d=nv;break;default:r.itemSize===1?d=Wx:d=nv;break}const h=s.interpolation!==void 0?Age[s.interpolation]:Ox,p=this._getArrayFromAccessor(r);for(let x=0,y=u.length;x<y;x++){const v=new d(u[x]+"."+Xf[a.path],t.array,p,h);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(v),o.push(v)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const r=e2(t.constructor),s=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a++)s[a]=t[a]*r;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const s=this instanceof $x?Nge:eG;return new s(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function kge(n,e,t){const r=e.attributes,s=new hi;if(r.POSITION!==void 0){const l=t.json.accessors[r.POSITION],u=l.min,d=l.max;if(u!==void 0&&d!==void 0){if(s.set(new we(u[0],u[1],u[2]),new we(d[0],d[1],d[2])),l.normalized){const h=e2(Nx[l.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const a=e.targets;if(a!==void 0){const l=new we,u=new we;for(let d=0,h=a.length;d<h;d++){const p=a[d];if(p.POSITION!==void 0){const x=t.json.accessors[p.POSITION],y=x.min,v=x.max;if(y!==void 0&&v!==void 0){if(u.setX(Math.max(Math.abs(y[0]),Math.abs(v[0]))),u.setY(Math.max(Math.abs(y[1]),Math.abs(v[1]))),u.setZ(Math.max(Math.abs(y[2]),Math.abs(v[2]))),x.normalized){const _=e2(Nx[x.componentType]);u.multiplyScalar(_)}l.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(l)}n.boundingBox=s;const o=new mi;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,n.boundingSphere=o}function sB(n,e,t){const r=e.attributes,s=[];function a(o,l){return t.getDependency("accessor",o).then(function(u){n.setAttribute(l,u)})}for(const o in r){const l=ZT[o]||o.toLowerCase();l in n.attributes||s.push(a(r[o],l))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(l){n.setIndex(l)});s.push(o)}return Ad(n,e),kge(n,e,t),Promise.all(s).then(function(){return e.targets!==void 0?Ege(n,e.targets,t):n})}const qE=new WeakMap;class Ige extends Ia{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){const a=new rl(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,o=>{const l={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,l).then(t).catch(s)},r,s)}decodeDracoFile(e,t,r,s){const a={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,a).then(t)}decodeGeometry(e,t){for(const u in t.attributeTypes){const d=t.attributeTypes[u];d.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[u]=d.name)}const r=JSON.stringify(t);if(qE.has(e)){const u=qE.get(e);if(u.key===r)return u.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const a=this.workerNextTaskID++,o=e.byteLength,l=this._getWorker(a,o).then(u=>(s=u,new Promise((d,h)=>{s._callbacks[a]={resolve:d,reject:h},s.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))).then(u=>this._createGeometry(u.geometry));return l.catch(()=>!0).then(()=>{s&&a&&this._releaseTask(s,a)}),qE.set(e,{key:r,promise:l}),l}_createGeometry(e){const t=new Bn;e.index&&t.setIndex(new Er(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],a=s.name,o=s.array,l=s.itemSize;t.setAttribute(a,new Er(o,l))}return t}_loadLibrary(e,t){const r=new rl(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((s,a)=>{r.load(e,s,void 0,a)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{const s=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const a=Bge.toString(),o=["/* draco decoder */",s,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
4508`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(a){const o=a.data;switch(o.type){case"decode":s._callbacks[o.id].resolve(o);break;case"error":s._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,a){return s._taskLoad>a._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function Bge(){let n,e;onmessage=function(o){const l=o.data;switch(l.type){case"init":n=l.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(p){h({draco:p})},DracoDecoderModule(n)});break;case"decode":const u=l.buffer,d=l.taskConfig;e.then(h=>{const p=h.draco,x=new p.Decoder,y=new p.DecoderBuffer;y.Init(new Int8Array(u),u.byteLength);try{const v=t(p,x,y,d),_=v.attributes.map(M=>M.array.buffer);v.index&&_.push(v.index.array.buffer),self.postMessage({type:"decode",id:l.id,geometry:v},_)}catch(v){console.error(v),self.postMessage({type:"error",id:l.id,error:v.message})}finally{p.destroy(y),p.destroy(x)}});break}};function t(o,l,u,d){const h=d.attributeIDs,p=d.attributeTypes;let x,y;const v=l.GetEncodedGeometryType(u);if(v===o.TRIANGULAR_MESH)x=new o.Mesh,y=l.DecodeBufferToMesh(u,x);else if(v===o.POINT_CLOUD)x=new o.PointCloud,y=l.DecodeBufferToPointCloud(u,x);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!y.ok()||x.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+y.error_msg());const _={index:null,attributes:[]};for(const M in h){const S=self[p[M]];let A,E;if(d.useUniqueIDs)E=h[M],A=l.GetAttributeByUniqueId(x,E);else{if(E=l.GetAttributeId(x,o[h[M]]),E===-1)continue;A=l.GetAttribute(x,E)}_.attributes.push(s(o,l,x,M,S,A))}return v===o.TRIANGULAR_MESH&&(_.index=r(o,l,x)),o.destroy(x),_}function r(o,l,u){const h=u.num_faces()*3,p=h*4,x=o._malloc(p);l.GetTrianglesUInt32Array(u,p,x);const y=new Uint32Array(o.HEAPF32.buffer,x,h).slice();return o._free(x),{array:y,itemSize:1}}function s(o,l,u,d,h,p){const x=p.num_components(),v=u.num_points()*x,_=v*h.BYTES_PER_ELEMENT,M=a(o,h),S=o._malloc(_);l.GetAttributeDataArrayForAllPoints(u,p,M,_,S);const A=new h(o.HEAPF32.buffer,S,v).slice();return o._free(S),{name:d,array:A,itemSize:x}}function a(o,l){switch(l){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}const iB=new hi,TS=new we;class HR extends iA{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(r),this.setAttribute("position",new tn(e,3)),this.setAttribute("uv",new tn(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,r=this.attributes.instanceEnd;
4508return t!==void 0&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const r=new AM(t,6,1);return this.setAttribute("instanceStart",new Do(r,3,0)),this.setAttribute("instanceEnd",new Do(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let r;e instanceof Float32Array?r=e:Array.isArray(e)&&(r=new Float32Array(e));const s=new AM(r,t*2,1);return this.setAttribute("instanceColorStart",new Do(s,t,0)),this.setAttribute("instanceColorEnd",new Do(s,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new _R(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hi);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),iB.setFromBufferAttribute(t),this.boundingBox.union(iB))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new mi),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let s=0;for(let a=0,o=e.count;a<o;a++)TS.fromBufferAttribute(e,a),s=Math.max(s,r.distanceToSquared(TS
4508)),TS.fromBufferAttribute(t,a),s=Math.max(s,r.distanceToSquared(TS));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class tG extends HR{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,r=new Float32Array(2*t);for(let s=0;s<t;s+=3)r[2*s]=e[s],r[2*s+1]=e[s+1],r[2*s+2]=e[s+2],r[2*s+3]=e[s+3],r[2*s+4]=e[s+4],r[2*s+5]=e[s+5];return super.setPositions(r),this}setColors(e,t=3){const r=e.length-t,s=new Float32Array(2*r);if(t===3)for(let a=0;a<r;a+=t)s[2*a]=e[a],s[2*a+1]=e[a+1],s[2*a+2]=e[a+2],s[2*a+3]=e[a+3],s[2*a+4]=e[a+4],s[2*a+5]=e[a+5];else for(let a=0;a<r;a+=t)s[2*a]=e[a],s[2*a+1]=e[a+1],s[2*a+2]=e[a+2],s[2*a+3]=e[a+3],s[2*a+4]=e[a+4],s[2*a+5]=e[a+5],s[2*a+6]=e[a+6],s[2*a+7]=e[a+7];return super.setColors(s,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class VR extends oo{constructor(e){super({type:"LineMaterial",uniforms:Vx.clone(Vx.merge([Xt.common,Xt.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new wt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
4509				#include <common>
4510				#include <fog_pars_vertex>
4511				#include <logdepthbuf_pars_vertex>
4512				#include <clipping_planes_pars_vertex>
4513
4514				uniform float linewidth;
4515				uniform vec2 resolution;
4516
4517				attribute vec3 instanceStart;
4518				attribute vec3 instanceEnd;
4519
4520				#ifdef USE_COLOR
4521					#ifdef USE_LINE_COLOR_ALPHA
4522						varying vec4 vLineColor;
4523						attribute vec4 instanceColorStart;
4524						attribute vec4 instanceColorEnd;
4525					#else
4526						varying vec3 vLineColor;
4527						attribute vec3 instanceColorStart;
4528						attribute vec3 instanceColorEnd;
4529					#endif
4530				#endif
4531
4532				#ifdef WORLD_UNITS
4533
4534					varying vec4 worldPos;
4535					varying vec3 worldStart;
4536					varying vec3 worldEnd;
4537
4538					#ifdef USE_DASH
4539
4540						varying vec2 vUv;
4541
4542					#endif
4543
4544				#else
4545
4546					varying vec2 vUv;
4547
4548				#endif
4549
4550				#ifdef USE_DASH
4551
4552					uniform float dashScale;
4553					attribute float instanceDistanceStart;
4554					attribute float instanceDistanceEnd;
4555					varying float vLineDistance;
4556
4557				#endif
4558
4559				void trimSegment( const in vec4 start, inout vec4 end ) {
4560
4561					// trim end segment so it terminates between the camera plane and the near plane
4562
4563					// conservative estimate of the near plane
4564					float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
4565					float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
4566					float nearEstimate = - 0.5 * b / a;
4567
4568					float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
4569
4570					end.xyz = mix( start.xyz, end.xyz, alpha );
4571
4572				}
4573
4574				void main() {
4575
4576					#ifdef USE_COLOR
4577
4578						vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
4579
4580					#endif
4581
4582					#ifdef USE_DASH
4583
4584						vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
4585						vUv = uv;
4586
4587					#endif
4588
4589					float aspect = resolution.x / resolution.y;
4590
4591					// camera space
4592					vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
4593					vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
4594
4595					#ifdef WORLD_UNITS
4596
4597						worldStart = start.xyz;
4598						worldEnd = end.xyz;
4599
4600					#else
4601
4602						vUv = uv;
4603
4604					#endif
4605
4606					// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
4607					// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
4608					// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
4609					// perhaps there is a more elegant solution -- WestLangley
4610
4611					bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
4612
4613					if ( perspective ) {
4614
4615						if ( start.z < 0.0 && end.z >= 0.0 ) {
4616
4617							trimSegment( start, end );
4618
4619						} else if ( end.z < 0.0 && start.z >= 0.0 ) {
4620
4621							trimSegment( end, start );
4622
4623						}
4624
4625					}
4626
4627					// clip space
4628					vec4 clipStart = projectionMatrix * start;
4629					vec4 clipEnd = projectionMatrix * end;
4630
4631					// ndc space
4632					vec3 ndcStart = clipStart.xyz / clipStart.w;
4633					vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
4634
4635					// direction
4636					vec2 dir = ndcEnd.xy - ndcStart.xy;
4637
4638					// account for clip-space aspect ratio
4639					dir.x *= aspect;
4640					dir = normalize( dir );
4641
4642					#ifdef WORLD_UNITS
4643
4644						// get the offset direction as perpendicular to the view vector
4645						vec3 worldDir = normalize( end.xyz - start.xyz );
4646						vec3 offset;
4647						if ( position.y < 0.5 ) {
4648
4649							offset = normalize( cross( start.xyz, worldDir ) );
4650
4651						} else {
4652
4653							offset = normalize( cross( end.xyz, worldDir ) );
4654
4655						}
4656
4657						// sign flip
4658						if ( position.x < 0.0 ) offset *= - 1.0;
4659
4660						float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
4661
4662						// don't extend the line if we're rendering dashes because we
4663						// won't be rendering the endcaps
4664						#ifndef USE_DASH
4665
4666							// extend the line bounds to encompass  endcaps
4667							start.xyz += - worldDir * linewidth * 0.5;
4668							end.xyz += worldDir * linewidth * 0.5;
4669
4670							// shift the position of the quad so it hugs the forward edge of the line
4671							offset.xy -= dir * forwardOffset;
4672							offset.z += 0.5;
4673
4674						#endif
4675
4676						// endcaps
4677						if ( position.y > 1.0 || position.y < 0.0 ) {
4678
4679							offset.xy += dir * 2.0 * forwardOffset;
4680
4681						}
4682
4683						// adjust for linewidth
4684						offset *= linewidth * 0.5;
4685
4686						// set the world position
4687						worldPos = ( position.y < 0.5 ) ? start : end;
4688						worldPos.xyz += offset;
4689
4690						// project the worldpos
4691						vec4 clip = projectionMatrix * worldPos;
4692
4693						// shift the depth of the projected points so the line
4694						// segments overlap neatly
4695						vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
4696						clip.z = clipPose.z * clip.w;
4697
4698					#else
4699
4700						vec2 offset = vec2( dir.y, - dir.x );
4701						// undo aspect ratio adjustment
4702						dir.x /= aspect;
4703						offset.x /= aspect;
4704
4705						// sign flip
4706						if ( position.x < 0.0 ) offset *= - 1.0;
4707
4708						// endcaps
4709						if ( position.y < 0.0 ) {
4710
4711							offset += - dir;
4712
4713						} else if ( position.y > 1.0 ) {
4714
4715							offset += dir;
4716
4717						}
4718
4719						// adjust for linewidth
4720						offset *= linewidth;
4721
4722						// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
4723						offset /= resolution.y;
4724
4725						// select end
4726						vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
4727
4728						// back to clip space
4729						offset *= clip.w;
4730
4731						clip.xy += offset;
4732
4733					#endif
4734
4735					gl_Position = clip;
4736
4737					vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
4738
4739					#include <logdepthbuf_vertex>
4740					#include <clipping_planes_vertex>
4741					#include <fog_vertex>
4742
4743				}
4744			`,fragmentShader:`
4745				uniform vec3 diffuse;
4746				uniform float opacity;
4747				uniform float linewidth;
4748
4749				#ifdef USE_DASH
4750
4751					uniform float dashOffset;
4752					uniform float dashSize;
4753					uniform float gapSize;
4754
4755				#endif
4756
4757				varying float vLineDistance;
4758
4759				#ifdef WORLD_UNITS
4760
4761					varying vec4 worldPos;
4762					varying vec3 worldStart;
4763					varying vec3 worldEnd;
4764
4765					#ifdef USE_DASH
4766
4767						varying vec2 vUv;
4768
4769					#endif
4770
4771				#else
4772
4773					varying vec2 vUv;
4774
4775				#endif
4776
4777				#include <common>
4778				#include <fog_pars_fragment>
4779				#include <logdepthbuf_pars_fragment>
4780				#include <clipping_planes_pars_fragment>
4781
4782				#ifdef USE_COLOR
4783					#ifdef USE_LINE_COLOR_ALPHA
4784						varying vec4 vLineColor;
4785					#else
4786						varying vec3 vLineColor;
4787					#endif
4788				#endif
4789
4790				vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
4791
4792					float mua;
4793					float mub;
4794
4795					vec3 p13 = p1 - p3;
4796					vec3 p43 = p4 - p3;
4797
4798					vec3 p21 = p2 - p1;
4799
4800					float d1343 = dot( p13, p43 );
4801					float d4321 = dot( p43, p21 );
4802					float d1321 = dot( p13, p21 );
4803					float d4343 = dot( p43, p43 );
4804					float d2121 = dot( p21, p21 );
4805
4806					float denom = d2121 * d4343 - d4321 * d4321;
4807
4808					float numer = d1343 * d4321 - d1321 * d4343;
4809
4810					mua = numer / denom;
4811					mua = clamp( mua, 0.0, 1.0 );
4812					mub = ( d1343 + d4321 * ( mua ) ) / d4343;
4813					mub = clamp( mub, 0.0, 1.0 );
4814
4815					return vec2( mua, mub );
4816
4817				}
4818
4819				void main() {
4820
4821					#include <clipping_planes_fragment>
4822
4823					#ifdef USE_DASH
4824
4825						if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
4826
4827						if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
4828
4829					#endif
4830
4831					float alpha = opacity;
4832
4833					#ifdef WORLD_UNITS
4834
4835						// Find the closest points on the view ray and the line segment
4836						vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
4837						vec3 lineDir = worldEnd - worldStart;
4838						vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
4839
4840						vec3 p1 = worldStart + lineDir * params.x;
4841						vec3 p2 = rayEnd * params.y;
4842						vec3 delta = p1 - p2;
4843						float len = length( delta );
4844						float norm = len / linewidth;
4845
4846						#ifndef USE_DASH
4847
4848							#ifdef USE_ALPHA_TO_COVERAGE
4849
4850								float dnorm = fwidth( norm );
4851								alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
4852
4853							#else
4854
4855								if ( norm > 0.5 ) {
4856
4857									discard;
4858
4859								}
4860
4861							#endif
4862
4863						#endif
4864
4865					#else
4866
4867						#ifdef USE_ALPHA_TO_COVERAGE
4868
4869							// artifacts appear on some hardware if a derivative is taken within a conditional
4870							float a = vUv.x;
4871							float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4872							float len2 = a * a + b * b;
4873							float dlen = fwidth( len2 );
4874
4875							if ( abs( vUv.y ) > 1.0 ) {
4876
4877								alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
4878
4879							}
4880
4881						#else
4882
4883							if ( abs( vUv.y ) > 1.0 ) {
4884
4885								float a = vUv.x;
4886								float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4887								float len2 = a * a + b * b;
4888
4889								if ( len2 > 1.0 ) discard;
4890
4891							}
4892
4893						#endif
4894
4895					#endif
4896
4897					vec4 diffuseColor = vec4( diffuse, alpha );
4898					#ifdef USE_COLOR
4899						#ifdef USE_LINE_COLOR_ALPHA
4900							diffuseColor *= vLineColor;
4901						#else
4902							diffuseColor.rgb *= vLineColor;
4903						#endif
4904					#endif
4905
4906					#include <logdepthbuf_fragment>
4907
4908					gl_FragColor = diffuseColor;
4909
4910					#include <tonemapping_fragment>
4911					#include <${zR>=154?"colorspace_fragment":"encodings_fragment"}>
4912					#include <fog_fragment>
4913					#include <premultiplied_alpha_fragment>
4914
4915				}
4916			`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}
4916,alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const YE=new mr,aB=new we,oB=new we,la=new mr,ca=new mr,gu=new mr,QE=new we,KE=new yn,da=new y9,lB=new we,RS=new hi,PS=new mi,xu=new mr;let Nu,rp;function cB(n,e,t){return xu.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),xu.multiplyScalar(1/xu.w),xu.x=rp/t.width,xu.y=rp/t.height,xu.applyMatrix4(n.projectionMatrixInverse),xu.multiplyScalar(1/xu.w),Math.abs(Math.max(xu.x,xu.y))}function Lge(n,e){const t=n.matrixWorld,r=n.geometry,s=r.attributes.instanceStart,a=r.attributes.instanceEnd,o=Math.min(r.instanceCount,s.count);for(let l=0,u=o;l<u;l++){da.start.fromBufferAttribute(s,l),da.end.fromBufferAttribute(a,l),da.applyMatrix4(t);const d=new we,h=new we;Nu.distanceSqToSegment(da.start,da.end,h,d),h.distanceTo(d)<rp*.5&&e.push({point:h,pointOnLine:d,distance:Nu.origin.distanceTo(h),object:n,face:null,faceIndex:l,uv:null,[J9]:null})}}function Oge(n,e,t){const r=e.projectionMatrix,a=n.material.resolution,o=n.matrixWorld,l=n.geometry,u=l.attributes.instanceStart,d=l.attributes.instanceEnd,h=Math.min(l.instanceCount,u.count),p=-e.near;Nu.at(1,gu),gu.w=1,gu.applyMatrix4(e.matrixWorldInverse),gu.applyMatrix4(r),gu.multiplyScalar(1/gu.w),gu.x*=a.x/2,gu.y*=a.y/2,gu.z=0,QE.copy(gu),KE.multiplyMatrices(e.matrixWorldInverse,o);for(let x=0,y=h;x<y;x++){if(la.fromBufferAttribute(u,x),ca.fromBufferAttribute(d,x),la.w=1,ca.w=1,la.applyMatrix4(KE),ca.applyMatrix4(KE),la.z>p&&ca.z>p)continue;if(la.z>p){const E=la.z-ca.z,C=(la.z-p)/E;la.lerp(ca,C)}else if(ca.z>p){const E=ca.z-la.z,C=(ca.z-p)/E;ca.lerp(la,C)}la.applyMatrix4(r),ca.applyMatrix4(r),la.multiplyScalar(1/la.w),ca.multiplyScalar(1/ca.w),la.x*=a.x/2,la.y*=a.y/2,ca.x*=a.x/2,ca.y*=a.y/2,da.start.copy(la),da.start.z=0,da.end.copy(ca),da.end.z=0;const _=da.closestPointToPointParameter(QE,!0);da.at(_,lB);const M=DN.lerp(la.z,ca.z,_),S=M>=-1&&M<=1,A=QE.distanceTo(lB)<rp*.5;if(S&&A){da.start.fromBufferAttribute(u,x),da.end.fromBufferAttribute(d,x),da.start.applyMatrix4(o),da.end.applyMatrix4(o);const E=new we,C=new we;Nu.distanceSqToSegment(da.start,da.end,C,E),t.push({point:C,pointOnLine:E,distance:Nu.origin.distanceTo(C),object:n,face:null,faceIndex:x,uv:null,[J9]:null})}}}class nG extends Ns{constructor(e=new HR,t=new VR({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let o=0,l=0,u=t.count;o<u;o++,l+=2)aB.fromBufferAttribute(t,o),oB.fromBufferAttribute(r,o),s[l]=l===0?0:s[l-1],s[l+1]=s[l]+aB.distanceTo(oB);const a=new AM(s,2,1);return e.setAttribute("instanceDistanceStart",new Do(a,1,0)),e.setAttribute("instanceDistanceEnd",new Do(a,1,1)),this}raycast(e,t){const r=this.material.worldUnits,s=e.camera;s===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Nu=e.ray;const o=this.matrixWorld,l=this.geometry,u=this.material;rp=u.linewidth+a,l.boundingSphere===null&&l.computeBoundingSphere(),PS.copy(l.boundingSphere).applyMatrix4(o);let d;if(r)d=rp*.5;else{const p=Math.max(s.near,PS.distanceToPoint(Nu.origin));d=cB(s,p,u.resolution)}if(PS.radius+=d,Nu.intersectsSphere(PS)===!1)return;l.boundingBox===null&&l.computeBoundingBox(),RS.copy(l.boundingBox).applyMatrix4(o);let h;if(r)h=rp*.5;else{const p=Math.max(s.near,RS.distanceToPoint(Nu.origin));h=cB(s,p,u.resolution)}RS.expandByScalar(h),Nu.intersectsBox(RS)!==!1&&(r?Lge(this,t):Oge(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(YE),this.material.uniforms.resolution.value.set(YE.z,YE.w))}}class Fge extends nG{constructor(e=new tG,t=new VR({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}let DS;const JE=()=>
4916{if(DS)return DS;const n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIA
4916LAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMG
4916XAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new 
4916Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let s=n;WebAssembly.validate(t)&&(s=e);let a;const o=WebAssembly.instantiate(l(s),{}).then(p=>{a=p.instance,a.exports.__wasm_call_ctors()});function l(p){const x=new Uint8Array(p.length);for(let v=0;v<p.length;++v){const _=p.charCodeAt(v);x[v]=_>96?_-71:_>64?_-65:_>47?_+4:_>46?63:62}let y=0;for(let v=0;v<p.length;++v)x[y++]=x[v]<60?r[x[v]]:(x[v]-60)*64+x[++v];return x.buffer.slice(0,y)}function u(p,x,y,v,_,M){const S=a.exports.sbrk,A=y+3&-4,E=S(A*v),C=S(_.length),I=new Uint8Array(a.exports.memory.buffer);I.set(_,C);const D=p(E,y,v,C,_.length);if(D===0&&M&&M(E,A,v),x.set(I.subarray(E,E+y*v)),S(E-S(0)),D!==0)throw new Error(`Malformed buffer data: ${D}`)}const d={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return DS={ready:o,supported:!0,decodeVertexBuffer(p,x,y,v,_){u(a.exports.meshopt_decodeVertexBuffer,p,x,y,v,a.exports[d[_]])},decodeIndexBuffer(p,x,y,v){u(a.exports.meshopt_decodeIndexBuffer,p,x,y,v)},decodeIndexSequence(p,x,y,v){u(a.exports.meshopt_decodeIndexSequence,p,x,y,v)},decodeGltfBuffer(p,x,y,v,_,M){u(a.exports[h[_]],p,x,y,v,a.exports[d[M]])}},DS},uA=T.forwardRef(function({points:e,color:t=16777215,vertexColors:r,linewidth:s,lineWidth:a,segments:o,dashed:l,...u},d){var h,p;const x=yu(S=>S.size),y=T.useMemo(()=>o?new nG:new Fge,[o]),[v]=T.useState(()=>new VR),_=(r==null||(h=r[0])==null?void 0:h.length)===4?4:3,M=T.useMemo(()=>{const S=o?new HR:new tG,A=e.map(E=>{const C=Array.isArray(E);return E instanceof we||E instanceof mr?[E.x,E.y,E.z]:E instanceof wt?[E.x,E.y,0]:C&&E.length===3?[E[0],E[1],E[2]]:C&&E.length===2?[E[0],E[1],0]:E});if(S.setPositions(A.flat()),r){t=16777215;const E=r.map(C=>C instanceof Ut?C.toArray():C);S.setColors(E.flat(),_)}return S},[e,o,r,_]);return T.useLayoutEffect(()=>{y.computeLineDistances()},[e,y]),T.useLayoutEffect(()=>{l?v.defines.USE_DASH="":delete v.defines.USE_DASH,v.needsUpdate=!0},[l,v]),T.useEffect(()=>()=>{M.dispose(),v.dispose()},[M]),T.createElement("primitive",Sh({object:y,ref:d},u),T.createElement("primitive",{object:M,attach:"geometry"}),T.createElement("primitive",Sh({object:v,attach:"material",color:t,vertexColors:!!r,resolution:[x.width,x.height],linewidth:(p=s??a)!==null&&p!==void 0?p:1,dashed:l,transparent:_===4},u)))});function Uge(){var n=Object.create(null);function e(s,a){var o=s.id,l=s.name,u=s.dependencies;u===void 0&&(u=[]);var d=s.init;d===void 0&&(d=function(){});var h=s.getTransferables;if(h===void 0&&(h=null),!n[o])try{u=u.map(function(x){return x&&x.isWorkerModule&&(e(x,function(y){if(y instanceof Error)throw y}),x=n[x.id].value),x}),d=r("<"+l+">.init",d),h&&(h=r("<"+l+">.getTransferables",h));var p=null;typeof d=="function"?p=d.apply(void 0,u):console.error("worker module init function failed to rehydrate"),n[o]={id:o,value:p,getTransferables:h},a(p)}catch(x){x&&x.noLog||console.error(x),a(x)}}function t(s,a){var o,l=s.id,u=s.args;(!n[l]||typeof n[l].value!="function")&&a(new Error("Worker module "+l+": not found or its 'init' did not return a function"));try{var d=(o=n[l]).value.apply(o,u);d&&typeof d.then=="function"?d.then(h,function(p){return a(p instanceof Error?p:new Error(""+p))}):h(d)}catch(p){a(p)}function h(p){try{var x=n[l].getTransferables&&n[l].getTransferables(p);(!x||!Array.isArray(x)||!x.length)&&(x=void 0),a(p,x)}catch(y){console.error(y),a(y)}}}function r(s,a){var o=void 0;self.troikaDefine=function(u){return o=u};var l=URL.createObjectURL(new Blob(["/** "+s.replace(/\*/g,"")+` **/
4917
4918troikaDefine(
4919`+a+`
4920)`],{type:"application/javascript"}));try{importScripts(l)}catch(u){console.error(u)}return URL.revokeObjectURL(l),delete self.troikaDefine,o}self.addEventListener("message",function(s){var a=s.data,o=a.messageId,l=a.action,u=a.data;try{l==="registerModule"&&e(u,function(d){d instanceof Error?postMessage({messageId:o,success:!1,error:d.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof d=="function"}})}),l==="callModule"&&t(u,function(d,h){d instanceof Error?postMessage({messageId:o,success:!1,error:d.message}):postMessage({messageId:o,success:!0,result:d},h||void 0)})}catch(d){postMessage({messageId:o,success:!1,error:d.stack})}})}
4920function zge(n){var e=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return e._getInitResult().then(function(s){if(typeof s=="function")return s.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=n.dependencies,r=n.init;t=Array.isArray(t)?t.map(function(a){return a&&(a=a.onMainThread||a,a._getInitResult&&(a=a._getInitResult())),a}):[];var s=Promise.all(t).then(function(a){return r.apply(null,a)});return e._getInitResult=function(){return s},s},e}var rG=function(){var n=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),n=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return rG=function(){return n},n},Gge=0,Hge=0,ZE=!1,Ey=Object.create(null),jy=Object.create(null),t2=Object.create(null);function c0(n){if((!n||typeof n.init!="function")&&!ZE)throw new Error("requires `options.init` function");var e=n.dependencies,t=n.init,r=n.getTransferables,s=n.workerId,a=zge(n);s==null&&(s="#default");var o="workerModule"+ ++Gge,l=n.name||o,u=null;e=e&&e.map(function(h){return typeof h=="function"&&!h.workerModuleData&&(ZE=!0,h=c0({workerId:s,name:"<"+l+"> function dependency: "+h.name,init:`function(){return (
4921`+d_(h)+`
4922)}`}),ZE=!1),h&&h.workerModuleData&&(h=h.workerModuleData),h});function d(){for(var h=[],p=arguments.length;p--;)h[p]=arguments[p];if(!rG())return a.apply(void 0,h);if(!u){u=uB(s,"registerModule",d.workerModuleData);var x=function(){u=null,jy[s].delete(x)};(jy[s]||(jy[s]=new Set)).add(x)}return u.then(function(y){var v=y.isCallable;if(v)return uB(s,"callModule",{id:o,args:h});throw new Error("Worker module function was called but `init` did not return a callable function")})}return d.workerModuleData={isWorkerModule:!0,id:o,name:l,dependencies:e,init:d_(t),getTransferables:r&&d_(r)},d.onMainThread=a,d}function Vge(n){jy[n]&&jy[n].forEach(function(e){e()}),Ey[n]&&(Ey[n].terminate(),delete Ey[n])}function d_(n){var e=n.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function Wge(n){var e=Ey[n];if(!e){var t=d_(Uge);e=Ey[n]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+n.replace(/\*/g,"")+` **/
4923
4924;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(r){var s=r.data,a=s.messageId,o=t2[a];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete t2[a],o(s)}}return e}function uB(n,e,t){return new Promise(function(r,s){var a=++Hge;t2[a]=function(o){o.success?r(o.result):s(new Error("Error in worker "+e+" call: "+o.error))},Wge(n).postMessage({messageId:a,action:e,data:t})})}function sG(){var n=(function(e){function t(oe,re,F,O,J,q,Q,ne){var Z=1-Q;ne.x=Z*Z*oe+2*Z*Q*F+Q*Q*J,ne.y=Z*Z*re+2*Z*Q*O+Q*Q*q}function r(oe,re,F,O,J,q,Q,ne,Z,se){var me=1-Z;se.x=me*me*me*oe+3*me*me*Z*F+3*me*Z*Z*J+Z*Z*Z*Q,se.y=me*me*me*re+3*me*me*Z*O+3*me*Z*Z*q+Z*Z*Z*ne}function s(oe,re){for(var F=/([MLQCZ])([^MLQCZ]*)/g,O,J,q,Q,ne;O=F.exec(oe);){var Z=O[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(se){return parseFloat(se)});switch(O[1]){case"M":Q=J=Z[0],ne=q=Z[1];break;case"L":(Z[0]!==Q||Z[1]!==ne)&&re("L",Q,ne,Q=Z[0],ne=Z[1]);break;case"Q":{re("Q",Q,ne,Q=Z[2],ne=Z[3],Z[0],Z[1]);break}case"C":{re("C",Q,ne,Q=Z[4],ne=Z[5],Z[0],Z[1],Z[2],Z[3]);break}case"Z":(Q!==J||ne!==q)&&re("L",Q,ne,J,q);break}}}function a(oe,re,F){F===void 0&&(F=16);var O={x:0,y:0};s(oe,function(J,q,Q,ne,Z,se,me,ze,Be){switch(J){case"L":re(q,Q,ne,Z);break;case"Q":{for(var ye=q,Le=Q,Ce=1;Ce<F;Ce++)t(q,Q,se,me,ne,Z,Ce/(F-1),O),re(ye,Le,O.x,O.y),ye=O.x,Le=O.y;break}case"C":{for(var Re=q,De=Q,he=1;he<F;he++)r(q,Q,se,me,ze,Be,ne,Z,he/(F-1),O),re(Re,De,O.x,O.y),Re=O.x,De=O.y;break}}})}var o="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",l="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",u=new WeakMap,d={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1}
4924;function h(oe,re){var F=oe.getContext?oe.getContext("webgl",d):oe,O=u.get(F);if(!O){let me=function(Re){var De=q[Re];if(!De&&(De=q[Re]=F.getExtension(Re),!De))throw new Error(Re+" not supported");return De},ze=function(Re,De){var he=F.createShader(De);return F.shaderSource(he,Re),F.compileShader(he),he},Be=function(Re,De,he,le){if(!Q[Re]){var Xe={},qe={},Ge=F.createProgram();F.attachShader(Ge,ze(De,F.VERTEX_SHADER)),F.attachShader(Ge,ze(he,F.FRAGMENT_SHADER)),F.linkProgram(Ge),Q[Re]={program:Ge,transaction:function(ve){F.useProgram(Ge),ve({setUniform:function(xt,ge){for(var Y=[],je=arguments.length-2;je-- >0;)Y[je]=arguments[je+2];var Ie=qe[ge]||(qe[ge]=F.getUniformLocation(Ge,ge));F["uniform"+xt].apply(F,[Ie].concat(Y))},setAttribute:function(xt,ge,Y,je,Ie){var Ve=Xe[xt];Ve||(Ve=Xe[xt]={buf:F.createBuffer(),loc:F.getAttribLocation(Ge,xt),data:null}),F.bindBuffer(F.ARRAY_BUFFER,Ve.buf),F.vertexAttribPointer(Ve.loc,ge,F.FLOAT,!1,0,0),F.enableVertexAttribArray(Ve.loc),J?F.vertexAttribDivisor(Ve.loc,je):me("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Ve.loc,je),Ie!==Ve.data&&(F.bufferData(F.ARRAY_BUFFER,Ie,Y),Ve.data=Ie)}})}}}Q[Re].transaction(le)},ye=function(Re,De){Z++;try{F.activeTexture(F.TEXTURE0+Z);var he=ne[Re];he||(he=ne[Re]=F.createTexture(),F.bindTexture(F.TEXTURE_2D,he),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.NEAREST),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.NEAREST)),F.bindTexture(F.TEXTURE_2D,he),De(he,Z)}finally{Z--}},Le=function(Re,De,he){var le=F.createFramebuffer();se.push(le),F.bindFramebuffer(F.FRAMEBUFFER,le),F.activeTexture(F.TEXTURE0+De),F.bindTexture(F.TEXTURE_2D,Re),F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Re,0);try{he(le)}finally{F.deleteFramebuffer(le),F.bindFramebuffer(F.FRAMEBUFFER,se[--se.length-1]||null)}},Ce=function(){q={},Q={},ne={},Z=-1,se.length=0};var J=typeof WebGL2RenderingContext<"u"&&F instanceof WebGL2RenderingContext,q={},Q={},ne={},Z=-1,se=[];F.canvas.addEventListener("webglcontextlost",function(Re){Ce(),Re.preventDefault()},!1),u.set(F,O={gl:F,isWebGL2:J,getExtension:me,withProgram:Be,withTexture:ye,withTextureFramebuffer:Le,handleContextLoss:Ce})}re(O)}function p(oe,re,F,O,J,q,Q,ne){Q===void 0&&(Q=15),ne===void 0&&(ne=null),h(oe,function(Z){var se=Z.gl,me=Z.withProgram,ze=Z.withTexture;ze("copy",function(Be,ye){se.texImage2D(se.TEXTURE_2D,0,se.RGBA,J,q,0,se.RGBA,se.UNSIGNED_BYTE,re),me("copy",o,l,function(Le){var Ce=Le.setUniform,Re=Le.setAttribute;Re("aUV",2,se.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),Ce("1i","image",ye),se.bindFramebuffer(se.FRAMEBUFFER,ne||null),se.disable(se.BLEND),se.colorMask(Q&8,Q&4,Q&2,Q&1),se.viewport(F,O,J,q),se.scissor(F,O,J,q),se.drawArrays(se.TRIANGLES,0,3)})})})}function x(oe,re,F){var O=oe.width,J=oe.height;h(oe,function(q){var Q=q.gl,ne=new Uint8Array(O*J*4);Q.readPixels(0,0,O,J,Q.RGBA,Q.UNSIGNED_BYTE,ne),oe.width=re,oe.height=F,p(Q,ne,0,0,O,J)})}var y=Object.freeze({__proto__:null,withWebGLContext:h,renderImageData:p,resizeWebGLCanvasWithoutClearing:x});function v(oe,re,F,O,J,q){q===void 0&&(q=1);var Q=new Uint8Array(oe*re),ne=O[2]-O[0],Z=O[3]-O[1],se=[];a(F,function(Re,De,he,le){se.push({x1:Re,y1:De,x2:he,y2:le,minX:Math.min(Re,he),minY:Math.min(De,le),maxX:Math.max(Re,he),maxY:Math.max(De,le)})}),se.sort(function(Re,De){return Re.maxX-De.maxX});for(var me=0;me<oe;me++)for(var ze=0;ze<re;ze++){var Be=Le(O[0]+ne*(me+.5)/oe,O[1]+Z*(ze+.5)/re),ye=Math.pow(1-Math.abs(Be)/J,q)/2;Be<0&&(ye=1-ye),ye=Math.max(0,Math.min(255,Math.round(ye*255))),Q[ze*oe+me]=ye}return Q;function Le(Re,De){for(var he=1/0,le=1/0,Xe=se.length;Xe--;){var qe=se[Xe];if(qe.maxX+le<=Re)break;if(Re+le>qe.minX&&De-le<qe.maxY&&De+le>qe.minY){var Ge=S(Re,De,qe.x1,qe.y1,qe.x2,qe.y2);Ge<he&&(he=Ge,le=Math.sqrt(he))}}return Ce(Re,De)&&(le=-le),le}function Ce(Re,De){for(var he=0,le=se.length;le--;){var Xe=se[le];if(Xe.maxX<=Re)break;var qe=Xe.y1>De!=Xe.y2>De&&Re<(Xe.x2-Xe.x1)*(De-Xe.y1)/(Xe.y2-Xe.y1)+Xe.x1;qe&&(he+=Xe.y1<Xe.y2?1:-1)}return he!==0}}function _(oe,re,F,O,J,q,Q,ne,Z,se){q===void 0&&(q=1),ne===void 0&&(ne=0),Z===void 0&&(Z=0),se===void 0&&(se=0),M(oe,re,F,O,J,q,Q,null,
4924ne,Z,se)}function M(oe,re,F,O,J,q,Q,ne,Z,se,me){q===void 0&&(q=1),Z===void 0&&(Z=0),se===void 0&&(se=0),me===void 0&&(me=0);for(var ze=v(oe,re,F,O,J,q),Be=new Uint8Array(ze.length*4),ye=0;ye<ze.length;ye++)Be[ye*4+me]=ze[ye];p(Q,Be,Z,se,oe,re,1<<3-me,ne)}function S(oe,re,F,O,J,q){var Q=J-F,ne=q-O,Z=Q*Q+ne*ne,se=Z?Math.max(0,Math.min(1,((oe-F)*Q+(re-O)*ne)/Z)):0,me=oe-(F+se*Q),ze=re-(O+se*ne);return me*me+ze*ze}var A=Object.freeze({__proto__:null,generate:v,generateIntoCanvas:_,generateIntoFramebuffer:M}),E="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",C="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",I="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",D=new Float32Array([0,0,2,0,0,2]),B=null,P=!1,G={},k=new WeakMap;function V(oe){if(!P&&!ee(oe))throw new Error("WebGL generation not supported")}function U(oe,re,F,O,J,q,Q){if(q===void 0&&(q=1),Q===void 0&&(Q=null),!Q&&(Q=B,!Q)){var ne=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!ne)throw new Error("OffscreenCanvas or DOM canvas not supported");Q=B=ne.getContext("webgl",{depth:!1})}V(Q);var Z=new Uint8Array(oe*re*4);h(Q,function(Be){var ye=Be.gl,Le=Be.withTexture,Ce=Be.withTextureFramebuffer;Le("readable",function(Re,De){ye.texImage2D(ye.TEXTURE_2D,0,ye.RGBA,oe,re,0,ye.RGBA,ye.UNSIGNED_BYTE,null),Ce(Re,De,function(he){X(oe,re,F,O,J,q,ye,he,0,0,0),ye.readPixels(0,0,oe,re,ye.RGBA,ye.UNSIGNED_BYTE,Z)})})});for(var se=new Uint8Array(oe*re),me=0,ze=0;me<Z.length;me+=4)se[ze++]=Z[me];return se}function $(oe,re,F,O,J,q,Q,ne,Z,se){q===void 0&&(q=1),ne===void 0&&(ne=0),Z===void 0&&(Z=0),se===void 0&&(se=0),X(oe,re,F,O,J,q,Q,null,ne,Z,se)}function X(oe,re,F,O,J,q,Q,ne,Z,se,me){q===void 0&&(q=1),Z===void 0&&(Z=0),se===void 0&&(se=0),me===void 0&&(me=0),V(Q);var ze=[];a(F,function(Be,ye,Le,Ce){ze.push(Be,ye,Le,Ce)}),ze=new Float32Array(ze),h(Q,function(Be){var ye=Be.gl,Le=Be.isWebGL2,Ce=Be.getExtension,Re=Be.withProgram,De=Be.withTexture,he=Be.withTextureFramebuffer,le=Be.handleContextLoss;if(De("rawDistances",function(Xe,qe){(oe!==Xe._lastWidth||re!==Xe._lastHeight)&&ye.texImage2D(ye.TEXTURE_2D,0,ye.RGBA,Xe._lastWidth=oe,Xe._lastHeight=re,0,ye.RGBA,ye.UNSIGNED_BYTE,null),Re("main",E,C,function(Ge){var ot=Ge.setAttribute,ve=Ge.setUniform,mt=!Le&&Ce("ANGLE_instanced_arrays"),xt=!Le&&Ce("EXT_blend_minmax");ot("aUV",2,ye.STATIC_DRAW,0,D),ot("aLineSegment",4,ye.DYNAMIC_DRAW,1,ze),ve.apply(void 0,["4f","uGlyphBounds"].concat(O)),ve("1f","uMaxDistance",J),ve("1f","uExponent",q),he(Xe,qe,function(ge){ye.enable(ye.BLEND),ye.colorMask(!0,!0,!0,!0),ye.viewport(0,0,oe,re),ye.scissor(0,0,oe,re),ye.blendFunc(ye.ONE,ye.ONE),ye.blendEquationSeparate(ye.FUNC_ADD,Le?ye.MAX:xt.MAX_EXT),ye.clear(ye.COLOR_BUFFER_BIT),Le?ye.drawArraysInstanced(ye.TRIANGLES,0,3,ze.length/4):mt.drawArraysInstancedANGLE(ye.TRIANGLES,0,3,ze.length/4)})}),Re("post",o,I,function(Ge){Ge.setAttribute("aUV",2,ye.STATIC_DRAW,0,D),Ge.setUniform("1i","tex",qe),ye.bindFramebuffer(ye.FRAMEBUFFER,ne),ye.disable(ye.BLEND),ye.colorMask(me===0,me===1,me===2,me===3),ye.viewport(Z,se,oe,re),ye.scissor(Z,se,oe,re),ye.drawArrays(ye.TRIANGLES,0,3)})}),ye.isContextLost())throw le(),new Error("webgl context lost")})}function ee(oe){var re=!oe||oe===B?G:oe.canvas||oe,F=k.get(re);if(F===void 0){P=!0;var O=null;try{var J=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],q=U(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,oe);F=q&&J.length===q.length&&q.every(function(Q,ne){return Q===J[ne]}),F||(O="bad trial run results",console.info(J,q))}catch(Q){F=!1,O=Q.message}O&&console.warn("WebGL SDF generation not supported:",O),P=!1,k.set(re,F)}return F}var z=Object.freeze({__proto__:null,generate:U,generateIntoCanvas:$,generateIntoFramebuffer:X,isSupported:ee});function K(oe,re,F,O,J,q){J===void 0&&(J=Math.max(O[2]-O[0],O[3]-O[1])/2),q===void 0&&(q=1);try{return U.apply(z,arguments)}catch(Q){return console.info("WebGL SDF generation failed, falling back to JS",Q),v.apply(A,arguments)}}function ae(oe,re,F,O,J,q,Q,ne,Z,se){J===void 0&&(J=Math.max(O[2]-O[0],O[3]-O[1])/2),q===void 0&&(q=1),ne===void 0&&(ne=0),Z===void 0&&(Z=0),se===void 0&&(se=0);try{return $.apply(z,arguments)}catch(me){return console.info("WebGL SDF generation failed, falling back to JS",me),_.apply(A,arguments)}}return e.forEachPathCommand=s,e.generate=K,e.generateIntoCanvas=ae,e.javascript=A,e.pathToLineSegments=a,e.webgl=z,e.webglUtils=y,Object.defineProperty(e,"__esMo
4924dule",{value:!0}),e})({});return n}function $ge(){var n=(function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},s={};r.L=1,s[1]="L",Object.keys(t).forEach(function(le,Xe){r[le]=1<<Xe+1,s[r[le]]=le}),Object.freeze(r);var a=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,l=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,u=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,d=r.S|r.WS|r.B|a|r.PDI|u,h=null;function p(){if(!h){h=new Map;var le=function(qe){if(t.hasOwnProperty(qe)){var Ge=0;t[qe].split(",").forEach(function(ot){var ve=ot.split("+"),mt=ve[0],xt=ve[1];mt=parseInt(mt,36),xt=xt?parseInt(xt,36):0,h.set(Ge+=mt,r[qe]);for(var ge=0;ge<xt;ge++)h.set(++Ge,r[qe])})}};for(var Xe in t)le(Xe)}}function x(le){return p(),h.get(le.codePointAt(0))||r.L}function y(le){return s[x(le)]}var v={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function _(le,Xe){var qe=36,Ge=0,ot=new Map,ve=Xe&&new Map,mt;return le.split(",").forEach(function xt(ge){if(ge.indexOf("+")!==-1)for(var Y=+ge;Y--;)xt(mt);else{mt=ge;var je=ge.split(">"),Ie=je[0],Ve=je[1];Ie=String.fromCodePoint(Ge+=parseInt(Ie,qe)),Ve=String.fromCodePoint(Ge+=parseInt(Ve,qe)),ot.set(Ie,Ve),Xe&&ve.set(Ve,Ie)}}),{map:ot,reverseMap:ve}}var M,S,A;
vendor: 6,046 bytes, line 4924
4924function E(){if(!M){var le=_(v.pairs,!0),Xe=le.map,qe=le.reverseMap;M=Xe,S=qe,A=_(v.canonical,!1).map}}function C(le){return E(),M.get(le)||null}function I(le){return E(),S.get(le)||null}function D(le){return E(),A.get(le)||null}var B=r.L,P=r.R,G=r.EN,k=r.ES,V=r.ET,U=r.AN,$=r.CS,X=r.B,ee=r.S,z=r.ON,K=r.BN,ae=r.NSM,oe=r.AL,re=r.LRO,F=r.RLO,O=r.LRE,J=r.RLE,q=r.PDF,Q=r.LRI,ne=r.RLI,Z=r.FSI,se=r.PDI;function me(le,Xe){for(var qe=125,Ge=new Uint32Array(le.length),ot=0;ot<le.length;ot++)Ge[ot]=x(le[ot]);var ve=new Map;function mt(ji,Ba){var Gi=Ge[ji];Ge[ji]=Ba,ve.set(Gi,ve.get(Gi)-1),Gi&l&&ve.set(l,ve.get(l)-1),ve.set(Ba,(ve.get(Ba)||0)+1),Ba&l&&ve.set(l,(ve.get(l)||0)+1)}for(var xt=new Uint8Array(le.length),ge=new Map,Y=[],je=null,Ie=0;Ie<le.length;Ie++)je||Y.push(je={start:Ie,end:le.length-1,level:Xe==="rtl"?1:Xe==="ltr"?0:Qd(Ie,!1)}),Ge[Ie]&X&&(je.end=Ie,je=null);for(var Ve=J|O|F|re|a|se|q|X,ft=function(ji){return ji+(ji&1?1:2)},vt=function(ji){return ji+(ji&1?2:1)},ce=0;ce<Y.length;ce++){je=Y[ce];var Me=[{_level:je.level,_override:0,_isolate:0}],Fe=void 0,ie=0,Se=0,Ae=0;ve.clear();for(var at=je.start;at<=je.end;at++){var pe=Ge[at];if(Fe=Me[Me.length-1],ve.set(pe,(ve.get(pe)||0)+1),pe&l&&ve.set(l,(ve.get(l)||0)+1),pe&Ve)if(pe&(J|O)){xt[at]=Fe._level;var Ke=(pe===J?vt:ft)(Fe._level);Ke<=qe&&!ie&&!Se?Me.push({_level:Ke,_override:0,_isolate:0}):ie||Se++}else if(pe&(F|re)){xt[at]=Fe._level;var Ne=(pe===F?vt:ft)(Fe._level);Ne<=qe&&!ie&&!Se?Me.push({_level:Ne,_override:pe&F?P:B,_isolate:0}):ie||Se++}else if(pe&a){pe&Z&&(pe=Qd(at+1,!0)===1?ne:Q),xt[at]=Fe._level,Fe._override&&mt(at,Fe._override);var Ye=(pe===ne?vt:ft)(Fe._level);Ye<=qe&&ie===0&&Se===0?(Ae++,Me.push({_level:Ye,_override:0,_isolate:1,_isolInitIndex:at})):ie++}else if(pe&se){if(ie>0)ie--;else if(Ae>0){for(Se=0;!Me[Me.length-1]._isolate;)Me.pop();var Te=Me[Me.length-1]._isolInitIndex;Te!=null&&(ge.set(Te,at),ge.set(at,Te)),Me.pop(),Ae--}Fe=Me[Me.length-1],xt[at]=Fe._level,Fe._override&&mt(at,Fe._override)}else pe&q?(ie===0&&(Se>0?Se--:!Fe._isolate&&Me.length>1&&(Me.pop(),Fe=Me[Me.length-1])),xt[at]=Fe._level):pe&X&&(xt[at]=je.level);else xt[at]=Fe._level,Fe._override&&pe!==K&&mt(at,Fe._override)}for(var st=[],et=null,Qe=je.start;Qe<=je.end;Qe++){var Mt=Ge[Qe];if(!(Mt&u)){var ue=xt[Qe],Je=Mt&a,it=Mt===se;et&&ue===et._level?(et._end=Qe,et._endsWithIsolInit=Je):st.push(et={_start:Qe,_end:Qe,_level:ue,_startsWithPDI:it,_endsWithIsolInit:Je})}}for(var Et=[],Wt=0;Wt<st.length;Wt++){var an=st[Wt];if(!an._startsWithPDI||an._startsWithPDI&&!ge.has(an._start)){for(var Sn=[et=an],Lr=void 0;et&&et._endsWithIsolInit&&(Lr=ge.get(et._end))!=null;)for(var Gr=Wt+1;Gr<st.length;Gr++)if(st[Gr]._start===Lr){Sn.push(et=st[Gr]);break}for(var Nr=[],Wn=0;Wn<Sn.length;Wn++)for(var jr=Sn[Wn],es=jr._start;es<=jr._end;es++)Nr.push(es);for(var Tr=xt[Nr[0]],as=je.level,Ps=Nr[0]-1;Ps>=0;Ps--)if(!(Ge[Ps]&u)){as=xt[Ps];break}var gi=Nr[Nr.length-1],Xr=xt[gi],ps=je.level;if(!(Ge[gi]&a)){for(var xi=gi+1;xi<=je.end;xi++)if(!(Ge[xi]&u)){ps=xt[xi];break}}Et.push({_seqIndices:Nr,_sosType:Math.max(as,Tr)%2?P:B,_eosType:Math.max(ps,Xr)%2?P:B})}}for(var Ds=0;Ds<Et.length;Ds++){var Vs=Et[Ds],Yt=Vs._seqIndices,or=Vs._sosType,ks=Vs._eosType,de=xt[Yt[0]]&1?P:B;if(ve.get(ae))for(var He=0;He<Yt.length;He++){var rt=Yt[He];if(Ge[rt]&ae){for(var Ze=or,We=He-1;We>=0;We--)if(!(Ge[Yt[We]]&u)){Ze=Ge[Yt[We]];break}mt(rt,Ze&(a|se)?z:Ze)}}if(ve.get(G))for(var Ct=0;Ct<Yt.length;Ct++){var zt=Yt[Ct];if(Ge[zt]&G)for(var Pt=Ct-1;Pt>=-1;Pt--){var _t=Pt===-1?or:Ge[Yt[Pt]];if(_t&o){_t===oe&&mt(zt,U);break}}}if(ve.get(oe))for(var kt=0;kt<Yt.length;kt++){var Rt=Yt[kt];Ge[Rt]&oe&&mt(Rt,P)}if(ve.get(k)||ve.get($))for(var qt=1;qt<Yt.length-1;qt++){var Qt=Yt[qt];if(Ge[Qt]&(k|$)){for(var nn=0,Cn=0,Zt=qt-1;Zt>=0&&(nn=Ge[Yt[Zt]],!!(nn&u));Zt--);for(var Fn=qt+1;Fn<Yt.length&&(Cn=Ge[Yt[Fn]],!!(Cn&u));Fn++);nn===Cn&&(Ge[Qt]===k?nn===G:nn&(G|U))&&mt(Qt,nn)}}if(ve.get(G))for(var _n=0;_n<Yt.length;_n++){var Gt=Yt[_n];if(Ge[Gt]&G){for(var Rr=_n-1;Rr>=0&&Ge[Yt[Rr]]&(V|u);Rr--)mt(Yt[Rr],G);for(_n++;_n<Yt.length&&Ge[Yt[_n]]&(V|u|G);_n++)Ge[Yt[_n]]!==G&&mt(Yt[_n],G)}}if(ve.get(V)||ve.get(k)||ve.get($))for(var mn=0;mn<Yt.length;mn++){var Or=Yt[mn];if(Ge[Or]&(V|k|$)){mt(Or,z);for(var os=mn-1;os>=0&&Ge[Yt[os]]&u;os--)mt(Yt[os],z);for(var gs=mn+1;gs<Yt.length&&Ge[Yt[gs]]&u;gs++)mt(Yt[gs],z)}}if(ve.get(G))for(var As=0,At=or;As<Yt.length;As++){var Ht=Yt[As],Dn=Ge[Ht];Dn&G?At===B&&mt(Ht,B):Dn&o&&(At=Dn)}if(ve.get(l)){var In=P|G|U,xs=In|B,ii=[];{for(var Cs=[],ts=0;ts<Yt.length;ts++)if(Ge[Yt[ts]]&l){var pa=le[Yt[ts]],Bo=void 0;if(C(pa)!==null)if(Cs.length<63)Cs.push({char:pa,seqIndex:ts});else break;else if((Bo=I(pa))!==null)for(var zi=Cs.length-1;zi>=0;zi--){var Ei=Cs[zi].char;if(Ei===Bo||Ei===I(D(pa))||C(D(Ei))===pa){ii.push([Cs[zi].seqIndex,ts]),Cs.length=zi;break}}}ii.sort(function(ji,Ba){return ji[0]-Ba[0]})}for(var il=0;il<ii.length;il++){for(var wr=ii[il],Is=wr[0],lo=wr[1],be=!1,It=0,en=Is+1;en<lo;en++){var ln=Yt[en];if(Ge[ln]&xs){be=!0;var Un=Ge[ln]&In?P:B;if(Un===de){It=Un;break}}}if(be&&!It){It=or;for(var Zn=Is-1;Zn>=0;Zn--){var Hr=Yt[Zn];if(Ge[Hr]&xs){var kc=Ge[Hr]&In?P:B;kc!==de?It=kc:It=de;break}}}if(It){if(Ge[Yt[Is]]=Ge[Yt[lo]]=It,It!==de){for(var co=Is+1;co<Yt.length;co++)if(!(Ge[Yt[co]]&u)){x(le[Yt[co]])&ae&&(Ge[Yt[co]]=It);break}}if(It!==de){for(var Ic=lo+1;Ic<Yt.length;Ic++)if(!(Ge[Yt[Ic]]&u)){x(le[Yt[Ic]])&ae&&(Ge[Yt[Ic]]=It);break}}}}for(var ls=0;ls<Yt.length;ls++)if(Ge[Yt[ls]]&l){for(var Lo=ls,ql=ls,al=or,Bc=ls-1;Bc>=0;Bc--)if(Ge[Yt[Bc]]&u)Lo=Bc;else{al=Ge[Yt[Bc]]&In?P:B;break}for(var Lc=ks,ol=ls+1;ol<Yt.length;ol++)if(Ge[Yt[ol]]&(l|u))ql=ol;else{Lc=Ge[Yt[ol]]&In?P:B;break}for(var ll=Lo;ll<=ql;ll++)Ge[Yt[ll]]=al===Lc?al:de;ls=ql}}}for(var Ws=je.start;Ws<=je.end;Ws++){var Ph=xt[Ws],Gu=Ge[Ws];if(Ph&1?Gu&(B|G|U)&&xt[Ws]++:Gu&P?xt[Ws]++:Gu&(U|G)&&(xt[Ws]+=2),Gu&u&&(xt[Ws]=Ws===0?je.level:xt[Ws-1]),Ws===je.end||x(le[Ws])&(ee|X))for(var Hu=Ws;Hu>=0&&x(le[Hu])&d;Hu--)xt[Hu]=je.level}}return{levels:xt,paragraphs:Y};function Qd(ji,Ba){for(var Gi=ji;Gi<le.length;
4924Gi++){var Oo=Ge[Gi];if(Oo&(P|oe))return 1;if(Oo&(X|B)||Ba&&Oo===se)return 0;if(Oo&a){var Oc=Kd(Gi);Gi=Oc===-1?le.length:Oc}}return 0}function Kd(ji){for(var Ba=1,Gi=ji+1;Gi<le.length;Gi++){var Oo=Ge[Gi];if(Oo&X)break;if(Oo&se){if(--Ba===0)return Gi}else Oo&a&&Ba++}return-1}}var ze="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",Be;function ye(){if(!Be){var le=_(ze,!0),Xe=le.map,qe=le.reverseMap;qe.forEach(function(Ge,ot){Xe.set(ot,Ge)}),Be=Xe}}function Le(le){return ye(),Be.get(le)||null}function Ce(le,Xe,qe,Ge){var ot=le.length;qe=Math.max(0,qe==null?0:+qe),Ge=Math.min(ot-1,Ge==null?ot-1:+Ge);for(var ve=new Map,mt=qe;mt<=Ge;mt++)if(Xe[mt]&1){var xt=Le(le[mt]);xt!==null&&ve.set(mt,xt)}return ve}function Re(le,Xe,qe,Ge){var ot=le.length;qe=Math.max(0,qe==null?0:+qe),Ge=Math.min(ot-1,Ge==null?ot-1:+Ge);var ve=[];return Xe.paragraphs.forEach(function(mt){var xt=Math.max(qe,mt.start),ge=Math.min(Ge,mt.end);if(xt<ge){for(var Y=Xe.levels.slice(xt,ge+1),je=ge;je>=xt&&x(le[je])&d;je--)Y[je]=mt.level;for(var Ie=mt.level,Ve=1/0,ft=0;ft<Y.length;ft++){var vt=Y[ft];vt>Ie&&(Ie=vt),vt<Ve&&(Ve=vt|1)}for(var ce=Ie;ce>=Ve;ce--)for(var Me=0;Me<Y.length;Me++)if(Y[Me]>=ce){for(var Fe=Me;Me+1<Y.length&&Y[Me+1]>=ce;)Me++;Me>Fe&&ve.push([Fe+xt,Me+xt])}}}),ve}function De(le,Xe,qe,Ge){var ot=he(le,Xe,qe,Ge),ve=[].concat(le);return ot.forEach(function(mt,xt){ve[xt]=(Xe.levels[mt]&1?Le(le[mt]):null)||le[mt]}),ve.join("")}function he(le,Xe,qe,Ge){for(var ot=Re(le,Xe,qe,Ge),ve=[],mt=0;mt<le.length;mt++)ve[mt]=mt;return ot.forEach(function(xt){for(var ge=xt[0],Y=xt[1],je=ve.slice(ge,Y+1),Ie=je.length;Ie--;)ve[Y-Ie]=je[Ie]}),ve}return e.closingToOpeningBracket=I,e.getBidiCharType=x,e.getBidiCharTypeName=y,e.getCanonicalBracket=D,e.getEmbeddingLevels=me,e.getMirroredCharacter=Le,e.getMirroredCharactersMap=Ce,e.getReorderSegments=Re,e.getReorderedIndices=he,e.getReorderedString=De,e.openingToClosingBracket=C,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return n}const iG=/\bvoid\s+main\s*\(\s*\)\s*{/g;function n2(n){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(r,s){let a=Yn[s];return a?n2(a):r}return n.replace(e,t)}const ua=[];for(let n=0;n<256;n++)ua[n]=(n<16?"0":"")+n.toString(16);function Xge(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ua[n&255]+ua[n>>8&255]+ua[n>>16&255]+ua[n>>24&255]+"-"+ua[e&255]+ua[e>>8&255]+"-"+ua[e>>16&15|64]+ua[e>>24&255]+"-"+ua[t&63|128]+ua[t>>8&255]+"-"+ua[t>>16&255]+ua[t>>24&255]+ua[r&255]+ua[r>>8&255]+ua[r>>16&255]+ua[r>>24&255]).toUpperCase()}const Em=Object.assign||function(){let n=arguments[0];for(let e=1,t=arguments.length;e<t;e++){let r=arguments[e];
4924if(r)for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])}return n},qge=Date.now(),dB=new WeakMap,fB=new Map;let Yge=1e10;function r2(n,e){const t=Zge(e);let r=dB.get(n);if(r||dB.set(n,r=Object.create(null)),r[t])return new r[t];const s=`_onBeforeCompile${t}`,a=function(d,h){n.onBeforeCompile.call(this,d,h);const p=this.customProgramCacheKey()+"|"+d.vertexShader+"|"+d.fragmentShader;let x=fB[p];if(!x){const y=Qge(this,d,e,t);x=fB[p]=y}d.vertexShader=x.vertexShader,d.fragmentShader=x.fragmentShader,Em(d.uniforms,this.uniforms),e.timeUniform&&(d.uniforms[e.timeUniform]={get value(){return Date.now()-qge}}),this[s]&&this[s](d)},o=function(){return l(e.chained?n:n.clone())},l=function(d){const h=Object.create(d,u);return Object.defineProperty(h,"baseMaterial",{value:n}),Object.defineProperty(h,"id",{value:Yge++}),h.uuid=Xge(),h.uniforms=Em({},d.uniforms,e.uniforms),h.defines=Em({},d.defines,e.defines),h.defines[`TROIKA_DERIVED_MATERIAL_${t}`]="",h.extensions=Em({},d.extensions,e.extensions),h._listeners=void 0,h},u={constructor:{value:o},isDerivedMaterial:{value:!0},type:{get:()=>n.type,set:d=>{n.type=d}},isDerivedFrom:{writable:!0,configurable:!0,value:function(d){const h=this.baseMaterial;return d===h||h.isDerivedMaterial&&h.isDerivedFrom(d)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return n.customProgramCacheKey()+"|"+t}},onBeforeCompile:{get(){return a},set(d){this[s]=d}},copy:{writable:!0,configurable:!0,value:function(d){return n.copy.call(this,d),!n.isShaderMaterial&&!n.isDerivedMaterial&&(Em(this.extensions,d.extensions),Em(this.defines,d.defines),Em(this.uniforms,Vx.clone(d.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const d=new n.constructor;return l(d).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let d=this._depthMaterial;return d||(d=this._depthMaterial=r2(n.isDerivedMaterial?n.getDepthMaterial():new tA({depthPacking:m8}),e),d.defines.IS_DEPTH_MATERIAL="",d.uniforms=this.uniforms),d}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let d=this._distanceMaterial;return d||(d=this._distanceMaterial=r2(n.isDerivedMaterial?n.getDistanceMaterial():new nA,e),d.defines.IS_DISTANCE_MATERIAL="",d.uniforms=this.uniforms),d}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:d,_distanceMaterial:h}=this;d&&d.dispose(),h&&h.dispose(),n.dispose.call(this)}}};return r[t]=o,new o}function Qge(n,{vertexShader:e,fragmentShader:t},r,s){let{vertexDefs:a,vertexMainIntro:o,vertexMainOutro:l,vertexTransform:u,fragmentDefs:d,fragmentMainIntro:h,fragmentMainOutro:p,fragmentColorTransform:x,customRewriter:y,timeUniform:v}=r;if(a=a||"",o=o||"",l=l||"",d=d||"",h=h||"",p=p||"",(u||y)&&(e=n2(e)),(x||y)&&(t=t.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
4925//!BEGIN_POST_CHUNK $1
4926$&
4927//!END_POST_CHUNK
4928`),t=n2(t)),y){let _=y({vertexShader:e,fragmentShader:t});e=_.vertexShader,t=_.fragmentShader}if(x){let _=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,M=>(_.push(M),"")),p=`${x}
4929${_.join(`
4930`)}
4931${p}`}if(v){const _=`
4932uniform float ${v};
4933`;a=_+a,d=_+d}return u&&(e=`vec3 troika_position_${s};
4934vec3 troika_normal_${s};
4935vec2 troika_uv_${s};
4936${e}
4937`,a=`${a}
4938void troikaVertexTransform${s}() {
4939  vec3 position = troika_position_${s};
4940  vec3 normal = troika_normal_${s};
4941  vec2 uv = troika_uv_${s};
4942  ${u}
4943  troika_position_${s} = position;
4944  troika_normal_${s} = normal;
4945  troika_uv_${s} = uv;
4946}
4947`,o=`
4948troika_position_${s} = vec3(position);
4949troika_normal_${s} = vec3(normal);
4950troika_uv_${s} = vec2(uv);
4951troikaVertexTransform${s}();
4952${o}
4953`,e=e.replace(/\b(position|normal|uv)\b/g,(_,M,S,A)=>/\battribute\s+vec[23]\s+$/.test(A.substr(0,S))?M:`troika_${M}_${s}`),n.map&&n.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${s}`))),e=hB(e,s,a,o,l),t=hB(t,s,d,h,p),{vertexShader:e,fragmentShader:t}}function hB(n,e,t,r,s){return(r||s||t)&&(n=n.replace(iG,`
4954${t}
4955void troikaOrigMain${e}() {`),n+=`
4956void main() {
4957  ${r}
4958  troikaOrigMain${e}();
4959  ${s}
4960}`),n}function Kge(n,e){return n==="uniforms"?void 0:typeof e=="function"?e.toString():e}let Jge=0;const mB=new Map;function Zge(n){const e=JSON.stringify(n,Kge);let t=mB.get(e);return t==null&&mB.set(e,t=++Jge),t}function exe(){return typeof window>"u"&&(self.window=self),(function(n){var e={parse:function(s){var a=e._bin,o=new Uint8Array(s);if(a.readASCII(o,0,4)=="ttcf"){var l=4;a.readUshort(o,l),l+=2,a.readUshort(o,l),l+=2;var u=a.readUint(o,l);l+=4;for(var d=[],h=0;h<u;h++){var p=a.readUint(o,l);l+=4,d.push(e._readFont(o,p))}return d}return[e._readFont(o,0)]},_readFont:function(s,a){var o=e._bin,l=a;o.readFixed(s,a),a+=4;var u=o.readUshort(s,a);a+=2,o.readUshort(s,a),a+=2,o.readUshort(s,a),a+=2,o.readUshort(s,a),a+=2;for(var d=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],h={_data:s,_offset:l},p={},x=0;x<u;x++){var y=o.readASCII(s,a,4);a+=4,o.readUint(s,a),a+=4;var v=o.readUint(s,a);a+=4;var _=o.readUint(s,a);a+=4,p[y]={offset:v,length:_}}for(x=0;x<d.length;x++){var M=d[x];p[M]&&(h[M.trim()]=e[M.trim()].parse(s,p[M].offset,p[M].length,h))}return h},_tabOffset:function(s,a,o){for(var l=e._bin,u=l.readUshort(s,o+4),d=o+12,h=0;h<u;h++){var p=l.readASCII(s,d,4);d+=4,l.readUint(s,d),d+=4;var x=l.readUint(s,d);if(d+=4,l.readUint(s,d),d+=4,p==a)return x}return 0}};e._bin={readFixed:function(s,a){return(s[a]<<8|s[a+1])+(s[a+2]<<8|s[a+3])/65540},readF2dot14:function(s,a){return e._bin.readShort(s,a)/16384},readInt:function(s,a){return e._bin._view(s).getInt32(a)},readInt8:function(s,a){return e._bin._view(s).getInt8(a)},readShort:function(s,a){return e._bin._view(s).getInt16(a)},readUshort:function(s,a){return e._bin._view(s).getUint16(a)},readUshorts:function(s,a,o){for(var l=[],u=0;u<o;u++)l.push(e._bin.readUshort(s,a+2*u));return l},readUint:function(s,a){return e._bin._view(s).getUint32(a)},readUint64:function(s,a){return 4294967296*e._bin.readUint(s,a)+e._bin.readUint(s,a+4)},readASCII:function(s,a,o){for(var l="",u=0;u<o;u++)l+=String.fromCharCode(s[a+u]);return l},readUnicode:function(s,a,o){for(var l="",u=0;u<o;u++){var d=s[a++]<<8|s[a++];l+=String.fromCharCode(d)}return l},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(s,a,o){var l=e._bin._tdec;return l&&a==0&&o==s.length?l.decode(s):e._bin.readASCII(s,a,o)},readBytes:function(s,a,o){for(var l=[],u=0;u<o;u++)l.push(s[a+u]);return l},readASCIIArray:function(s,a,o){for(var l=[],u=0;u<o;u++)l.push(String.fromCharCode(s[a+u]));return l},_view:function(s){return s._dataView||(s._dataView=s.buffer?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(new Uint8Array(s).buffer))}},e._lctf={},e._lctf.parse=function(s,a,o,l,u){var d=e._bin,h={},p=a;d.readFixed(s,a),a+=4;var x=d.readUshort(s,a);a+=2;var y=d.readUshort(s,a);a+=2;var v=d.readUshort(s,a);return a+=2,h.scriptList=e._lctf.readScriptList(s,p+x),h.featureList=e._lctf.readFeatureList(s,p+y),h.lookupList=e._lctf.readLookupList(s,p+v,u),h},e._lctf.readLookupList=function(s,a,o){var l=e._bin,u=a,d=[],h=l.readUshort(s,a);a+=2;for(var p=0;p<h;p++){var x=l.readUshort(s,a);a+=2;var y=e._lctf.readLookupTable(s,u+x,o);d.push(y)}return d},e._lctf.readLookupTable=function(s,a,o){var l=e._bin,u=a,d={tabs:[]};d.ltype=l.readUshort(s,a),a+=2,d.flag=l.readUshort(s,a),a+=2;var h=l.readUshort(s,a);a+=2;for(var p=d.ltype,x=0;x<h;x++){var y=l.readUshort(s,a);a+=2;var v=o(s,p,u+y,d);d.tabs.push(v)}return d},e._lctf.numOfOnes=function(s){for(var a=0,o=0;o<32;o++)(s>>>o&1)!=0&&a++;return a},e._lctf.readClassDef=function(s,a){var o=e._bin,l=[],u=o.readUshort(s,a);if(a+=2,u==1){var d=o.readUshort(s,a);a+=2;var h=o.readUshort(s,a);a+=2;for(var p=0;p<h;p++)l.push(d+p),l.push(d+p),l.push(o.readUshort(s,a)),a+=2}if(u==2){var x=o.readUshort(s,a);for(a+=2,p=0;p<x;p++)l.push(o.readUshort(s,a)),a+=2,l.push(o.readUshort(s,a)),a+=2,l.push(o.readUshort(s,a)),a+=2}return l},e._lctf.getInterval=function(s,a){for(var o=0;o<s.length;o+=3){var l=s[o],u=s[o+1];if(s[o+2],l<=a&&a<=u)return o}return-1},e._lctf.readCoverage=function(s,a){var o=e._bin,l={};l.fmt=o.readUshort(s,a),a+=2;var u=o.readUshort(s,a);return a+=2,l.fmt==1&&(l.tab=o.readUshorts(s,a,u)),l.fmt==2&&(l.tab=o.readUshorts(s,a,3*u)),l},e._lctf.coverageIndex=function(s,a){var o=s.tab;if(s.fmt==1)return o.indexOf(a);if(s.fmt==2){var l=e._lctf.getInterval(o,a);if(l!=-1)return o[l+2]+(a-o[l])}return-1},e._lctf.readFeatureList=function(s,a){var o=e._bin,l=a,u=[],d=o.readUshort(s,a);a+=2;for(var h=0;h<d;h++){var p=o.readASCII(s,a,4);a+=4;var x=o.readUshort(s,a);a+=2;var y=e._lctf.readFeatureTable(s,l+x);y.tag=p.trim(),u.push(y)}return u},e._lctf.readFeatureTable=function(s,a){var o=e._bin,l=a,u={},d=o.readUshort(s,a);a+=2,d>
49600&&(u.featureParams=l+d);var h=o.readUshort(s,a);a+=2,u.tab=[];for(var p=0;p<h;p++)u.tab.push(o.readUshort(s,a+2*p));return u},e._lctf.readScriptList=function(s,a){var o=e._bin,l=a,u={},d=o.readUshort(s,a);a+=2;for(var h=0;h<d;h++){var p=o.readASCII(s,a,4);a+=4;var x=o.readUshort(s,a);a+=2,u[p.trim()]=e._lctf.readScriptTable(s,l+x)}return u},e._lctf.readScriptTable=function(s,a){var o=e._bin,l=a,u={},d=o.readUshort(s,a);a+=2,d>0&&(u.default=e._lctf.readLangSysTable(s,l+d));var h=o.readUshort(s,a);a+=2;for(var p=0;p<h;p++){var x=o.readASCII(s,a,4);a+=4;var y=o.readUshort(s,a);a+=2,u[x.trim()]=e._lctf.readLangSysTable(s,l+y)}return u},e._lctf.readLangSysTable=function(s,a){var o=e._bin,l={};o.readUshort(s,a),a+=2,l.reqFeature=o.readUshort(s,a),a+=2;var u=o.readUshort(s,a);return a+=2,l.features=o.readUshorts(s,a,u),l},e.CFF={},e.CFF.parse=function(s,a,o){var l=e._bin;(s=new Uint8Array(s.buffer,a,o))[a=0],s[++a],s[++a],s[++a],a++;var u=[];a=e.CFF.readIndex(s,a,u);for(var d=[],h=0;h<u.length-1;h++)d.push(l.readASCII(s,a+u[h],u[h+1]-u[h]));a+=u[u.length-1];var p=[];a=e.CFF.readIndex(s,a,p);var x=[];for(h=0;h<p.length-1;h++)x.push(e.CFF.readDict(s,a+p[h],a+p[h+1]));a+=p[p.length-1];var y=x[0],v=[];a=e.CFF.readIndex(s,a,v);var _=[];for(h=0;h<v.length-1;h++)_.push(l.readASCII(s,a+v[h],v[h+1]-v[h]));if(a+=v[v.length-1],e.CFF.readSubrs(s,a,y),y.CharStrings){a=y.CharStrings,v=[],a=e.CFF.readIndex(s,a,v);var M=[];for(h=0;h<v.length-1;h++)M.push(l.readBytes(s,a+v[h],v[h+1]-v[h]));y.CharStrings=M}if(y.ROS){a=y.FDArray;var S=[];for(a=e.CFF.readIndex(s,a,S),y.FDArray=[],h=0;h<S.length-1;h++){var A=e.CFF.readDict(s,a+S[h],a+S[h+1]);e.CFF._readFDict(s,A,_),y.FDArray.push(A)}a+=S[S.length-1],a=y.FDSelect,y.FDSelect=[];var E=s[a];if(a++,E!=3)throw E;var C=l.readUshort(s,a);for(a+=2,h=0;h<C+1;h++)y.FDSelect.push(l.readUshort(s,a),s[a+2]),a+=3}return y.Encoding&&(y.Encoding=e.CFF.readEncoding(s,y.Encoding,y.CharStrings.length)),y.charset&&(y.charset=e.CFF.readCharset(s,y.charset,y.CharStrings.length)),e.CFF._readFDict(s,y,_),y},e.CFF._readFDict=function(s,a,o){var l;for(var u in a.Private&&(l=a.Private[1],a.Private=e.CFF.readDict(s,l,l+a.Private[0]),a.Private.Subrs&&e.CFF.readSubrs(s,l+a.Private.Subrs,a.Private)),a)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(u)!=-1&&(a[u]=o[a[u]-426+35])},e.CFF.readSubrs=function(s,a,o){var l=e._bin,u=[];a=e.CFF.readIndex(s,a,u);var d,h=u.length;d=h<1240?107:h<33900?1131:32768,o.Bias=d,o.Subrs=[];for(var p=0;p<u.length-1;p++)o.Subrs.push(l.readBytes(s,a+u[p],u[p+1]-u[p]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(s,a){for(var o=0;o<s.charset.length;o++)if(s.charset[o]==a)return o;return-1},e.CFF.glyphBySE=function(s,a){return a<0||a>255?-1:e.CFF.glyphByUnicode(s,e.CFF.tableSE[a])},e.CFF.readEncoding=function(s,a,o){e._bin;var l=[".notdef"],u=s[a];if(a++,u!=0)throw"error: unknown encoding format: "+u;var d=s[a];a++;for(var h=0;h<d;h++)l.push(s[a+h]);return l},e.CFF.readCharset=function(s,a,o){var l=e._bin,u=[".notdef"],d=s[a];if(a++,d==0)for(var h=0;h<o;h++){var p=l.readUshort(s,a);a+=2,u.push(p)}else{if(d!=1&&d!=2)throw"error: format: "+d;for(;u.length<o;){p=l.readUshort(s,a),a+=2;var x=0;for(d==1?(x=s[a],a++):(x=l.readUshort(s,a),a+=2),h=0;h<=x;h++)u.push(p),p++}}return u},e.CFF.readIndex=function(s,a,o){var l=e._bin,u=l.readUshort(s,a)+1,d=s[a+=2];if(a++,d==1)for(var h=0;h<u;h++)o.push(s[a+h]);else if(d==2)for(h=0;h<u;h++)o.push(l.readUshort(s,a+2*h));else if(d==3)for(h=0;h<u;h++)o.push(16777215&l.readUint(s,a+3*h-1));else if(u!=1)throw"unsupported offset size: "+d+", count: "+u;return(a+=u*d)-1},e.CFF.getCharString=function(s,a,o){var l=e._bin,u=s[a],d=s[a+1];s[a+2],s[a+3],s[a+4];var h=1,p=null,x=null;u<=20&&(p=u,h=1),u==12&&(p=100*u+d,h=2),21<=u&&u<=27&&(p=u,h=1),u==28&&(x=l.readShort(s,a+1),h=3),29<=u&&u<=31&&(p=u,h=1),32<=u&&u<=246&&(x=u-139,h=1),247<=u&&u<=250&&(x=256*(u-247)+d+108,h=2),251<=u&&u<=254&&(x=256*-(u-251)-d-108,h=2),u==255&&(x=l.readInt(s,a+1)/65535,h=5),o.val=x??"o"+p,o.size=h},e.CFF.readCharString=function(s,a,o){for(var l=a+o,u=e._bin,d=[];a<l;){var h=s[a],p=s[a+1];s[a+2],s[a+3],s[a+4];var x=1,y=null,v=null;h<=20&&(y=h,x=1),h==12&&(y=100*h+p,x=2),h!=19&&h!=20||(y=h,x=2),21<=h&&h<=27&&(y=h,x=1),h==28&&(v=u.readShort(s,a+1),x=3),29<=h&&h<=31&&(y=h,x=1),32<=h&&h<=246&&(v=h-139,x=1),247<=h&&h<=250&&(v=256*(h-247)+p+108,x=2),251<=h&&h<=254&&(v=256*-(h-251)-p-108,x=2),h==255&&(v=u.readInt(s,a+1)/65535,x=5),d.push(v??"o"+y),a+=x}return d},e.CFF.readDict=function(s,a,o){for(var l=e._bin,u={},d=[];a<o;){var h=s[a],p=s[a+1];s[a+2],s[a+3],s[a+4];var x=1,y=null,v=null;if(h==28&&(v=l.readShort(s,a+1),x=3),h==29&&(v=l.readInt(s,a+1),x=5),32<=h&&h<=246&&(v=h-139,x=1),247<=h&&h<=250&&(v=256*(h-247)+p+108,x=2),251<=h&&h<=254&&(v=256*-(h-251)-p-108,x=2),h==255)throw v=l.readInt(s,a+1)/65535,x=5,"unknown number";if(h==30){var _=[];for(x=1;;){var M=s[a+x];x++;var S=M>>4,A=15&M;if(S!=15&&_.push(S),A!=15&&_.push(A),A==15)break}for(var E="",C=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],I=0;I<_.length;I++)E+=C[_[I]];v=parseFloat(E)}h<=21&&(y=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][h],x=1,h==12&&(y=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][p],x=2)),y!=null?(u[y]=d.length==1?d[0]:d,d=[]):d.push(v),a+=x}return u},e.cmap={},e.cmap.parse=function(s,a,o){s=new Uint8Array(s.buffer,a,o),a=0;var l=e._bin,u={};l.readUshort(s,a),a+=2;var d=l.readUshort(s,a);a+=2;var h=[];u.tables=[];for(var p=0;p<d;p++){var x=l.readUshort(s,a);a+=2;var y=l.readUshort(s,a);a+=2;var v=l.readUint(s,a);a+=4;var _="p"+x+"e"+y,M=h.indexOf(v);if(M==-1){var S;M=u.tables.length,h.push(v);var A=l.readUshort(s,v);A==0?S=e.cmap.parse0(s,v):A==4?S=e.cmap.parse4(s,v):A==6?S=e.cmap.parse6(s,v):A==12?S=e.cmap.parse12(s,v):console.debug("unknown format: "+A,x,y,v),u.tables.push(S)}if(u[_]!=null)throw"multiple tables for one platform+encoding";u[_]=M}return u},e.cmap.parse0=function(s,a){var o=e._bin,l={};l.format=o.readUshort(s,a),a+=2;var u=o.readUshort(s,a);a+=2,o.readUshort(s,a),a+=2,l.map=[];for(var d=0;d<u-6;d++)l.map.push(s[a+d]);return l},e.cmap.parse4=function(s,a){var o=e._bin,l=a,u={};u.format=o.readUshort(s,a),a+=2;var d=o.readUshort(s,a);a+=2,o.readUshort(s,a),a+=2;var h=o.readUshort(s,a);a+=2;
4960var p=h/2;u.searchRange=o.readUshort(s,a),a+=2,u.entrySelector=o.readUshort(s,a),a+=2,u.rangeShift=o.readUshort(s,a),a+=2,u.endCount=o.readUshorts(s,a,p),a+=2*p,a+=2,u.startCount=o.readUshorts(s,a,p),a+=2*p,u.idDelta=[];for(var x=0;x<p;x++)u.idDelta.push(o.readShort(s,a)),a+=2;for(u.idRangeOffset=o.readUshorts(s,a,p),a+=2*p,u.glyphIdArray=[];a<l+d;)u.glyphIdArray.push(o.readUshort(s,a)),a+=2;return u},e.cmap.parse6=function(s,a){var o=e._bin,l={};l.format=o.readUshort(s,a),a+=2,o.readUshort(s,a),a+=2,o.readUshort(s,a),a+=2,l.firstCode=o.readUshort(s,a),a+=2;var u=o.readUshort(s,a);a+=2,l.glyphIdArray=[];for(var d=0;d<u;d++)l.glyphIdArray.push(o.readUshort(s,a)),a+=2;return l},e.cmap.parse12=function(s,a){var o=e._bin,l={};l.format=o.readUshort(s,a),a+=2,a+=2,o.readUint(s,a),a+=4,o.readUint(s,a),a+=4;var u=o.readUint(s,a);a+=4,l.groups=[];for(var d=0;d<u;d++){var h=a+12*d,p=o.readUint(s,h+0),x=o.readUint(s,h+4),y=o.readUint(s,h+8);l.groups.push([p,x,y])}return l},e.glyf={},e.glyf.parse=function(s,a,o,l){for(var u=[],d=0;d<l.maxp.numGlyphs;d++)u.push(null);return u},e.glyf._parseGlyf=function(s,a){var o=e._bin,l=s._data,u=e._tabOffset(l,"glyf",s._offset)+s.loca[a];if(s.loca[a]==s.loca[a+1])return null;var d={};if(d.noc=o.readShort(l,u),u+=2,d.xMin=o.readShort(l,u),u+=2,d.yMin=o.readShort(l,u),u+=2,d.xMax=o.readShort(l,u),u+=2,d.yMax=o.readShort(l,u),u+=2,d.xMin>=d.xMax||d.yMin>=d.yMax)return null;if(d.noc>0){d.endPts=[];for(var h=0;h<d.noc;h++)d.endPts.push(o.readUshort(l,u)),u+=2;var p=o.readUshort(l,u);if(u+=2,l.length-u<p)return null;d.instructions=o.readBytes(l,u,p),u+=p;var x=d.endPts[d.noc-1]+1;for(d.flags=[],h=0;h<x;h++){var y=l[u];if(u++,d.flags.push(y),(8&y)!=0){var v=l[u];u++;for(var _=0;_<v;_++)d.flags.push(y),h++}}for(d.xs=[],h=0;h<x;h++){var M=(2&d.flags[h])!=0,S=(16&d.flags[h])!=0;M?(d.xs.push(S?l[u]:-l[u]),u++):S?d.xs.push(0):(d.xs.push(o.readShort(l,u)),u+=2)}for(d.ys=[],h=0;h<x;h++)M=(4&d.flags[h])!=0,S=(32&d.flags[h])!=0,M?(d.ys.push(S?l[u]:-l[u]),u++):S?d.ys.push(0):(d.ys.push(o.readShort(l,u)),u+=2);var A=0,E=0;for(h=0;h<x;h++)A+=d.xs[h],E+=d.ys[h],d.xs[h]=A,d.ys[h]=E}else{var C;d.parts=[];do{C=o.readUshort(l,u),u+=2;var I={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(d.parts.push(I),I.glyphIndex=o.readUshort(l,u),u+=2,1&C){var D=o.readShort(l,u);u+=2;var B=o.readShort(l,u);u+=2}else D=o.readInt8(l,u),u++,B=o.readInt8(l,u),u++;2&C?(I.m.tx=D,I.m.ty=B):(I.p1=D,I.p2=B),8&C?(I.m.a=I.m.d=o.readF2dot14(l,u),u+=2):64&C?(I.m.a=o.readF2dot14(l,u),u+=2,I.m.d=o.readF2dot14(l,u),u+=2):128&C&&(I.m.a=o.readF2dot14(l,u),u+=2,I.m.b=o.readF2dot14(l,u),u+=2,I.m.c=o.readF2dot14(l,u),u+=2,I.m.d=o.readF2dot14(l,u),u+=2)}while(32&C);if(256&C){var P=o.readUshort(l,u);for(u+=2,d.instr=[],h=0;h<P;h++)d.instr.push(l[u]),u++}}return d},e.GDEF={},e.GDEF.parse=function(s,a,o,l){var u=a;a+=4;var d=e._bin.readUshort(s,a);return{glyphClassDef:d===0?null:e._lctf.readClassDef(s,u+d)}},e.GPOS={},e.GPOS.parse=function(s,a,o,l){return e._lctf.parse(s,a,o,l,e.GPOS.subt)},e.GPOS.subt=function(s,a,o,l){var u=e._bin,d=o,h={};if(h.fmt=u.readUshort(s,o),o+=2,a==1||a==2||a==3||a==7||a==8&&h.fmt<=2){var p=u.readUshort(s,o);o+=2,h.coverage=e._lctf.readCoverage(s,p+d)}if(a==1&&h.fmt==1){var x=u.readUshort(s,o);o+=2,x!=0&&(h.pos=e.GPOS.readValueRecord(s,o,x))}else if(a==2&&h.fmt>=1&&h.fmt<=2){x=u.readUshort(s,o),o+=2;var y=u.readUshort(s,o);o+=2;var v=e._lctf.numOfOnes(x),_=e._lctf.numOfOnes(y);if(h.fmt==1){h.pairsets=[];var M=u.readUshort(s,o);o+=2;for(var S=0;S<M;S++){var A=d+u.readUshort(s,o);o+=2;var E=u.readUshort(s,A);A+=2;for(var C=[],I=0;I<E;I++){var D=u.readUshort(s,A);A+=2,x!=0&&(U=e.GPOS.readValueRecord(s,A,x),A+=2*v),y!=0&&($=e.GPOS.readValueRecord(s,A,y),A+=2*_),C.push({gid2:D,val1:U,val2:$})}h.pairsets.push(C)}}if(h.fmt==2){var B=u.readUshort(s,o);o+=2;var P=u.readUshort(s,o);o+=2;var G=u.readUshort(s,o);o+=2;var k=u.readUshort(s,o);for(o+=2,h.classDef1=e._lctf.readClassDef(s,d+B),h.classDef2=e._lctf.readClassDef(s,d+P),h.matrix=[],S=0;S<G;S++){var V=[];for(I=0;I<k;I++){var U=null,$=null;x!=0&&(U=e.GPOS.readValueRecord(s,o,x),o+=2*v),y!=0&&($=e.GPOS.readValueRecord(s,o,y),o+=2*_),V.push({val1:U,val2:$})}h.matrix.push(V)}}}else if(a==4&&h.fmt==1)h.markCoverage=e._lctf.readCoverage(s,u.readUshort(s,o)+d),h.baseCoverage=e._lctf.readCoverage(s,u.readUshort(s,o+2)+d),h.markClassCount=u.readUshort(s,o+4),h.markArray=e.GPOS.readMarkArray(s,u.readUshort(s,o+6)+d),h.baseArray=e.GPOS.readBaseArray(s,u.readUshort(s,o+8)+d,h.markClassCount);else if(a==6&&h.fmt==1)h.mark1Coverage=e._lctf.readCoverage(s,u.readUshort(s,o)+d),h.mark2Coverage=e._lctf.readCoverage(s,u.readUshort(s,o+2)+d),h.markClassCount=u.readUshort(s,o+4),h.mark1Array=e.GPOS.readMarkArray(s,u.readUshort(s,o+6)+d),h.mark2Array=e.GPOS.readBaseArray(s,u.readUshort(s,o+8)+d,h.markClassCount);else{if(a==9&&h.fmt==1){var X=u.readUshort(s,o);o+=2;var ee=u.readUint(s,o);if(o+=4,l.ltype==9)l.ltype=X;else if(l.ltype!=X)throw"invalid extension substitution";return e.GPOS.subt(s,l.ltype,d+ee)}console.debug("unsupported GPOS table LookupType",a,"format",h.fmt)}return h},e.GPOS.readValueRecord=function(s,a,o){var l=e._bin,u=[];return u.push(1&o?l.readShort(s,a):0),a+=1&o?2:0,u.push(2&o?l.readShort(s,a):0),a+=2&o?2:0,u.push(4&o?l.readShort(s,a):0),a+=4&o?2:0,u.push(8&o?l.readShort(s,a):0),a+=8&o?2:0,u},e.GPOS.readBaseArray=function(s,a,o){var l=e._bin,u=[],d=a,h=l.readUshort(s,a);a+=2;for(var p=0;p<h;p++){for(var x=[],y=0;y<o;y++)x.push(e.GPOS.readAnchorRecord(s,d+l.readUshort(s,a))),a+=2;u.push(x)}return u},e.GPOS.readMarkArray=function(s,a){var o=e._bin,l=[],u=a,d=o.readUshort(s,a);a+=2;for(var h=0;h<d;h++){var p=e.GPOS.readAnchorRecord(s,o.readUshort(s,a+2)+u);p.markClass=o.readUshort(s,a),l.push(p),a+=4}return l},e.GPOS.readAnchorRecord=function(s,a){var o=e._bin,l={};return l.fmt=o.readUshort(s,a),l.x=o.readShort(s,a+2),l.y=o.readShort(s,a+4),l},e.GSUB={},e.GSUB.parse=function(s,a,o,l){return e._lctf.parse(s,a,o,l,e.GSUB.subt)},e.GSUB.subt=function(s,a,o,l){var u=e._bin,d=o,h={};if(h.fmt=u.readUshort(s,o),o+=2,a!=1&&a!=2&&a!=4&&a!=5&&a!=6)return null;if(a==1||a==2||a==4||a==5&&h.fmt<=2||a==6&&h.fmt<=2){var p=u.readUshort(s,o);o+=2,h.coverage=e._lctf.readCoverage(s,d+p)}if(a==1&&h.fmt>=1&&h.fmt<=2){if(h.fmt==1)h.delta=u.readShort(s,o),o+=2;else if(h.fmt==2){var x=u.readUshort(s,o);o+=2,h.newg=u.readUshorts(s,o,x),o+=2*h.newg.length}}else if(a==2&&h.fmt==1){x=u.readUshort(s,o),o+=2,h.seqs=[];for(var y=0;y<x;y++){var v=u.readUshort(s,o)+d;o+=2;var _=u.readUshort(s,v);h.seqs.push(u.readUshorts(s,v+2,_))}}else if(a==4)for(h.vals=[],x=u.readUshort(s,o),o+=2,y=0;y<x;y++){var M=u.readUshort(s,o);o+=2,h.vals.push(e.GSUB.readLigatureSet(s,d+M))}else if(a==5&&h.fmt==2){if(h.fmt==2){var S=u.readUshort(s,o);o+=2,h.cDef=e._lctf.readClassDef(s,d+S),h.scset=[];var A=u.readUshort(s,o);for(o+=2,y=0;y<A;y++){var E=u.readUshort(s,o);o+=2,h.scset.push(E==0?null:e.GSUB.readSubClassSet(s,d+E))}}}else if(a==6&&h.fmt==3){if(h.fmt==3){for(y=0;y<3;y++){x=u.readUshort(s,o),o+=2;for(var C=[],I=0;I<x;I++)C.push(e._lctf.readCoverage(s,d+u.readUshort(s,o+2*I)));o+=2*x,y==0&&(h.backCvg=C),y==1&&(h.inptCvg=C),y==2&&(h.ahedCvg=C)}x=u.readUshort(s,o),o+=2,h.lookupRec=e.GSUB.readSubstLookupRecords(s,o,x)}}else{if(a==7&&h.fmt==1){var D=u.readUshort(s,o);o+=2;var B=u.readUint(s,o);if(o+=4,l.ltype==9)l.ltype=D;else if(l.ltype!=D)throw"invalid extension substitution";return e.GSUB.subt(s,l.ltype,d+B)}console.debug("unsupported GSUB table LookupType",a,"format",h.fmt)}return h},e.GSUB.readSubClassSet=function(s,a){var o=e._bin.readUshort,l=a,u=[],d=o(s,a);a+=2;for(var h=0;h<d;h++){var p=o(s,a);a+=2,u.push(e.GSUB.readSubClassRule(s,l+p))}return u},e.GSUB.readSubClassRule=function(s,a){var o=e._bin.readUshort,l={},u=o(s,a),d=o(s,a+=2);a+=2,l.input=[];for(var h=0;h<u-1;h++)l.input.push(o(s,a)),a+=2;
4960return l.substLookupRecords=e.GSUB.readSubstLookupRecords(s,a,d),l},e.GSUB.readSubstLookupRecords=function(s,a,o){for(var l=e._bin.readUshort,u=[],d=0;d<o;d++)u.push(l(s,a),l(s,a+2)),a+=4;return u},e.GSUB.readChainSubClassSet=function(s,a){var o=e._bin,l=a,u=[],d=o.readUshort(s,a);a+=2;for(var h=0;h<d;h++){var p=o.readUshort(s,a);a+=2,u.push(e.GSUB.readChainSubClassRule(s,l+p))}return u},e.GSUB.readChainSubClassRule=function(s,a){for(var o=e._bin,l={},u=["backtrack","input","lookahead"],d=0;d<u.length;d++){var h=o.readUshort(s,a);a+=2,d==1&&h--,l[u[d]]=o.readUshorts(s,a,h),a+=2*l[u[d]].length}return h=o.readUshort(s,a),a+=2,l.subst=o.readUshorts(s,a,2*h),a+=2*l.subst.length,l},e.GSUB.readLigatureSet=function(s,a){var o=e._bin,l=a,u=[],d=o.readUshort(s,a);a+=2;for(var h=0;h<d;h++){var p=o.readUshort(s,a);a+=2,u.push(e.GSUB.readLigature(s,l+p))}return u},e.GSUB.readLigature=function(s,a){var o=e._bin,l={chain:[]};l.nglyph=o.readUshort(s,a),a+=2;var u=o.readUshort(s,a);a+=2;for(var d=0;d<u-1;d++)l.chain.push(o.readUshort(s,a)),a+=2;return l},e.head={},e.head.parse=function(s,a,o){var l=e._bin,u={};return l.readFixed(s,a),a+=4,u.fontRevision=l.readFixed(s,a),a+=4,l.readUint(s,a),a+=4,l.readUint(s,a),a+=4,u.flags=l.readUshort(s,a),a+=2,u.unitsPerEm=l.readUshort(s,a),a+=2,u.created=l.readUint64(s,a),a+=8,u.modified=l.readUint64(s,a),a+=8,u.xMin=l.readShort(s,a),a+=2,u.yMin=l.readShort(s,a),a+=2,u.xMax=l.readShort(s,a),a+=2,u.yMax=l.readShort(s,a),a+=2,u.macStyle=l.readUshort(s,a),a+=2,u.lowestRecPPEM=l.readUshort(s,a),a+=2,u.fontDirectionHint=l.readShort(s,a),a+=2,u.indexToLocFormat=l.readShort(s,a),a+=2,u.glyphDataFormat=l.readShort(s,a),a+=2,u},e.hhea={},e.hhea.parse=function(s,a,o){var l=e._bin,u={};return l.readFixed(s,a),a+=4,u.ascender=l.readShort(s,a),a+=2,u.descender=l.readShort(s,a),a+=2,u.lineGap=l.readShort(s,a),a+=2,u.advanceWidthMax=l.readUshort(s,a),a+=2,u.minLeftSideBearing=l.readShort(s,a),a+=2,u.minRightSideBearing=l.readShort(s,a),a+=2,u.xMaxExtent=l.readShort(s,a),a+=2,u.caretSlopeRise=l.readShort(s,a),a+=2,u.caretSlopeRun=l.readShort(s,a),a+=2,u.caretOffset=l.readShort(s,a),a+=2,a+=8,u.metricDataFormat=l.readShort(s,a),a+=2,u.numberOfHMetrics=l.readUshort(s,a),a+=2,u},e.hmtx={},e.hmtx.parse=function(s,a,o,l){for(var u=e._bin,d={aWidth:[],lsBearing:[]},h=0,p=0,x=0;x<l.maxp.numGlyphs;x++)x<l.hhea.numberOfHMetrics&&(h=u.readUshort(s,a),a+=2,p=u.readShort(s,a),a+=2),d.aWidth.push(h),d.lsBearing.push(p);return d},e.kern={},e.kern.parse=function(s,a,o,l){var u=e._bin,d=u.readUshort(s,a);if(a+=2,d==1)return e.kern.parseV1(s,a-2,o,l);var h=u.readUshort(s,a);a+=2;for(var p={glyph1:[],rval:[]},x=0;x<h;x++){a+=2,o=u.readUshort(s,a),a+=2;var y=u.readUshort(s,a);a+=2;var v=y>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;a=e.kern.readFormat0(s,a,p)}return p},e.kern.parseV1=function(s,a,o,l){var u=e._bin;u.readFixed(s,a),a+=4;var d=u.readUint(s,a);a+=4;for(var h={glyph1:[],rval:[]},p=0;p<d;p++){u.readUint(s,a),a+=4;var x=u.readUshort(s,a);a+=2,u.readUshort(s,a),a+=2;var y=x>>>8;if((y&=15)!=0)throw"unknown kern table format: "+y;a=e.kern.readFormat0(s,a,h)}return h},e.kern.readFormat0=function(s,a,o){var l=e._bin,u=-1,d=l.readUshort(s,a);a+=2,l.readUshort(s,a),a+=2,l.readUshort(s,a),a+=2,l.readUshort(s,a),a+=2;for(var h=0;h<d;h++){var p=l.readUshort(s,a);a+=2;var x=l.readUshort(s,a);a+=2;var y=l.readShort(s,a);a+=2,p!=u&&(o.glyph1.push(p),o.rval.push({glyph2:[],vals:[]}));var v=o.rval[o.rval.length-1];v.glyph2.push(x),v.vals.push(y),u=p}return a},e.loca={},e.loca.parse=function(s,a,o,l){var u=e._bin,d=[],h=l.head.indexToLocFormat,p=l.maxp.numGlyphs+1;if(h==0)for(var x=0;x<p;x++)d.push(u.readUshort(s,a+(x<<1))<<1);if(h==1)for(x=0;x<p;x++)d.push(u.readUint(s,a+(x<<2)));return d},e.maxp={},e.maxp.parse=function(s,a,o){var l=e._bin,u={},d=l.readUint(s,a);return a+=4,u.numGlyphs=l.readUshort(s,a),a+=2,d==65536&&(u.maxPoints=l.readUshort(s,a),a+=2,u.maxContours=l.readUshort(s,a),a+=2,u.maxCompositePoints=l.readUshort(s,a),a+=2,u.maxCompositeContours=l.readUshort(s,a),a+=2,u.maxZones=l.readUshort(s,a),a+=2,u.maxTwilightPoints=l.readUshort(s,a),a+=2,u.maxStorage=l.readUshort(s,a),a+=2,u.maxFunctionDefs=l.readUshort(s,a),a+=2,u.maxInstructionDefs=l.readUshort(s,a),a+=2,u.maxStackElements=l.readUshort(s,a),a+=2,u.maxSizeOfInstru
4960ctions=l.readUshort(s,a),a+=2,u.maxComponentElements=l.readUshort(s,a),a+=2,u.maxComponentDepth=l.readUshort(s,a),a+=2),u},e.name={},e.name.parse=function(s,a,o){var l=e._bin,u={};l.readUshort(s,a),a+=2;var d=l.readUshort(s,a);a+=2,l.readUshort(s,a);for(var h,p=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],x=a+=2,y=0;y<d;y++){var v=l.readUshort(s,a);a+=2;var _=l.readUshort(s,a);a+=2;var M=l.readUshort(s,a);a+=2;var S=l.readUshort(s,a);a+=2;var A=l.readUshort(s,a);a+=2;var E=l.readUshort(s,a);a+=2;var C,I=p[S],D=x+12*d+E;if(v==0)C=l.readUnicode(s,D,A/2);else if(v==3&&_==0)C=l.readUnicode(s,D,A/2);else if(_==0)C=l.readASCII(s,D,A);else if(_==1)C=l.readUnicode(s,D,A/2);else if(_==3)C=l.readUnicode(s,D,A/2);else{if(v!=1)throw"unknown encoding "+_+", platformID: "+v;C=l.readASCII(s,D,A),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var B="p"+v+","+M.toString(16);u[B]==null&&(u[B]={}),u[B][I!==void 0?I:S]=C,u[B]._lang=M}for(var P in u)if(u[P].postScriptName!=null&&u[P]._lang==1033)return u[P];for(var P in u)if(u[P].postScriptName!=null&&u[P]._lang==0)return u[P];for(var P in u)if(u[P].postScriptName!=null&&u[P]._lang==3084)return u[P];for(var P in u)if(u[P].postScriptName!=null)return u[P];for(var P in u){h=P;break}return console.debug("returning name table with languageID "+u[h]._lang),u[h]},e["OS/2"]={},e["OS/2"].parse=function(s,a,o){var l=e._bin.readUshort(s,a);a+=2;var u={};if(l==0)e["OS/2"].version0(s,a,u);else if(l==1)e["OS/2"].version1(s,a,u);else if(l==2||l==3||l==4)e["OS/2"].version2(s,a,u);else{if(l!=5)throw"unknown OS/2 table version: "+l;e["OS/2"].version5(s,a,u)}return u},e["OS/2"].version0=function(s,a,o){var l=e._bin;return o.xAvgCharWidth=l.readShort(s,a),a+=2,o.usWeightClass=l.readUshort(s,a),a+=2,o.usWidthClass=l.readUshort(s,a),a+=2,o.fsType=l.readUshort(s,a),a+=2,o.ySubscriptXSize=l.readShort(s,a),a+=2,o.ySubscriptYSize=l.readShort(s,a),a+=2,o.ySubscriptXOffset=l.readShort(s,a),a+=2,o.ySubscriptYOffset=l.readShort(s,a),a+=2,o.ySuperscriptXSize=l.readShort(s,a),a+=2,o.ySuperscriptYSize=l.readShort(s,a),a+=2,o.ySuperscriptXOffset=l.readShort(s,a),a+=2,o.ySuperscriptYOffset=l.readShort(s,a),a+=2,o.yStrikeoutSize=l.readShort(s,a),a+=2,o.yStrikeoutPosition=l.readShort(s,a),a+=2,o.sFamilyClass=l.readShort(s,a),a+=2,o.panose=l.readBytes(s,a,10),a+=10,o.ulUnicodeRange1=l.readUint(s,a),a+=4,o.ulUnicodeRange2=l.readUint(s,a),a+=4,o.ulUnicodeRange3=l.readUint(s,a),a+=4,o.ulUnicodeRange4=l.readUint(s,a),a+=4,o.achVendID=[l.readInt8(s,a),l.readInt8(s,a+1),l.readInt8(s,a+2),l.readInt8(s,a+3)],a+=4,o.fsSelection=l.readUshort(s,a),a+=2,o.usFirstCharIndex=l.readUshort(s,a),a+=2,o.usLastCharIndex=l.readUshort(s,a),a+=2,o.sTypoAscender=l.readShort(s,a),a+=2,o.sTypoDescender=l.readShort(s,a),a+=2,o.sTypoLineGap=l.readShort(s,a),a+=2,o.usWinAscent=l.readUshort(s,a),a+=2,o.usWinDescent=l.readUshort(s,a),a+=2},e["OS/2"].version1=function(s,a,o){var l=e._bin;return a=e["OS/2"].version0(s,a,o),o.ulCodePageRange1=l.readUint(s,a),a+=4,o.ulCodePageRange2=l.readUint(s,a),a+=4},e["OS/2"].version2=function(s,a,o){var l=e._bin;return a=e["OS/2"].version1(s,a,o),o.sxHeight=l.readShort(s,a),a+=2,o.sCapHeight=l.readShort(s,a),a+=2,o.usDefault=l.readUshort(s,a),a+=2,o.usBreak=l.readUshort(s,a),a+=2,o.usMaxContext=l.readUshort(s,a),a+=2},e["OS/2"].version5=function(s,a,o){var l=e._bin;return a=e["OS/2"].version2(s,a,o),o.usLowerOpticalPointSize=l.readUshort(s,a),a+=2,o.usUpperOpticalPointSize=l.readUshort(s,a),a+=2},e.post={},e.post.parse=function(s,a,o){var l=e._bin,u={};return u.version=l.readFixed(s,a),a+=4,u.italicAngle=l.readFixed(s,a),a+=4,u.underlinePosition=l.readShort(s,a),a+=2,u.underlineThickness=l.readShort(s,a),a+=2,u},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(s,a){var o=s.cmap,l=-1;
4960if(o.p0e4!=null?l=o.p0e4:o.p3e1!=null?l=o.p3e1:o.p1e0!=null?l=o.p1e0:o.p0e3!=null&&(l=o.p0e3),l==-1)throw"no familiar platform and encoding!";var u=o.tables[l];if(u.format==0)return a>=u.map.length?0:u.map[a];if(u.format==4){for(var d=-1,h=0;h<u.endCount.length;h++)if(a<=u.endCount[h]){d=h;break}return d==-1||u.startCount[d]>a?0:65535&(u.idRangeOffset[d]!=0?u.glyphIdArray[a-u.startCount[d]+(u.idRangeOffset[d]>>1)-(u.idRangeOffset.length-d)]:a+u.idDelta[d])}if(u.format==12){if(a>u.groups[u.groups.length-1][1])return 0;for(h=0;h<u.groups.length;h++){var p=u.groups[h];if(p[0]<=a&&a<=p[1])return p[2]+(a-p[0])}return 0}throw"unknown cmap table format "+u.format},e.U.glyphToPath=function(s,a){var o={cmds:[],crds:[]};if(s.SVG&&s.SVG.entries[a]){var l=s.SVG.entries[a];return l==null?o:(typeof l=="string"&&(l=e.SVG.toPath(l),s.SVG.entries[a]=l),l)}if(s.CFF){var u={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:s.CFF.Private?s.CFF.Private.defaultWidthX:0,open:!1},d=s.CFF,h=s.CFF.Private;if(d.ROS){for(var p=0;d.FDSelect[p+2]<=a;)p+=2;h=d.FDArray[d.FDSelect[p+1]].Private}e.U._drawCFF(s.CFF.CharStrings[a],u,d,h,o)}else s.glyf&&e.U._drawGlyf(a,s,o);return o},e.U._drawGlyf=function(s,a,o){var l=a.glyf[s];l==null&&(l=a.glyf[s]=e.glyf._parseGlyf(a,s)),l!=null&&(l.noc>-1?e.U._simpleGlyph(l,o):e.U._compoGlyph(l,a,o))},e.U._simpleGlyph=function(s,a){for(var o=0;o<s.noc;o++){for(var l=o==0?0:s.endPts[o-1]+1,u=s.endPts[o],d=l;d<=u;d++){var h=d==l?u:d-1,p=d==u?l:d+1,x=1&s.flags[d],y=1&s.flags[h],v=1&s.flags[p],_=s.xs[d],M=s.ys[d];if(d==l)if(x){if(!y){e.U.P.moveTo(a,_,M);continue}e.U.P.moveTo(a,s.xs[h],s.ys[h])}else y?e.U.P.moveTo(a,s.xs[h],s.ys[h]):e.U.P.moveTo(a,(s.xs[h]+_)/2,(s.ys[h]+M)/2);x?y&&e.U.P.lineTo(a,_,M):v?e.U.P.qcurveTo(a,_,M,s.xs[p],s.ys[p]):e.U.P.qcurveTo(a,_,M,(_+s.xs[p])/2,(M+s.ys[p])/2)}e.U.P.closePath(a)}},e.U._compoGlyph=function(s,a,o){for(var l=0;l<s.parts.length;l++){var u={cmds:[],crds:[]},d=s.parts[l];e.U._drawGlyf(d.glyphIndex,a,u);for(var h=d.m,p=0;p<u.crds.length;p+=2){var x=u.crds[p],y=u.crds[p+1];o.crds.push(x*h.a+y*h.b+h.tx),o.crds.push(x*h.c+y*h.d+h.ty)}for(p=0;p<u.cmds.length;p++)o.cmds.push(u.cmds[p])}},e.U._getGlyphClass=function(s,a){var o=e._lctf.getInterval(a,s);return o==-1?0:a[o+2]},e.U._applySubs=function(s,a,o,l){for(var u=s.length-a-1,d=0;d<o.tabs.length;d++)if(o.tabs[d]!=null){var h,p=o.tabs[d];if(!p.coverage||(h=e._lctf.coverageIndex(p.coverage,s[a]))!=-1){if(o.ltype==1)s[a],p.fmt==1?s[a]=s[a]+p.delta:s[a]=p.newg[h];else if(o.ltype==4)for(var x=p.vals[h],y=0;y<x.length;y++){var v=x[y],_=v.chain.length;if(!(_>u)){for(var M=!0,S=0,A=0;A<_;A++){for(;s[a+S+(1+A)]==-1;)S++;v.chain[A]!=s[a+S+(1+A)]&&(M=!1)}if(M){for(s[a]=v.nglyph,A=0;A<_+S;A++)s[a+A+1]=-1;break}}}else if(o.ltype==5&&p.fmt==2)for(var E=e._lctf.getInterval(p.cDef,s[a]),C=p.cDef[E+2],I=p.scset[C],D=0;D<I.length;D++){var B=I[D],P=B.input;if(!(P.length>u)){for(M=!0,A=0;A<P.length;A++){var G=e._lctf.getInterval(p.cDef,s[a+1+A]);if(E==-1&&p.cDef[G+2]!=P[A]){M=!1;break}}if(M){var k=B.substLookupRecords;for(y=0;y<k.length;y+=2)k[y],k[y+1]}}}else if(o.ltype==6&&p.fmt==3){if(!e.U._glsCovered(s,p.backCvg,a-p.backCvg.length)||!e.U._glsCovered(s,p.inptCvg,a)||!e.U._glsCovered(s,p.ahedCvg,a+p.inptCvg.length))continue;var V=p.lookupRec;for(D=0;D<V.length;D+=2){E=V[D];var U=l[V[D+1]];e.U._applySubs(s,a+E,U,l)}}}}},e.U._glsCovered=function(s,a,o){for(var l=0;l<a.length;l++)if(e._lctf.coverageIndex(a[l],s[o+l])==-1)return!1;return!0},e.U.glyphsToPath=function(s,a,o){for(var l={cmds:[],crds:[]},u=0,d=0;d<a.length;d++){var h=a[d];if(h!=-1){for(var p=d<a.length-1&&a[d+1]!=-1?a[d+1]:0,x=e.U.glyphToPath(s,h),y=0;y<x.crds.length;y+=2)l.crds.push(x.crds[y]+u),l.crds.push(x.crds[y+1]);for(o&&l.cmds.push(o),y=0;y<x.cmds.length;y++)l.cmds.push(x.cmds[y]);o&&l.cmds.push("X"),u+=s.hmtx.aWidth[h],d<a.length-1&&(u+=e.U.getPairAdjustment(s,h,p))}}return l},e.U.P={},e.U.P.moveTo=function(s,a,o){s.cmds.push("M"),s.crds.push(a,o)},e.U.P.lineTo=function(s,a,o){s.cmds.push("L"),s.crds.push(a,o)},e.U.P.curveTo=function(s,a,o,l,u,d,h){s.cmds.push("C"),s.crds.push(a,o,l,u,d,h)},e.U.P.qcurveTo=function(s,a,o,l,u){s.cmds.push("Q"),s.crds.push(a,o,l,u)},e.U.P.closePath=function(s){s.cmds.push("Z")},e.U._drawCFF=function(s,a,o,l,u){for(var d=a.stack,h=a.nStems,p=a.haveWidth,x=a.width,y=a.open,v=0,_=a.x,M=a.y,S=0,A=0,E=0,C=0,I=0,D=0,B=0,P=0,G=0,k=0,V={val:0,size:0};v<s.length;){e.CFF.getCharString(s,v,V);var U=V.val;if(v+=V.size,U=="o1"||U=="o18")d.length%2!=0&&!p&&(x=d.shift()+l.nominalWidthX),h+=d.length>>1,d.length=0,p=!0;else if(U=="o3"||U=="o23")d.length%2!=0&&!p&&(x=d.shift()+l.nominalWidthX),h+=d.length>>1,d.length=0,p=!0;else if(U=="o4")d.length>1&&!p&&(x=d.shift()+l.nominalWidthX,p=!0),y&&e.U.P.closePath(u),M+=d.pop(),e.U.P.moveTo(u,_,M),y=!0;else if(U=="o5")for(;d.length>0;)_+=d.shift(),M+=d.shift(),e.U.P.lineTo(u,_,M);else if(U=="o6"||U=="o7")for(var $=d.length,X=U=="o6",ee=0;ee<$;ee++){var z=d.shift();X?_+=z:M+=z,X=!X,e.U.P.lineTo(u,_,M)}else if(U=="o8"||U=="o24"){$=d.length;for(var K=0;K+6<=$;)S=_+d.shift(),A=M+d.shift(),E=S+d.shift(),C=A+d.shift(),_=E+d.shift(),M=C+d.shift(),e.U.P.curveTo(u,S,A,E,C,_,M),K+=6;U=="o24"&&(_+=d.shift(),M+=d.shift(),e.U.P.lineTo(u,_,M))}else{if(U=="o11")break;
4960if(U=="o1234"||U=="o1235"||U=="o1236"||U=="o1237")U=="o1234"&&(A=M,E=(S=_+d.shift())+d.shift(),k=C=A+d.shift(),D=C,P=M,_=(B=(I=(G=E+d.shift())+d.shift())+d.shift())+d.shift(),e.U.P.curveTo(u,S,A,E,C,G,k),e.U.P.curveTo(u,I,D,B,P,_,M)),U=="o1235"&&(S=_+d.shift(),A=M+d.shift(),E=S+d.shift(),C=A+d.shift(),G=E+d.shift(),k=C+d.shift(),I=G+d.shift(),D=k+d.shift(),B=I+d.shift(),P=D+d.shift(),_=B+d.shift(),M=P+d.shift(),d.shift(),e.U.P.curveTo(u,S,A,E,C,G,k),e.U.P.curveTo(u,I,D,B,P,_,M)),U=="o1236"&&(S=_+d.shift(),A=M+d.shift(),E=S+d.shift(),k=C=A+d.shift(),D=C,B=(I=(G=E+d.shift())+d.shift())+d.shift(),P=D+d.shift(),_=B+d.shift(),e.U.P.curveTo(u,S,A,E,C,G,k),e.U.P.curveTo(u,I,D,B,P,_,M)),U=="o1237"&&(S=_+d.shift(),A=M+d.shift(),E=S+d.shift(),C=A+d.shift(),G=E+d.shift(),k=C+d.shift(),I=G+d.shift(),D=k+d.shift(),B=I+d.shift(),P=D+d.shift(),Math.abs(B-_)>Math.abs(P-M)?_=B+d.shift():M=P+d.shift(),e.U.P.curveTo(u,S,A,E,C,G,k),e.U.P.curveTo(u,I,D,B,P,_,M));else if(U=="o14"){if(d.length>0&&!p&&(x=d.shift()+o.nominalWidthX,p=!0),d.length==4){var ae=d.shift(),oe=d.shift(),re=d.shift(),F=d.shift(),O=e.CFF.glyphBySE(o,re),J=e.CFF.glyphBySE(o,F);e.U._drawCFF(o.CharStrings[O],a,o,l,u),a.x=ae,a.y=oe,e.U._drawCFF(o.CharStrings[J],a,o,l,u)}y&&(e.U.P.closePath(u),y=!1)}else if(U=="o19"||U=="o20")d.length%2!=0&&!p&&(x=d.shift()+l.nominalWidthX),h+=d.length>>1,d.length=0,p=!0,v+=h+7>>3;else if(U=="o21")d.length>2&&!p&&(x=d.shift()+l.nominalWidthX,p=!0),M+=d.pop(),_+=d.pop(),y&&e.U.P.closePath(u),e.U.P.moveTo(u,_,M),y=!0;else if(U=="o22")d.length>1&&!p&&(x=d.shift()+l.nominalWidthX,p=!0),_+=d.pop(),y&&e.U.P.closePath(u),e.U.P.moveTo(u,_,M),y=!0;else if(U=="o25"){for(;d.length>6;)_+=d.shift(),M+=d.shift(),e.U.P.lineTo(u,_,M);S=_+d.shift(),A=M+d.shift(),E=S+d.shift(),C=A+d.shift(),_=E+d.shift(),M=C+d.shift(),e.U.P.curveTo(u,S,A,E,C,_,M)}else if(U=="o26")for(d.length%2&&(_+=d.shift());d.length>0;)S=_,A=M+d.shift(),_=E=S+d.shift(),M=(C=A+d.shift())+d.shift(),e.U.P.curveTo(u,S,A,E,C,_,M);else if(U=="o27")for(d.length%2&&(M+=d.shift());d.length>0;)A=M,E=(S=_+d.shift())+d.shift(),C=A+d.shift(),_=E+d.shift(),M=C,e.U.P.curveTo(u,S,A,E,C,_,M);else if(U=="o10"||U=="o29"){var q=U=="o10"?l:o;if(d.length==0)console.debug("error: empty stack");else{var Q=d.pop(),ne=q.Subrs[Q+q.Bias];a.x=_,a.y=M,a.nStems=h,a.haveWidth=p,a.width=x,a.open=y,e.U._drawCFF(ne,a,o,l,u),_=a.x,M=a.y,h=a.nStems,p=a.haveWidth,x=a.width,y=a.open}}else if(U=="o30"||U=="o31"){var Z=d.length,se=(K=0,U=="o31");for(K+=Z-($=-3&Z);K<$;)se?(A=M,E=(S=_+d.shift())+d.shift(),M=(C=A+d.shift())+d.shift(),$-K==5?(_=E+d.shift(),K++):_=E,se=!1):(S=_,A=M+d.shift(),E=S+d.shift(),C=A+d.shift(),_=E+d.shift(),$-K==5?(M=C+d.shift(),K++):M=C,se=!0),e.U.P.curveTo(u,S,A,E,C,_,M),K+=4}else{if((U+"").charAt(0)=="o")throw console.debug("Unknown operation: "+U,s),U;d.push(U)}}}a.x=_,a.y=M,a.nStems=h,a.haveWidth=p,a.width=x,a.open=y};var t=e,r={Typr:t};return n.Typr=t,n.default=r,Object.defineProperty(n,"__esModule",{value:!0}),n})({}).Typr}function txe(){return(function(n){var e=Uint8Array,t=Uint16Array,r=Uint32Array,s=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(U,$){for(var X=new t(31),ee=0;ee<31;++ee)X[ee]=$+=1<<U[ee-1];var z=new r(X[30]);for(ee=1;ee<30;++ee)for(var K=X[ee];K<X[ee+1];++K)z[K]=K-X[ee]<<5|ee;return[X,z]},u=l(s,2),d=u[0],h=u[1];d[28]=258,h[258]=28;for(var p=l(a,0)[0],x=new t(32768),y=0;y<32768;++y){var v=(43690&y)>>>1|(21845&y)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,x[y]=((65280&v)>>>8|(255&v)<<8)>>>1}var _=function(U,$,X){for(var ee=U.length,z=0,K=new t($);z<ee;++z)++K[U[z]-1];var ae,oe=new t($);for(z=0;z<$;++z)oe[z]=oe[z-1]+K[z-1]<<1;{ae=new t(1<<$);var re=15-$;for(z=0;z<ee;++z)if(U[z])for(var F=z<<4|U[z],O=$-U[z],J=oe[U[z]-1]++<<O,q=J|(1<<O)-1;J<=q;++J)ae[x[J]>>>re]=F}return ae},M=new e(288);for(y=0;y<144;++y)M[y]=8;for(y=144;y<256;++y)M[y]=9;for(y=256;y<280;++y)M[y]=7;for(y=280;y<288;++y)M[y]=8;var S=new e(32);for(y=0;y<32;++y)S[y]=5;var A=_(M,9),E=_(S,5),C=function(U){for(var $=U[0],X=1;X<U.length;++X)U[X]>$&&($=U[X]);return $},I=function(U,$,X){var ee=$/8|0;return(U[ee]|U[ee+1]<<8)>>(7&$)&X},D=function(U,$){var X=$/8|0;return(U[X]|U[X+1]<<8|U[X+2]<<16)>>(7&$)}
4960,B=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],P=function(U,$,X){var ee=new Error($||B[U]);if(ee.code=U,Error.captureStackTrace&&Error.captureStackTrace(ee,P),!X)throw ee;return ee},G=function(U,$,X){var ee=U.length;if(!ee||X&&!X.l&&ee<5)return $||new e(0);var z=!$||X,K=!X||X.i;X||(X={}),$||($=new e(3*ee));var ae,oe=function(Fe){var ie=$.length;if(Fe>ie){var Se=new e(Math.max(2*ie,Fe));Se.set($),$=Se}},re=X.f||0,F=X.p||0,O=X.b||0,J=X.l,q=X.d,Q=X.m,ne=X.n,Z=8*ee;do{if(!J){X.f=re=I(U,F,1);var se=I(U,F+1,3);if(F+=3,!se){var me=U[(qe=((ae=F)/8|0)+(7&ae&&1)+4)-4]|U[qe-3]<<8,ze=qe+me;if(ze>ee){K&&P(0);break}z&&oe(O+me),$.set(U.subarray(qe,ze),O),X.b=O+=me,X.p=F=8*ze;continue}if(se==1)J=A,q=E,Q=9,ne=5;else if(se==2){var Be=I(U,F,31)+257,ye=I(U,F+10,15)+4,Le=Be+I(U,F+5,31)+1;F+=14;for(var Ce=new e(Le),Re=new e(19),De=0;De<ye;++De)Re[o[De]]=I(U,F+3*De,7);F+=3*ye;var he=C(Re),le=(1<<he)-1,Xe=_(Re,he);for(De=0;De<Le;){var qe,Ge=Xe[I(U,F,le)];if(F+=15&Ge,(qe=Ge>>>4)<16)Ce[De++]=qe;else{var ot=0,ve=0;for(qe==16?(ve=3+I(U,F,3),F+=2,ot=Ce[De-1]):qe==17?(ve=3+I(U,F,7),F+=3):qe==18&&(ve=11+I(U,F,127),F+=7);ve--;)Ce[De++]=ot}}var mt=Ce.subarray(0,Be),xt=Ce.subarray(Be);Q=C(mt),ne=C(xt),J=_(mt,Q),q=_(xt,ne)}else P(1);if(F>Z){K&&P(0);break}}z&&oe(O+131072);for(var ge=(1<<Q)-1,Y=(1<<ne)-1,je=F;;je=F){var Ie=(ot=J[D(U,F)&ge])>>>4;if((F+=15&ot)>Z){K&&P(0);break}if(ot||P(2),Ie<256)$[O++]=Ie;else{if(Ie==256){je=F,J=null;break}var Ve=Ie-254;if(Ie>264){var ft=s[De=Ie-257];Ve=I(U,F,(1<<ft)-1)+d[De],F+=ft}var vt=q[D(U,F)&Y],ce=vt>>>4;if(vt||P(3),F+=15&vt,xt=p[ce],ce>3&&(ft=a[ce],xt+=D(U,F)&(1<<ft)-1,F+=ft),F>Z){K&&P(0);break}z&&oe(O+131072);for(var Me=O+Ve;O<Me;O+=4)$[O]=$[O-xt],$[O+1]=$[O+1-xt],$[O+2]=$[O+2-xt],$[O+3]=$[O+3-xt];O=Me}}X.l=J,X.p=je,X.b=O,J&&(re=1,X.m=Q,X.d=q,X.n=ne)}while(!re);return O==$.length?$:(function(Fe,ie,Se){(Se==null||Se>Fe.length)&&(Se=Fe.length);var Ae=new(Fe instanceof t?t:Fe instanceof r?r:e)(Se-ie);return Ae.set(Fe.subarray(ie,Se)),Ae})($,0,O)},k=new e(0),V=typeof TextDecoder<"u"&&new TextDecoder;try{V.decode(k,{stream:!0})}catch{}return n.convert_streams=function(U){var $=new DataView(U),X=0;function ee(){var Be=$.getUint16(X);return X+=2,Be}function z(){var Be=$.getUint32(X);return X+=4,Be}function K(Be){me.setUint16(ze,Be),ze+=2}function ae(Be){me.setUint32(ze,Be),ze+=4}for(var oe={signature:z(),flavor:z(),length:z(),numTables:ee(),reserved:ee(),totalSfntSize:z(),majorVersion:ee(),minorVersion:ee(),metaOffset:z(),metaLength:z(),metaOrigLength:z(),privOffset:z(),privLength:z()},re=0;Math.pow(2,re)<=oe.numTables;)re++;re--;for(var F=16*Math.pow(2,re),O=16*oe.numTables-F,J=12,q=[],Q=0;Q<oe.numTables;Q++)q.push({tag:z(),offset:z(),compLength:z(),origLength:z(),origChecksum:z()}),J+=16;var ne,Z=new Uint8Array(12+16*q.length+q.reduce((function(Be,ye){return Be+ye.origLength+4}),0)),se=Z.buffer,me=new DataView(se),ze=0;return ae(oe.flavor),K(oe.numTables),K(F),K(re),K(O),q.forEach((function(Be){ae(Be.tag),ae(Be.origChecksum),ae(J),ae(Be.origLength),Be.outOffset=J,(J+=Be.origLength)%4!=0&&(J+=4-J%4)})),q.forEach((function(Be){var ye,Le=U.slice(Be.offset,Be.offset+Be.compLength);if(Be.compLength!=Be.origLength){var Ce=new Uint8Array(Be.origLength);ye=new Uint8Array(Le,2),G(ye,Ce)}else Ce=new Uint8Array(Le);Z.set(Ce,Be.outOffset);var Re=0;(J=Be.outOffset+Be.origLength)%4!=0&&(Re=4-J%4),Z.set(new Uint8Array(Re).buffer,Be.outOffset+Be.origLength),ne=J+Re})),se.slice(0,ne)},Object.defineProperty(n,"__esModule",{value:!0}),n})({}).convert_streams}function nxe(n,e){const t={M:2,L:2,Q:4,C:6,Z:0},r={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},s=1,a=2,o=4,l=8,u=16,d=32;let h;function p(B){if(!h){const P={R:a,L:s,D:o,C:u,U:d,T:l};h=new Map;for(let G in r){let k=0;r[G].split(",").forEach(V=>{let[U,$]=V.split("+");
4960U=parseInt(U,36),$=$?parseInt($,36):0,h.set(k+=U,P[G]);for(let X=$;X--;)h.set(++k,P[G])})}}return h.get(B)||d}const x=1,y=2,v=3,_=4,M=[null,"isol","init","fina","medi"];function S(B){const P=new Uint8Array(B.length);let G=d,k=x,V=-1;for(let U=0;U<B.length;U++){const $=B.codePointAt(U);let X=p($)|0,ee=x;X&l||(G&(s|o|u)?X&(a|o|u)?(ee=v,(k===x||k===v)&&P[V]++):X&(s|d)&&(k===y||k===_)&&P[V]--:G&(a|d)&&(k===y||k===_)&&P[V]--,k=P[U]=ee,G=X,V=U,$>65535&&U++)}return P}function A(B,P){const G=[];for(let V=0;V<P.length;V++){const U=P.codePointAt(V);U>65535&&V++,G.push(n.U.codeToGlyph(B,U))}const k=B.GSUB;if(k){const{lookupList:V,featureList:U}=k;let $;const X=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,ee=[];U.forEach(z=>{if(X.test(z.tag))for(let K=0;K<z.tab.length;K++){if(ee[z.tab[K]])continue;ee[z.tab[K]]=!0;const ae=V[z.tab[K]],oe=/^(isol|init|fina|medi)$/.test(z.tag);oe&&!$&&($=S(P));for(let re=0;re<G.length;re++)(!$||!oe||M[$[re]]===z.tag)&&n.U._applySubs(G,re,ae,V)}})}return G}function E(B,P){const G=new Int16Array(P.length*3);let k=0;for(;k<P.length;k++){const X=P[k];if(X===-1)continue;G[k*3+2]=B.hmtx.aWidth[X];const ee=B.GPOS;if(ee){const z=ee.lookupList;for(let K=0;K<z.length;K++){const ae=z[K];for(let oe=0;oe<ae.tabs.length;oe++){const re=ae.tabs[oe];if(ae.ltype===1){if(n._lctf.coverageIndex(re.coverage,X)!==-1&&re.pos){$(re.pos,k);break}}else if(ae.ltype===2){let F=null,O=V();if(O!==-1){const J=n._lctf.coverageIndex(re.coverage,P[O]);if(J!==-1){if(re.fmt===1){const q=re.pairsets[J];for(let Q=0;Q<q.length;Q++)q[Q].gid2===X&&(F=q[Q])}else if(re.fmt===2){const q=n.U._getGlyphClass(P[O],re.classDef1),Q=n.U._getGlyphClass(X,re.classDef2);F=re.matrix[q][Q]}if(F){F.val1&&$(F.val1,O),F.val2&&$(F.val2,k);break}}}}else if(ae.ltype===4){const F=n._lctf.coverageIndex(re.markCoverage,X);if(F!==-1){const O=V(U),J=O===-1?-1:n._lctf.coverageIndex(re.baseCoverage,P[O]);if(J!==-1){const q=re.markArray[F],Q=re.baseArray[J][q.markClass];G[k*3]=Q.x-q.x+G[O*3]-G[O*3+2],G[k*3+1]=Q.y-q.y+G[O*3+1];break}}}else if(ae.ltype===6){const F=n._lctf.coverageIndex(re.mark1Coverage,X);if(F!==-1){const O=V();if(O!==-1){const J=P[O];if(C(B,J)===3){const q=n._lctf.coverageIndex(re.mark2Coverage,J);if(q!==-1){const Q=re.mark1Array[F],ne=re.mark2Array[q][Q.markClass];G[k*3]=ne.x-Q.x+G[O*3]-G[O*3+2],G[k*3+1]=ne.y-Q.y+G[O*3+1];break}}}}}}}}else if(B.kern&&!B.cff){const z=V();if(z!==-1){const K=B.kern.glyph1.indexOf(P[z]);if(K!==-1){const ae=B.kern.rval[K].glyph2.indexOf(X);ae!==-1&&(G[z*3+2]+=B.kern.rval[K].vals[ae])}}}}return G;function V(X){for(let ee=k-1;ee>=0;ee--)if(P[ee]!==-1&&(!X||X(P[ee])))return ee;return-1}function U(X){return C(B,X)===1}function $(X,ee){for(let z=0;z<3;z++)G[ee*3+z]+=X[z]||0}}function C(B,P){const G=B.GDEF&&B.GDEF.glyphClassDef;return G?n.U._getGlyphClass(P,G):0}function I(...B){for(let P=0;P<B.length;P++)if(typeof B[P]=="number")return B[P]}function D(B){const P=Object.create(null),G=B["OS/2"],k=B.hhea,V=B.head.unitsPerEm,U=I(G&&G.sTypoAscender,k&&k.ascender,V),$={unitsPerEm:V,ascender:U,descender:I(G&&G.sTypoDescender,k&&k.descender,0),capHeight:I(G&&G.sCapHeight,U),xHeight:I(G&&G.sxHeight,U),lineGap:I(G&&G.sTypoLineGap,k&&k.lineGap),supportsCodePoint(X){return n.U.codeToGlyph(B,X)>0},forEachGlyph(X,ee,z,K){let ae=0;const oe=1/$.unitsPerEm*ee,re=A(B,X);let F=0;const O=E(B,re);return re.forEach((J,q)=>{if(J!==-1){let Q=P[J];if(!Q){const{cmds:ne,crds:Z}=n.U.glyphToPath(B,J);let se="",me=0;for(let Ce=0,Re=ne.length;Ce<Re;Ce++){const De=t[ne[Ce]];se+=ne[Ce];for(let he=1;he<=De;he++)se+=(he>1?",":"")+Z[me++]}let ze,Be,ye,Le;if(Z.length){ze=Be=1/0,ye=Le=-1/0;for(let Ce=0,Re=Z.length;Ce<Re;Ce+=2){let De=Z[Ce],he=Z[Ce+1];De<ze&&(ze=De),he<Be&&(Be=he),De>ye&&(ye=De),he>Le&&(Le=he)}}else ze=ye=Be=Le=0;Q=P[J]={index:J,advanceWidth:B.hmtx.aWidth[J],xMin:ze,yMin:Be,xMax:ye,yMax:Le,path:se}}K.call(null,Q,ae+O[q*3]*oe,O[q*3+1]*oe,F),ae+=O[q*3+2]*oe,z&&(ae+=z*ee)}F+=X.codePointAt(F)>65535?2:1}),ae}};return $}return function(P){const G=new Uint8Array(P,0,4),k=n._bin.readASCII(G,0,4);if(k==="wOFF")P=e(P);else if(k==="wOF2")throw new Error("woff2 fonts not supported");return D(n.parse(P)[0])}}
4960const rxe=c0({name:"Typr Font Parser",dependencies:[exe,txe,nxe],init(n,e,t){const r=n(),s=e();return t(r,s)}});function sxe(){return(function(n){var e=function(){this.buckets=new Map};e.prototype.add=function(E){var C=E>>5;this.buckets.set(C,(this.buckets.get(C)||0)|1<<(31&E))},e.prototype.has=function(E){var C=this.buckets.get(E>>5);return C!==void 0&&(C&1<<(31&E))!=0},e.prototype.serialize=function(){var E=[];return this.buckets.forEach((function(C,I){E.push((+I).toString(36)+":"+C.toString(36))})),E.join(",")},e.prototype.deserialize=function(E){var C=this;this.buckets.clear(),E.split(",").forEach((function(I){var D=I.split(":");C.buckets.set(parseInt(D[0],36),parseInt(D[1],36))}))};var t=Math.pow(2,8),r=t-1,s=~r;function a(E){var C=(function(D){return D&s})(E).toString(16),I=(function(D){return(D&s)+t-1})(E).toString(16);return"codepoint-index/plane"+(E>>16)+"/"+C+"-"+I+".json"}function o(E,C){var I=E&r,D=C.codePointAt(I/6|0);return((D=(D||48)-48)&1<<I%6)!=0}function l(E,C){var I;(I=E,I.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(D){return D.split("-").map((function(B){return parseInt(B.trim(),16)}))}))).forEach((function(D){var B=D[0],P=D[1];P===void 0&&(P=B),C(B,P)}))}function u(E,C){l(E,(function(I,D){for(var B=I;B<=D;B++)C(B)}))}var d={},h={},p=new WeakMap,x="https://cdn.jsdelivr.net/gh/lojjic/[email protected]/packages/data";function y(E){var C=p.get(E);return C||(C=new e,u(E.ranges,(function(I){return C.add(I)})),p.set(E,C)),C}var v,_=new Map;function M(E,C,I){return E[C]?C:E[I]?I:(function(D){for(var B in D)return B})(E)}function S(E,C){var I=C;if(!E.includes(I)){I=1/0;for(var D=0;D<E.length;D++)Math.abs(E[D]-C)<Math.abs(I-C)&&(I=E[D])}return I}function A(E){return v||(v=new Set,u("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(C){v.add(C)}))),v.has(E)}return n.CodePointSet=e,n.clearCache=function(){d={},h={}},n.getFontsForString=function(E,C){C===void 0&&(C={});var I,D=C.lang;D===void 0&&(D=new RegExp("\\p{Script=Hangul}","u").test(I=E)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(I)?"ja":"en");var B=C.category;B===void 0&&(B="sans-serif");var P=C.style;P===void 0&&(P="normal");var G=C.weight;G===void 0&&(G=400);var k=(C.dataUrl||x).replace(/\/$/g,""),V=new Map,U=new Uint8Array(E.length),$={},X={},ee=new Array(E.length),z=new Map,K=!1;function ae(F){var O=_.get(F);return O||(O=fetch(k+"/"+F).then((function(J){if(!J.ok)throw new Error(J.statusText);return J.json().then((function(q){if(!Array.isArray(q)||q[0]!==1)throw new Error("Incorrect schema version; need 1, got "+q[0]);return q[1]}))})).catch((function(J){if(k!==x)return K||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+k+'", trying default CDN. '+J.message),K=!0),k=x,_.delete(F),ae(F);throw J})),_.set(F,O)),O}for(var oe=function(F){var O=E.codePointAt(F),J=a(O);ee[F]=J,d[J]||z.has(J)||z.set(J,ae(J).then((function(q){d[J]=q}))),O>65535&&(F++,re=F)},re=0;re<E.length;re++)oe(re);return Promise.all(z.values()).then((function(){z.clear();for(var F=function(J){var q=E.codePointAt(J),Q=null,ne=d[ee[J]],Z=void 0;for(var se in ne){var me=X[se];if(me===void 0&&(me=X[se]=new RegExp(se).test(D||"en")),me){for(var ze in Z=se,ne[se])if(o(q,ne[se][ze])){Q=ze;break}break}}if(!Q){e:for(var Be in ne)if(Be!==Z){for(var ye in ne[Be])if(o(q,ne[Be][ye])){Q=ye;break e}}}Q||(console.debug("No font coverage for U+"+q.toString(16)),Q="latin"),ee[J]=Q,h[Q]||z.has(Q)||z.set(Q,ae("font-meta/"+Q+".json").then((function(Le){h[Q]=Le}))),q>65535&&(J++,O=J)},O=0;O<E.length;O++)F(O);return Promise.all(z.values())})).then((function(){for(var F,O=null,J=0;J<E.length;J++){var q=E.codePointAt(J);if(O&&(A(q)||y(O).has(q)))U[J]=U[J-1];else{O=h[ee[J]];var Q=$[O.id];if(!Q){var ne=O.typeforms,Z=M(ne,B,"sans-serif"),se=M(ne[Z],P,"normal"),me=S((F=ne[Z])===null||F===void 0?void 0:F[se],G);Q=$[O.id]=k+"/font-files/"+O.id+"/"+Z+"."+se+"."+me+".woff"}var ze=V.get(Q);ze==null&&(ze=V.size,V.set(Q,ze)),U[J]=ze}q>65535&&(J++,U[J]=U[J-1])}return{fontUrls:Array.from(V.keys()),chars:U}}))},Object.defineProperty(n,"__esModule",{value:!0}),n})({})}function ixe(n,e){const t=Object.create(null),r=Object.create(null);function s(o,l){const u=d=>{console.error(`Failure loading font ${o}`,d)};try{const d=new XMLHttpRequest;d.open("get",o,!0),d.responseType="arraybuffer",d.onload=function(){if(d.status>=400)u(new Error(d.statusText));else if(d.status>0)try{const h=n(d.response);h.src=o,l(h)}catch(h){u(h)}},d.onerror=u,d.send()}catch(d){u(d)}}function a(o,l){let u=t[o];u?l(u):r[o]?r[o].push(l):(r[o]=[l],s(o,d=>
4960{d.src=o,t[o]=d,r[o].forEach(h=>h(d)),delete r[o]}))}return function(o,l,{lang:u,fonts:d=[],style:h="normal",weight:p="normal",unicodeFontsURL:x}={}){const y=new Uint8Array(o.length),v=[];o.length||A();const _=new Map,M=[];if(h!=="italic"&&(h="normal"),typeof p!="number"&&(p=p==="bold"?700:400),d&&!Array.isArray(d)&&(d=[d]),d=d.slice().filter(C=>!C.lang||C.lang.test(u)).reverse(),d.length){let B=0;(function P(G=0){for(let k=G,V=o.length;k<V;k++){const U=o.codePointAt(k);if(B===1&&v[y[k-1]].supportsCodePoint(U)||k>0&&/\s/.test(o[k]))y[k]=y[k-1],B===2&&(M[M.length-1][1]=k);else for(let $=y[k],X=d.length;$<=X;$++)if($===X){const ee=B===2?M[M.length-1]:M[M.length]=[k,k];ee[1]=k,B=2}else{y[k]=$;const{src:ee,unicodeRange:z}=d[$];if(!z||E(U,z)){const K=t[ee];if(!K){a(ee,()=>{P(k)});return}if(K.supportsCodePoint(U)){let ae=_.get(K);typeof ae!="number"&&(ae=v.length,v.push(K),_.set(K,ae)),y[k]=ae,B=1;break}}}U>65535&&k+1<V&&(y[k+1]=y[k],k++,B===2&&(M[M.length-1][1]=k))}S()})()}else M.push([0,o.length-1]),S();function S(){if(M.length){const C=M.map(I=>o.substring(I[0],I[1]+1)).join(`
4961`);e.getFontsForString(C,{lang:u||void 0,style:h,weight:p,dataUrl:x}).then(({fontUrls:I,chars:D})=>{const B=v.length;let P=0;M.forEach(k=>{for(let V=0,U=k[1]-k[0];V<=U;V++)y[k[0]+V]=D[P++]+B;P++});let G=0;I.forEach((k,V)=>{a(k,U=>{v[V+B]=U,++G===I.length&&A()})})})}else A()}function A(){l({chars:y,fonts:v})}function E(C,I){for(let D=0;D<I.length;D++){const[B,P=B]=I[D];if(B<=C&&C<=P)return!0}return!1}}}const axe=c0({name:"FontResolver",dependencies:[ixe,rxe,sxe],init(n,e,t){return n(e,t())}});function oxe(n,e){const r=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,s="[^\\S\\u00A0]",a=new RegExp(`${s}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function o({text:v,lang:_,fonts:M,style:S,weight:A,preResolvedFonts:E,unicodeFontsURL:C},I){const D=({chars:B,fonts:P})=>{let G,k;const V=[];for(let U=0;U<B.length;U++)B[U]!==k?(k=B[U],V.push(G={start:U,end:U,fontObj:P[B[U]]})):G.end=U;I(V)};E?D(E):n(v,D,{lang:_,fonts:M,style:S,weight:A,unicodeFontsURL:C})}function l({text:v="",font:_,lang:M,sdfGlyphSize:S=64,fontSize:A=400,fontWeight:E=1,fontStyle:C="normal",letterSpacing:I=0,lineHeight:D="normal",maxWidth:B=1/0,direction:P,textAlign:G="left",textIndent:k=0,whiteSpace:V="normal",overflowWrap:U="normal",anchorX:$=0,anchorY:X=0,metricsOnly:ee=!1,unicodeFontsURL:z,preResolvedFonts:K=null,includeCaretPositions:ae=!1,chunkedBoundsSize:oe=8192,colorRanges:re=null},F){const O=p(),J={fontLoad:0,typesetting:0};v.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),v=v.replace(/\r\n/g,`
4962`).replace(/\r/g,`
4963`)),A=+A,I=+I,B=+B,D=D||"normal",k=+k,o({text:v,lang:M,style:C,weight:E,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:z,preResolvedFonts:K},q=>{J.fontLoad=p()-O;const Q=isFinite(B);let ne=null,Z=null,se=null,me=null,ze=null,Be=null,ye=null,Le=null,Ce=0,Re=0,De=V!=="nowrap";const he=new Map,le=p();let Xe=k,qe=0,Ge=new x;const ot=[Ge];q.forEach(Y=>{const{fontObj:je}=Y,{ascender:Ie,descender:Ve,unitsPerEm:ft,lineGap:vt,capHeight:ce,xHeight:Me}=je;let Fe=he.get(je);if(!Fe){const pe=A/ft,Ke=D==="normal"?(Ie-Ve+vt)*pe:D*A,Ne=(Ke-(Ie-Ve)*pe)/2,Ye=Math.min(Ke,(Ie-Ve)*pe),Te=(Ie+Ve)/2*pe+Ye/2;Fe={index:he.size,src:je.src,fontObj:je,fontSizeMult:pe,unitsPerEm:ft,ascender:Ie*pe,descender:Ve*pe,capHeight:ce*pe,xHeight:Me*pe,lineHeight:Ke,baseline:-Ne-Ie*pe,caretTop:Te,caretBottom:Te-Ye},he.set(je,Fe)}const{fontSizeMult:ie}=Fe,Se=v.slice(Y.start,Y.end+1);let Ae,at;je.forEachGlyph(Se,A,I,(pe,Ke,Ne,Ye)=>{Ke+=qe,Ye+=Y.start,Ae=Ke,at=pe;const Te=v.charAt(Ye),st=pe.advanceWidth*ie,et=Ge.count;let Qe;if("isEmpty"in pe||(pe.isWhitespace=!!Te&&new RegExp(s).test(Te),pe.canBreakAfter=!!Te&&a.test(Te),pe.isEmpty=pe.xMin===pe.xMax||pe.yMin===pe.yMax||r.test(Te)),!pe.isWhitespace&&!pe.isEmpty&&Re++,De&&Q&&!pe.isWhitespace&&Ke+st+Xe>B&&et){if(Ge.glyphAt(et-1).glyphObj.canBreakAfter)Qe=new x,Xe=-Ke;else for(let ue=et;ue--;)if(ue===0&&U==="break-word"){Qe=new x,Xe=-Ke;break}else if(Ge.glyphAt(ue).glyphObj.canBreakAfter){Qe=Ge.splitAt(ue+1);const Je=Qe.glyphAt(0).x;Xe-=Je;for(let it=Qe.count;it--;)Qe.glyphAt(it).x-=Je;break}Qe&&(Ge.isSoftWrapped=!0,Ge=Qe,ot.push(Ge),Ce=B)}let Mt=Ge.glyphAt(Ge.count);Mt.glyphObj=pe,Mt.x=Ke+Xe,Mt.y=Ne,Mt.width=st,Mt.charIndex=Ye,Mt.fontData=Fe,Te===`
4964`&&(Ge=new x,ot.push(Ge),Xe=-(Ke+st+I*A)+k)}),qe=Ae+at.advanceWidth*ie+I*A});let ve=0;ot.forEach(Y=>{let je=!0;for(let Ie=Y.count;Ie--;){const Ve=Y.glyphAt(Ie);je&&!Ve.glyphObj.isWhitespace&&(Y.width=Ve.x+Ve.width,Y.width>Ce&&(Ce=Y.width),je=!1);let{lineHeight:ft,capHeight:vt,xHeight:ce,baseline:Me}=Ve.fontData;ft>Y.lineHeight&&(Y.lineHeight=ft);const Fe=Me-Y.baseline;Fe<0&&(Y.baseline+=Fe,Y.cap+=Fe,Y.ex+=Fe),Y.cap=Math.max(Y.cap,Y.baseline+vt),Y.ex=Math.max(Y.ex,Y.baseline+ce)}Y.baseline-=ve,Y.cap-=ve,Y.ex-=ve,ve+=Y.lineHeight});let mt=0,xt=0;if($&&(typeof $=="number"?mt=-$:typeof $=="string"&&(mt=-Ce*($==="left"?0:$==="center"?.5:$==="right"?1:d($)))),X&&(typeof X=="number"?xt=-X:typeof X=="string"&&(xt=X==="top"?0:X==="top-baseline"?-ot[0].baseline:X==="top-cap"?-ot[0].cap:X==="top-ex"?-ot[0].ex:X==="middle"?ve/2:X==="bottom"?ve:X==="bottom-baseline"?-ot[ot.length-1].baseline:d(X)*ve)),!ee){const Y=e.getEmbeddingLevels(v,P);ne=new Uint16Array(Re),Z=new Uint8Array(Re),se=new Float32Array(Re*2),me={},ye=[1/0,1/0,-1/0,-1/0],Le=[],ae&&(Be=new Float32Array(v.length*4)),re&&(ze=new Uint8Array(Re*3));let je=0,Ie=-1,Ve=-1,ft,vt;if(ot.forEach((ce,Me)=>{let{count:Fe,width:ie}=ce;if(Fe>0){let Se=0;for(let Ye=Fe;Ye--&&ce.glyphAt(Ye).glyphObj.isWhitespace;)Se++;let Ae=0,at=0;if(G==="center")Ae=(Ce-ie)/2;else if(G==="right")Ae=Ce-ie;else if(G==="justify"&&ce.isSoftWrapped){let Ye=0;for(let Te=Fe-Se;Te--;)ce.glyphAt(Te).glyphObj.isWhitespace&&Ye++;at=(Ce-ie)/Ye}if(at||Ae){let Ye=0;for(let Te=0;Te<Fe;Te++){let st=ce.glyphAt(Te);const et=st.glyphObj;st.x+=Ae+Ye,at!==0&&et.isWhitespace&&Te<Fe-Se&&(Ye+=at,st.width+=at)}}const pe=e.getReorderSegments(v,Y,ce.glyphAt(0).charIndex,ce.glyphAt(ce.count-1).charIndex);for(let Ye=0;Ye<pe.length;Ye++){const[Te,st]=pe[Ye];let et=1/0,Qe=-1/0;for(let Mt=0;Mt<Fe;Mt++)if(ce.glyphAt(Mt).charIndex>=Te){let ue=Mt,Je=Mt;for(;Je<Fe;Je++){let it=ce.glyphAt(Je);if(it.charIndex>st)break;Je<Fe-Se&&(et=Math.min(et,it.x),Qe=Math.max(Qe,it.x+it.width))}for(let it=ue;it<Je;it++){const Et=ce.glyphAt(it);Et.x=Qe-(Et.x+Et.width-et)}break}}let Ke;const Ne=Ye=>Ke=Ye;for(let Ye=0;Ye<Fe;Ye++){const Te=ce.glyphAt(Ye);Ke=Te.glyphObj;const st=Ke.index,et=Y.levels[Te.charIndex]&1;if(et){const Qe=e.getMirroredCharacter(v[Te.charIndex]);
4964Qe&&Te.fontData.fontObj.forEachGlyph(Qe,0,0,Ne)}if(ae){const{charIndex:Qe,fontData:Mt}=Te,ue=Te.x+mt,Je=Te.x+Te.width+mt;Be[Qe*4]=et?Je:ue,Be[Qe*4+1]=et?ue:Je,Be[Qe*4+2]=ce.baseline+Mt.caretBottom+xt,Be[Qe*4+3]=ce.baseline+Mt.caretTop+xt;const it=Qe-Ie;it>1&&h(Be,Ie,it),Ie=Qe}if(re){const{charIndex:Qe}=Te;for(;Qe>Ve;)Ve++,re.hasOwnProperty(Ve)&&(vt=re[Ve])}if(!Ke.isWhitespace&&!Ke.isEmpty){const Qe=je++,{fontSizeMult:Mt,src:ue,index:Je}=Te.fontData,it=me[ue]||(me[ue]={});it[st]||(it[st]={path:Ke.path,pathBounds:[Ke.xMin,Ke.yMin,Ke.xMax,Ke.yMax]});const Et=Te.x+mt,Wt=Te.y+ce.baseline+xt;se[Qe*2]=Et,se[Qe*2+1]=Wt;const an=Et+Ke.xMin*Mt,Sn=Wt+Ke.yMin*Mt,Lr=Et+Ke.xMax*Mt,Gr=Wt+Ke.yMax*Mt;an<ye[0]&&(ye[0]=an),Sn<ye[1]&&(ye[1]=Sn),Lr>ye[2]&&(ye[2]=Lr),Gr>ye[3]&&(ye[3]=Gr),Qe%oe===0&&(ft={start:Qe,end:Qe,rect:[1/0,1/0,-1/0,-1/0]},Le.push(ft)),ft.end++;const Nr=ft.rect;if(an<Nr[0]&&(Nr[0]=an),Sn<Nr[1]&&(Nr[1]=Sn),Lr>Nr[2]&&(Nr[2]=Lr),Gr>Nr[3]&&(Nr[3]=Gr),ne[Qe]=st,Z[Qe]=Je,re){const Wn=Qe*3;ze[Wn]=vt>>16&255,ze[Wn+1]=vt>>8&255,ze[Wn+2]=vt&255}}}}}),Be){const ce=v.length-Ie;ce>1&&h(Be,Ie,ce)}}const ge=[];he.forEach(({index:Y,src:je,unitsPerEm:Ie,ascender:Ve,descender:ft,lineHeight:vt,capHeight:ce,xHeight:Me})=>{ge[Y]={src:je,unitsPerEm:Ie,ascender:Ve,descender:ft,lineHeight:vt,capHeight:ce,xHeight:Me}}),J.typesetting=p()-le,F({glyphIds:ne,glyphFontIndices:Z,glyphPositions:se,glyphData:me,fontData:ge,caretPositions:Be,glyphColors:ze,chunkedBounds:Le,fontSize:A,topBaseline:xt+ot[0].baseline,blockBounds:[mt,xt-ve,mt+Ce,xt],visibleBounds:ye,timings:J})})}function u(v,_){l({...v,metricsOnly:!0},M=>{const[S,A,E,C]=M.blockBounds;_({width:E-S,height:C-A})})}function d(v){let _=v.match(/^([\d.]+)%$/),M=_?parseFloat(_[1]):NaN;return isNaN(M)?0:M/100}function h(v,_,M){const S=v[_*4],A=v[_*4+1],E=v[_*4+2],C=v[_*4+3],I=(A-S)/M;for(let D=0;D<M;D++){const B=(_+D)*4;v[B]=S+I*D,v[B+1]=S+I*(D+1),v[B+2]=E,v[B+3]=C}}function p(){return(self.performance||Date).now()}function x(){this.data=[]}const y=["glyphObj","x","y","width","charIndex","fontData"];return x.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/y.length)},glyphAt(v){let _=x.flyweight;return _.data=this.data,_.index=v,_},splitAt(v){let _=new x;return _.data=this.data.splice(v*y.length),_}},x.flyweight=y.reduce((v,_,M,S)=>(Object.defineProperty(v,_,{get(){return this.data[this.index*y.length+M]},set(A){this.data[this.index*y.length+M]=A}}),v),{data:null,index:0}),{typeset:l,measure:u}}const sp=()=>(self.performance||Date).now(),dA=sG();let pB;function lxe(n,e,t,r,s,a,o,l,u,d,h=!0){return h?uxe(n,e,t,r,s,a,o,l,u,d).then(null,p=>(pB||(console.warn("WebGL SDF generation failed, falling back to JS",p),pB=!0),xB(n,e,t,r,s,a,o,l,u,d))):xB(n,e,t,r,s,a,o,l,u,d)}const f_=[],cxe=5;let s2=0;function aG(){const n=sp();for(;f_.length&&sp()-n<cxe;)f_.shift()();s2=f_.length?setTimeout(aG,0):0}const uxe=(...n)=>new Promise((e,t)=>{f_.push(()=>{const r=sp();try{dA.webgl.generateIntoCanvas(...n),e({timing:sp()-r})}catch(s){t(s)}}),s2||(s2=setTimeout(aG,0))}),dxe=4,fxe=2e3,gB={};let hxe=0;function xB(n,e,t,r,s,a,o,l,u,d){const h="TroikaTextSDFGenerator_JS_"+hxe++%dxe;let p=gB[h];return p||(p=gB[h]={workerModule:c0({name:h,workerId:h,dependencies:[sG,sp],init(x,y){const v=x().javascript.generate;return function(..._){const M=y();return{textureData:v(..._),timing:y()-M}}},getTransferables(x){return[x.textureData.buffer]}}),requests:0,idleTimer:null}),p.requests++,clearTimeout(p.idleTimer),p.workerModule(n,e,t,r,s,a).then(({textureData:x,timing:y})=>{const v=sp(),_=new Uint8Array(x.length*4);for(let M=0;M<x.length;M++)_[M*4+d]=x[M];
4964return dA.webglUtils.renderImageData(o,_,l,u,n,e,1<<3-d),y+=sp()-v,--p.requests===0&&(p.idleTimer=setTimeout(()=>{Vge(h)},fxe)),{timing:y}})}function mxe(n){n._warm||(dA.webgl.isSupported(n),n._warm=!0)}const pxe=dA.webglUtils.resizeWebGLCanvasWithoutClearing,sy={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},gxe=new Ut;function lx(){return(self.performance||Date).now()}const bB=Object.create(null);function oG(n,e){n=yxe({},n);const t=lx(),r=[];if(n.font&&r.push({label:"user",src:vxe(n.font)}),n.font=r,n.text=""+n.text,n.sdfGlyphSize=n.sdfGlyphSize||sy.sdfGlyphSize,n.unicodeFontsURL=n.unicodeFontsURL||sy.unicodeFontsURL,n.colorRanges!=null){let x={};for(let y in n.colorRanges)if(n.colorRanges.hasOwnProperty(y)){let v=n.colorRanges[y];typeof v!="number"&&(v=gxe.set(v).getHex()),x[y]=v}n.colorRanges=x}Object.freeze(n);const{textureWidth:s,sdfExponent:a}=sy,{sdfGlyphSize:o}=n,l=s/o*4;let u=bB[o];if(!u){const x=document.createElement("canvas");x.width=s,x.height=o*256/l,u=bB[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:x,sdfTexture:new ms(x,void 0,void 0,void 0,qr,qr),contextLost:!1,glyphsByFont:new Map},u.sdfTexture.generateMipmaps=!1,xxe(u)}const{sdfTexture:d,sdfCanvas:h}=u;uG(n).then(x=>{const{glyphIds:y,glyphFontIndices:v,fontData:_,glyphPositions:M,fontSize:S,timings:A}=x,E=[],C=new Float32Array(y.length*4);let I=0,D=0;const B=lx(),P=_.map($=>{let X=u.glyphsByFont.get($.src);return X||u.glyphsByFont.set($.src,X=new Map),X});y.forEach(($,X)=>{const ee=v[X],{src:z,unitsPerEm:K}=_[ee];let ae=P[ee].get($);if(!ae){const{path:J,pathBounds:q}=x.glyphData[z][$],Q=Math.max(q[2]-q[0],q[3]-q[1])/o*(sy.sdfMargin*o+.5),ne=u.glyphCount++,Z=[q[0]-Q,q[1]-Q,q[2]+Q,q[3]+Q];P[ee].set($,ae={path:J,atlasIndex:ne,sdfViewBox:Z}),E.push(ae)}const{sdfViewBox:oe}=ae,re=M[D++],F=M[D++],O=S/K;C[I++]=re+oe[0]*O,C[I++]=F+oe[1]*O,C[I++]=re+oe[2]*O,C[I++]=F+oe[3]*O,y[X]=ae.atlasIndex}),A.quads=(A.quads||0)+(lx()-B);const G=lx();A.sdf={};const k=h.height,V=Math.ceil(u.glyphCount/l),U=Math.pow(2,Math.ceil(Math.log2(V*o)));U>k&&(console.info(`Increasing SDF texture size ${k}->${U}`),pxe(h,s,U),d.dispose()),Promise.all(E.map($=>lG($,u,n.gpuAccelerateSDF).then(({timing:X})=>{A.sdf[$.atlasIndex]=X}))).then(()=>{E.length&&!u.contextLost&&(cG(u),d.needsUpdate=!0),A.sdfTotal=lx()-G,A.total=lx()-t,e(Object.freeze({parameters:n,sdfTexture:d,sdfGlyphSize:o,sdfExponent:a,glyphBounds:C,glyphAtlasIndices:y,glyphColors:x.glyphColors,caretPositions:x.caretPositions,chunkedBounds:x.chunkedBounds,ascender:x.ascender,descender:x.descender,lineHeight:x.lineHeight,capHeight:x.capHeight,xHeight:x.xHeight,topBaseline:x.topBaseline,blockBounds:x.blockBounds,visibleBounds:x.visibleBounds,timings:x.timings}))})}),Promise.resolve().then(()=>{u.contextLost||mxe(h)})}function lG({path:n,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:r,sdfCanvas:s,contextLost:a},o){if(a)return Promise.resolve({timing:-1});const{textureWidth:l,sdfExponent:u}=sy,d=Math.max(t[2]-t[0],t[3]-t[1]),h=Math.floor(e/4),p=h%(l/r)*r,x=Math.floor(h/(l/r))*r,y=e%4;return lxe(r,r,n,t,d,u,s,p,x,y,o)}function xxe(n){const e=n.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),n.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),n.contextLost=!1;const r=[];n.glyphsByFont.forEach(s=>{s.forEach(a=>{r.push(lG(a,n,!0))})}),Promise.all(r).then(()=>{cG(n),n.sdfTexture.needsUpdate=!0})})}function bxe({font:n,characters:e,sdfGlyphSize:t},r){let s=Array.isArray(e)?e.join(`
4965`):""+e;oG({font:n,sdfGlyphSize:t,text:s},r)}function yxe(n,e){for(let t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}let kS;function vxe(n){return kS||(kS=typeof document>"u"?{}:document.createElement("a")),kS.href=n,kS.href}function cG(n){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=n,{width:r,height:s}=e,a=n.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==r*s*4)&&(o=new Uint8Array(r*s*4),t.image={width:r,height:s,data:o},t.flipY=!1,t.isDataTexture=!0),a.readPixels(0,0,r,s,a.RGBA,a.UNSIGNED_BYTE,o)}}
4965const wxe=c0({name:"Typesetter",dependencies:[oxe,axe,$ge],init(n,e,t){return n(e,t())}}),uG=c0({name:"Typesetter",dependencies:[wxe],init(n){return function(e){return new Promise(t=>{n.typeset(e,t)})}},getTransferables(n){const e=[];for(let t in n)n[t]&&n[t].buffer&&e.push(n[t].buffer);return e}});uG.onMainThread;const yB={};function Sxe(n){let e=yB[n];return e||(e=yB[n]=new Yd(1,1,n,n).translate(.5,.5,0)),e}const _xe="aTroikaGlyphBounds",vB="aTroikaGlyphIndex",Mxe="aTroikaGlyphColor";class Nxe extends iA{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new mi,this.boundingBox=new hi}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=Sxe(e);["position","normal","uv"].forEach(r=>{this.attributes[r]=t.attributes[r].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,r,s,a){this.updateAttributeData(_xe,e,4),this.updateAttributeData(vB,t,1),this.updateAttributeData(Mxe,a,3),this._blockBounds=r,this._chunkedBounds=s,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:r}=this;if(t){const{PI:s,floor:a,min:o,max:l,sin:u,cos:d}=Math,h=s/2,p=s*2,x=Math.abs(t),y=e[0]/x,v=e[2]/x,_=a((y+h)/p)!==a((v+h)/p)?-x:o(u(y)*x,u(v)*x),M=a((y-h)/p)!==a((v-h)/p)?x:l(u(y)*x,u(v)*x),S=a((y+s)/p)!==a((v+s)/p)?x*2:l(x-d(y)*x,x-d(v)*x);r.min.set(_,e[1],t<0?-S:0),r.max.set(M,e[3],t<0?0:S)}else r.min.set(e[0],e[1],0),r.max.set(e[2],e[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(vB).count,r=this._chunkedBounds;if(r)for(let s=r.length;s--;){t=r[s].end;let a=r[s].rect;if(a[1]<e.w&&a[3]>e.y&&a[0]<e.z&&a[2]>e.x)break}this.instanceCount=t}updateAttributeData(e,t,r){const s=this.getAttribute(e);t?s&&s.array.length===t.length?(s.array.set(t),s.needsUpdate=!0):(this.setAttribute(e,new wh(t,r)),delete this._maxInstanceCount,this.dispose()):s&&this.deleteAttribute(e)}}const Axe=`
4966uniform vec2 uTroikaSDFTextureSize;
4967uniform float uTroikaSDFGlyphSize;
4968uniform vec4 uTroikaTotalBounds;
4969uniform vec4 uTroikaClipRect;
4970uniform mat3 uTroikaOrient;
4971uniform bool uTroikaUseGlyphColors;
4972uniform float uTroikaEdgeOffset;
4973uniform float uTroikaBlurRadius;
4974uniform vec2 uTroikaPositionOffset;
4975uniform float uTroikaCurveRadius;
4976attribute vec4 aTroikaGlyphBounds;
4977attribute float aTroikaGlyphIndex;
4978attribute vec3 aTroikaGlyphColor;
4979varying vec2 vTroikaGlyphUV;
4980varying vec4 vTroikaTextureUVBounds;
4981varying float vTroikaTextureChannel;
4982varying vec3 vTroikaGlyphColor;
4983varying vec2 vTroikaGlyphDimensions;
4984`,Cxe=`
4985vec4 bounds = aTroikaGlyphBounds;
4986bounds.xz += uTroikaPositionOffset.x;
4987bounds.yw -= uTroikaPositionOffset.y;
4988
4989vec4 outlineBounds = vec4(
4990  bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,
4991  bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius
4992);
4993vec4 clippedBounds = vec4(
4994  clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
4995  clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
4996);
4997
4998vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
4999
5000position.xy = mix(bounds.xy, bounds.zw, clippedXY);
5001
5002uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
5003
5004float rad = uTroikaCurveRadius;
5005if (rad != 0.0) {
5006  float angle = position.x / rad;
5007  position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
5008  normal.xz = vec2(sin(angle), cos(angle));
5009}
5010  
5011position = uTroikaOrient * position;
5012normal = uTroikaOrient * normal;
5013
5014vTroikaGlyphUV = clippedXY.xy;
5015vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
5016
5017
5018float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
5019vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
5020vec2 txStartUV = txUvPerSquare * vec2(
5021  mod(floor(aTroikaGlyphIndex / 4.0), txCols),
5022  floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
5023);
5024vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
5025vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
5026`,Exe=`
5027uniform sampler2D uTroikaSDFTexture;
5028uniform vec2 uTroikaSDFTextureSize;
5029uniform float uTroikaSDFGlyphSize;
5030uniform float uTroikaSDFExponent;
5031uniform float uTroikaEdgeOffset;
5032uniform float uTroikaFillOpacity;
5033uniform float uTroikaBlurRadius;
5034uniform vec3 uTroikaStrokeColor;
5035uniform float uTroikaStrokeWidth;
5036uniform float uTroikaStrokeOpacity;
5037uniform bool uTroikaSDFDebug;
5038varying vec2 vTroikaGlyphUV;
5039varying vec4 vTroikaTextureUVBounds;
5040varying float vTroikaTextureChannel;
5041varying vec2 vTroikaGlyphDimensions;
5042
5043float troikaSdfValueToSignedDistance(float alpha) {
5044  // Inverse of exponential encoding in webgl-sdf-generator
5045  
5046  float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
5047  float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
5048  float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
5049  return signedDist;
5050}
5051
5052float troikaGlyphUvToSdfValue(vec2 glyphUV) {
5053  vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
5054  vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
5055  float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
5056  return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
5057}
5058
5059float troikaGlyphUvToDistance(vec2 uv) {
5060  return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
5061}
5062
5063float troikaGetAADist() {
5064  
5065  #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
5066  return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
5067  #else
5068  return vTroikaGlyphDimensions.x / 64.0;
5069  #endif
5070}
5071
5072float troikaGetFragDistValue() {
5073  vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
5074  float distance = troikaGlyphUvToDistance(clampedGlyphUV);
5075 
5076  // Extrapolate distance when outside bounds:
5077  distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : 
5078    length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
5079
5080  
5081
5082  return distance;
5083}
5084
5085float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
5086  #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
5087  float alpha = step(-distanceOffset, -distance);
5088  #else
5089
5090  float alpha = smoothstep(
5091    distanceOffset + aaDist,
5092    distanceOffset - aaDist,
5093    distance
5094  );
5095  #endif
5096
5097  return alpha;
5098}
5099`,jxe=`
5100float aaDist = troikaGetAADist();
5101float fragDistance = troikaGetFragDistValue();
5102float edgeAlpha = uTroikaSDFDebug ?
5103  troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
5104  troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));
5105
5106#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
5107vec4 fillRGBA = gl_FragColor;
5108fillRGBA.a *= uTroikaFillOpacity;
5109vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
5110if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
5111gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
5112  -uTroikaStrokeWidth - aaDist,
5113  -uTroikaStrokeWidth + aaDist,
5114  fragDistance
5115));
5116gl_FragColor.a *= edgeAlpha;
5117#endif
5118
5119if (edgeAlpha == 0.0) {
5120  discard;
5121}
5122`;function Txe(n){const e=r2(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new wt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new mr(0,0,0,0)},uTroikaClipRect:{value:new mr(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new wt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ut},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Ln},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:Axe,vertexTransform:Cxe,fragmentDefs:Exe,fragmentColorTransform:jxe,customRewriter({vertexShader:t,fragmentShader:r}){let s=/\buniform\s+vec3\s+diffuse\b/;return s.test(r)&&(r=r.replace(s,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),s.test(t)||(t=t.replace(iG,`uniform vec3 diffuse;
5123$&
5124vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
5125`))),{vertexShader:t,fragmentShader:r}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const WR=new ko({color:16777215,side:Ll,transparent:!0}),wB=8421504,SB=new yn,IS=new we,ej=new we,Qb=[],Rxe=new we,tj="+x+y";function _B(n){return Array.isArray(n)?n[0]:n}let dG=()=>{const n=new Ns(new Yd(1,1),WR);return dG=()=>n,n},fG=()=>{const n=new Ns(new Yd(1,1,32,1),WR);return fG=()=>n,n};const Pxe={type:"syncstart"},Dxe={type:"synccomplete"},hG=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],kxe=hG.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let mG=class extends Ns{constructor(){const e=new Nxe;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=wB,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=tj,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(Pxe),oG({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{r.forEach(s=>s&&s())})),this.dispatchEvent(Dxe),e&&e()})))}onBeforeRender(e,t,r,s,a,o){this.sync(),a.isTroikaTextMaterial&&this._prepareForRender(a)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return Txe(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=WR.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function r(){t.removeEventListener("dispose",r),e.dispose()})),this.hasOutline()){let r=e._outlineMtl;return r||(r=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),r.isTextOutlineMaterial=!0,r.depthWrite=!1,r.map=null,e.addEventListener("dispose",function s(){e.removeEventListener("dispose",s),r.dispose()})),[r,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return _B(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return _B(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,r=e.uniforms,s=this.textRenderInfo;if(s){const{sdfTexture:l,blockBounds:u}=s;r.uTroikaSDFTexture.value=l,r.uTroikaSDFTextureSize.value.set(l.image.width,l.image.height),r.uTroikaSDFGlyphSize.value=s.sdfGlyphSize,r.uTroikaSDFExponent.value=s.sdfExponent,r.uTroikaTotalBounds.value.fromArray(u),r.uTroikaUseGlyphColors.value=!t&&!!s.glyphColors;let d=0,h=0,p=0,x,y,v,_=0,M=0;if(t){let{outlineWidth:A,outlineOffsetX:E,outlineOffsetY:C,outlineBlur:I,outlineOpacity:D}=this;d=this._parsePercent(A)||0,h=Math.max(0,this._parsePercent(I)||0),x=D,_=this._parsePercent(E)||0,M=this._parsePercent(C)||0}else p=Math.max(0,this._parsePercent(this.strokeWidth)||0),p&&(v=this.strokeColor,r.uTroikaStrokeColor.value.set(v??wB),y=this.strokeOpacity,y==null&&(y=1)),x=this.fillOpacity;r.uTroikaEdgeOffset.value=d,r.uTroikaPositionOffset.value.set(_,M),r.uTroikaBlurRadius.value=h,r.uTroikaStrokeWidth.value=p,r.uTroikaStrokeOpacity.value=y,r.uTroikaFillOpacity.value=x??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let S=this.clipRect;if(S&&Array.isArray(S)&&S.length===4)r.uTroikaClipRect.value.fromArray(S);else{const A=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(u[0]-A,u[1]-A,u[2]+A,u[3]+A)}this.geometry.applyClipRect(r.uTroikaClipRect.value)}r.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const a=t?this.outlineColor||0:this.color;if(a==null)delete e.color;else{const l=e.hasOwnProperty("color")?e.color:e.color=new Ut;(a!==l._input||typeof a=="object")&&l.set(l._input=a)}let o=this.orientation||tj;if(o!==e._orientation){let l=r.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let u=o!==tj&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(u){let[,d,h,p,x]=u;IS.set(0,0,0)[h]=d==="-"?1:-1,ej.set(0,0,0)[x]=p==="-"?-1:1,SB.lookAt(Rxe,IS.
5125cross(ej),ej),l.setFromMatrix4(SB)}else l.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),r=t?parseFloat(t[1]):NaN;e=(isNaN(r)?0:r/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new wt){t.copy(e);const r=this.curveRadius;return r&&(t.x=Math.atan2(e.x,Math.abs(r)-Math.abs(e.z))*Math.abs(r)),t}worldPositionToTextCoords(e,t=new wt){return IS.copy(e),this.localPositionToTextCoords(this.worldToLocal(IS),t)}raycast(e,t){const{textRenderInfo:r,curveRadius:s}=this;if(r){const a=r.blockBounds,o=s?fG():dG(),l=o.geometry,{position:u,uv:d}=l.attributes;for(let h=0;h<d.count;h++){let p=a[0]+d.getX(h)*(a[2]-a[0]);const x=a[1]+d.getY(h)*(a[3]-a[1]);let y=0;s&&(y=s-Math.cos(p/s)*s,p=Math.sin(p/s)*s),u.setXYZ(h,p,x,y)}l.boundingSphere=this.geometry.boundingSphere,l.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,Qb.length=0,o.raycast(e,Qb);for(let h=0;h<Qb.length;h++)Qb[h].object=this,t.push(Qb[h])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,kxe.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};hG.forEach(n=>{const e="_private_"+n;Object.defineProperty(mG.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new Ut;const tl=T.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:r,fontSize:s=1,children:a,characters:o,onSync:l,...u},d)=>{const h=yu(({invalidate:v})=>v),[p]=T.useState(()=>new mG),[x,y]=T.useMemo(()=>{const v=[];let _="";return T.Children.forEach(a,M=>{typeof M=="string"||typeof M=="number"?_+=M:v.push(M)}),[v,_]},[a]);return P9(()=>new Promise(v=>bxe({font:r,characters:o},v)),["troika-text",r,o]),T.useLayoutEffect(()=>{p.sync(()=>{h(),l&&l(p)})}),T.useEffect(()=>()=>p.dispose(),[p]),T.createElement("primitive",Sh({object:p,ref:d,font:r,text:y,anchorX:e,anchorY:t,fontSize:s,sdfGlyphSize:n},u),x)});function Ixe(n,e,t,r){var s;return s=class extends oo{constructor(a){super({vertexShader:e,fragmentShader:t,...a});for(const o in n)this.uniforms[o]=new aA(n[o]),Object.defineProperty(this,o,{get(){return this.uniforms[o].value},set(l){this.uniforms[o].value=l}});this.uniforms=Vx.clone(this.uniforms)}},s.key=DN.generateUUID(),s}const Bxe=()=>parseInt(i0.replace(/\D+/g,"")),Lxe=Bxe();let BS=null,pG="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function gG(n=!0,e=!0,t){return r=>{t&&t(r),n&&(BS||(BS=new Ige),BS.setDecoderPath(typeof n=="string"?n:pG),r.setDRACOLoader(BS)),e&&r.setMeshoptDecoder(typeof JE=="function"?JE():JE)}}const fA=(n,e,t,r)=>Bv(GR,n,gG(e,t,r));fA.preload=(n,e,t,r)=>Bv.preload(GR,n,gG(e,t,r));fA.clear=n=>Bv.clear(GR,n);fA.setDecoderPath=n=>{pG=n};const Oxe=T.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:r,enableDamping:s=!0,keyEvents:a=!1,onChange:o,onStart:l,onEnd:u,...d},h)=>{const p=yu(D=>D.invalidate),x=yu(D=>D.camera),y=yu(D=>D.gl),v=yu(D=>D.events),_=yu(D=>D.setEvents),M=yu(D=>D.set),S=yu(D=>D.get),A=yu(D=>D.performance),E=e||x,C=r||v.connected||y.domElement,I=T.useMemo(()=>new Zpe(E),[E]);return Iv(()=>{I.enabled&&I.update()},-1),T.useEffect(()=>(a&&I.connect(a===!0?C:a),I.connect(C),()=>{I.dispose()}),[a,C,t,I,p]),T.useEffect(()=>{const D=G=>{p(),t&&A.regress(),o&&o(G)},B=G=>{l&&l(G)},P=G=>{u&&u(G)};return I.addEventListener("change",D),I.addEventListener("start",B),I.addEventListener("end",P),()=>{I.removeEventListener("start",B),I.removeEventListener("end",P),I.removeEventListener("change",D)}},[o,l,u,I,p,_]),T.useEffect(()=>{if(n){const D=S().controls;return M({controls:I}),()=>M({controls:D})}},[n,I]),T.createElement("primitive",Sh({ref:h,object:I,enableDamping:s},d))}),Fxe=Ixe({cellSize:.5,sectionSize:1,fadeDistance:100,fadeStrength:1,fadeFrom:1,cellThickness:.5,sectionThickness:1,cellColor:new Ut,sectionColor:new Ut,infiniteGrid:!1,followCamera:!1,worldCamProjPosition:new we,worldPlanePosition:new we},`
5126    varying vec3 localPosition;
5127    varying vec4 worldPosition;
5128
5129    uniform vec3 worldCamProjPosition;
5130    uniform vec3 worldPlanePosition;
5131    uniform float fadeDistance;
5132    uniform bool infiniteGrid;
5133    uniform bool followCamera;
5134
5135    void main() {
5136      localPosition = position.xzy;
5137      if (infiniteGrid) localPosition *= 1.0 + fadeDistance;
5138      
5139      worldPosition = modelMatrix * vec4(localPosition, 1.0);
5140      if (followCamera) {
5141        worldPosition.xyz += (worldCamProjPosition - worldPlanePosition);
5142        localPosition = (inverse(modelMatrix) * worldPosition).xyz;
5143      }
5144
5145      gl_Position = projectionMatrix * viewMatrix * worldPosition;
5146    }
5147  `,`
5148    varying vec3 localPosition;
5149    varying vec4 worldPosition;
5150
5151    uniform vec3 worldCamProjPosition;
5152    uniform float cellSize;
5153    uniform float sectionSize;
5154    uniform vec3 cellColor;
5155    uniform vec3 sectionColor;
5156    uniform float fadeDistance;
5157    uniform float fadeStrength;
5158    uniform float fadeFrom;
5159    uniform float cellThickness;
5160    uniform float sectionThickness;
5161
5162    float getGrid(float size, float thickness) {
5163      vec2 r = localPosition.xz / size;
5164      vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
5165      float line = min(grid.x, grid.y) + 1.0 - thickness;
5166      return 1.0 - min(line, 1.0);
5167    }
5168
5169    void main() {
5170      float g1 = getGrid(cellSize, cellThickness);
5171      float g2 = getGrid(sectionSize, sectionThickness);
5172
5173      vec3 from = worldCamProjPosition*vec3(fadeFrom);
5174      float dist = distance(from, worldPosition.xyz);
5175      float d = 1.0 - min(dist / fadeDistance, 1.0);
5176      vec3 color = mix(cellColor, sectionColor, min(1.0, sectionThickness * g2));
5177
5178      gl_FragColor = vec4(color, (g1 + g2) * pow(d, fadeStrength));
5179      gl_FragColor.a = mix(0.75 * gl_FragColor.a, gl_FragColor.a, g2);
5180      if (gl_FragColor.a <= 0.0) discard;
5181
5182      #include <tonemapping_fragment>
5183      #include <${Lxe>=154?"colorspace_fragment":"encodings_fragment"}>
5184    }
5185  `),Uxe=T.forwardRef(({args:n,cellColor:e="#000000",sectionColor:t="#2080ff",cellSize:r=.5,sectionSize:s=1,followCamera:a=!1,infiniteGrid:o=!1,fadeDistance:l=100,fadeStrength:u=1,fadeFrom:d=1,cellThickness:h=.5,sectionThickness:p=1,side:x=Da,...y},v)=>{W9({GridMaterial:Fxe});const _=T.useRef(null);T.useImperativeHandle(v,()=>_.current,[]);const M=new _u,S=new we(0,1,0),A=new we(0,0,0);Iv(I=>{M.setFromNormalAndCoplanarPoint(S,A).applyMatrix4(_.current.matrixWorld);const D=_.current.material,B=D.uniforms.worldCamProjPosition,P=D.uniforms.worldPlanePosition;M.projectPoint(I.camera.position,B.value),P.value.set(0,0,0).applyMatrix4(_.current.matrixWorld)});const E={cellSize:r,sectionSize:s,cellColor:e,sectionColor:t,cellThickness:h,sectionThickness:p},C={fadeDistance:l,fadeStrength:u,fadeFrom:d,infiniteGrid:o,followCamera:a};return T.createElement("mesh",Sh({ref:_,frustumCulled:!1},y),T.createElement("gridMaterial",Sh({transparent:!0,"extensions-derivatives":!0,side:x},E,C)),T.createElement("planeGeometry",{args:n}))}),hA=T.createContext(null);hA.displayName="PanelGroupContext";const Zs={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},$R=10,ip=T.useLayoutEffect,MB=_h.useId,zxe=typeof MB=="function"?MB:()=>null;let Gxe=0;function XR(n=null){const e=zxe(),t=T.useRef(n||e||null);return t.current===null&&(t.current=""+Gxe++),n??t.current}function xG({children:n,className:e="",collapsedSize:t,collapsible:r,defaultSize:s,forwardedRef:a,id:o,maxSize:l,minSize:u,onCollapse:d,onExpand:h,onResize:p,order:x,style:y,tagName:v="div",..._}){const M=T.useContext(hA);if(M===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:A,getPanelSize:E,getPanelStyle:C,groupId:I,isPanelCollapsed:D,reevaluatePanelConstraints:B,registerPanel:P,resizePanel:G,unregisterPanel:k}=M,V=XR(o),U=T.useRef({callbacks:{onCollapse:d,onExpand:h,onResize:p},constraints:{collapsedSize:t,collapsible:r,defaultSize:s,maxSize:l,minSize:u},id:V,idIsFromProps:o!==void 0,order:x});T.useRef({didLogMissingDefaultSizeWarning:!1}),ip(()=>{const{callbacks:X,constraints:ee}=U.current,z={...ee};U.current.id=V,U.current.idIsFromProps=o!==void 0,U.current.order=x,X.onCollapse=d,X.onExpand=h,X.onResize=p,ee.collapsedSize=t,ee.collapsible=r,ee.defaultSize=s,ee.maxSize=l,ee.minSize=u,(z.collapsedSize!==ee.collapsedSize||z.collapsible!==ee.collapsible||z.maxSize!==ee.maxSize||z.minSize!==ee.minSize)&&B(U.current,z)}),ip(()=>{const X=U.current;return P(X),()=>{k(X)}},[x,V,P,k]),T.useImperativeHandle(a,()=>({collapse:()=>{S(U.current)},expand:X=>{A(U.current,X)},getId(){return V},getSize(){return E(U.current)},isCollapsed(){return D(U.current)},isExpanded(){return!D(U.current)},resize:X=>{G(U.current,X)}}),[S,A,E,D,V,G]);const $=C(U.current,s);return T.createElement(v,{..._,children:n,className:e,id:V,style:{...$,...y},[Zs.groupId]:I,[Zs.panel]:"",[Zs.panelCollapsible]:r||void 0,[Zs.panelId]:V,[Zs.panelSize]:parseFloat(""+$.flexGrow).toFixed(1)})}
5185const bG=T.forwardRef((n,e)=>T.createElement(xG,{...n,forwardedRef:e}));xG.displayName="Panel";bG.displayName="forwardRef(Panel)";let i2=null,h_=-1,Zf=null;function Hxe(n,e,t){const r=(e&_G)!==0,s=(e&MG)!==0,a=(e&NG)!==0,o=(e&AG)!==0;if(e){if(r)return a?"se-resize":o?"ne-resize":"e-resize";if(s)return a?"sw-resize":o?"nw-resize":"w-resize";if(a)return"s-resize";if(o)return"n-resize"}switch(n){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Vxe(){Zf!==null&&(document.head.removeChild(Zf),i2=null,Zf=null,h_=-1)}function nj(n,e,t){var r,s;const a=Hxe(n,e);if(i2!==a){if(i2=a,Zf===null&&(Zf=document.createElement("style"),document.head.appendChild(Zf)),h_>=0){var o;(o=Zf.sheet)===null||o===void 0||o.removeRule(h_)}h_=(r=(s=Zf.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${a} !important;}`))!==null&&r!==void 0?r:-1}}function yG(n){return n.type==="keydown"}function vG(n){return n.type.startsWith("pointer")}function wG(n){return n.type.startsWith("mouse")}function mA(n){if(vG(n)){if(n.isPrimary)return{x:n.clientX,y:n.clientY}}else if(wG(n))return{x:n.clientX,y:n.clientY};return{x:1/0,y:1/0}}function Wxe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function $xe(n,e,t){return n.x<e.x+e.width&&n.x+n.width>e.x&&n.y<e.y+e.height&&n.y+n.height>e.y}function Xxe(n,e){if(n===e)throw new Error("Cannot compare node with itself");const t={a:CB(n),b:CB(e)};let r;for(;t.a.at(-1)===t.b.at(-1);)n=t.a.pop(),e=t.b.pop(),r=n;nr(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:AB(NB(t.a)),b:AB(NB(t.b))};if(s.a===s.b){const a=r.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let l=a.length;for(;l--;){const u=a[l];if(u===o.a)return 1;if(u===o.b)return-1}}return Math.sign(s.a-s.b)}const qxe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Yxe(n){var e;const t=getComputedStyle((e=SG(n))!==null&&e!==void 0?e:n).display;return t==="flex"||t==="inline-flex"}function Qxe(n){const e=getComputedStyle(n);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Yxe(n))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||qxe.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function NB(n){let e=n.length;for(;e--;){const t=n[e];if(nr(t,"Missing node"),Qxe(t))return t}return null}function AB(n){return n&&Number(getComputedStyle(n).zIndex)||0}function CB(n){const e=[];for(;n;)e.push(n),n=SG(n);return e}function SG(n){const{parentNode:e}=n;return e&&e instanceof ShadowRoot?e.host:e}const _G=1,MG=2,NG=4,AG=8,Kxe=Wxe()==="coarse";let Nc=[],Ax=!1,eh=new Map,pA=new Map;const av=new Set;function Jxe(n,e,t,r,s){var a;const{ownerDocument:o}=e,l={direction:t,element:e,hitAreaMargins:r,setResizeHandlerState:s},u=(a=eh.get(o))!==null&&a!==void 0?a:0;return eh.set(o,u+1),av.add(l),PM(),function(){var h;pA.delete(n),av.delete(l);const p=(h=eh.get(o))!==null&&h!==void 0?h:1;if(eh.set(o,p-1),PM(),p===1&&eh.delete(o),Nc.includes(l)){const x=Nc.indexOf(l);x>=0&&Nc.splice(x,1),gA(),s("up",!0,null)}}}function Zxe(n){const{target:e}=n,{x:t,y:r}=mA(n);Ax=!0,qR({target:e,x:t,y:r}),PM(),Nc.length>0&&(DM("down",n),gA(),n.preventDefault(),CG(e)||n.stopImmediatePropagation())}function rj(n){const{x:e,y:t}=mA(n);if(Ax&&n.type!=="pointerleave"&&n.buttons===0&&(Ax=!1,DM("up",n)),!Ax){const{target:r}=n;qR({target:r,x:e,y:t})}DM("move",n),gA(),Nc.length>0&&n.preventDefault()}function sj(n){const{target:e}=n,{x:t,y:r}=mA(n);pA.clear(),Ax=!1,Nc.length>0&&(n.preventDefault(),CG(e)||n.stopImmediatePropagation()),DM("up",n),qR({target:e,x:t,y:r}),gA(),PM()}function CG(n){let e=n;for(;e;){if(e.hasAttribute(Zs.resizeHandle))return!0;e=e.parentElement}return!1}function qR({target:n,x:e,y:t}){Nc.splice(0);let r=null;(n instanceof HTMLElement||n instanceof SVGElement)&&(r=n),av.forEach(s=>{const{element:a,hitAreaMargins:o}=s,l=a.getBoundingClientRect(),{bottom:u,left:d,right:h,top:p}=l,x=Kxe?o.coarse:o.fine;if(e>=d-x&&e<=h+x&&t>=p-x&&t<=u+x){if(r!==null&&document.contains(r)&&a!==r&&!a.contains(r)&&!r.contains(a)&&Xxe(r,a)>0){let v=r,_=!1;for(;v&&!v.contains(a);){if($xe(v.getBoundingClientRect(),l)){_=!0;break}v=v.parentElement}if(_)return}Nc.push(s)}})}function ij(n,e){pA.set(n,e)}function gA(){let n=!1,e=!1;Nc.forEach(r=>{const{direction:s}=r;s==="horizontal"?n=!0:e=!0});let t=0;pA.forEach(r=>{t|=r}),n&&e?nj("intersection",t):n?nj("horizontal",t):e?nj("vertical",t):Vxe()}let aj;function PM(){var n;(n=aj)===null||n===void 0||n.abort(),aj=new AbortController;const e={capture:!0,signal:aj.signal};av.size&&(Ax?(Nc.length>0&&eh.forEach((t,r)=>{const{body:s}=r;t>0&&(s.addEventListener("contextmenu",sj,e),s.addEventListener("pointerleave",rj,e),s.addEventListener("pointermove",rj,e))}),eh.forEach((t,r)=>{const{body:s}=r;s.addEventListener("pointerup",sj,e),s.addEventListener("pointercancel",sj,e)})):eh.forEach((t,r)=>{const{body:s}=r;t>0&&(s.addEventListener("pointerdown",Zxe,e),s.addEventListener("pointermove",rj,e))}))}function DM(n,e){av.forEach(t=>{const{setResizeHandlerState:r}=t,s=Nc.includes(t);r(n,s,e)})}function e0e(){const[n,e]=T.useState(0);return T.useCallback(()=>e(t=>t+1),[])}function nr(n,e){if(!n)throw console.error(e),Error(e)}function vp(n,e,t=$R){return n.toFixed(t)===e.toFixed(t)?0:n>e?1:-1}function Pd(n,e,t=$R){return vp(n,e,t)===0}function $o(n,e,t){return vp(n,e,t)===0}function t0e(n,e,t){if(n.length!==e.length)return!1;for(let r=0;r<n.length;r++){const s=n[r],a=e[r];if(!$o(s,a,t))return!1}return!0}function yx({panelConstraints:n,panelIndex:e,size:t}){const r=n[e];nr(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:s=0,collapsible:a,maxSize:o=100,minSize:l=0}=r;
5185if(vp(t,l)<0)if(a){const u=(s+l)/2;vp(t,u)<0?t=s:t=l}else t=l;return t=Math.min(o,t),t=parseFloat(t.toFixed($R)),t}function iy({delta:n,initialLayout:e,panelConstraints:t,pivotIndices:r,prevLayout:s,trigger:a}){if($o(n,0))return e;const o=[...e],[l,u]=r;nr(l!=null,"Invalid first pivot index"),nr(u!=null,"Invalid second pivot index");let d=0;if(a==="keyboard"){{const p=n<0?u:l,x=t[p];nr(x,`Panel constraints not found for index ${p}`);const{collapsedSize:y=0,collapsible:v,minSize:_=0}=x;if(v){const M=e[p];if(nr(M!=null,`Previous layout not found for panel index ${p}`),$o(M,y)){const S=_-M;vp(S,Math.abs(n))>0&&(n=n<0?0-S:S)}}}{const p=n<0?l:u,x=t[p];nr(x,`No panel constraints found for index ${p}`);const{collapsedSize:y=0,collapsible:v,minSize:_=0}=x;if(v){const M=e[p];if(nr(M!=null,`Previous layout not found for panel index ${p}`),$o(M,_)){const S=M-y;vp(S,Math.abs(n))>0&&(n=n<0?0-S:S)}}}}{const p=n<0?1:-1;let x=n<0?u:l,y=0;for(;;){const _=e[x];nr(_!=null,`Previous layout not found for panel index ${x}`);const S=yx({panelConstraints:t,panelIndex:x,size:100})-_;if(y+=S,x+=p,x<0||x>=t.length)break}const v=Math.min(Math.abs(n),Math.abs(y));n=n<0?0-v:v}{let x=n<0?l:u;for(;x>=0&&x<t.length;){const y=Math.abs(n)-Math.abs(d),v=e[x];nr(v!=null,`Previous layout not found for panel index ${x}`);const _=v-y,M=yx({panelConstraints:t,panelIndex:x,size:_});if(!$o(v,M)&&(d+=v-M,o[x]=M,d.toFixed(3).localeCompare(Math.abs(n).toFixed(3),void 0,{numeric:!0})>=0))break;n<0?x--:x++}}if(t0e(s,o))return s;{const p=n<0?u:l,x=e[p];nr(x!=null,`Previous layout not found for panel index ${p}`);const y=x+d,v=yx({panelConstraints:t,panelIndex:p,size:y});if(o[p]=v,!$o(v,y)){let _=y-v,S=n<0?u:l;for(;S>=0&&S<t.length;){const A=o[S];nr(A!=null,`Previous layout not found for panel index ${S}`);const E=A+_,C=yx({panelConstraints:t,panelIndex:S,size:E});if($o(A,C)||(_-=C-A,o[S]=C),$o(_,0))break;n>0?S--:S++}}}const h=o.reduce((p,x)=>x+p,0);return $o(h,100)?o:s}function n0e({layout:n,panelsArray:e,pivotIndices:t}){let r=0,s=100,a=0,o=0;const l=t[0];nr(l!=null,"No pivot index found"),e.forEach((p,x)=>{const{constraints:y}=p,{maxSize:v=100,minSize:_=0}=y;x===l?(r=_,s=v):(a+=_,o+=v)});const u=Math.min(s,100-a),d=Math.max(r,100-o),h=n[l];return{valueMax:u,valueMin:d,valueNow:h}}function ov(n,e=document){return Array.from(e.querySelectorAll(`[${Zs.resizeHandleId}][data-panel-group-id="${n}"]`))}function EG(n,e,t=document){const s=ov(n,t).findIndex(a=>a.getAttribute(Zs.resizeHandleId)===e);return s??null}function jG(n,e,t){const r=EG(n,e,t);return r!=null?[r,r+1]:[-1,-1]}function r0e(n){return n instanceof HTMLElement?!0:typeof n=="object"&&n!==null&&"tagName"in n&&"getAttribute"in n}function TG(n,e=document){if(r0e(e)&&e.dataset.panelGroupId==n)return e;
5185const t=e.querySelector(`[data-panel-group][data-panel-group-id="${n}"]`);return t||null}function xA(n,e=document){const t=e.querySelector(`[${Zs.resizeHandleId}="${n}"]`);return t||null}function s0e(n,e,t,r=document){var s,a,o,l;const u=xA(e,r),d=ov(n,r),h=u?d.indexOf(u):-1,p=(s=(a=t[h])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null,x=(o=(l=t[h+1])===null||l===void 0?void 0:l.id)!==null&&o!==void 0?o:null;return[p,x]}function i0e({committedValuesRef:n,eagerValuesRef:e,groupId:t,layout:r,panelDataArray:s,panelGroupElement:a,setLayout:o}){T.useRef({didWarnAboutMissingResizeHandle:!1}),ip(()=>{if(!a)return;const l=ov(t,a);for(let u=0;u<s.length-1;u++){const{valueMax:d,valueMin:h,valueNow:p}=n0e({layout:r,panelsArray:s,pivotIndices:[u,u+1]}),x=l[u];if(x!=null){const y=s[u];nr(y,`No panel data found for index "${u}"`),x.setAttribute("aria-controls",y.id),x.setAttribute("aria-valuemax",""+Math.round(d)),x.setAttribute("aria-valuemin",""+Math.round(h)),x.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{l.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[t,r,s,a]),T.useEffect(()=>{if(!a)return;const l=e.current;nr(l,"Eager values not found");const{panelDataArray:u}=l,d=TG(t,a);nr(d!=null,`No group found for id "${t}"`);const h=ov(t,a);nr(h,`No resize handles found for group id "${t}"`);const p=h.map(x=>{const y=x.getAttribute(Zs.resizeHandleId);nr(y,"Resize handle element has no handle id attribute");const[v,_]=s0e(t,y,u,a);if(v==null||_==null)return()=>{};const M=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const A=u.findIndex(E=>E.id===v);if(A>=0){const E=u[A];nr(E,`No panel data found for index ${A}`);const C=r[A],{collapsedSize:I=0,collapsible:D,minSize:B=0}=E.constraints;if(C!=null&&D){const P=iy({delta:$o(C,I)?B-I:I-C,initialLayout:r,panelConstraints:u.map(G=>G.constraints),pivotIndices:jG(t,y,a),prevLayout:r,trigger:"keyboard"});r!==P&&o(P)}}break}}};return x.addEventListener("keydown",M),()=>{x.removeEventListener("keydown",M)}});return()=>{p.forEach(x=>x())}},[a,n,e,t,r,s,o])}function EB(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function RG(n,e){const t=n==="horizontal",{x:r,y:s}=mA(e);return t?r:s}function a0e(n,e,t,r,s){const a=t==="horizontal",o=xA(e,s);nr(o,`No resize handle element found for id "${e}"`);const l=o.getAttribute(Zs.groupId);nr(l,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=r;const d=RG(t,n),h=TG(l,s);nr(h,`No group element found for id "${l}"`);const p=h.getBoundingClientRect(),x=a?p.width:p.height;return(d-u)/x*100}function o0e(n,e,t,r,s,a){if(yG(n)){const o=t==="horizontal";let l=0;n.shiftKey?l=100:s!=null?l=s:l=10;let u=0;switch(n.key){case"ArrowDown":u=o?0:l;break;case"ArrowLeft":u=o?-l:0;break;case"ArrowRight":u=o?l:0;break;case"ArrowUp":u=o?0:-l;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return r==null?0:a0e(n,e,t,r,a)}function l0e({panelDataArray:n}){const e=Array(n.length),t=n.map(a=>a.constraints);let r=0,s=100;for(let a=0;a<n.length;a++){const o=t[a];nr(o,`Panel constraints not found for index ${a}`);const{defaultSize:l}=o;l!=null&&(r++,e[a]=l,s-=l)}for(let a=0;a<n.length;a++){const o=t[a];nr(o,`Panel constraints not found for index ${a}`);const{defaultSize:l}=o;if(l!=null)continue;const u=n.length-r,d=s/u;r++,e[a]=d,s-=d}return e}function cx(n,e,t){e.forEach((r,s)=>{const a=n[s];nr(a,`Panel data not found for index ${s}`);const{callbacks:o,constraints:l,id:u}=a,{collapsedSize:d=0,collapsible:h}=l,p=t[u];if(p==null||r!==p){t[u]=r;const{onCollapse:x,onExpand:y,onResize:v}=o;v&&v(r,p),h&&(x||y)&&(y&&(p==null||Pd(p,d))&&!Pd(r,d)&&y(),x&&(p==null||!Pd(p,d))&&Pd(r,d)&&x())}})}function LS(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t])return!1;return!0}function c0e({defaultSize:n,dragState:e,layout:t,panelData:r,panelIndex:s,precision:a=3}){const o=t[s];let l;return o==null?l=n!=null?n.toFixed(a):"1":r.length===1?l="1":l=o.toFixed(a),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function u0e(n,e=10){let t=null;return(...s)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...s)},e)}}function jB(n){try{if(typeof localStorage<"u")n.getItem=e=>localStorage.getItem(e),n.setItem=(e,t)=>
5185{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),n.getItem=()=>null,n.setItem=()=>{}}}function PG(n){return`react-resizable-panels:${n}`}function DG(n){return n.map(e=>{const{constraints:t,id:r,idIsFromProps:s,order:a}=e;return s?r:a?`${a}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function kG(n,e){try{const t=PG(n),r=e.getItem(t);if(r){const s=JSON.parse(r);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function d0e(n,e,t){var r,s;const a=(r=kG(n,t))!==null&&r!==void 0?r:{},o=DG(e);return(s=a[o])!==null&&s!==void 0?s:null}function f0e(n,e,t,r,s){var a;const o=PG(n),l=DG(e),u=(a=kG(n,s))!==null&&a!==void 0?a:{};u[l]={expandToSizes:Object.fromEntries(t.entries()),layout:r};try{s.setItem(o,JSON.stringify(u))}catch(d){console.error(d)}}function TB({layout:n,panelConstraints:e}){const t=[...n],r=t.reduce((a,o)=>a+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(a=>`${a}%`).join(", ")}`);if(!$o(r,100)&&t.length>0)for(let a=0;a<e.length;a++){const o=t[a];nr(o!=null,`No layout data found for index ${a}`);const l=100/r*o;t[a]=l}let s=0;for(let a=0;a<e.length;a++){const o=t[a];nr(o!=null,`No layout data found for index ${a}`);const l=yx({panelConstraints:e,panelIndex:a,size:o});o!=l&&(s+=o-l,t[a]=l)}if(!$o(s,0))for(let a=0;a<e.length;a++){const o=t[a];nr(o!=null,`No layout data found for index ${a}`);const l=o+s,u=yx({panelConstraints:e,panelIndex:a,size:l});if(o!==u&&(s-=u-o,t[a]=u,$o(s,0)))break}return t}const h0e=100,ay={getItem:n=>(jB(ay),ay.getItem(n)),setItem:(n,e)=>{jB(ay),ay.setItem(n,e)}},RB={};function IG({autoSaveId:n=null,children:e,className:t="",direction:r,forwardedRef:s,id:a=null,onLayout:o=null,keyboardResizeBy:l=null,storage:u=ay,style:d,tagName:h="div",...p}){const x=XR(a),y=T.useRef(null),[v,_]=T.useState(null),[M,S]=T.useState([]),A=e0e(),E=T.useRef({}),C=T.useRef(new Map),I=T.useRef(0),D=T.useRef({autoSaveId:n,direction:r,dragState:v,id:x,keyboardResizeBy:l,onLayout:o,storage:u}),B=T.useRef({layout:M,panelDataArray:[],panelDataArrayChanged:!1});T.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),T.useImperativeHandle(s,()=>({getId:()=>D.current.id,getLayout:()=>{const{layout:J}=B.current;return J},setLayout:J=>{const{onLayout:q}=D.current,{layout:Q,panelDataArray:ne}=B.current,Z=TB({layout:J,panelConstraints:ne.map(se=>se.constraints)});EB(Q,Z)||(S(Z),B.current.layout=Z,q&&q(Z),cx(ne,Z,E.current))}}),[]),ip(()=>{D.current.autoSaveId=n,D.current.direction=r,D.current.dragState=v,D.current.id=x,D.current.onLayout=o,D.current.storage=u}),i0e({committedValuesRef:D,eagerValuesRef:B,groupId:x,layout:M,panelDataArray:B.current.panelDataArray,setLayout:S,panelGroupElement:y.current}),T.useEffect(()=>{const{panelDataArray:J}=B.current;if(n){if(M.length===0||M.length!==J.length)return;let q=RB[n];q==null&&(q=u0e(f0e,h0e),RB[n]=q);const Q=[...J],ne=new Map(C.current);q(n,Q,ne,M,u)}},[n,M,u]),T.useEffect(()=>{});const P=T.useCallback(J=>{const{onLayout:q}=D.current,{layout:Q,panelDataArray:ne}=B.current;if(J.constraints.collapsible){const Z=ne.map(Be=>Be.constraints),{collapsedSize:se=0,panelSize:me,pivotIndices:ze}=jm(ne,J,Q);if(nr(me!=null,`Panel size not found for panel "${J.id}"`),!Pd(me,se)){C.current.set(J.id,me);const ye=hx(ne,J)===ne.length-1?me-se:se-me,Le=iy({delta:ye,initialLayout:Q,panelConstraints:Z,pivotIndices:ze,prevLayout:Q,trigger:"imperative-api"});LS(Q,Le)||(S(Le),B.current.layout=Le,q&&q(Le),cx(ne,Le,E.current))}}},[]),G=T.useCallback((J,q)=>{const{onLayout:Q}=D.current,{layout:ne,panelDataArray:Z}=B.current;if(J.constraints.collapsible){const se=Z.map(Ce=>Ce.constraints),{collapsedSize:me=0,panelSize:ze=0,minSize:Be=0,pivotIndices:ye}=jm(Z,J,ne),Le=q??Be;if(Pd(ze,me)){const Ce=C.current.get(J.id),Re=Ce!=null&&Ce>=Le?Ce:Le,he=hx(Z,J)===Z.length-1?ze-Re:Re-ze,le=iy({delta:he,initialLayout:ne,panelConstraints:se,pivotIndices:ye,prevLayout:ne,trigger:"imperative-api"});LS(ne,le)||(S(le),B.current.layout=le,Q&&Q(le),cx(Z,le,E.current))}}},[]),k=T.useCallback(J=>{const{layout:q,panelDataArray:Q}=B.current,{panelSize:ne}=jm(Q,J,q);return nr(ne!=null,`Panel size not found for panel "${J.id}"`),ne},[]),V=T.useCallback((J,q)=>{const{panelDataArray:Q}=B.current,ne=hx(Q,J);return c0e({defaultSize:q,dragState:v,layout:M,panelData:Q,panelIndex:ne})},[v,M]),U=T.useCallback(J=>{const{layout:q,panelDataArray:Q}=B.current,{collapsedSize:ne=0,collapsible:Z,panelSize:se}=jm(Q,J,q);return nr(se!=null,`Panel size not found for panel "${J.id}"`),Z===!0&&Pd(se,ne)},[]),$=T.useCallback(J=>{const{layout:q,panelDataArray:Q}=B.current,{collapsedSize:ne=0,collapsible:Z,panelSize:se}=jm(Q,J,q);return nr(se!=null,`Panel size not found for panel "${J.id}"`),!Z||vp(se,ne)>0},[]),X=T.useCallback(J=>{const{panelDataArray:q}=B.current;q.push(J),q.sort((Q,ne)=>{const Z=Q.order,se=ne.order;return Z==null&&se==null?0:Z==null?-1:se==null?1:Z-se}),B.current.panelDataArrayChanged=!0,A()},[A]);ip(()=>
5185{if(B.current.panelDataArrayChanged){B.current.panelDataArrayChanged=!1;const{autoSaveId:J,onLayout:q,storage:Q}=D.current,{layout:ne,panelDataArray:Z}=B.current;let se=null;if(J){const ze=d0e(J,Z,Q);ze&&(C.current=new Map(Object.entries(ze.expandToSizes)),se=ze.layout)}se==null&&(se=l0e({panelDataArray:Z}));const me=TB({layout:se,panelConstraints:Z.map(ze=>ze.constraints)});EB(ne,me)||(S(me),B.current.layout=me,q&&q(me),cx(Z,me,E.current))}}),ip(()=>{const J=B.current;return()=>{J.layout=[]}},[]);const ee=T.useCallback(J=>{let q=!1;const Q=y.current;return Q&&window.getComputedStyle(Q,null).getPropertyValue("direction")==="rtl"&&(q=!0),function(Z){Z.preventDefault();const se=y.current;if(!se)return()=>null;const{direction:me,dragState:ze,id:Be,keyboardResizeBy:ye,onLayout:Le}=D.current,{layout:Ce,panelDataArray:Re}=B.current,{initialLayout:De}=ze??{},he=jG(Be,J,se);let le=o0e(Z,J,me,ze,ye,se);const Xe=me==="horizontal";Xe&&q&&(le=-le);const qe=Re.map(ve=>ve.constraints),Ge=iy({delta:le,initialLayout:De??Ce,panelConstraints:qe,pivotIndices:he,prevLayout:Ce,trigger:yG(Z)?"keyboard":"mouse-or-touch"}),ot=!LS(Ce,Ge);(vG(Z)||wG(Z))&&I.current!=le&&(I.current=le,!ot&&le!==0?Xe?ij(J,le<0?_G:MG):ij(J,le<0?NG:AG):ij(J,0)),ot&&(S(Ge),B.current.layout=Ge,Le&&Le(Ge),cx(Re,Ge,E.current))}},[]),z=T.useCallback((J,q)=>{const{onLayout:Q}=D.current,{layout:ne,panelDataArray:Z}=B.current,se=Z.map(Ce=>Ce.constraints),{panelSize:me,pivotIndices:ze}=jm(Z,J,ne);nr(me!=null,`Panel size not found for panel "${J.id}"`);const ye=hx(Z,J)===Z.length-1?me-q:q-me,Le=iy({delta:ye,initialLayout:ne,panelConstraints:se,pivotIndices:ze,prevLayout:ne,trigger:"imperative-api"});LS(ne,Le)||(S(Le),B.current.layout=Le,Q&&Q(Le),cx(Z,Le,E.current))},[]),K=T.useCallback((J,q)=>{const{layout:Q,panelDataArray:ne}=B.current,{collapsedSize:Z=0,collapsible:se}=q,{collapsedSize:me=0,collapsible:ze,maxSize:Be=100,minSize:ye=0}=J.constraints,{panelSize:Le}=jm(ne,J,Q);Le!=null&&(se&&ze&&Pd(Le,Z)?Pd(Z,me)||z(J,me):Le<ye?z(J,ye):Le>Be&&z(J,Be))},[z]),ae=T.useCallback((J,q)=>{const{direction:Q}=D.current,{layout:ne}=B.current;if(!y.current)return;const Z=xA(J,y.current);nr(Z,`Drag handle element not found for id "${J}"`);const se=RG(Q,q);_({dragHandleId:J,dragHandleRect:Z.getBoundingClientRect(),initialCursorPosition:se,initialLayout:ne})},[]),oe=T.useCallback(()=>{_(null)},[]),re=T.useCallback(J=>{const{panelDataArray:q}=B.current,Q=hx(q,J);Q>=0&&(q.splice(Q,1),delete E.current[J.id],B.current.panelDataArrayChanged=!0,A())},[A]),F=T.useMemo(()=>({collapsePanel:P,direction:r,dragState:v,expandPanel:G,getPanelSize:k,getPanelStyle:V,groupId:x,isPanelCollapsed:U,isPanelExpanded:$,reevaluatePanelConstraints:K,registerPanel:X,registerResizeHandle:ee,resizePanel:z,startDragging:ae,stopDragging:oe,unregisterPanel:re,panelGroupElement:y.current}),[P,v,r,G,k,V,x,U,$,K,X,ee,z,ae,oe,re]),O={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return T.createElement(hA.Provider,{value:F},T.createElement(h,{...p,children:e,className:t,id:a,ref:y,style:{...O,...d},[Zs.group]:"",[Zs.groupDirection]:r,[Zs.groupId]:x}))}const BG=T.forwardRef((n,e)=>T.createElement(IG,{...n,forwardedRef:e}));IG.displayName="PanelGroup";BG.displayName="forwardRef(PanelGroup)";function hx(n,e){return n.findIndex(t=>t===e||t.id===e.id)}function jm(n,e,t){const r=hx(n,e),a=r===n.length-1?[r-1,r]:[r,r+1],o=t[r];return{...e.constraints,panelSize:o,pivotIndices:a}}function m0e({disabled:n,handleId:e,resizeHandler:t,panelGroupElement:r}){T.useEffect(()=>{if(n||t==null||r==null)return;const s=xA(e,r);if(s==null)return;const a=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const l=s.getAttribute(Zs.groupId);nr(l,`No group element found for id "${l}"`);const u=ov(l,r),d=EG(l,e,r);nr(d!==null,`No resize element found for id "${e}"`);const h=o.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[h].focus();break}}};return s.addEventListener("keydown",a),()=>{s.removeEventListener("keydown",a)}},[r,n,e,t])}function LG({children:n=null,className:e="",disabled:t=!1,hitAreaMargins:r,id:s,onBlur:a,onClick:o,onDragging:l,onFocus:u,onPointerDown:d,onPointerUp:h,style:p={},tabIndex:x=0,tagName:y="div",...v}){var _,M;const S=T.useRef(null),A=T.useRef({onClick:o,onDragging:l,onPointerDown:d,onPointerUp:h});T.useEffect(()=>{A.current.onClick=o,A.current.onDragging=l,A.current.onPointerDown=d,A.current.onPointerUp=h});const E=T.useContext(hA);if(E===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:I,registerResizeHandle:D,startDragging:B,stopDragging:P,panelGroupElement:G}=E,k=XR(s),[V,U]=T.useState("inactive"),[$,X]=T.useState(!1),[ee,z]=T.useState(null),K=T.useRef({state:V});ip(()=>{K.current.state=V}),T.useEffect(()=>{if(t)z(null);else{const F=D(k);z(()=>F)}},[t,k,D]);const ae=(_=r?.coarse)!==null&&_!==void 0?_:15,oe=(M=r?.fine)!==null&&M!==void 0?M:5;T.useEffect(()=>{if(t||ee==null)return;const F=S.current;nr(F,"Element ref not attached");let O=!1;return Jxe(k,F,C,{coarse:ae,fine:oe},(q,Q,ne)=>{if(!Q){U("inactive");return}switch(q){case"down":{U("drag"),O=!1,nr(ne,'Expected event to be defined for "down" action'),B(k,ne);const{onDragging:Z,onPointerDown:se}=A.current;Z?.(!0),se?.();break}case"move":{const{state:Z}=K.current;O=!0,Z!=="drag"&&U("hover"),nr(ne,'Expected event to be defined for "move" action'),ee(ne);break}case"up":{U("hover"),P();const{onClick:Z,onDragging:se,onPointerUp:me}=A.current;se?.(!1),me?.(),O||Z?.();break}}})},[ae,C,t,oe,D,k,ee,B,P]),m0e({disabled:t,handleId:k,resizeHandler:ee,panelGroupElement:G});const re={touchAction:"none",userSelect:"none"};return T.createElement(y,{...v,children:n,className:e,id:s,onBlur:()=>{X(!1),a?.()},onFocus:()=>{X(!0),u?.()},ref:S,role:"separator",style:{...re,...p},tabIndex:x,[Zs.groupDirection]:C,[Zs.groupId]:I,[Zs.resizeHandle]:"",[Zs.resizeHandleActive]:V==="drag"?"pointer":$?"keyboard":void 0,[Zs.resizeHandleEnabled]:!t,[Zs.resizeHandleId]:k,[Zs.resizeHandleState]:V})}LG.displayName="PanelResizeHandle";function p0e({className:n,...e}){return i.jsx(BG,{"data-slot":"resizable-panel-group",className:br("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...e})}function oj({...n}){return i.jsx(bG,{"data-slot":"resizable-panel",...n})}function PB({withHandle:n,className:e,...t}){return i.jsx(LG,{"data-slot":"resizable-handle",className:br("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...t,children:n&&i.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:i.jsx(zY,{className:"size-2.5"})})})}function OG(n,e,t){const r=Math.max(0,Number(n)||0),s=Math.max(0,Number(e)||0),a=Math.max(0,Number(t)||0);return{floorAreaM2:Number((r*s).toFixed(3)),volumeM3:Number((r*s*a).toFixed(3)),perimeterM:Number((2*(r+s)).toFixed(3))}}function Dl(n,e=.5){const t=Math.max(.01,Number(e)||.5);return Number((Math.round((Number(n)||0)/t)*t).toFixed(4))}function OS(n,e=!1){const t=e?Number(n.leftClearanceM||0):0,r=e?Number(n.right
5185ClearanceM||0):0,s=e?Number(n.frontClearanceM||0):0,a=e?Number(n.rearClearanceM||0):0;return{minX:Number(n.xM||0)-t,maxX:Number(n.xM||0)+Math.max(0,Number(n.lengthM||0))+r,minZ:Number(n.zM||0)-a,maxZ:Number(n.zM||0)+Math.max(0,Number(n.widthM||0))+s}}function DB(n,e){return n.minX<e.maxX&&n.maxX>e.minX&&n.minZ<e.maxZ&&n.maxZ>e.minZ}function FG(n,e,t){const r=[];return n.forEach((s,a)=>{const o=OS(s),l=OS(s,!0);(o.minX<0||o.minZ<0||o.maxX>e||o.maxZ>t)&&r.push({type:"boundary",placementId:s.id,message:`الآلة «${s.name}» تتجاوز حدود المصنع`}),n.slice(a+1).forEach(u=>{DB(o,OS(u))?r.push({type:"collision",placementId:s.id,otherPlacementId:u.id,message:`تصادم بين «${s.name}» و«${u.name}»`}):DB(l,OS(u,!0))&&r.push({type:"clearance",placementId:s.id,otherPlacementId:u.id,message:`منطقة الصيانة غير كافية بين «${s.name}» و«${u.name}»`})})}),r}function UG(n,e,t){const r=Math.max(0,Number(n)||0),s=e.reduce((l,u)=>l+Math.max(0,Number(u.lengthM||0)*Number(u.widthM||0)),0),a=t.reduce((l,u)=>l+Math.max(0,Number(u.lengthM||0)*Number(u.widthM||0)),0),o=Math.min(r,s||a);return{totalAreaM2:r,roomAreaM2:Number(s.toFixed(2)),machineAreaM2:Number(a.toFixed(2)),availableAreaM2:Number(Math.max(0,r-o).toFixed(2)),usedPercent:r>0?Number((o/r*100).toFixed(1)):0}}const g0e=[{key:"door",name:"باب صناعي",category:"building",objectType:"door",color:"#F97316",lengthM:2.4,widthM:.18,heightM:3.1},{key:"window",name:"شباك",category:"building",objectType:"window",color:"#38BDF8",lengthM:2.1,widthM:.16,heightM:1.4},{key:"restroom",name:"حمام كامل",category:"interior",objectType:"restroom",color:"#0EA5E9",lengthM:3,widthM:2.4,heightM:2.8},{key:"office_desk",name:"مكتب جاهز",category:"interior",objectType:"office_desk",color:"#B7794F",lengthM:1.8,widthM:.8,heightM:.76},{key:"office_chair",name:"كرسي مكتب",category:"interior",objectType:"office_chair",color:"#334155",lengthM:.7,widthM:.7,heightM:1.1},{key:"kitchen",name:"مطبخ",category:"interior",objectType:"kitchen",color:"#64748B",lengthM:3.2,widthM:.7,heightM:1.05},{key:"road",name:"طريق سيارات",category:"outdoor",objectType:"road",color:"#475569",lengthM:12,widthM:4.5,heightM:.08},{key:"pedestrian_path",name:"ممر مشاة",category:"outdoor",objectType:"pedestrian_path",color:"#D1D5DB",lengthM:8,widthM:1.7,heightM:.05},{key:"parking",name:"موقف سيارات",category:"outdoor",objectType:"parking",color:"#334155",lengthM:5.5,widthM:2.7,heightM:.06},{key:"car",name:"سيارة",category:"outdoor",objectType:"car",color:"#F97316",lengthM:4.4,widthM:1.85,heightM:1.45},{key:"signboard",name:"لوحة قابلة للتعديل",category:"infrastru
5185cture",objectType:"signboard",color:"#0F172A",lengthM:2.4,widthM:.18,heightM:2.4},{key:"column",name:"عمود",category:"infrastructure",objectType:"column",color:"#64748B",lengthM:.45,widthM:.45,heightM:4.5},{key:"no_parking",name:"عمود ممنوع الوقوف",category:"infrastructure",objectType:"no_parking",color:"#EF4444",lengthM:.55,widthM:.18,heightM:2.2},{key:"pipe",name:"أنبوب تدفق صناعي",category:"infrastructure",objectType:"pipe",color:"#94A3B8",lengthM:6,widthM:.42,heightM:2.2}],Ji="#0096A7",zG="#29C3CE",a2={materialType:"water",materialLabel:"مياه",flowColor:"#38BDF8",flowSpeed:1,flowDirection:1,particleCount:10,flowMode:"continuous",isFlowing:!0,isLooping:!0,path:[]},kB={isExploded:!1,explodeAmount:1,processPipeEnabled:!1,processPipeShape:"straight",processPipeLength:3,processPipeRadius:.14,processPipeBendAngle:90,materialType:"chocolate",materialLabel:"شوكولا",flowColor:"#5B2C1E",flowSpeed:1,flowDirection:1,particleCount:10,flowMode:"continuous",isFlowing:!0,isLooping:!0,machineRotation:[0,0,0],partStates:{}};function x0e(n){try{const e=JSON.parse(String(n.metadataJson||"{}"));return{...a2,...e,path:Array.isArray(e.path)?e.path.map(t=>({xM:hn(t.xM??t.x),yM:hn(t.yM??t.y),zM:hn(t.zM??t.z)})):[]}}catch{return a2}}function b0e(n){try{return{...kB,...JSON.parse(String(n.metadataJson||"{}"))}}catch{return kB}}function GG({curve:n,settings:e,radius:t,isPlaying:r=!0}){const s=T.useRef([]),a=T.useRef(0);Iv((l,u)=>{!r||!e.isFlowing||(a.current+=u*Math.max(.1,Number(e.flowSpeed||1))*.13,s.current.forEach((d,h)=>{if(!d)return;const p=e.flowMode==="pulse"?.45+Math.sin(a.current*Math.PI*3)*.28:1,x=a.current*p*(e.flowDirection||1)+h/Math.max(1,s.current.length),y=e.isLooping?(x%1+1)%1:Math.max(0,Math.min(1,x));d.position.copy(n.getPointAt(y))}))});const o=e.flowMode==="batch"?Math.max(2,Math.ceil(Number(e.particleCount||10)*.38)):Math.max(2,Math.min(80,Number(e.particleCount||10)));return i.jsx(i.Fragment,{children:Array.from({length:o}).map((l,u)=>i.jsxs("mesh",{ref:d=>{s.current[u]=d},children:[i.jsx("sphereGeometry",{args:[Math.max(.045,t*.55),14,14]}),i.jsx("meshStandardMaterial",{color:e.flowColor,emissive:e.flowColor,emissiveIntensity:.8,roughness:.24,metalness:.08})]},u))})}function y0e({item:n,selected:e}){const t=T.useMemo(()=>x0e(n),[n.metadataJson]),r=Math.max(.1,Number(n.widthM||.42)/2),s=T.useMemo(()=>(t.path.length>=2?t.path:[{xM:hn(n.xM),yM:hn(n.yM)+Number(n.heightM||2.2)*.58,zM:hn(n.zM)},{xM:hn(n.xM)+Number(n.lengthM||6),yM:hn(n.yM)+Number(n.heightM||2.2)*.58,zM:hn(n.zM)}]).map(u=>new we(u.xM-hn(n.xM),u.yM-hn(n.yM),u.zM-hn(n.zM))),[n.heightM,n.lengthM,n.xM,n.yM,n.zM,t.path]),a=T.useMemo(()=>new $N(s,!1,"centripetal"),[s]),o=T.useMemo(()=>new bp(a,Math.max(28,s.length*26),r,12,!1),[a,s.length,r]);return T.useEffect(()=>()=>o.dispose(),[o]),i.jsxs(i.Fragment,{children:[i.jsx("mesh",{geometry:o,castShadow:!0,receiveShadow:!0,children:i.jsx("meshPhysicalMaterial",{color:"#D8E6ED",transparent:!0,opacity:.42,roughness:.12,metalness:.22,transmission:.18})}),i.jsx(GG,{curve:a,settings:t,radius:r}),i.jsxs("mesh",{position:s[0],children:[i.jsx("sphereGeometry",{args:[r*1.2,18,18]}),i.jsx("meshStandardMaterial",{color:"#64748B",metalness:.62,roughness:.28})]}),i.jsxs("mesh",{position:s[s.length-1],children:[i.jsx("sphereGeometry",{args:[r*1.2,18,18]}),i.jsx("meshStandardMaterial",{color:"#64748B",metalness:.62,roughness:.28})]}),e&&i.jsx(uA,{points:s,color:Ji,lineWidth:2.4,dashed:!0,dashSize:.16,gapSize:.08}),i.jsx(tl,{position:[s[0].x,s[0].y+r+.32,s[0].z],color:"#0F172A",fontSize:.26,anchorX:"center",anchorY:"middle",children:`${t.materialLabel||"مادة"} · ${Math.round(Number(t.flowSpeed||1)*100)}%`})]})}function HG({length:n,width:e,height:t,settings:r,selected:s,targetPartState:a,targetBounds:o,isPlaying:l=!0}){const u=!!o,d=o?.size||[n,t,e],h=o?.center||[0,0,0],p=u?Math.max(.08,d[1]):t,x=Math.max(.16,Math.min(Math.max(d[0],.08),Math.max(d[1],.08),Math.max(d[2],.08))*.72),y=r.processPipeShape||"straight",v=Math.max(.3,Number(r.processPipeLength||n*.8)),_=u?Math.min(v,x):v,M=Math.min(Math.max(.025,Number(r.processPipeRadius||Math.min(n,e,t)*.065)),Math.max(.025,x*.16)),S=Math.max(15,Math.min(165,Number(r.processPipeBendAngle||90)))*Math.PI/180,A=u?0:p*.18,E=T.useMemo(()=>
5185{if(y==="circle"){const V=_/2;return Array.from({length:33},(U,$)=>{const X=$/32*Math.PI*2;return new we(Math.cos(X)*V,A+Math.sin(X)*V*.18,Math.sin(X)*V)})}if(y==="elbow"){const V=new we(-_/2,A,0),U=new we(0,A,0);return[V,U,new we(_/2*Math.cos(S),A+_/2*Math.sin(S),_/2*Math.sin(S)*.35)]}return[new we(-_/2,A,0),new we(_/2,A,0)]},[S,A,_,y]),C=T.useMemo(()=>new $N(E,y==="circle","centripetal"),[E,y]),I=T.useMemo(()=>new bp(C,Math.max(52,E.length*4),M,12,y==="circle"),[C,E.length,M,y]),D=T.useMemo(()=>new bp(C,Math.max(56,E.length*5),Math.max(.018,M*.48),10,y==="circle"),[C,E.length,M,y]);T.useEffect(()=>()=>{I.dispose(),D.dispose()},[I,D]);const B={...a2,...r,path:[]},P=a?.position||[0,0,0],G=a?.rotation||[0,0,0],k=Math.max(.1,Number(a?.scale||1));return i.jsxs("group",{position:[P[0]+h[0],P[1]+h[1],P[2]+h[2]],rotation:G,scale:k,children:[i.jsx("mesh",{geometry:I,castShadow:!0,receiveShadow:!0,children:i.jsx("meshPhysicalMaterial",{color:"#D8E6ED",transparent:!0,opacity:.48,roughness:.12,metalness:.3,transmission:.2})}),r.isFlowing&&i.jsx("mesh",{geometry:D,renderOrder:2,children:i.jsx("meshStandardMaterial",{color:r.flowColor,emissive:r.flowColor,emissiveIntensity:.42,roughness:.18,metalness:.04,depthTest:!1,depthWrite:!1})}),i.jsx(GG,{curve:C,settings:B,radius:M,isPlaying:l}),i.jsxs("mesh",{position:E[0],rotation:[0,0,Math.PI/2],children:[i.jsx("cylinderGeometry",{args:[M*1.28,M*1.28,M*1.2,16]}),i.jsx("meshStandardMaterial",{color:"#64748B",metalness:.7,roughness:.24})]}),s&&i.jsx(tl,{position:[0,t*.43,-e*.35],color:r.flowColor,fontSize:.19,anchorX:"center",anchorY:"middle",children:`${y==="circle"?"حلقة":y==="elbow"?"أنبوب زاوية":"أنبوب"} · ${r.materialLabel}`})]})}function km(n,e){return`${n}:${e}`}function hn(n){return Number(n||0)}function v0e({room:n,projectHeight:e,selected:t,register:r,onSelect:s}){const a=Math.max(hn(n.lengthM)||1,1),o=Math.max(hn(n.widthM)||1,1),l=Math.max(2.7,Math.min(hn(n.heightM)||e*.72,e*.78)),u=.16,d=Math.min(1.35,Math.max(.8,a*.28)),h=Math.max(.1,(a-d)/2),p=n.color||"#3B82F6",x=i.jsx("meshStandardMaterial",{color:p,transparent:!0,opacity:t?.72:.58,roughness:.68});return i.jsxs("group",{ref:r,position:[hn(n.xM)+a/2,0,hn(n.zM)+o/2],rotation:[0,hn(n.rotationY),0],onClick:y=>{y.stopPropagation(),s()},children:[i.jsxs("mesh",{receiveShadow:!0,position:[0,.06,0],children:[i.jsx("boxGeometry",{args:[a,.12,o]}),i.jsx("meshStandardMaterial",{color:p,transparent:!0,opacity:.34,roughness:.7})]}),i.jsxs("mesh",{position:[0,l/2,o/2],children:[i.jsx("boxGeometry",{args:[a,l,u]}),x]}),i.jsxs("mesh",{position:[-a/2,l/2,0],children:[i.jsx("boxGeometry",{args:[u,l,o]}),x]}),i.jsxs("mesh",{position:[a/2,l/2,0],children:[i.jsx("boxGeometry",{args:[u,l,o]}),x]}),i.jsxs("mesh",{position:[-(d+h)/2,l/2,-o/2],children:[i.jsx("boxGeometry",{args:[h,l,u]}),x]}),i.jsxs("mesh",{position:[(d+h)/2,l/2,-o/2],children:[i.jsx("boxGeometry",{args:[h,l,u]}),x]}),i.jsxs("mesh",{position:[0,l*.35,-o/2-.035],children:[i.jsx("boxGeometry",{args:[d*.78,l*.7,.06]}),i.jsx("meshStandardMaterial",{color:Ji,metalness:.22,roughness:.45})]}),i.jsxs("mesh",{position:[0,l*.62,o/2+.035],children:[i.jsx("boxGeometry",{args:[Math.min(a*.48,2.1),Math.min(l*.24,1.2),.05]}),i.jsx("meshStandardMaterial",{color:"#7DD3FC",transparent:!0,opacity:.68,metalness:.15,roughness:.22})]}),t&&i.jsxs("mesh",{position:[0,.13,0],children:[i.jsx("boxGeometry",{args:[a+.16,.03,o+.16]}),i.jsx("meshStandardMaterial",{color:Ji,emissive:Ji,emissiveIntensity:.65})]}),i.jsx(tl,{position:[0,l+.28,0],color:"#0F172A",fontSize:Math.max(.42,Math.min(.85,a/9)),anchorX:"center",anchorY:"middle",children:n.name})]})}function w0e({item:n,selected:e,register:t,onSelect:r}){const s=Math.max(hn(n.lengthM)||1,.2),a=Math.max(hn(n.widthM)||1,.12),o=Math.max(hn(n.heightM)||1,.2),l=n.color||Ji,u=[hn(n.xM),hn(n.yM),hn(n.zM)],d=i.jsx("meshStandardMaterial",{color:l,roughness:.55,metalness:.08}),h=e?i.jsxs("mesh",{position:[0,.03,0],children:[i.jsx("boxGeometry",{args:[s+.14,.035,a+.14]}),i.jsx("meshStandardMaterial",{color:Ji,emissive:Ji,emissiveIntensity:.7})]}):null,p=n.labelText||n.name;let x;switch(n.objectType){case"door":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),d]}),i.jsxs("mesh",{position:[s*.28,o*.48,-a/2-.02],children:[i.jsx("sphereGeometry",{args:[.07,12,12]}),i.jsx("meshStandardMaterial",{color:"#FDE68A",metalness:.7})]})]});break;case"window":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),i.jsx("meshStandardMaterial",{color:"#7DD3FC",transparent:!0,opacity:.7,metalness:.35,roughness:.12})]}),i.jsxs("mesh",{position:[0,o/2,a/2+.02],children:[i.jsx("boxGeometry",{args:[.05,o*1.05,.03]}),d]})]});break;case"restroom":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),i.jsx("meshStandardMaterial",{color:"#DBEAFE",transparent:!0,opacity:.78})]}),i.jsxs("mesh",{position:[0,o*.26,-a/2-.04],children:[i.jsx("boxGeometry",{args:[Math.min(.8,s*.4),o*.5,.07]}),i.jsx("meshStandardMaterial",{color:"#0EA5E9"})]})]});break;case"office_desk":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o*.72,0],children:[i.jsx("boxGeometry",{args:[s,.12,a]}),d]}),[-1,1].flatMap(y=>[-1,1].map(v=>i.jsxs("mesh",{position:[y*s*.37,o*.34,v*a*.35],children:[i.jsx("boxGeometry",{args:[.12,o*.7,.12]}),d]},`${y}-${v}`)))]});break;case"office_chair":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o*.35,0],children:[i.jsx("boxGeometry",{args:[s,o*.13,a]}),d]}),i.jsxs("mesh",{position:[0,o*.7,a*.34],children:[i.jsx("boxGeometry",{args:[s,o*.55,.12]}),d]}),i.jsxs("mesh",{position:[0,o*.16,0],children:[i.jsx("cylinderGeometry",{args:[.06,.08,o*.3,12]}),d]})]});break;case"kitchen":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o*.45,0],children:[i.jsx("boxGeometry",{args:[s,o*.9,a]}),d]}),i.jsxs("mesh",{position:[s*.22,o*.94,0],children:[i.jsx("boxGeometry",{args:[s*.32,.04,a*.72]}),i.jsx("meshStandardMaterial",{color:"#E2E8F0",metalness:.4})]})]});break;case"road":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),i.jsx("meshStandardMaterial",{color:"#475569",roughness:.95})]}),i.jsxs("mesh",{position:[0,o+.01,0],children:[i.jsx("boxGeometry",{args:[s*.85,.015,.09]}),i.jsx("meshStandardMaterial",{color:"#F8FAFC",emissive:"#F8FAFC",emissiveIntensity:.12})]})]});break;case"pedestrian_path":x=i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),i.jsx("meshStandardMaterial",{color:"#CBD5E1",roughness:.9})]});break;case"parking":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),i.jsx("meshStandardMaterial",{color:"#334155",roughness:.9})]}),[-.34,0,.34].map(y=>i.jsxs("mesh",{position:[y*s,o+.02,0],children:[i.jsx("boxGeometry",{args:[.06,.02,a*.83]}),i.jsx("meshStandardMaterial",{color:"#F8FAFC"})]},y))]});break;case"car":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o*.34,0],children:[i.jsx("boxGeometry",{args:[s,o*.48,a]}),d]}),i.jsxs("mesh",{position:[-s*.1,o*.67,0],children:[i.jsx("boxGeometry",{args:[s*.45,o*.32,a*.78]}),i.jsx("meshStandardMaterial",{color:"#BFDBFE",metalness:.25,roughness:.18})]}),[-1,1].flatMap(y=>[-1,1].map(v=>i.jsxs("mesh",{rotation:[Math.PI/2,0,0],position:[y*s*.31,o*.15,v*a*.54],children:[i.jsx("cylinderGeometry",{args:[o*.16,o*.16,.12,16]}),i.jsx("meshStandardMaterial",{color:"#111827",roughness:.72})]},`${y}-${v}`)))]});break;case"signboard":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o*.22,0],children:[i.jsx("cylinderGeometry",{args:[.06,.08,o*.45,12]}),i.jsx("meshStandardMaterial",{color:"#475569",metalness:.6})]}),i.jsxs("mesh",{position:[0,o*.72,0],children:[i.jsx("boxGeometry",{args:[s,o*.38,a]}),d]}),i.jsx(tl,{position:[0,o*.72,a/2+.02],color:"#FFFFFF",fontSize:Math.max(.18,Math.min(.42,s/6)),anchorX:"center",anchorY:"middle",children:p})]});break;case"column":x=i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("cylinderGeometry",{args:[s/2,s/2,o,18]}),d]});break;case"no_parking":x=i.jsxs(i.Fragment,{children:[i.jsxs("mesh",{position:[0,o*.42,0],children:[i.jsx("cylinderGeometry",{args:[.05,.07,o*.8,12]}),i.jsx("meshStandardMaterial",{color:"#475569"})]}),i.jsxs("mesh",{position:[0,o*.82,0],rotation:[Math.PI/2,0,0],children:[i.jsx("cylinderGeometry",{args:[s/2,s/2,a,24]}),i.jsx("meshStandardMaterial",{color:"#EF4444"})]}),i.jsx(tl,{position:[0,o*.82,a/2+.02],color:"#FFFFFF",fontSize:.16,anch
5185orX:"center",anchorY:"middle",children:"ممنوع الوقوف"})]});break;case"pipe":x=i.jsx(y0e,{item:n,selected:e});break;default:x=i.jsxs("mesh",{position:[0,o/2,0],children:[i.jsx("boxGeometry",{args:[s,o,a]}),d]})}return i.jsxs("group",{ref:t,position:u,rotation:[hn(n.rotationX),hn(n.rotationY),hn(n.rotationZ)],onClick:y=>{y.stopPropagation(),r()},children:[x,h]})}function S0e(n){const e=n.replace(/\r/g,"").split(`
5186`).map(o=>o.trim()),t=[];let r="",s={};const a=()=>{r==="LINE"&&s[10]?.[0]!==void 0&&s[20]?.[0]!==void 0&&s[11]?.[0]!==void 0&&s[21]?.[0]!==void 0&&t.push([[s[10][0],0,s[20][0]],[s[11][0],0,s[21][0]]]),(r==="LWPOLYLINE"||r==="POLYLINE")&&(s[10]?.length||0)>1&&t.push((s[10]||[]).map((o,l)=>[o,0,s[20]?.[l]||0])),s={}};for(let o=0;o<e.length-1;o+=2){const l=e[o],u=e[o+1];if(l==="0"){a(),r=u.toUpperCase();continue}["10","20","11","21"].includes(l)&&(s[l]||=[]).push(Number(u))}return a(),t.slice(0,240)}function _0e({url:n,length:e,width:t,settings:r}){const[s,a]=T.useState([]);T.useEffect(()=>{let l=!0;return fetch(n).then(u=>u.text()).then(u=>{l&&a(S0e(u))}).catch(()=>{l&&a([])}),()=>{l=!1}},[n]);const o=T.useMemo(()=>{const l=s.flat();if(!l.length)return[];const u=l.map(_=>_[0]),d=l.map(_=>_[2]),h=Math.min(...u),p=Math.min(...d),x=Math.max(Math.max(...u)-h,.001),y=Math.max(Math.max(...d)-p,.001),v=Math.min(e/x,t/y)*.88;return s.map(_=>_.map(M=>[(M[0]-h)*v-e/2,.055,(M[2]-p)*v-t/2]))},[s,e,t]);return o.length?i.jsx("group",{children:o.map((l,u)=>i.jsx(uA,{points:l,position:r.isExploded?[(u%3-1)*.16*r.explodeAmount,Math.floor(u/3)*.04*r.explodeAmount,0]:[0,0,0],color:Ji,lineWidth:2},u))}):null}function M0e({url:n,settings:e}){const t=fA(n),r=T.useMemo(()=>{const s=t.scene.clone();let a=0;return s.traverse(o=>{if(!o.isMesh)return;const l=e.isExploded?(a%3-1)*.18*e.explodeAmount:0;o.position.x+=l,o.position.y+=e.isExploded?Math.floor(a/3)*.08*e.explodeAmount:0,a+=1}),s},[t.scene,e.explodeAmount,e.isExploded]);return i.jsx("primitive",{object:r})}function N0e({part:n,index:e,settings:t,selectedPartId:r,onSelect:s,isFlowTarget:a,machineDimensions:o,machineSelected:l,isPlaying:u=!0}){const d=T.useMemo(()=>{const D=new Bn;return D.setAttribute("position",new tn(n.positions,3)),D.setIndex(n.indices),D.computeVertexNormals(),D},[n]),h=T.useMemo(()=>{d.computeBoundingBox();const D=d.boundingBox;if(!D)return;const B=D.getCenter(new we),P=D.getSize(new we);return{center:[B.x,B.y,B.z],size:[P.x,P.y,P.z]}},[d]);T.useEffect(()=>()=>d.dispose(),[d]);const p=`step-${e+1}`,x=t.partStates?.[p]||{},y=r===p,v=t.isExploded?[(e%3-1)*.32*t.explodeAmount,Math.floor(e/3)*.14*t.explodeAmount,(e%2-.5)*.18*t.explodeAmount]:[0,0,0],_=x.position||[0,0,0],M=x.rotation||[0,0,0],S=Math.max(.1,Number(x.scale||1)),A=T.useRef(null),E=T.useRef(0);T.useEffect(()=>{E.current=0},[t.partAnimation?.enabled,t.partAnimation?.partId,t.partAnimation?.speedRpm,t.partAnimation?.keyframes]),Iv((D,B)=>{const P=t.partAnimation;if(!u||!A.current||!P?.enabled||P.partId!==p)return;E.current+=B;const G=Math.max(.1,Number(P.durationSeconds||10));if(!P.loop&&E.current>G)return;const k=P.loop?E.current%G:E.current,V=[...P.keyframes||[]].sort((X,ee)=>X.time-ee.time);if(V.length>1){const X=[...V].reverse().find(J=>J.time<=k)||V[0],ee=V.find(J=>J.time>=k)||V[V.length-1],z=Math.max(.001,ee.time-X.time),K=Math.max(0,Math.min(1,(k-X.time)/z)),ae=(J,q)=>J+(q-J)*K,oe=X.position||[0,0,0],re=ee.position||oe,F=X.rotation||[0,0,0],O=ee.rotation||F;A.current.position.set(v[0]+ae(oe[0],re[0]),v[1]+ae(oe[1],re[1]),v[2]+ae(oe[2],re[2])),A.current.rotation.set(ae(F[0],O[0]),ae(F[1],O[1]),ae(F[2],O[2])),A.current.scale.setScalar(ae(Number(X.scale||1),Number(ee.scale||X.scale||1)));return}const U=P.axis,$=Math.max(0,Number(P.speedRpm||0))*Math.PI*2/60;P.action==="rotate"?A.current.rotation[U]+=$*B:A.current.position[U]=v[U==="x"?0:U==="y"?1:2]+Number(_[U==="x"?0:U==="y"?1:2]||0)+Math.sin(k*$)*.2});const C=Math.max(.08,Math.min(1,Number(x.opacity??1))),I=a?Math.min(C,.36):C;return i.jsxs("mesh",{ref:A,geometry:d,position:[v[0]+Number(_[0]||0),v[1]+Number(_[1]||0),v[2]+Number(_[2]||0)],rotation:M,scale:S,visible:x.visible!==!1,castShadow:!0,receiveShadow:!0,onClick:D=>{D.stopPropagation(),s?.(p)},children:[i.jsx("meshStandardMaterial",{color:x.color||n.color,transparent:a||C<1,opacity:I,depthWrite:!a,metalness:.46,roughness:.34,emissive:a?t.flowColor:y?Ji:"#000000",emissiveIntensity:a?.12:y?.26:0}),a&&i.jsx(HG,{length:o.length,width:o.width,height:o.height,settings:t,selected:l,targetBounds:h,isPlaying:u})]})}function A0e({url:n,length:e,width:t,height:r,settings:s,selectedPartId:a,onParts:o,onPartSelect:l,machineSelected:u,isPlaying:d=!0}){const[h,p]=T.useState([]),[x,y]=T.useState(!1);return T.useEffect(()=>{let v=!0;return(async()=>{try{const[{default:M},{default:S},A]=await Promise.all([A_(()=>import("./occt-import-js-BfXrJmh_.js").then(oe=>oe.o),[]),A_(()=>import("./occt-import-js-n6oKH6Ps.js"),[]),fetch(n)]),E=new Uint8Array(await A.arrayBuffer()),I=(await M({locateFile:()=>S})).ReadStepFile(E,{linearUnit:"meter",linearDeflectionType:"bounding_box_ratio",linearDeflection:.001,angularDeflection:.25});if(!I?.success||!Array.isArray(I.meshes))throw new Error("STEP import failed");const D=I.meshes.filter(oe=>oe?.attributes?.position?.array?.length&&oe?.index?.array?.length),B=D.flatMap(oe=>Array.from(oe.attributes.position.array));if(!B.length)throw new Error("STEP has no mesh");const P=B.filter((oe,re)=>re%3===0),G=B.filter((oe,re)=>re%3===1),k=B.filter((oe,re)=>re%3===2),V=Math.min(...P),U=Math.max(...P),$=Math.min(...G),X=Math.max(...G),ee=Math.min(...k),z=Math.max(...k),K=Math.min(e/Math.max(U-V,
51861e-4),r/Math.max(z-ee,1e-4),t/Math.max(X-$,1e-4))*.88,ae=D.slice(0,120).map(oe=>{const re=Array.from(oe.attributes.position.array),F=[];for(let q=0;q<re.length;q+=3)F.push((re[q]-(V+U)/2)*K,(re[q+2]-ee)*K-r/2,-(re[q+1]-($+X)/2)*K);const O=Array.isArray(oe.color)?oe.color:[.06,.42,.45],J=`rgb(${Math.round((O[0]??.06)*255)}, ${Math.round((O[1]??.42)*255)}, ${Math.round((O[2]??.45)*255)})`;return{positions:F,indices:Array.from(oe.index.array),color:J}});v&&(p(ae),y(!1))}catch{v&&(p([]),y(!0))}})(),()=>{v=!1}},[n,e,t,r]),T.useEffect(()=>{h.length&&o?.(h.map((v,_)=>({id:`step-${_+1}`,name:`Mesh ${String(_+1).padStart(2,"0")}`,color:v.color})))},[h]),h.length?i.jsx("group",{children:h.map((v,_)=>i.jsx(N0e,{part:v,index:_,settings:s,selectedPartId:a,onSelect:l,isFlowTarget:s.processPipeEnabled&&s.processPipeTargetPartId===`step-${_+1}`,machineDimensions:{length:e,width:t,height:r},machineSelected:u,isPlaying:d},_))}):x?i.jsx(tl,{position:[0,0,0],color:"#B45309",fontSize:.24,anchorX:"center",anchorY:"middle",children:"تعذر قراءة نموذج STEP"}):null}function C0e({height:n,onStart:e}){return i.jsxs("group",{position:[0,n/2+.82,0],children:[i.jsxs("mesh",{onPointerDown:t=>{t.stopPropagation(),t.nativeEvent.preventDefault(),e()},children:[i.jsx("coneGeometry",{args:[.38,.64,24]}),i.jsx("meshStandardMaterial",{color:zG,emissive:Ji,emissiveIntensity:.7,metalness:.22,roughness:.28})]}),i.jsx(tl,{position:[0,.5,0],color:Ji,fontSize:.24,anchorX:"center",anchorY:"middle",children:"اسحب للتحريك"})]})}function E0e({height:n,onStart:e}){return i.jsxs("group",{position:[0,n/2+.18,0],rotation:[-Math.PI/2,0,0],children:[i.jsxs("mesh",{onPointerDown:t=>{t.stopPropagation(),t.nativeEvent.preventDefault(),e()},children:[i.jsx("torusGeometry",{args:[.72,.075,12,42]}),i.jsx("meshStandardMaterial",{color:"#F59E0B",emissive:"#D97706",emissiveIntensity:.55,metalness:.2,roughness:.32})]}),i.jsx(tl,{position:[0,-.9,0],rotation:[Math.PI/2,0,0],color:"#B45309",fontSize:.2,anchorX:"center",anchorY:"middle",children:"اسحب للتدوير"})]})}function j0e({placement:n,model:e,selected:t,register:r,onSelect:s,onTransform:a,onInteraction:o,selectedCadPartId:l,onCadParts:u,onCadPartSelect:d,isPlaying:h=!0}){const p=Math.max(hn(n.lengthM)||1,.2),x=Math.max(hn(n.widthM)||1,.2),y=Math.max(hn(n.heightM)||1,.2),v=String(e?.cadFileType||"").toLowerCase(),_=String(e?.modelUrl||""),M=T.useRef(null),S=T.useRef(null),A=!!(_&&v),E=b0e(n),C=hn(n.scaleX)||1,I=hn(n.scaleY)||1,D=hn(n.scaleZ)||1,B=A?y*Math.max(I,.1)/2:hn(n.yM)+y/2,P=A?null:i.jsxs("mesh",{castShadow:!0,receiveShadow:!0,children:[i.jsx("boxGeometry",{args:[p,y,x]}),i.jsx("meshStandardMaterial",{color:"#3C8189",emissive:"#123C43",emissiveIntensity:.14,metalness:.28,roughness:.45})]}),G=U=>a?.({xM:U.position.x-p/2,yM:A?0:U.position.y-y/2,zM:U.position.z-x/2,rotationX:U.rotation.x,rotationY:U.rotation.y,rotationZ:U.rotation.z,scaleX:U.scale.x,scaleY:U.scale.y,scaleZ:U.scale.z});T.useEffect(()=>()=>S.current?.(),[]);const k=()=>{const U=M.current;if(!U)return;o?.(!0);let $=!1;const X=z=>{U.position.x+=z.movementX*.018,U.position.z+=z.movementY*.018,U.updateMatrix(),$=!0},ee=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",ee),S.current=null,o?.(!1),$&&G(U)};S.current?.(),S.current=ee,window.addEventListener("pointermove",X),window.addEventListener("pointerup",ee,{once:!0})},V=()=>{const U=M.current;if(!U)return;o?.(!0);let $=!1;const X=z=>{U.rotation.y+=z.movementX*.012,U.updateMatrix(),$=!0},ee=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",ee),S.current=null,o?.(!1),$&&G(U)};S.current?.(),S.current=ee,window.addEventListener("pointermove",X),window.addEventListener("pointerup",ee,{once:!0})};return i.jsxs("group",{ref:U=>{M.current=U,r(U)},position:[hn(n.xM)+p/2,B,hn(n.zM)+x/2],rotation:[hn(n.rotationX)+Number(E.machineRotation?.[0]||0),hn(n.rotationY)+Number(E.machineRotation?.[1]||0),hn(n.rotationZ)+Number(E.machineRotation?.[2]||0)],scale:[C,I,D],onClick:U=>{U.nativeEvent.shiftKey||(U.stopPropagation(),s())},onWheel:U=>{if(!t||U.nativeEvent.shiftKey)return;const $=M.current;$&&(U.stopPropagation(),U.nativeEvent.preventDefault(),o?.(!0),$.scale.multiplyScalar(U.deltaY<0?1.08:.92),$.updateMatrix(),G($),window.setTimeout(()=>
5186o?.(!1),0))},children:[v==="dxf"&&_?i.jsx(_0e,{url:_,length:p,width:x,settings:E}):(v==="step"||v==="stp")&&_?i.jsx(A0e,{url:_,length:p,width:x,height:y,settings:E,selectedPartId:l,onParts:u,onPartSelect:d,machineSelected:t,isPlaying:h}):(v==="glb"||v==="gltf")&&_?i.jsx(T.Suspense,{fallback:null,children:i.jsx(M0e,{url:_,settings:E})}):P,E.processPipeEnabled&&!E.processPipeTargetPartId&&i.jsx(HG,{length:p,width:x,height:y,settings:E,selected:t,isPlaying:h}),i.jsxs("mesh",{onPointerDown:U=>{U.nativeEvent.shiftKey||(U.stopPropagation(),U.nativeEvent.preventDefault(),s(),U.button===0&&k(),U.button===2&&V())},onContextMenu:U=>{U.stopPropagation(),U.nativeEvent.preventDefault()},children:[i.jsx("boxGeometry",{args:[p,y,x]}),i.jsx("meshBasicMaterial",{transparent:!0,opacity:0,depthWrite:!1})]}),i.jsx(tl,{position:[0,y/2+.32,0],color:t?Ji:"#16343A",fontSize:.45,anchorX:"center",anchorY:"middle",children:n.name}),t&&i.jsxs(i.Fragment,{children:[i.jsx(tl,{position:[0,y/2+.62,0],color:Ji,fontSize:.17,anchorX:"center",anchorY:"middle",children:"اسحب للتحريك · زر أيمن للدوران · العجلة للحجم"}),i.jsx(C0e,{height:y,onStart:k}),i.jsx(E0e,{height:y,onStart:V})]})]})}function VG(n,e){try{const t=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(t)&&t.length>1)return t.map(r=>[hn(r.x??r[0]),hn(r.y??r[1]),hn(r.z??r[2])])}catch{}return e}function T0e(n,e){if(n.length<2)return n[0]||[0,0,0];const t=e*(n.length-1),r=n[Math.floor(t)],s=n[Math.min(n.length-1,Math.ceil(t))],a=t-Math.floor(t);return[r[0]+(s[0]-r[0])*a,r[1]+(s[1]-r[1])*a,r[2]+(s[2]-r[2])*a]}function R0e({workspace:n,singleTrackId:e}){const t=(n.animationTracks||[]).filter(a=>a.isEnabled!==!1),r=n.project,s=[[1,.25,1],[Math.max(hn(r.lengthM)-3,3),.25,Math.max(hn(r.widthM)*.35,2)],[Math.max(hn(r.lengthM)-3,3),.25,Math.max(hn(r.widthM)-3,2)]];return i.jsx(i.Fragment,{children:t.filter(a=>!e||Number(a.id)===Number(e)).map(a=>i.jsx(uA,{points:VG(a.routeJson,s),color:a.color||Ji,lineWidth:1.2,transparent:!0,opacity:.55,dashed:!0,dashSize:.22,gapSize:.12},a.id))})}function P0e({workspace:n,refs:e,playSimulation:t,simulationRunId:r,singleTrackId:s,fallbackRoute:a}){const o=T.useRef(null),l=T.useRef(new Map);return T.useEffect(()=>{o.current=null,l.current.clear()},[r,s]),Iv(({clock:u})=>{if(!t)return;o.current===null&&(o.current=u.getElapsedTime());const d=u.getElapsedTime()-o.current,h=(n.animationTracks||[]).filter(_=>_.isEnabled!==!1&&(!s||Number(_.id)===Number(s))).sort((_,M)=>Number(_.playOrder||1)-Number(M.playOrder||1)),p=h.reduce((_,M)=>_+Math.max(0,hn(M.startDelaySeconds))+Math.max(1,hn(M.durationSeconds)||8),0),y=(s?h[0]?.isLooping!==!1:h.length>0&&h[h.length-1]?.isLooping!==!1)&&p>0?d%p:d;let v=0;h.forEach(_=>{const M=v+Math.max(0,hn(_.startDelaySeconds)),S=Math.max(1,hn(_.durationSeconds)||8);v=M+S;const A=km(_.targetType==="placement"?"placement":"sceneObject",Number(_.targetId)),E=e.current.get(A);if(!E||y<M||y>M+S)return;l.current.has(A)||l.current.set(A,{x:E.position.x,y:E.position.y,z:E.position.z});const C=T0e(VG(_.routeJson,a),Math.min(1,Math.max(0,(y-M)/S))),I=l.current.get(A);E.position.set(C[0],hn(C[1])||I.y,C[2]),E.updateMatrix()})}),null}function YR({workspace:n,selection:e=null,onSelect:t,onMove:r,onTransform:s,interactive:a=!1,playSimulation:o=!1,simulationRunId:l=0,singleTrackId:u=null,routeDrafting:d=!1,routePoints:h=[],onRoutePoint:p,onCameraReady:x,onCanvasReady:y,selectedCadPartId:v,onCadParts:_,onCadPartSelect:M,labMode:S=!n.rooms?.length&&!n.sceneObjects?.length&&(n.placements||[]).length===1}){const A=n.sceneObjects||[],E=n.rooms||[],C=n.placements||[],I=n.machineModels||[],D=T.useRef(new Map),B=T.useRef(null),[P,G]=T.useState(!1),k=n.project,V=Math.max(hn(k.lengthM)||50,8),U=Math.max(hn(k.widthM)||30,8),$=Math.max(hn(k.heightM)||8,5),X=e?km(e.type,e.id):null;X&&D.current.get(X);const ee=Math.max(V,U),z=F=>{B.current&&(B.current.enabled=!F)};T.useEffect(()=>{d||z(!1)},[d]),T.useEffect(()=>{const F=J=>{J.key==="Shift"&&G(J.type==="keydown")},O=()=>G(!1);return window.addEventListener("keydown",F),window.addEventListener("keyup",F),window.addEventListener("blur",O),()=>{window.removeEventListener("keydown",F),window.removeEventListener("keyup",F),window.removeEventListener("blur",O)}},[]);const K=(F,O)=>
5186J=>{const q=km(F,O);J?D.current.set(q,J):D.current.delete(q)},ae=T.useMemo(()=>[V+24,U+24],[V,U]),oe=h.map(F=>[hn(F.xM??F.x),Math.max(.09,hn(F.yM??F.y)+.09),hn(F.zM??F.z)]),re=[[1,.25,1],[Math.max(V-3,3),.25,Math.max(U*.35,2)],[Math.max(V-3,3),.25,Math.max(U-3,2)]];return i.jsxs(Wpe,{shadows:!0,camera:{position:[V*.88,ee*.86,U*1.35],fov:43},className:"h-full w-full",style:{cursor:d?"crosshair":P||a?"grab":"default"},onCreated:({gl:F})=>{F.domElement.oncontextmenu=O=>O.preventDefault(),y?.(F.domElement)},onPointerDown:F=>{F.nativeEvent.shiftKey&&!d&&z(!1)},onPointerUp:()=>z(!1),onPointerCancel:()=>z(!1),onPointerMissed:()=>{d||z(!1),t?.(null)},children:[i.jsx("color",{attach:"background",args:["#EAF1F4"]}),i.jsx("fog",{attach:"fog",args:["#EAF1F4",ee*1.2,ee*3.8]}),i.jsx("ambientLight",{intensity:1.12}),i.jsx("hemisphereLight",{args:["#FFFFFF","#B7C8C3",1.4]}),i.jsx("directionalLight",{castShadow:!0,position:[V*.55,ee*1.15,U*.35],intensity:1.7,"shadow-mapSize":[2048,2048]}),i.jsxs("group",{position:[-V/2,0,-U/2],children:[i.jsxs("mesh",{receiveShadow:!0,rotation:[-Math.PI/2,0,0],position:[V/2,-.08,U/2],children:[i.jsx("planeGeometry",{args:ae}),i.jsx("meshStandardMaterial",{color:S?"#D8E7EB":"#9CCB95",roughness:1})]}),i.jsxs("mesh",{receiveShadow:!0,rotation:[-Math.PI/2,0,0],position:[V/2,0,U/2],onClick:F=>{!d||!p||(F.stopPropagation(),p({xM:F.point.x+V/2,yM:0,zM:F.point.z+U/2}))},children:[i.jsx("planeGeometry",{args:[V,U]}),i.jsx("meshStandardMaterial",{color:S?"#F5FAFC":"#D8E1E6",roughness:.94})]}),i.jsx(Uxe,{position:[V/2,.015,U/2],args:[V,U],cellSize:hn(k.defaultGridM)||.5,cellThickness:.32,cellColor:"#AABCC4",sectionSize:5,sectionThickness:.7,sectionColor:"#829AA5",fadeDistance:500,infiniteGrid:!1}),i.jsxs("group",{visible:S,position:[V/2,$*.46,.26],children:[i.jsxs("mesh",{receiveShadow:!0,children:[i.jsx("boxGeometry",{args:[Math.max(8,V*.92),Math.max(4.5,$*.88),.16]}),i.jsx("meshStandardMaterial",{color:"#0B2830",metalness:.26,roughness:.42})]}),i.jsxs("mesh",{position:[-Math.min(2.9,V*.27),0,.1],children:[i.jsx("boxGeometry",{args:[1.3,1.3,.08]}),i.jsx("meshStandardMaterial",{color:Ji,emissive:Ji,emissiveIntensity:.2,metalness:.24,roughness:.32})]}),i.jsx(tl,{position:[-Math.min(2.9,V*.27),0,.16],color:"#FFFFFF",fontSize:.45,fontWeight:"bold",anchorX:"center",anchorY:"middle",children:"AMZ"}),i.jsx(tl,{position:[.45,.17,.14],color:"#FFFFFF",fontSize:.98,fontWeight:"bold",anchorX:"center",anchorY:"middle",children:"AMZ"}),i.jsx(tl,{position:[.45,-.66,.14],color:"#71E4E9",fontSize:.19,letterSpacing:.12,anchorX:"center",anchorY:"middle",children:"INDUSTRIAL CAD LAB"})]}),i.jsxs("group",{visible:!S,position:[V/2,$/2,U/2],children:[i.jsxs("mesh",{position:[0,0,U/2],children:[i.jsx("boxGeometry",{args:[V+.4,$,.38]}),i.jsx("meshStandardMaterial",{color:"#9CBFC3",transparent:!0,opacity:.66,roughness:.72})]}),i.jsxs("mesh",{position:[-V/2,0,0],children:[i.jsx("boxGeometry",{args:[.38,$,U]}),i.jsx("meshStandardMaterial",{color:"#9CBFC3",transparent:!0,opacity:.66,roughness:.72})]}),i.jsxs("mesh",{position:[V/2,0,0],children:[i.jsx("boxGeometry",{args:[.38,$,U]}),i.jsx("meshStandardMaterial",{color:"#9CBFC3",transparent:!0,opacity:.66,roughness:.72})]}),i.jsxs("mesh",{position:[-V*.3,0,-U/2],children:[i.jsx("boxGeometry",{args:[V*.4,$,.38]}),i.jsx("meshStandardMaterial",{color:"#9CBFC3",transparent:!0,opacity:.66,roughness:.72})]}),i.jsxs("mesh",{position:[V*.3,0,-U/2],children:[i.jsx("boxGeometry",{args:[V*.4,$,.38]}),i.jsx("meshStandardMaterial",{color:"#9CBFC3",transparent:!0,opacity:.66,roughness:.72})]})]}),E.map(F=>i.jsx(v0e,{room:F,projectHeight:$,selected:X===km("room",F.id),register:K("room",F.id),onSelect:()=>t?.({type:"room",id:F.id})},`room-${F.id}`)),C.map(F=>i.jsx(j0e,{placement:F,model:I.find(O=>O.id===F.machineModelId),selected:X===km("placement",F.id),register:K("placement",F.id),onSelect:()=>t?.({type:"placement",id:F.id}),onInteraction:z,onTransform:O=>s?.("placement",F.id,O),selectedCadPartId:X===km("placement",F.id)?v:null,onCadParts:O=>_?.(F.id,O),onCadPartSelect:O=>M?.(F.id,O),isPlaying:o},`placement-${F.id}`)),A.map(F=>i.jsx(w0e,{item:F,selected:X===km("sceneObject",F.id),register:K("sceneObject",F.id),onSelect:()=>t?.({type:"sceneObject",id:F.id})},`object-${F.id}`)),oe.length>1&&i.jsx(uA,{points:oe,color:zG,lineWidth:2.5,dashed:!0,dashSize:.22,gapSize:.1}),oe.map((F,O)=>i.jsxs("mesh",{position:F,children:[i.jsx("sphereGeometry",{args:[.12,16,16]}),i.jsx("meshStandardMaterial",{color:Ji,emissive:Ji,emissiveIntensity:.6})]},`route-point-${O}`)),i.jsx(R0e,{workspace:n,singleTrackId:u}),i.jsx(P0e,{workspace:n,refs:D,playSimulation:o,simulationRunId:l,singleTrackId:u,fallbackRoute:re})]}),i.jsx(Oxe,{ref:F=>{B.current=F,F&&x?.(F)},makeDefault:!0,enablePan:!d,enableZoom:!0,enableDamping:!0,screenSpacePanning:!0,enableRotate:!1,dampingFactor:.12,panSpeed:1.35,zoomSpeed:1.45,mou
5186seButtons:{LEFT:Su.PAN,MIDDLE:Su.DOLLY,RIGHT:Su.PAN},maxPolarAngle:Math.PI/2.04,minDistance:6,maxDistance:ee*3.5,target:[0,0,0]})]})}const kM=["#3b82f6","#10b981","#f97316","#facc15","#8b5cf6","#ec4899"],Kb={name:"",factoryType:"مصنع إنتاج",location:"",description:"",lengthM:50,widthM:30,heightM:8,defaultGridM:.5};function kl({label:n,value:e,onChange:t,min:r=0}){return i.jsx(Vt,{label:n,children:i.jsx(Ee,{type:"number",min:r,step:"0.1",value:Number.isFinite(e)?e:0,onChange:s=>t(Number(s.target.value)||r),className:"h-9 border-slate-200 bg-slate-50 text-center text-slate-900 focus-visible:ring-orange-500"})})}function D0e({workspace:n,selectedPlacementId:e,onSelect:t}){const r=n.project,s=680/Math.max(Number(r.lengthM||50),Number(r.widthM||30)),a=n.rooms||[],o=n.placements||[];return i.jsx("div",{className:"h-full min-h-[560px] overflow-auto bg-[#edf1f5] p-8",children:i.jsxs("div",{className:"relative mx-auto origin-top-left shadow-[0_22px_42px_rgba(15,23,42,.14)]",style:{width:Number(r.lengthM||50)*s,height:Number(r.widthM||30)*s,backgroundImage:"linear-gradient(rgba(100,116,139,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(100,116,139,.18) 1px, transparent 1px)",backgroundSize:`${Number(r.defaultGridM||.5)*s}px ${Number(r.defaultGridM||.5)*s}px`,border:"3px solid #64748b",backgroundColor:"#f8fafc"},children:[a.map((l,u)=>i.jsx("div",{className:"absolute overflow-hidden border border-slate-600/45 px-2 py-1 text-[11px] font-bold text-slate-800",style:{left:Number(l.xM||0)*s,top:Number(l.zM||0)*s,width:Math.max(24,Number(l.lengthM||1)*s),height:Math.max(24,Number(l.widthM||1)*s),background:`${l.color||kM[u%kM.length]}4D`},children:l.name},`room-${l.id}`)),o.map(l=>i.jsxs("button",{type:"button",onClick:()=>t(l.id),"aria-label":`تحديد المكنة ${l.name}`,className:`absolute z-10 flex flex-col justify-center overflow-visible border-2 px-1 text-center text-[10px] font-bold transition ${e===l.id?"border-orange-600 bg-orange-400 text-slate-950 shadow-[0_0_18px_rgba(249,115,22,.5)]":"border-amber-700 bg-amber-300 text-slate-800 hover:bg-amber-200"}`,style:{left:Number(l.xM||0)*s,top:Number(l.zM||0)*s,width:Math.max(20,Number(l.lengthM||1)*s),height:Math.max(20,Number(l.widthM||1)*s)},children:[i.jsx("span",{"data-machine-label":!0,className:"pointer-events-none absolute -top-6 left-1/2 z-20 w-max max-w-40 -translate-x-1/2 rounded-md border border-amber-800/35 bg-white/95 px-1.5 py-0.5 text-[10px] font-extrabold leading-tight text-slate-900 shadow-sm",children:l.name||"مكنة بلا اسم"}),i.jsx("span",{className:"line-clamp-2",children:l.name}),i.jsxs("span",{className:"mt-1 text-[8px] opacity-75",children:[l.lengthM," × ",l.widthM," م"]})]},`machine-${l.id}`)),i.jsxs("div",{className:"absolute -bottom-7 right-0 text-xs text-slate-600",children:[r.lengthM," م"]}),i.jsxs("div",{className:"absolute -right-10 top-0 [writing-mode:vertical-rl] text-xs text-slate-600",children:[r.widthM," م"]})]})})}function Tm({active:n,label:e,onClick:t,children:r}){return i.jsx("button",{type:"button","aria-label":e,title:e,onClick:t,className:`flex h-8 w-8 items-center justify-center rounded-md transition ${n?"bg-orange-500 text-white shadow-lg shadow-orange-950/20":"text-slate-300 hover:bg-slate-700 hover:text-white"}`,children:r})}const m_=[];function k0e({workspace:n,draft:e,setDraft:t,editingTrackId:r,onSave:s,onEdit:a,onDelete:o,onRunTrack:l,onRunSequence:u,onClose:d}){const h=[...(n?.placements||[]).map(y=>({key:`placement:${y.id}`,type:"placement",id:y.id,label:`آلة: ${y.name}`})),...(n?.sceneObjects||[]).map(y=>({key:`sceneObject:${y.id}`,type:"sceneObject",id:y.id,label:`عنصر: ${y.name}`}))],p=e.points||m_,x=(y,v,_)=>t({...e,points:p.map((M,S)=>S===y?{...M,[v]:_}:M)});return i.jsxs("aside",{className:"fixed inset-y-16 left-4 z-[80] flex w-[23rem] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-2xl border border-primary/20 bg-white text-slate-900 shadow-2xl",dir:"rtl",children:[i.jsxs("div",{className:"border-b border-primary/10 bg-primary/5 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-bold tracking-[.13em] text-primary",children:"MANUAL ANIMATION"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:"محرر الحركة اليدوي"})]}),i.jsx(ke,{size:"sm",variant:"ghost",className:"h-8 px-2 text-slate-500",onClick:d,children:"إغلاق"})]}),i.jsx("p",{className:"mt-2 text-[11px] leading-5 text-slate-500",children:"حدد العنصر ونقاط الحركة بنفسك ثم احفظ المسار. لا يتم إنشاء أي مسار تلقائي."})]}),i.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4",children:[i.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-3 text-xs leading-6 text-slate-700",children:[i.jsx("b",{className:"text-primary",children:"الطريقة السريعة:"})," 1) انقر الآلة أو العنصر في المخطط. 2) اضغط زر «اختر عنصراً ثم ارسم المسار» أعلى المشهد. 3) انقر أرضية المصنع لإضافة نقاط الحركة، ثم اضغط «إنشاء المسار اليدوي». تبقى حقول X/Y/Z أدناه فقط للتعديل الدقيق عند الحاجة."]}),i.jsx(Vt,{label:"اسم الحركة",children:i.jsx(Ee,{value:e.name,onChange:y=>t({...e,name:y.target.value}),placeholder:"مثال: دخول سيارة التوريد"})}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Vt,{label:"نوع الحركة",children:i.jsxs("select",{value:e.animationType,onCh
5186ange:y=>t({...e,animationType:y.target.value}),className:"h-9 w-full rounded-md border border-slate-200 bg-slate-50 px-2 text-sm outline-none focus:border-primary",children:[i.jsx("option",{value:"vehicle",children:"سيارة"}),i.jsx("option",{value:"worker",children:"موظف"}),i.jsx("option",{value:"machine",children:"آلة"}),i.jsx("option",{value:"water",children:"مياه / أنبوب"})]})}),i.jsx(Vt,{label:"سرعة الحركة",children:i.jsxs("div",{className:"rounded-md border border-slate-200 bg-slate-50 px-2 py-2",children:[i.jsx("input",{type:"range",min:"1",max:"20",step:"1",value:Math.max(1,Math.min(20,21-Number(e.durationSeconds||8))),onChange:y=>t({...e,durationSeconds:Math.max(1,21-Number(y.target.value))}),className:"h-2 w-full accent-[var(--primary)]"}),i.jsxs("div",{className:"mt-1 flex justify-between text-[10px] text-slate-500",children:[i.jsx("span",{children:"هادئة"}),i.jsx("b",{className:"text-primary",children:Number(e.durationSeconds||8)<=3?"سريعة":Number(e.durationSeconds||8)<=8?"متوسطة":"هادئة"}),i.jsx("span",{children:"سريعة"})]})]})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Vt,{label:"ترتيب التشغيل",children:i.jsx(Ee,{type:"number",min:"1",value:e.playOrder??1,onChange:y=>t({...e,playOrder:Math.max(1,Number(y.target.value)||1)}),className:"h-9 border-slate-200 bg-slate-50 text-slate-900"})}),i.jsx(Vt,{label:"تأخير البداية (ثانية)",children:i.jsx(Ee,{type:"number",min:"0",step:"0.5",value:e.startDelaySeconds??0,onChange:y=>t({...e,startDelaySeconds:Math.max(0,Number(y.target.value)||0)}),className:"h-9 border-slate-200 bg-slate-50 text-slate-900"})})]}),i.jsx(Vt,{label:"العنصر المتحرك",children:i.jsxs("select",{value:`${e.targetType}:${e.targetId}`,onChange:y=>{const[v,_]=y.target.value.split(":");t({...e,targetType:v,targetId:Number(_)||0})},className:"h-9 w-full rounded-md border border-slate-200 bg-slate-50 px-2 text-sm outline-none focus:border-primary",children:[i.jsx("option",{value:"sceneObject:0",children:"عنصر تمثيلي للحركة"}),h.map(y=>i.jsx("option",{value:y.key,children:y.label},y.key))]})}),i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-primary/20 bg-primary/5 px-3 py-2",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-xs font-bold text-primary",children:"تكرار الحركة باستمرار"}),i.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:e.isLooping?"ستعود الحركة إلى البداية تلقائياً بعد انتهاء المسار.":"ستتوقف الحركة عند آخر نقطة."})]}),i.jsx("input",{type:"checkbox",checked:e.isLooping,onChange:y=>t({...e,isLooping:y.target.checked}),className:"h-4 w-4 accent-[var(--primary)]"})]}),i.jsxs("div",{className:"rounded-xl border border-slate-200 p-3",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-extrabold",children:"نقاط المسار"}),i.jsx("p",{className:"mt-1 text-[10px] text-slate-500",children:"أدخل X وY وZ لكل نقطة بالمتـر."})]}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"border-primary/30 text-primary hover:bg-primary/10",onClick:()=>t({...e,points:[...p,{...p[p.length-1],x:Number(p[p.length-1]?.x||0)+2}]}),children:"إضافة نقطة"})]}),i.jsx("div",{className:"space-y-2",children:p.map((y,v)=>i.jsxs("div",{className:"grid grid-cols-[auto_1fr_1fr_1fr_auto] items-center gap-1.5",children:[i.jsx("span",{className:"text-[10px] font-bold text-slate-400",children:v+1}),["x","y","z"].map(_=>i.jsx(Ee,{type:"number",step:"0.1",value:y[_],onChange:M=>x(v,_,Number(M.target.value)||0),className:"h-8 border-slate-200 bg-slate-50 px-1 text-center text-xs"},_)),i.jsx("button",{type:"button",disabled:p.length<=2,onClick:()=>t({...e,points:p.filter((_,M)=>M!==v)}),className:"text-xs text-red-500 disabled:opacity-30",children:"حذف"})]},`point-${v}`))})]}),i.jsxs(ke,{className:"w-full bg-primary text-primary-foreground hover:bg-primary/90",onClick:s,children:[i.jsx(Km,{className:"ml-2 h-4 w-4"}),r?"حفظ تعديل المسار":"إنشاء المسار اليدوي"]}),i.jsxs("div",{className:"border-t border-slate-200 pt-3",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsx("p",{className:"text-xs font-extrabold",children:"المسارات المحفوظة"}),i.jsx(ke,{size:"sm",className:"h-7 bg-primary px-2 text-[10px] text-primary-foreground hover:bg-primary/90",onClick:u,children:"تشغيل التسلسل"})]}),i.jsx("div",{className:"space-y-2",children:(n?.animationTracks||[]).length?[...n.animationTracks].sort((y,v)=>Number(y.playOrder||1)-Number(v.playOrder||1)).map(y=>i.jsx("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-2.5",children:i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"truncate text-xs font-bold text-slate-800",children:y.name}),i.jsxs("p",{className:"mt-0.5 text-[10px] text-slate-500",children:["خطوة ",y.playOrder||1," · تأخير ",Number(y.startDelaySeconds||0)," ث · سرعة ",Number(y.durationSeconds||8)<=3?"سريعة":Number(y.durationSeconds||8)<=8?"متوسطة":"هادئة"]})]}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ke,{size:"sm",variant:"outline",className:"h-7 border-primary/30 px-2 text-[10px] text-primary",onClick:()=>l(y.id),children:"تشغيل"}),i.jsx(ke,{size:"sm",variant:"outline",className:"h-7 border-primary/30 px-2 text-[10px] text-primary",onClick:()=>a(y),children:"تعديل"}),i.jsx(ke,{size:"sm",variant:"outline",className:"h-7 border-red-200 px-2 text-[10px] text-red-600",onClick:()=>o(y.id),children:"حذف"})]})]})},y.id)):i.jsx("p",{className:"rounded-lg border border-dashed border-slate-200 p-3 text-center text-[11px] text-slate-500",children:"لا توجد مسارات. أنشئ أول حركة بالنقاط التي تحددها."})})]})]})]})}function I0e(){const n=Pe.useUtils(),{data:e,isLoading:t,isError:r,refetch:s}=Pe.factoryPlanner.list.useQuery(),[a,o]=T.useState(!1),[l,u]=T.useState(null),d=l||e?.[0]?.id||null,{data:h,isLoading:p,isError:x,refetch:y}=Pe.factoryPlanner.workspace.useQuery({factoryProjectId:d||0},{enabled:!!d}),[v,_]=T.useState(!1),[M,S]=T.useState(!1),[A,E]=T.useState(!1),[C,I]=T.useState(!1),[D,B]=T.useState(!1),[P,G]=T.useState(""),[k,V]=T.useState(null),[U,$]=T.useState(""),[X,ee]=T.useState(!1),[z,K]=T.useState(!1),[ae,oe]=T.useState(0),[re,F]=T.useState(null),[O,J]=T.useState(null),[q,Q]=T.useState({}),[ne,Z]=T.useState({}),[se,me]=T.useState(!0),[ze,Be]=T.useState(!0),[ye,Le]=T.useState(null),[Ce,Re]=T.useState({name:"",animationType:"vehicle",targetType:"sceneObject",targetId:0,color:"#0096A7",durationSeconds:8,playOrder:1,startDelaySeconds:0,isLooping:!0,points:m_}),[De,he]=T.useState(Kb),[le,Xe]=T.useState(Kb),[qe,Ge]=T.useState({name:"منطقة الإنتاج",roomType:"production",xM:1,zM:1,lengthM:12,widthM:8,heightM:4,color:"#3b82f6"}),[ot,ve]=T.useState(null),[mt,xt]=T.useState(null),[ge,Y]=T.useState(null),[je,Ie]=T.useState("catalog"),[Ve,ft]=T.useState("three"),[vt,ce]=T.useState(!1),[Me,Fe]=T.useState(!1),[ie,Se]=T.useState([]),[Ae,at]=T.useState(null),[pe,Ke]=T.useState(!1),[Ne,Ye]=T.useState("props"),[Te,st]=T.useState("rooms"),[et,Qe]=T.useState(""),[Mt,ue]=T.useState("all"),[Je,it]=T.useState(.5),[Et,Wt]=T.useState(null),[an,Sn]=T.useState(null),[Lr,Gr]=T.useState(!1),Nr=Pe.factoryPlanner.createProject.useMutation({onSuccess:async be=>
5186{await n.factoryPlanner.list.invalidate(),u(Number(be.insertId)),Ie("workspace"),_(!1),_e.success("تم إنشاء مشروع المصنع")}}),Wn=Pe.factoryPlanner.updateProject.useMutation({onSuccess:async()=>{await n.factoryPlanner.workspace.invalidate(),await n.factoryPlanner.list.invalidate(),_e.success("تم حفظ خصائص المصنع")}}),jr=Pe.factoryPlanner.createRoom.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),S(!1),_e.success("تمت إضافة المنطقة")}}),es=Pe.factoryPlanner.createPlacement.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تم وضع الآلة في المخطط")}}),Tr=Pe.factoryPlanner.deletePlacement.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),ve(null),_e.success("تمت إزالة الآلة من المخطط")}}),as=Pe.factoryPlanner.updatePlacement.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تم حفظ موقع الآلة")}}),Ps=Pe.factoryPlanner.updateRoom.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تم حفظ موقع الغرفة")}}),gi=Pe.factoryPlanner.createSceneObject.useMutation({onSuccess:be=>{const It=Number(be?.insertId||be?.id||0);It&&(Y(It),ve(null),xt(null),Ye("props")),n.factoryPlanner.workspace.invalidate(),_e.success("تمت إضافة العنصر إلى الموقع")}}),Xr=Pe.factoryPlanner.updateSceneObject.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تم حفظ موقع العنصر")}}),ps=Pe.factoryPlanner.deleteSceneObject.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),Y(null),_e.success("تمت إزالة العنصر")}}),xi=Pe.factoryPlanner.createAnimationTrack.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تمت إضافة مسار المحاكاة")}}),Ds=Pe.factoryPlanner.updateAnimationTrack.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تم حفظ تعديل المسار")}}),Vs=Pe.factoryPlanner.deleteAnimationTrack.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),_e.success("تم حذف مسار المحاكاة")}}),Yt=Pe.factoryPlanner.uploadCad.useMutation(),or=Pe.factoryPlanner.createMachineModel.useMutation({onSuccess:()=>{n.factoryPlanner.workspace.invalidate(),I(!1),V(null),$(""),_e.success("تم حفظ آلة CAD في المكتبة")}}),ks=Pe.factoryPlanner.duplicateProject.useMutation({onSuccess:async be=>{await n.factoryPlanner.list.invalidate(),u(Number(be.id)),_e.success("تم إنشاء نسخة من المشروع")}}),de=Pe.factoryPlanner.archiveProject.useMutation({onSuccess:()=>{n.factoryPlanner.list.invalidate(),_e.success("تمت أرشفة مشروع المصنع")}}),He=be=>{const It=`${window.location.origin}/factory-preview/${be}`;navigator.clipboard?.writeText(It),_e.success("تم نسخ رابط معاينة العميل")},rt=Pe.factoryPlanner.enablePreview.useMutation({onSuccess:async be=>{await n.factoryPlanner.workspace.invalidate(),He(be.shareToken)}}),Ze=Pe.factoryPlanner.revokePreview.useMutation({onSuccess:async()=>{await n.factoryPlanner.workspace.invalidate(),_e.success("تم إلغاء رابط معاينة العميل")}});T.useEffect(()=>{s()},[s]),T.useEffect(()=>{if(e||r){o(!1);return}const be=window.setTimeout(()=>o(!0),6e3);return()=>window.clearTimeout(be)},[e,r]),T.useEffect(()=>{if(!h?.project)return;const be=h.project;Xe({name:be.name||"",factoryType:be.factoryType||"مصنع إنتاج",location:be.location||"",description:be.description||"",lengthM:Number(be.lengthM||50),widthM:Number(be.widthM||30),heightM:Number(be.heightM||8),defaultGridM:Number(be.defaultGridM||.5)}),G(be.clientNotes||"")},[h?.project]),T.useEffect(()=>{ce(!1),Fe(!1),Se([])},[d,je]);const We=T.useMemo(()=>h&&{...h,placements:(h.placements||[]).map(be=>({...be,...q[be.id]||{}})),sceneObjects:(h.sceneObjects||[]).map(be=>
5186({...be,...ne[be.id]||{}}))},[h,q,ne]),Ct=T.useMemo(()=>h?OG(Number(h.project.lengthM),Number(h.project.widthM),Number(h.project.heightM)):null,[h]),zt=T.useMemo(()=>We&&Ct?UG(Ct.floorAreaM2,We.rooms,We.placements):null,[We,Ct]),Pt=T.useMemo(()=>We?FG(We.placements,Number(We.project.lengthM),Number(We.project.widthM)):[],[We]),_t=We?.placements?.find(be=>be.id===ot),kt=h?.rooms?.find(be=>be.id===mt),Rt=We?.sceneObjects?.find(be=>be.id===ge),qt=_t??Rt??null,Qt=T.useMemo(()=>(h?.rooms||[]).filter(be=>be.name.toLowerCase().includes(et.trim().toLowerCase())),[h?.rooms,et]);T.useMemo(()=>(h?.products||[]).filter(be=>be.showOnWebsite!==!1),[h?.products]);const nn=T.useMemo(()=>(h?.machineModels||[]).filter(be=>be.modelUrl&&["dxf","dwg","step","stp","iges","igs","glb","gltf"].includes(String(be.cadFileType||"").toLowerCase())),[h?.machineModels]),Cn=T.useMemo(()=>(Ce.points||[]).map(be=>({xM:Number(be.x??be.xM??0),yM:Number(be.y??be.yM??0),zM:Number(be.z??be.zM??0)})),[Ce.points]),Zt=T.useMemo(()=>{if(Rt?.objectType!=="pipe")return null;try{const be=JSON.parse(String(Rt.metadataJson||"{}"));return{materialType:"water",materialLabel:"مياه",flowColor:"#38BDF8",flowSpeed:1,isFlowing:!0,isLooping:!0,path:[],...be}}catch{return{materialType:"water",materialLabel:"مياه",flowColor:"#38BDF8",flowSpeed:1,isFlowing:!0,isLooping:!0,path:[]}}},[Rt]);T.useMemo(()=>{if(!_t||!Number(_t.machineModelId))return null;try{return{isExploded:!1,explodeAmount:1,processPipeEnabled:!1,materialType:"chocolate",materialLabel:"شوكولا",flowColor:"#5B2C1E",flowSpeed:1,isFlowing:!0,isLooping:!0,...JSON.parse(String(_t.metadataJson||"{}"))}}catch{return{isExploded:!1,explodeAmount:1,processPipeEnabled:!1,materialType:"chocolate",materialLabel:"شوكولا",flowColor:"#5B2C1E",flowSpeed:1,isFlowing:!0,isLooping:!0}}},[_t]),T.useEffect(()=>{if(Te!=="simulation"||ye)return;const be=_t?{targetType:"placement",targetId:_t.id,targetName:_t.name}:Rt?{targetType:"sceneObject",targetId:Rt.id,targetName:Rt.name}:null;be&&Re(It=>({...It,...be,name:It.name||`حركة ${be.targetName}`}))},[Te,_t,Rt,ye]);const Fn=be=>{if(!d||!h)return;const It=h.placements.length;es.mutate({factoryProjectId:d,machineModelId:be.id,productId:0,roomId:h.rooms[0]?.id||0,name:be.name,xM:Dl(2+It%6*3,Number(h.project.defaultGridM||.5)),yM:0,zM:Dl(2+Math.floor(It/6)*3,Number(h.project.defaultGridM||.5)),rotationX:0,rotationY:0,rotationZ:0,lengthM:Number(be.lengthM||2.5),widthM:Number(be.widthM||1.6),heightM:Number(be.heightM||2),isLocked:!1,isVisible:!0,notes:`تمت إضافتها من مكتبة CAD: ${be.cadFileName||be.name}`})},_n=be=>{if(!d||!h)return;const It=h.sceneObjects?.length||0,en=(be.category==="outdoor"||be.category==="infrastructure")&&be.objectType!=="pipe",ln=en?-5-It%3*4:3+It%4*2.2,Un=en?3+It%5*3:3+Math.floor(It/4)*2.2,Zn=be.objectType==="pipe"?JSON.stringify({materialType:"water",materialLabel:"مياه",flowColor:"#38BDF8",flowSpeed:1,isFlowing:!0,isLooping:!0,path:[{xM:ln,yM:be.heightM*.58,zM:Un},{xM:ln+be.lengthM,yM:be.heightM*.58,zM:Un}]}):void 0;gi.mutate({factoryProjectId:d,roomId:0,catalogKey:be.key,objectType:be.objectType,category:be.category,name:be.name,xM:ln,yM:0,zM:Un,rotationX:0,rotationY:0,rotationZ:0,scaleX:1,scaleY:1,scaleZ:1,lengthM:be.lengthM,widthM:be.widthM,heightM:be.heightM,color:be.color,labelText:be.objectType==="signboard"?"AMZ Production":be.objectType==="no_parking"?"ممنوع الوقوف":"",metadataJson:Zn,isLocked:!1,isVisible:!0})},Gt=be=>{ve(be?.type==="placement"?be.id:null),xt(be?.type==="room"?be.id:null),Y(be?.type==="sceneObject"?be.id:null),be&&Ye("props")},Rr=(be,It,en)=>{const ln=Number(h?.project?.defaultGridM||.5),Un={xM:Dl(en.xM,ln),yM:Math.max(0,Dl(en.yM,ln)),zM:Dl(en.zM,ln)};be==="room"?Ps.mutate({id:It,data:Un}):be==="placement"?as.mutate({id:It,data:Un}):Xr.mutate({id:It,data:Un})},mn=(be,It,en)=>{const ln=Number(h?.project?.defaultGridM||.5),Un={xM:Dl(en.xM,ln),yM:Math.max(0,Dl(en.yM,ln)),zM:Dl(en.zM,ln)};if(be==="room"){const Zn=h?.rooms?.find(Hr=>
5186Hr.id===It);if(!Zn)return;Ps.mutate({id:It,data:{...Un,rotationY:en.rotationY,lengthM:Math.max(.5,Number(Zn.lengthM)*Math.max(.2,en.scaleX)),widthM:Math.max(.5,Number(Zn.widthM)*Math.max(.2,en.scaleZ)),heightM:Math.max(2.7,Number(Zn.heightM)*Math.max(.2,en.scaleY))}})}else be==="placement"?as.mutate({id:It,data:{...Un,rotationX:en.rotationX,rotationY:en.rotationY,rotationZ:en.rotationZ,scaleX:en.scaleX,scaleY:en.scaleY,scaleZ:en.scaleZ}}):Xr.mutate({id:It,data:{...Un,rotationX:en.rotationX,rotationY:en.rotationY,rotationZ:en.rotationZ,scaleX:en.scaleX,scaleY:en.scaleY,scaleZ:en.scaleZ}})},Or=()=>{const be=_t?{targetType:"placement",targetId:_t.id,targetName:_t.name}:Rt?{targetType:"sceneObject",targetId:Rt.id,targetName:Rt.name}:null;if(!be){_e.error("اختر آلة أو عنصراً من المخطط أولاً");return}ft("three"),st("simulation"),ce(!0),Le(null),Re(It=>({...It,...be,name:`حركة ${be.targetName}`,points:[]})),_e.message("انقر على أرضية المصنع لإضافة نقاط المسار، ثم احفظ الحركة")},os=be=>{const It=Number(h?.project?.defaultGridM||.5);Re(en=>({...en,points:[...en.points||[],{x:Dl(be.xM,It),y:.25,z:Dl(be.zM,It)}]}))},gs=()=>{if(!Rt||Rt.objectType!=="pipe"||!Zt){_e.error("اختر أنبوباً من المخطط أولاً");return}ft("three"),Fe(!0),ce(!1),Se((Zt.path||[]).map(be=>({xM:Number(be.xM??be.x??0),yM:Number(be.yM??be.y??Number(Rt.heightM||2.2)*.58),zM:Number(be.zM??be.z??0)}))),_e.message("انقر أرضية المصنع لإضافة نقاط مسار الأنبوب، ثم احفظ المسار")},As=be=>{const It=Number(h?.project?.defaultGridM||.5),en=Number(Rt?.yM||0)+Number(Rt?.heightM||2.2)*.58;Se(ln=>[...ln,{xM:Dl(be.xM,It),yM:en,zM:Dl(be.zM,It)}])},At=(be={},It=ie)=>{if(!Rt||Rt.objectType!=="pipe"||!Zt)return;const en=JSON.stringify({...Zt,...be,path:It.map(ln=>({xM:Number(ln.xM),yM:Number(ln.yM),zM:Number(ln.zM)}))});Object.assign(h?.sceneObjects?.find(ln=>ln.id===Rt.id)||{},{metadataJson:en}),Z(ln=>({...ln,[Rt.id]:{...ln[Rt.id]||{},metadataJson:en}})),Xr.mutate({id:Rt.id,data:{metadataJson:en}})},Ht=()=>{if(ie.length<2){_e.error("أضف نقطتين على الأقل لمسار الأنبوب");return}At({},ie),Fe(!1),_e.success("تم حفظ مسار الأنبوب وتحديث التدفق")},Dn=()=>{if(kt){at({kind:"room",name:kt.name,rotationY:Number(kt.rotationY||0),lengthM:Number(kt.lengthM),widthM:Number(kt.widthM),heightM:Number(kt.heightM)}),_e.success("تم نسخ تدوير وأبعاد الغرفة");return}const be=_t||Rt;if(!be){_e.error("اختر عنصراً أو غرفة أولاً");return}at({kind:"element",name:be.name,rotationX:Number(be.rotationX||0),rotationY:Number(be.rotationY||0),rotationZ:Number(be.rotationZ||0),scaleX:Number(be.scaleX||1),scaleY:Number(be.scaleY||1),scaleZ:Number(be.scaleZ||1)}),_e.success("تم نسخ التدوير والتحجيم")},In=()=>{if(!Ae){_e.error("انسخ التحويلات من عنصر المصدر أولاً");return}if(kt){if(Ae.kind!=="room"){_e.error("لتطبيق أبعاد الغرفة، انسخ من غرفة أخرى أولاً");return}Ps.mutate({id:kt.id,data:{rotationY:Ae.rotationY,lengthM:Ae.lengthM,widthM:Ae.widthM,heightM:Ae.heightM}}),_e.success(`طُبّق تحويل ${Ae.name} على الغرفة`);return}const be=_t||Rt;if(!be){_e.error("اختر العنصر الهدف أولاً");return}if(Ae.kind!=="element"){_e.error("لتطبيق التحجيم، انسخ من آلة أو عنصر آخر أولاً");return}const It={rotationX:Ae.rotationX,rotationY:Ae.rotationY,rotationZ:Ae.rotationZ,scaleX:Ae.scaleX,scaleY:Ae.scaleY,scaleZ:Ae.scaleZ};_t?as.mutate({id:_t.id,data:It}):Rt&&Xr.mutate({id:Rt.id,data:It}),_e.success(`طُبّق تحويل ${Ae.name} على ${be.name}`)},xs=()=>{d&&Wn.mutate({id:d,data:le})},ii=()=>{d&&(Wn.mutate({id:d,data:{clientNotes:P}}),E(!1))},Cs=async()=>{if(!k){_e.error("اختر ملف CAD أولاً");return}const be=["dxf","dwg","step","stp","iges","igs","glb","gltf"],It=k.name.split(".").pop()?.toLowerCase()||"";if(!be.includes(It)){_e.error("اختر ملف DXF أو DWG أو STEP أو IGES أو GLB/GLTF");return}if(k.size>12*1024*1024){_e.error("حجم الملف يجب ألا يتجاوز 12 ميغابايت");return}const en=await new Promise((ln,Un)=>{const Zn=new FileReader;Zn.onload=()=>ln(String(Zn.result)),Zn.onerror=Un,Zn.readAsDataURL(k)});try{const ln=await Yt.mutateAsync({fileBase64:en,fileName:k.name,mimeType:k.type||"application/octet-stream"}),Un=await or.mutateAsync({name:U.trim()||k.name.replace(/\.[^.]+$/,""),code:`CAD-${Date.now().toString().slice(-6)}`,category:"cad",lengthM:2.5,widthM:1.6,heightM:2,modelUrl:ln.url,cadFileName:ln.fileName,cadFileType:ln.fileType,technicalDataJ
5186son:JSON.stringify({source:"cad",fileSize:ln.fileSize})});d&&h&&es.mutate({factoryProjectId:d,machineModelId:Number(Un.insertId||0),productId:0,roomId:h.rooms[0]?.id||0,name:U.trim()||k.name.replace(/\.[^.]+$/,""),xM:2,yM:0,zM:2,rotationX:0,rotationY:0,rotationZ:0,lengthM:2.5,widthM:1.6,heightM:2,isLocked:!1,isVisible:!0,notes:`CAD: ${ln.fileName}`})}catch(ln){_e.error(ln?.message||"تعذر رفع ملف CAD")}},ts=()=>{Le(null),Re({name:"",animationType:"vehicle",targetType:"sceneObject",targetId:0,color:"#0096A7",durationSeconds:8,playOrder:1,startDelaySeconds:0,isLooping:!0,points:m_})},pa=async()=>{if(!d||!h)return;if(!Ce.name.trim()){_e.error("اكتب اسم الحركة أولاً");return}if(!Array.isArray(Ce.points)||Ce.points.length<2){_e.error("أضف نقطتين على الأقل للمسار");return}const be={factoryProjectId:d,name:Ce.name.trim(),animationType:Ce.animationType,targetType:Ce.targetType,targetId:Number(Ce.targetId)||0,routeJson:JSON.stringify(Ce.points),color:Ce.color||"#0096A7",durationSeconds:Math.max(1,Number(Ce.durationSeconds)||8),playOrder:Math.max(1,Number(Ce.playOrder)||1),startDelaySeconds:Math.max(0,Number(Ce.startDelaySeconds)||0),isLooping:!!Ce.isLooping,isEnabled:!0,notes:"مسار يدوي يحدده المستخدم"};try{ye?await Ds.mutateAsync({id:ye,data:be}):await xi.mutateAsync(be),await n.factoryPlanner.workspace.invalidate(),_e.success(ye?"تم حفظ المسار":"تم إنشاء مسار الحركة"),F(ye||null),oe(It=>It+1),K(!0),ce(!1),ts()}catch(It){_e.error(It?.message||"تعذر إنشاء مسار الحركة")}},Bo=be=>{let It=m_;try{const en=JSON.parse(be.routeJson||"[]");Array.isArray(en)&&en.length>=2&&(It=en.map(ln=>({x:Number(ln.x??ln[0]??0),y:Number(ln.y??ln[1]??0),z:Number(ln.z??ln[2]??0)})))}catch{}Le(be.id),Re({name:be.name||"",animationType:be.animationType||"vehicle",targetType:be.targetType||"sceneObject",targetId:Number(be.targetId)||0,color:be.color||"#0096A7",durationSeconds:Number(be.durationSeconds)||8,playOrder:Number(be.playOrder)||1,startDelaySeconds:Number(be.startDelaySeconds)||0,isLooping:be.isLooping!==!1,points:It})},zi=async()=>{try{document.fullscreenElement?(await document.exitFullscreen(),ee(!1)):(await document.documentElement.requestFullscreen(),ee(!0))}catch{_e.error("لا يدعم المتصفح وضع ملء الشاشة في هذه الجلسة")}},Ei=(be,It)=>{O&&(O.target.x+=be,O.target.z+=It,O.object.position.x+=be,O.object.position.z+=It,O.update())},il=be=>{O&&(be==="in"?O.dollyIn?.(1.35):O.dollyOut?.(1.35),O.update())},wr=(be,It=!0)=>{const en=_t||Rt;if(!en){_e.error("اختر آلة أو عنصراً أولاً");return}const ln={xM:Number(en.xM||0),yM:Number(en.yM||0),zM:Number(en.zM||0),rotationX:Number(en.rotationX||0),rotationY:Number(en.rotationY||0),rotationZ:Number(en.rotationZ||0),scaleX:Number(en.scaleX||1),scaleY:Number(en.scaleY||1),scaleZ:Number(en.scaleZ||1)};if(_t){const Un=_t.id,Zn=q[Un];It&&Wt({type:"placement",id:Un,data:ln}),Object.assign(h?.placements?.find(Hr=>
5186Hr.id===Un)||{},be),Q(Hr=>({...Hr,[Un]:{...Hr[Un]||{},...be}})),as.mutate({id:Un,data:be},{onError:()=>Q(Hr=>({...Hr,[Un]:Zn||{}}))})}else if(Rt){const Un=Rt.id,Zn=ne[Un];It&&Wt({type:"sceneObject",id:Un,data:ln}),Object.assign(h?.sceneObjects?.find(Hr=>Hr.id===Un)||{},be),Z(Hr=>({...Hr,[Un]:{...Hr[Un]||{},...be}})),Xr.mutate({id:Un,data:be},{onError:()=>Z(Hr=>({...Hr,[Un]:Zn||{}}))})}},Is=be=>{const It=_t||Rt;if(!It){_e.error("اختر آلة أو عنصراً أولاً");return}const en=Math.max(.05,Je),ln=Math.PI/12,Un=1.12,Zn={};if(be==="left"&&(Zn.xM=Number(It.xM||0)-en),be==="right"&&(Zn.xM=Number(It.xM||0)+en),be==="up"&&(Zn.zM=Number(It.zM||0)-en),be==="down"&&(Zn.zM=Number(It.zM||0)+en),be==="rotateLeft"&&(Zn.rotationY=Number(It.rotationY||0)-ln),be==="rotateRight"&&(Zn.rotationY=Number(It.rotationY||0)+ln),be==="grow"||be==="shrink"){const Hr=be==="grow"?Un:1/Un;Zn.scaleX=Number(It.scaleX||1)*Hr,Zn.scaleY=Number(It.scaleY||1)*Hr,Zn.scaleZ=Number(It.scaleZ||1)*Hr}wr(Zn)},lo=()=>{if(!Et){_e.error("لا يوجد تعديل للتراجع عنه");return}const be=Et.data;Wt(null),wr(be,!1),_e.success("تم التراجع عن آخر تعديل")};return r?i.jsxs(bn,{className:"flex min-h-72 flex-col items-center justify-center gap-4 border-dashed p-8 text-center",dir:"rtl",children:[i.jsx(Jb,{className:"h-12 w-12 text-destructive"}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"تعذر تحميل مشاريع المصنع"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"تحقق من الاتصال ثم أعد محاولة قراءة بيانات التخطيط."})]}),i.jsx(ke,{onClick:()=>{s()},children:"إعادة المحاولة"})]}):a&&!e?i.jsxs(bn,{className:"flex min-h-72 flex-col items-center justify-center gap-4 border-dashed p-8 text-center",dir:"rtl",children:[i.jsx(Jb,{className:"h-12 w-12 text-destructive"}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"تأخر تحميل مشاريع المصنع"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"لم تصل بيانات التخطيط خلال المهلة المحددة. أعد المحاولة لتظهر قائمة المصانع ومساحة العمل."})]}),i.jsx(ke,{onClick:()=>{o(!1),s()},children:"إعادة المحاولة"})]}):t&&!a?i.jsx("div",{className:"flex h-64 items-center justify-center",children:i.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):i.jsxs("div",{className:"factory-workspace font-[Cairo]",dir:"rtl",children:[e?.length?je==="catalog"?i.jsxs("section",{className:"rounded-2xl border border-slate-200 bg-[#edf1f5] p-5 text-slate-900 shadow-[0_18px_42px_rgba(15,23,42,.11)]",children:[i.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-slate-200 pb-5",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-extrabold tracking-[.16em] text-primary",children:"AMZ · FACTORY SITES"}),i.jsx("h1",{className:"mt-1 text-2xl font-extrabold",children:"المصانع والمواقع الصناعية"}),i.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"اختر مصنعاً للدخول إلى بيئته ثلاثية الأبعاد، أو أنشئ مشروعاً جديداً."})]}),i.jsxs(ke,{className:"bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>{he(Kb),_(!0)},children:[i.jsx(Nn,{className:"ml-2 h-4 w-4"}),"مصنع جديد"]})]}),i.jsx("div",{className:"mt-5 grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:e.map(be=>i.jsxs("button",{type:"button",onClick:()=>{u(be.id),ve(null),xt(null),Y(null),Ie("workspace")},className:"group overflow-hidden rounded-2xl border border-slate-200 bg-white text-right shadow-sm transition hover:-translate-y-0.5 hover:border-primary/50 hover:shadow-xl",children:[i.jsxs("div",{className:"relative h-36 overflow-hidden bg-gradient-to-bl from-slate-800 via-slate-700 to-[#173d47] p-4",children:[i.jsx("div",{className:"absolute -bottom-14 -left-12 h-40 w-40 rounded-full bg-primary/25 blur-2xl"}),i.jsxs("div",{className:"relative flex items-start justify-between",children:[i.jsx("span",{className:"rounded-md bg-white/10 px-2 py-1 text-[10px] font-bold text-slate-200",children:be.projectNumber}),i.jsx(Vl,{className:"h-7 w-7 text-primary"})]}),i.jsxs("div",{className:"absolute bottom-4 right-4 flex items-end gap-2",children:[i.jsx("div",{className:"h-12 w-20 rounded-sm border border-white/25 bg-cyan-400/40"}),i.jsx("div",{className:"h-7 w-8 rounded-sm bg-teal-400/80"}),i.jsx("div",{className:"h-9 w-10 rounded-sm bg-emerald-400/60"})]})]}),i.jsxs("div",{className:"p-4",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-extrabold text-slate-900",children:be.name}),i.jsxs("p",{className:"mt-1 text-xs text-slate-500",children:[be.factoryType||"مصنع إنتاج"," · ",be.location||"الموقع غير محدد"]})]}),i.jsx(Qm,{className:"h-5 w-5 text-slate-400 transition group-hover:-translate-x-1 group-hover:text-orange-600"})]}),i.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-2 border-t border-slate-100 pt-3 text-center text-[10px] text-slate-500",children:[i.jsxs("span",{children:[i.jsx("b",{className:"block text-sm text-slate-800",children:be.roomCount}),"غرف"]}),i.jsxs("span",{children:[i.jsx("b",{className:"block text-sm text-slate-800",children:be.machineCount}),"آلات"]}),i.jsxs("span",{children:[i.jsx("b",{className:"block text-sm text-slate-800",children:be.sceneObjectCount||0}),"تجهيزات"]})]})]})]},be.id))})]}):x?i.jsxs(bn,{className:"flex min-h-72 flex-col items-center justify-center gap-4 p-8 text-center",children:[i.jsx(Jb,{className:"h-10 w-10 text-destructive"}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-bold",children:"تعذر تحميل مساحة عمل المصنع"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"أعد المحاولة لقراءة المخطط والآلات والمناطق."})]}),i.jsx(ke,{variant:"outline",onClick:()=>{y()},children:"إعادة المحاولة"})]}):p||!h?i.jsx(bn,{className:"p-16 text-center text-muted-foreground",children:"جارٍ تحميل مساحة العمل..."}):i.jsxs("section",{className:X?"fixed inset-0 z-[200] overflow-hidden bg-[#edf1f5] text-slate-900":"overflow-hidden rounded-2xl border border-slate-200 bg-[#edf1f5] text-slate-900 shadow-[0_18px_42px_rgba(15,23,42,.11)]",children:[i.jsxs("header",{className:`${X?"hidden":"flex"} min-h-16 flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3`,children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:i.jsx(Vl,{className:"h-5 w-5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"truncate text-sm font-extrabold",children:h.project.name}),i.jsxs("p",{className:"mt-0.5 text-[11px] text-slate-500",children:["تخطيط المصنع · ",h.project.projectNumber]})]}),i.jsx("span",{className:"hidden rounded-md border border-emerald-200 bg-emerald-50 px-2 py-1 text-[10px] font-bold text-emerald-700 lg:inline-flex",children:"محفوظ تلقائياً"})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs(ke,{size:"sm",variant:"outline",className:"border-slate-200 bg-white text-slate-700 hover:bg-slate-100",onClick:()=>Ie("catalog"),children:[i.jsx(Qm,{className:"ml-1.5 h-3.5 w-3.5"}),"المصانع"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"border-slate-200 bg-white text-slate-700 hover:bg-slate-100",onClick:()=>{he(Kb),_(!0)},children:[i.jsx(Nn,{className:"ml-1.5 h-3.5 w-3.5"}),"مصنع"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"border-slate-200 bg-white text-slate-700 hover:bg-slate-100",onClick:()=>d&&ks.mutate({id:d}),children:[i.jsx(VS,{className:"ml-1.5 h-3.5 w-3.5"}),"نسخ"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10",onClick:()=>E(!0),children:[i.jsx(iN,{className:"ml-1.5 h-3.5 w-3.5"}),"ملاحظات"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10",onClick:()=>I(!0),children:[i.jsx(WS,{className:"ml-1.5 h-3.5 w-3.5"}),"CAD"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10",onClick:()=>Ke(be=>!be),children:[i.jsx(VS,{className:"ml-1.5 h-3.5 w-3.5"}),pe?"إخفاء النسخ":"نسخ التحويلات"]}),i.jsxs(ke,{size:"sm",variant:"outline",className:"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10",onClick:()=>{zi()},children:[i.jsx(B2,{className:"ml-1.5 h-3.5 w-3.5"}),X?"تصغير":"تكبير"]}),h.project.isPreviewEnabled&&h.project.shareToken?i.jsxs(i.Fragment,{children:[i.jsxs(ke,{size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>He(h.project.shareToken),children:[i.jsx(YD,{className:"ml-1.5 h-3.5 w-3.5"}),"رابط العميل"]}),i.jsx(ke,{size:"sm",variant:"outline",className:"border-slate-200 bg-white text-slate-700 hover:bg-slate-100",onClick:()=>d&&Ze.mutate({id:d}),children:"إلغاء الرابط"})]}):i.jsxs(ke,{size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>d&&rt.mutate({id:d}),children:[i.jsx(YD,{className:"ml-1.5 h-3.5 w-3.5"}),"إنشاء رابط معاينة"]})]})]}),i.jsxs("div",{className:`${X?"hidden":"flex"} flex-wrap items-center gap-2 border-b border-slate-200 bg-slate-50 px-4 py-2.5`,children:[i.jsx("div",{className:"ml-auto flex flex-wrap gap-1.5",children:e.map(be=>i.jsx("button",{type:"button",onClick:()=>{u(be.id),ve(null),xt(null)},className:`rounded-md border px-2.5 py-1.5 text-xs font-bold transition ${d===be.id?"border-orange-300 bg-orange-50 text-orange-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-100"}`,children:be.name},be.id))}),i.jsx(ke,{size:"sm",variant:"ghost",className:"h-8 px-2 text-slate-500 hover:bg-slate-200 hover:text-slate-700",onClick:()=>d&&de.mutate({id:d}),children:"أرشفة"})]}),i.jsxs(p0e,{direction:"horizontal",className:"min-h-[690px]",dir:"ltr",children:[i.jsx(oj,{defaultSize:20,minSize:15,className:X?"hidden":se?"min-w-0 bg-white":"min-w-0 !basis-[38px] !grow-0 !shrink-0 overflow-hidden bg-white",dir:"rtl",children:i.jsxs("aside",{className:`${se?"flex":"hidden"} h-full flex-col`,dir:"rtl",children:[i.jsx("div",{className:"flex items-center gap-1 border-b border-slate-200 px-3 py-2.5",children:[{key:"props",label:"خصائص",icon:aQ},{key:"stats",label:"إحصاءات",icon:S_},{key:"layers",label:"طبقات",icon:dy}].map(be=>i.jsxs("button",{type:"button",onClick:()=>Ye(be.key),className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-bold transition ${Ne===be.key?"bg-orange-50 text-orange-700":"text-slate-500 hover:bg-slate-100"}`,children:[i.jsx(be.icon,{className:"h-3.5 w-3.5"}),be.label]},be.key))}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[Ne==="props"&&(_t?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-bold tracking-[.12em] text-orange-600",children:"العنصر المحدد"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:_t.name})]}),i.jsx("div",{className:"rounded-xl border border-orange-200 bg-orange-50 p-3 text-xs text-orange-800",children:"تم تحديد آلة داخل المخطط. يمكنك مراجعة أبعادها وموقعها ثم حذفها عند الحاجة."}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["الطول ",i.jsxs("b",{className:"block mt-1",children:[_t.lengthM," م"]})]}),i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["العرض ",i.jsxs("b",{className:"block mt-1",children:[_t.widthM," م"]})]}),i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["الارتفاع ",i.jsxs("b",{className:"block mt-1",children:[_t.heightM," م"]})]}),i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["الموضع ",i.jsxs("b",{className:"block mt-1",children:[_t.xM," ، ",_t.zM]})]})]}),i.jsxs("div",{className:"rounded-lg border border-slate-200 p-3 text-xs text-slate-600",children:[i.jsx("span",{className:"font-bold text-slate-800",children:"الغرفة:"})," ",h.rooms.find(be=>be.id===_t.roomId)?.name||"غير محددة"]}),i.jsxs(ke,{variant:"destructive",className:"w-full",onClick:()=>Tr.mutate({id:_t.id}),children:[i.jsx(Ar,{className:"ml-2 h-4 w-4"}),"إزالة من المخطط"]})]}):kt?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-bold tracking-[.12em] text-orange-600",children:"الغرفة المحددة"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:kt.name})]}),i.jsx("div",{className:"h-2 rounded-full",style:{backgroundColor:kt.color||"#3b82f6"}}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["الطول ",i.jsxs("b",{className:"block mt-1",children:[kt.lengthM," م"]})]}),i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["العرض ",i.jsxs("b",{className:"block mt-1",children:[kt.widthM," م"]})]}),i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["الارتفاع ",i.jsxs("b",{className:"block mt-1",children:[kt.heightM," م"]})]}),i.jsxs("div",{className:"rounded-lg bg-slate-100 p-2.5",children:["المساحة ",i.jsxs("b",{className:"block mt-1",children:[Number(kt.lengthM)*Number(kt.widthM)," م²"]})]})]}),i.jsx(ke,{variant:"outline",className:"w-full border-slate-200 text-slate-700",onClick:()=>xt(null),children:"إلغاء تحديد الغرفة"})]}):i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-bold tracking-[.12em] text-orange-600",children:"خصائص المصنع"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:h.project.name}),i.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-500",children:"عدّل أبعاد المصنع الحقيقية ثم احفظها لتنعكس فوراً في المخطط."})]}),i.jsx(Vt,{label:"اسم المصنع",children:i.jsx(Ee,{value:le.name,onChange:be=>Xe({...le,name:be.target.value}),className:"h-9 border-slate-200 bg-slate-50 text-slate-900"})}),i.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[i.jsx(kl,{label:"الطول",min:1,value:le.lengthM,onChange:be=>Xe({...le,lengthM:be})}),i.jsx(kl,{label:"العرض",min:1,value:le.widthM,onChange:be=>Xe({...le,widthM:be})}),i.jsx(kl,{label:"الارتفاع",min:1,value:le.heightM,onChange:be=>Xe({...le,heightM:be})})]}),i.jsxs("div",{className:"rounded-xl bg-slate-100 p-3",children:[i.jsxs("div",{className:"flex justify-between text-xs text-slate-500",children:[i.jsx("span",{children:"مساحة الأرضية"}),i.jsxs("b",{className:"text-slate-900",children:[Ct?.floorAreaM2.toLocaleStr
5186ing()," م²"]})]}),i.jsxs("div",{className:"mt-2 flex justify-between text-xs text-slate-500",children:[i.jsx("span",{children:"حجم المصنع"}),i.jsxs("b",{className:"text-slate-900",children:[Ct?.volumeM3.toLocaleString()," م³"]})]})]}),i.jsxs(ke,{className:"w-full bg-orange-500 text-white hover:bg-orange-600",disabled:Wn.isPending,onClick:xs,children:[i.jsx(Km,{className:"ml-2 h-4 w-4"}),"حفظ الخصائص"]})]})),Ne==="stats"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-bold tracking-[.12em] text-orange-600",children:"تحليل فوري"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:"السعة والسلامة"})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"rounded-xl border border-slate-200 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-xs text-slate-500",children:"استغلال المساحة"}),i.jsx(XD,{className:"h-4 w-4 text-emerald-600"})]}),i.jsxs("p",{className:"mt-2 text-2xl font-extrabold",children:[zt?.usedPercent,"%"]})]}),i.jsxs("div",{className:"rounded-xl border border-slate-200 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-xs text-slate-500",children:"آلات موضوعة"}),i.jsx(uy,{className:"h-4 w-4 text-amber-600"})]}),i.jsx("p",{className:"mt-2 text-2xl font-extrabold",children:h.placements.length})]}),i.jsxs("div",{className:"rounded-xl border border-slate-200 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-xs text-slate-500",children:"تنبيهات التخطيط"}),i.jsx(tk,{className:`h-4 w-4 ${Pt.length?"text-red-600":"text-emerald-600"}`})]}),i.jsx("p",{className:"mt-2 text-2xl font-extrabold",children:Pt.length})]})]}),Pt.length?i.jsx("div",{className:"space-y-2",children:Pt.slice(0,3).map((be,It)=>i.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 p-2.5 text-xs leading-5 text-red-700",children:be.message},`${be.type}-${It}`))}):i.jsxs("div",{className:"rounded-xl border border-emerald-200 bg-emerald-50 p-3 text-xs leading-6 text-emerald-700",children:[i.jsx(jx,{className:"ml-1 inline h-4 w-4"}),"لا توجد تصادمات أو تجاوزات للحدود."]})]}),Ne==="layers"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-bold tracking-[.12em] text-orange-600",children:"طبقات المشروع"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:"محتويات المخطط"})]}),[{icon:fh,label:"الغرف والمناطق",value:h.rooms.length,color:"text-blue-600"},{icon:uy,label:"الآلات",value:h.placements.length,color:"text-amber-600"},{icon:iQ,label:"شبكة القياس",value:`${h.project.defaultGridM} م`,color:"text-violet-600"}].map(be=>i.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-slate-200 p-3",children:[i.jsx(be.icon,{className:`h-5 w-5 ${be.color}`}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm font-bold",children:be.label}),i.jsx("p",{className:"text-xs text-slate-500",children:"مرئي في المشهد"})]}),i.jsx("span",{className:"text-sm font-extrabold",children:be.value})]},be.label))]})]})]})}),i.jsx(PB,{withHandle:!0,className:"bg-slate-200"}),i.jsx(oj,{defaultSize:59,minSize:40,className:X?"min-w-0 !basis-full !grow !shrink-0":"min-w-0",dir:"rtl",children:i.jsxs("main",{className:"flex h-full min-w-0 flex-col bg-[#edf1f5]",dir:"rtl",children:[i.jsxs("div",{className:`${X?"hidden":"flex"} flex-wrap items-center gap-1 border-b border-slate-200 bg-white px-4 py-2`,children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"border-primary/30 px-2 text-xs text-primary hover:bg-primary/10",onClick:()=>me(be=>!be),children:se?"إغلاق الخصائص":"فتح الخصائص"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"border-primary/30 px-2 text-xs text-primary hover:bg-primary/10",onClick:()=>Be(be=>!be),children:ze?"إغلاق القائمة":"فتح القائمة"})]}),i.jsxs("div",{className:`${X?"hidden":"flex"} flex-wrap items-center gap-2 border-b border-primary/10 bg-primary/5 px-4 py-2`,dir:"rtl",children:[i.jsx("span",{className:"text-[11px] font-bold text-slate-600",children:"حدّد آلة أو عنصراً لتظهر مقابض التحريك والتدوير والتحجيم تلقائياً."}),i.jsx(ke,{type:"button",size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90",onClick:Or,children:"1. اختر عنصراً ثم ارسم المسار"}),(vt||Me)&&i.jsxs("div",{className:"flex items-center gap-1 rounded-md border border-primary/25 bg-white px-2 py-1 text-[11px] text-primary",children:[i.jsx("span",{children:Me?`انقر الأرضية لإضافة نقاط الأنبوب (${ie.length})`:`انقر الأرضية لإضافة نقاط (${Ce.points?.length||0})`}),i.jsx("button",{type:"button",onClick:()=>Me?Se(be=>be.slice(0,-1)):Re(be=>({...be,points:(be.points||[]).slice(0,-1)})),className:"mr-1 underline",children:"تراجع"}),Me?i.jsx("button",{type:"button",onClick:Ht,className:"mr-1 underline",children:"حفظ المسار"}):i.jsx("button",{type:"button",onClick:()=>ce(!1),className:"mr-1 underline",children:"إنهاء الرسم"})]})]}),i.jsxs("div",{className:`${X?"hidden":"flex"} flex-wrap items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 py-3`,children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"rounded-md bg-primary/10 px-2 py-1 text-[10px] font-bold text-primary",children:"مساحة العمل"}),i.jsx("h1",{className:"font-extrabold",children:Ve==="three"?"الموقع الصناعي ثلاثي الأبعاد":"المخطط الهندسي"})]}),i.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"اسحب أرضية فارغة بالزر الأيسر لتحريك الكاميرا، أو اضغط Shift واسحب أثناء تحديد آلة. تُحجز إيماءات الآلة للتحريك والتدوير والتحجيم فقط."})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 p-1",children:[i.jsxs("button",{type:"button",onClick:()=>ft("plan"),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-bold ${Ve==="plan"?"bg-white text-primary shadow-sm":"text-slate-500"}`,children:[i.jsx(XD,{className:"h-3.5 w-3.5"}),"2D"]}),i.jsxs("button",{type:"button",onClick:()=>ft("three"),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-bold ${Ve==="three"?"bg-primary text-primary-foreground shadow-sm":"text-slate-500"}`,children:[i.jsx(jY,{className:"h-3.5 w-3.5"}),"3D"]}),i.jsxs("button",{type:"button",onClick:()=>{F(null),oe(be=>be+1),K(be=>!be)},className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-bold ${z?"bg-primary text-primary-foreground":"text-primary hover:bg-primary/10"}`,children:[i.jsx(nk,{className:"h-3.5 w-3.5"}),z?"إيقاف المحاكاة":"تشغيل التسلسل"]})]})]}),i.jsxs("div",{className:"relative min-h-[590px] flex-1",children:[qt&&i.jsxs("div",{className:"absolute left-3 top-3 z-30 w-64 roun
5186ded-xl border border-primary/25 bg-white/95 p-2.5 shadow-xl backdrop-blur",dir:"rtl",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-extrabold text-primary",children:"إعدادات التحكم الكاملة"}),i.jsx("p",{className:"max-w-40 truncate text-[11px] text-slate-500",children:qt.name})]}),i.jsx("span",{className:"rounded-md bg-primary/10 px-2 py-1 text-[10px] font-bold text-primary",children:"تحديث فوري"})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-1.5",children:[i.jsxs("label",{className:"text-[10px] text-slate-500",children:["X",i.jsx(Ee,{type:"number",step:"0.1",className:"mt-1 h-8 px-2 text-xs",value:Number(qt.xM||0),onChange:be=>wr({xM:Number(be.target.value)||0})})]}),i.jsxs("label",{className:"text-[10px] text-slate-500",children:["Y",i.jsx(Ee,{type:"number",step:"0.1",className:"mt-1 h-8 px-2 text-xs",value:Number(qt.yM||0),onChange:be=>wr({yM:Number(be.target.value)||0})})]}),i.jsxs("label",{className:"text-[10px] text-slate-500",children:["Z",i.jsx(Ee,{type:"number",step:"0.1",className:"mt-1 h-8 px-2 text-xs",value:Number(qt.zM||0),onChange:be=>wr({zM:Number(be.target.value)||0})})]})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-4 gap-1.5",children:[i.jsxs("label",{className:"text-[10px] text-slate-500",children:["X°",i.jsx(Ee,{type:"number",step:"5",className:"mt-1 h-8 px-1 text-center text-xs",value:Math.round(Number(qt.rotationX||0)*180/Math.PI),onChange:be=>wr({rotationX:(Number(be.target.value)||0)*Math.PI/180})})]}),i.jsxs("label",{className:"text-[10px] text-slate-500",children:["Y°",i.jsx(Ee,{type:"number",step:"5",className:"mt-1 h-8 px-1 text-center text-xs",value:Math.round(Number(qt.rotationY||0)*180/Math.PI),onChange:be=>wr({rotationY:(Number(be.target.value)||0)*Math.PI/180})})]}),i.jsxs("label",{className:"text-[10px] text-slate-500",children:["Z°",i.jsx(Ee,{type:"number",step:"5",className:"mt-1 h-8 px-1 text-center text-xs",value:Math.round(Number(qt.rotationZ||0)*180/Math.PI),onChange:be=>wr({rotationZ:(Number(be.target.value)||0)*Math.PI/180})})]}),i.jsxs("label",{className:"text-[10px] text-slate-500",children:["المقياس",i.jsx(Ee,{type:"number",step:"0.1",min:"0.1",className:"mt-1 h-8 px-1 text-center text-xs",value:Number(qt.scaleX||1),onChange:be=>{const It=Math.max(.1,Number(be.target.value)||1);wr({scaleX:It,scaleY:It,scaleZ:It})}})]})]}),Zt&&i.jsxs("div",{className:"mt-2 rounded-xl border border-cyan-200 bg-cyan-50/70 p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-[11px] font-extrabold text-cyan-800",children:"تدفق داخل الأنبوب"}),i.jsxs("span",{className:"rounded bg-white px-1.5 py-0.5 text-[9px] font-bold text-cyan-700",children:[Zt.path?.length||0," نقاط"]})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-1.5",children:[i.jsxs("label",{className:"text-[10px] font-bold text-slate-600",children:["المادة",i.jsxs("select",{value:Zt.materialType,onChange:be=>{const It={water:{materialLabel:"مياه",flowColor:"#38BDF8"},chocolate:{materialLabel:"شوكولا",flowColor:"#5B2C1E"},custom:{materialLabel:"مادة مخصصة",flowColor:"#A855F7"}};At({materialType:be.target.value,...It[be.target.value]})},className:"mt-1 h-8 w-full rounded border border-cyan-200 bg-white px-1 text-xs outline-none",children:[i.jsx("option",{value:"water",children:"مياه"}),i.jsx("option",{value:"chocolate",children:"شوكولا"}),i.jsx("option",{value:"custom",children:"مادة أخرى"})]})]}),i.jsxs("label",{className:"text-[10px] font-bold text-slate-600",children:["اسم المادة",i.jsx(Ee,{value:Zt.materialLabel,onChange:be=>At({materialLabel:be.target.value||"مادة"}),className:"mt-1 h-8 border-cyan-200 bg-white px-2 text-xs"})]})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-[1fr_auto] items-end gap-2",children:[i.jsxs("label",{className:"text-[10px] font-bold text-slate-600",children:["سرعة التدفق ",i.jsxs("b",{className:"text-cyan-700",children:[Number(Zt.flowSpeed||1).toFixed(2),"×"]}),i.jsx("input",{type:"range",min:"0.25",max:"4",step:"0.25",value:Number(Zt.flowSpeed||1),onChange:be=>At({flowSpeed:Number(be.target.value)||1}),className:"mt-1 w-full accent-cyan-600"})]}),i.jsx("input",{"aria-label":"لون المادة داخل الأنبوب",type:"color",value:Zt.flowColor,onChange:be=>At({flowColor:be.target.value}),className:"h-8 w-9 cursor-pointer rounded border border-cyan-200 bg-white p-0.5"})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",className:"h-8 bg-cyan-700 px-1 text-[10px] text-white hover:bg-cyan-800",onClick:()=>At({isFlowing:!Zt.isFlowing}),children:Zt.isFlowing?"إيقاف التدفق":"تشغيل التدفق"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 border-cyan-300 px-1 text-[10px] text-cyan-800",onClick:()=>At({isLooping:!Zt.isLooping}),children:Zt.isLooping?"تكرار مستمر":"تدفق مرة واحدة"})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 border-cyan-300 px-1 text-[10px] text-cyan-800",onClick:gs,children:"رسم مسار الأنبوب"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 border-slate-200 px-1 text-[10px] text-slate-600",onClick:()=>{Se([]),At({},[])},children:"مسح المسار"})]}),i.jsx("p",{className:"mt-1.5 text-[9px] leading-4 text-slate-500",children:"ارسم نقاط المسار بنفسك؛ سترى المادة تتحرك داخل الأنبوب مباشرة."})]}),i.jsxs("div",{className:"mt-2",children:[i.jsx("p",{className:"mb-1 text-[10px] font-bold text-slate-500",children:"اتجاه ملف CAD"}),i.jsxs("div",{className:"grid grid-cols-3 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-primary/25 px-1 text-[10px] text-primary",onClick:()=>wr({rotationX:0,rotationZ:0}),children:"قائم"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-slate-200 px-1 text-[10px] text-slate-600",onClick:()=>wr({rotationX:Math.PI/2,rotationZ:0}),children:"90° X"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-slate-200 px-1 text-[10px] text-slate-600",onClick:()=>wr({rotationX:0,rotationZ:Math.PI/2}),children:"90° Z"})]}),i.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-primary/25 px-1 text-[10px] text-primary",onClick:()=>wr({rotationX:-Math.PI/2,rotationZ:0}),children:"قلب لأعلى ↑"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-primary/25 px-1 text-[10px] text-primary",onClick:()=>wr({rotationX:Math.PI/2,rotationZ:0}),children:"قلب لأسفل ↓"})]})]}),i.jsxs("div",{className:"mt-2 rounded-lg border border-primary/15 bg-primary/5 p-2",children:[i.jsx("p",{className:"mb-1.5 text-[10px] font-bold text-primary",children:"قلب ودوران جميع المحاور"}),i.jsxs("div",{className:"grid grid-cols-3 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-primary/25 px-1 text-[10px] text-primary",onClick:()=>wr({rotationX:Number(qt.rotationX||0)+Math.PI/2}),children:"X +90°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-primary/25 px-1 text-[10px] text-primary",onClick:()=>wr({rotationY:Number(qt.rotationY||0)+Math.PI/2}),children:"Y +90°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-primary/25 px-1 text-[10px] text-primary",onClick:()=>wr({rotationZ:Number(qt.rotationZ||0)+Math.PI/2}),children:"Z +90°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-slate-200 px-1 text-[10px] text-slate-600",onClick:()=>wr({rotationX:Number(qt.rotationX||0)-Math.PI/2}),children:"X −90°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-slate-200 px-1 text-[10px] text-slate-600",onClick:()=>wr({rotationY:Number(qt.rotationY||0)-Math.PI/2}),children:"Y −90°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-slate-200 px-1 text-[10px] text-slate-600",onClick:()=>wr({rotationZ:Number(qt.rotationZ||0)-Math.PI/2}),children:"Z −90°"})]}),i.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-orange-200 px-1 text-[10px] text-orange-700",onClick:()=>wr({rotationX:Number(qt.rotationX||0)+Math.PI}),children:"قلب X 180°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-orange-200 px-1 text-[10px] text-orange-700",onClick:()=>wr({rotationY:Number(qt.rotationY||0)+Math.PI}),children:"قلب Y 180°"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-7 border-orange-200 px-1 text-[10px] text-orange-700",onClick:()=>wr({rotationZ:Number(qt.rotationZ||0)+Math.PI}),children:"قلب Z 180°"})]})]}),i.jsxs("div",{className:"mt-2 flex items-center justify-between rounded-lg bg-slate-50 p-2",children:[i.jsxs("label",{className:"text-[10px] font-bold text-slate-600",children:["مقدار الحركة",i.jsx("input",{type:"number",min:"0.05",step:"0.05",className:"mr-2 w-14 roun
5186ded border border-slate-200 bg-white px-1 py-1 text-center text-xs",value:Je,onChange:be=>it(Math.max(.05,Number(be.target.value)||.5))})]}),i.jsx("span",{className:"text-[10px] text-slate-400",children:"متر"})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-4 gap-1",dir:"ltr",children:[i.jsx("span",{}),i.jsx(ke,{type:"button",size:"sm",className:"h-8 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("up"),children:"↑"}),i.jsx("span",{}),i.jsx(ke,{type:"button",size:"sm",className:"h-8 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("left"),children:"←"}),i.jsx(ke,{type:"button",size:"sm",className:"h-8 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("down"),children:"↓"}),i.jsx(ke,{type:"button",size:"sm",className:"h-8 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("right"),children:"→"})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 border-primary/25 text-primary",onClick:()=>lo(),children:"تراجع"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 border-slate-200 text-slate-600",onClick:()=>wr({xM:0,yM:0,zM:0,rotationX:0,rotationY:0,rotationZ:0,scaleX:1,scaleY:1,scaleZ:1}),children:"إعادة ضبط"})]})]}),Ve==="three"?i.jsxs(i.Fragment,{children:[i.jsx(YR,{workspace:We,interactive:!0,playSimulation:z,simulationRunId:ae,singleTrackId:re,routeDrafting:vt||Me,routePoints:Me?ie:Cn,onRoutePoint:Me?As:os,selection:ot?{type:"placement",id:ot}:mt?{type:"room",id:mt}:ge?{type:"sceneObject",id:ge}:null,onSelect:Gt,onMove:Rr,onTransform:mn,onCameraReady:J,onCanvasReady:Sn}),i.jsxs("div",{className:"absolute bottom-4 right-4 z-20 rounded-xl border border-primary/20 bg-white/95 p-1.5 shadow-lg backdrop-blur",dir:"ltr",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-1",children:[i.jsx("span",{}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 w-8 p-0 text-primary",onClick:()=>Ei(0,-3),title:"تحريك للأعلى",children:"↑"}),i.jsx("span",{}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 w-8 p-0 text-primary",onClick:()=>Ei(-3,0),title:"تحريك لليسار",children:"←"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 w-8 p-0 text-primary",onClick:()=>Ei(0,3),title:"تحريك للأسفل",children:"↓"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 w-8 p-0 text-primary",onClick:()=>Ei(3,0),title:"تحريك لليمين",children:"→"})]}),i.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 px-2 text-primary",onClick:()=>il("in"),title:"تكبير",children:"+"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 px-2 text-primary",onClick:()=>il("out"),title:"تصغير",children:"−"})]})]}),qt&&i.jsxs("div",{className:"absolute bottom-4 left-4 z-20 w-44 rounded-xl border border-primary/25 bg-white/95 p-2 shadow-xl backdrop-blur",dir:"rtl",children:[i.jsxs("p",{className:"mb-2 truncate text-center text-[11px] font-extrabold text-primary",children:["تحكم مباشر: ",qt.name]}),i.jsxs("div",{className:"grid grid-cols-3 gap-1",dir:"ltr",children:[i.jsx("span",{}),i.jsx(ke,{type:"button",size:"sm",className:"h-9 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("up"),children:"↑"}),i.jsx("span",{}),i.jsx(ke,{type:"button",size:"sm",className:"h-9 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("left"),children:"←"}),i.jsx(ke,{type:"button",size:"sm",className:"h-9 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("down"),children:"↓"}),i.jsx(ke,{type:"button",size:"sm",className:"h-9 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Is("right"),children:"→"})]}),i.jsxs("div",{className:"mt-1 grid grid-cols-4 gap-1",children:[i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 px-1 text-primary",title:"تدوير لليسار",onClick:()=>Is("rotateLeft"),children:"↺"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 px-1 text-primary",title:"تدوير لليمين",onClick:()=>Is("rotateRight"),children:"↻"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 px-1 text-primary",title:"تكبير",onClick:()=>Is("grow"),children:"+"}),i.jsx(ke,{type:"button",size:"sm",variant:"outline",className:"h-8 px-1 text-primary",title:"تصغير",onClick:()=>
5186Is("shrink"),children:"−"})]})]})]}):i.jsx(D0e,{workspace:h,selectedPlacementId:ot,onSelect:be=>{ve(be),xt(null),Y(null),Ye("props")}}),!X&&i.jsxs("div",{className:"absolute bottom-4 right-4 rounded-lg border border-primary/20 bg-white/95 px-3 py-2 text-[11px] text-slate-600 shadow-lg",children:[i.jsx("span",{className:"font-bold text-slate-800",children:Ve==="three"?"موقع 3D قابل للتحريك":"مخطط 2D"}),i.jsx("span",{className:"mx-2 text-slate-300",children:"|"}),"جدران ",h.project.heightM," م"]}),X&&i.jsx(ke,{size:"sm",className:"absolute left-4 top-4 bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>{zi()},children:"خروج من التكبير"})]})]})}),i.jsx(PB,{withHandle:!0,className:"bg-slate-200"}),i.jsx(oj,{defaultSize:21,minSize:16,className:X?"hidden":ze?"min-w-0 bg-white":"min-w-0 !basis-[38px] !grow-0 !shrink-0 overflow-hidden bg-white",dir:"ltr",children:i.jsxs("aside",{className:`${ze?"flex":"hidden"} h-full`,dir:"ltr",children:[i.jsxs("nav",{className:"flex w-10 shrink-0 flex-col items-center gap-1.5 bg-[#1c2328] py-2","aria-label":"أدوات مساحة العمل",children:[i.jsx(Tm,{active:Te==="rooms",label:"الغرف",onClick:()=>st("rooms"),children:i.jsx(fh,{className:"h-4 w-4"})}),i.jsx(Tm,{active:Te==="machines",label:"الآلات",onClick:()=>st("machines"),children:i.jsx(uy,{className:"h-4 w-4"})}),i.jsx(Tm,{active:Te==="elements",label:"عناصر الموقع",onClick:()=>st("elements"),children:i.jsx(Bj,{className:"h-4 w-4"})}),i.jsx(Tm,{active:C,label:"رفع CAD",onClick:()=>I(!0),children:i.jsx(WS,{className:"h-4 w-4"})}),i.jsx(Tm,{active:Te==="simulation",label:"المحاكاة الحية",onClick:()=>st("simulation"),children:i.jsx(nk,{className:"h-4 w-4"})}),i.jsx(Tm,{active:Ne==="stats",label:"تحليل السلامة",onClick:()=>Ye("stats"),children:i.jsx(tk,{className:"h-4 w-4"})}),i.jsx(Tm,{active:Ne==="layers",label:"الطبقات",onClick:()=>Ye("layers"),children:i.jsx(dy,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"relative min-w-0 flex-1 overflow-hidden",dir:"rtl",children:Te==="rooms"?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"border-b border-slate-200 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h2",{className:"font-extrabold",children:"الغرف"}),i.jsx("span",{className:"rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-bold text-slate-600",children:h.rooms.length})]}),i.jsxs(ke,{size:"sm",className:"mt-3 h-9 w-full bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>S(!0),children:[i.jsx(Nn,{className:"ml-1.5 h-3.5 w-3.5"}),"إضافة غرفة"]}),i.jsxs("div",{className:"relative mt-3",children:[i.jsx(si,{className:"absolute right-2.5 top-2.5 h-3.5 w-3.5 text-slate-400"}),i.jsx(Ee,{value:et,onChange:be=>Qe(be.target.value),placeholder:"البحث عن الغرف",className:"h-8 border-slate-200 bg-slate-50 pr-8 text-xs text-slate-900 focus-visible:ring-primary"})]})]}),i.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[Qt.map((be,It)=>i.jsxs("button",{type:"button",onClick:()=>{xt(be.id),ve(null),Ye("props")},className:`flex w-full items-center gap-2 rounded-lg border p-2.5 text-right transition ${mt===be.id?"border-primary/30 bg-primary/5":"border-slate-200 bg-white hover:border-primary/20 hover:bg-primary/5"}`,children:[i.jsx("span",{className:"h-3 w-3 shrink-0 rounded-full",style:{backgroundColor:be.color||kM[It%kM.length]}}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-xs font-extrabold text-slate-800",children:be.name}),i.jsxs("span",{className:"mt-0.5 block text-[10px] text-slate-500",children:[be.roomType||"منطقة تشغيل"," · ",be.lengthM,"×",be.widthM,"م"]})]}),i.jsx(Qm,{className:"h-3.5 w-3.5 text-slate-400"})]},be.id)),!Qt.length&&i.jsx("div",{className:"rounded-lg border border-dashed border-slate-200 p-4 text-center text-xs text-slate-500",children:"لا توجد غرف مطابقة للبحث."})]})]}):i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"border-b border-slate-200 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h2",{className:"font-extrabold",children:"مكتبة الآلات CAD"}),i.jsx("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-bold text-primary",children:nn.length})]}),i.jsx("p",{className:"mt-1 text-[11px] leading-5 text-slate-500",children:"هذه المكتبة تعرض ملفات CAD المرفوعة فقط. اختر نموذجاً لوضعه داخل المصنع."})]}),i.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[nn.map(be=>i.jsxs("button",{type:"button",onClick:()=>Fn(be),className:"flex w-full items-center gap-2 rounded-lg border border-slate-200 bg-white p-2.5 text-right transition hover:border-primary/30 hover:bg-primary/5",children:[i.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary",children:i.jsx(WS,{className:"h-4 w-4"})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-xs font-extrabold text-slate-800",children:be.name}),i.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-slate-500",children:[String(be.cadFileType||"CAD").toUpperCase()," · ",be.cadFileName||"ملف CAD محفوظ"]})]}),i.jsx(Nn,{className:"h-3.5 w-3.5 text-primary"})]},be.id)),!nn.length&&i.jsx("div",{className:"rounded-lg border border-dashed border-primary/20 bg-primary/5 p-4 text-center text-xs leading-6 text-slate-500",children:"لا توجد ملفات CAD مرفوعة. استخدم زر CAD أعلى المحرر لرفع أول آلة."})]})]})})]})})]}),!X&&i.jsxs("footer",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-slate-200 bg-white px-4 py-2 text-[11px] text-slate-500",children:[i.jsxs("span",{children:["الغرف: ",i.jsx("b",{className:"text-slate-800",children:h.rooms.length})]}),i.jsxs("span",{children:["الآلات: ",i.jsx("b",{className:"text-slate-800",children:h.placements.length})]}),i.jsxs("span",{children:["التجهيزات: ",i.jsx("b",{className:"text-slate-800",children:h.sceneObjects?.length||0})]}),i.jsxs("span",{children:["الاستغلال: ",i.jsxs("b",{className:"text-slate-800",children:[zt?.usedPercent,"%"]})]}),i.jsxs("span",{className:"mr-auto flex items-center gap-1 text-emerald-700",children:[i.jsx(jx,{className:"h-3.5 w-3.5"}),"جاهز للمشاركة مع العميل"]})]}),!X&&Te==="elements"&&i.jsxs("aside",{className:"fixed inset-y-16 left-4 z-[80] flex w-80 max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white text-slate-900 shadow-2xl",dir:"rtl",children:[i.jsxs("div",{className:"border-b border-slate-200 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-bold tracking-[.13em] text-orange-600",children:"SITE ASSETS"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:"مكتبة عناصر الموقع"})]}),i.jsx(ke,{size:"sm",variant:"ghost",className:"h-8 px-2 text-slate-500",onClick:()=>st("rooms"),children:"إغلاق"})]}),i.jsx("p",{className:"mt-2 text-[11px] leading-5 text-slate-500",children:"أضف عنصراً، ثم انقر عليه في المشهد واسحبه بالمقابض البرتقالية."}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-1",children:[{key:"all",label:"الكل"},{key:"building",label:"مبنى"},{key:"interior",label:"داخلي"},{key:"outdoor",label:"خارجي"}
5186,{key:"infrastructure",label:"بنية"}].map(be=>i.jsx("button",{type:"button",onClick:()=>ue(be.key),className:`rounded-md px-2 py-1 text-[10px] font-bold ${Mt===be.key?"bg-primary text-primary-foreground":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:be.label},be.key))})]}),i.jsx("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:g0e.filter(be=>Mt==="all"||be.category===Mt).map(be=>i.jsxs("button",{type:"button",onClick:()=>_n(be),className:"flex w-full items-center gap-2 rounded-lg border border-slate-200 bg-white p-2.5 text-right transition hover:border-primary/30 hover:bg-primary/5",children:[i.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary/5 text-primary",children:i.jsx(Bj,{className:"h-4 w-4"})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-xs font-extrabold text-slate-800",children:be.name}),i.jsxs("span",{className:"mt-0.5 block text-[10px] text-slate-500",children:[be.lengthM," × ",be.widthM," م"]})]}),i.jsx(Nn,{className:"h-3.5 w-3.5 text-primary"})]},be.key))})]}),!X&&D&&i.jsxs("aside",{className:"fixed inset-y-16 left-4 z-[81] flex w-80 max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-2xl border border-primary/20 bg-white text-slate-900 shadow-2xl",dir:"rtl",children:[i.jsxs("div",{className:"border-b border-primary/10 bg-primary/5 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-bold tracking-[.13em] text-primary",children:"REUSABLE CAD LIBRARY"}),i.jsx("h2",{className:"mt-1 font-extrabold",children:"الآلات CAD المحفوظة"})]}),i.jsx(ke,{size:"sm",variant:"ghost",className:"h-8 px-2 text-slate-500",onClick:()=>B(!1),children:"إغلاق"})]}),i.jsx("p",{className:"mt-2 text-[11px] leading-5 text-slate-500",children:"كل آلة ترفعها تحفظ هنا ويمكن وضعها في أي مشروع مصنع بلا رفع جديد."})]}),i.jsx("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:nn.length?nn.map(be=>i.jsxs("div",{className:"rounded-xl border border-slate-200 bg-slate-50 p-3",children:[i.jsx("p",{className:"truncate text-xs font-extrabold text-slate-800",children:be.name}),i.jsxs("p",{className:"mt-1 text-[10px] text-slate-500",children:[String(be.cadFileType||"CAD").toUpperCase()," · ",be.cadFileName||"ملف محفوظ"]}),i.jsxs(ke,{size:"sm",className:"mt-3 w-full bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>Fn(be),children:[i.jsx(Nn,{className:"ml-1.5 h-3.5 w-3.5"}),"وضع داخل المصنع"]})]},be.id)):i.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 p-5 text-center text-xs leading-6 text-slate-500",children:"لم تحفظ أي آلة CAD بعد. استخدم زر CAD في أعلى المحرر لإضافة أول ملف."})})]}),!X&&Te==="simulation"&&i.jsx(k0e,{workspace:h,draft:Ce,setDraft:Re,editingTrackId:ye,onSave:pa,onEdit:Bo,onDelete:be=>Vs.mutate({id:be}),onRunTrack:be=>{F(be),oe(It=>It+1),K(!0)},onRunSequence:()=>{F(null),oe(be=>be+1),K(!0)},onClose:()=>{ts(),st("rooms")}}),!X&&pe&&(_t||kt||Rt)&&i.jsxs("aside",{className:"fixed bottom-4 left-4 z-[75] w-72 rounded-xl border border-primary/20 bg-white p-3 text-slate-900 shadow-xl",dir:"rtl",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(VS,{className:"mt-0.5 h-4 w-4 text-primary"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-extrabold",children:"نسخ التدوير والتحجيم"}),i.jsx("p",{className:"mt-1 text-[10px] leading-4 text-slate-500",children:"انسخ التحويل من المصدر ثم طبقه على الهدف."})]})]}),i.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-1.5",children:[i.jsx(ke,{size:"sm",variant:"outline",className:"h-8 border-primary/30 text-primary hover:bg-primary/10",onClick:Dn,children:"نسخ"}),i.jsx(ke,{size:"sm",className:"h-8 bg-primary text-primary-foreground hover:bg-primary/90",disabled:!Ae,onClick:In,children:"تطبيق"})]}),Ae&&i.jsxs("p",{className:"mt-2 rounded-md bg-primary/5 px-2 py-1 text-[10px] text-primary",children:["المصدر: ",i.jsx("b",{children:Ae.name})]})]}),Rt&&i.jsxs("aside",{className:"fixed right-5 top-20 z-[70] w-72 rounded-2xl border border-slate-200 bg-white p-4 text-slate-900 shadow-2xl",dir:"rtl",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-bold tracking-[.13em] text-orange-600",children:"العنصر المحدد"}),i.jsx("h2",{className:"mt-1 text-sm font-extrabold",children:Rt.name})]}),i.jsx("button",{type:"button",className:"text-xs text-slate-500 hover:text-slate-800",onClick:()=>Y(null),children:"إغلاق"})]}),i.jsxs("p",{className:"mt-2 text-[11px] leading-5 text-slate-500",children:["الموضع: ",Number(Rt.xM).toFixed(1)," ، ",Number(Rt.zM).toFixed(1)," م. استخدم المقابض في المشهد للتحريك."]}),["signboard","no_parking"].includes(Rt.objectType)&&i.jsx(Vt,{label:"نص اللوحة",children:i.jsx(Ee,{defaultValue:Rt.labelText||"",onBlur:be=>Xr.mutate({id:Rt.id,data:{labelText:be.target.value}}),className:"h-9 border-slate-200 bg-slate-50 text-slate-900"})}),i.jsxs(ke,{variant:"destructive",className:"mt-4 w-full",onClick:()=>ps.mutate({id:Rt.id}),children:[i.jsx(Ar,{className:"ml-2 h-4 w-4"}),"إزالة العنصر"]})]})]}):i.jsxs(bn,{className:"flex min-h-72 flex-col items-center justify-center gap-4 border-dashed p-8 text-center",children:[i.jsx(Jb,{className:"h-12 w-12 text-primary"}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-bold",children:"ابدأ بمشروع المصنع الأول"}),i.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"أدخل الأبعاد الحقيقية للمصنع لتفعيل المخطط ثنائي وثلاثي الأبعاد."})]}),i.jsxs(ke,{onClick:()=>{he(Kb),_(!0)},children:[i.jsx(Nn,{className:"ml-2 h-4 w-4"}),"إنشاء مشروع"]})]}),i.jsx(Qo,{open:v,onOpenChange:_,title:"مشروع مصنع جديد",submitLabel:"إنشاء المشروع",onSubmit:()=>Nr.mutate(De),className:"sm:max-w-3xl",children:i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsx(Vt,{label:"اسم المصنع / المشروع *",children:i.jsx(Ee,{value:De.name,onChange:be=>
5186he({...De,name:be.target.value})})}),i.jsx(Vt,{label:"نوع المصنع",children:i.jsx(Ee,{value:De.factoryType,onChange:be=>he({...De,factoryType:be.target.value})})}),i.jsx(Vt,{label:"الموقع",children:i.jsx(Ee,{value:De.location,onChange:be=>he({...De,location:be.target.value})})}),i.jsx(kl,{label:"شبكة القياس (متر)",min:.1,value:De.defaultGridM,onChange:be=>he({...De,defaultGridM:be})}),i.jsx(kl,{label:"الطول (متر) *",min:1,value:De.lengthM,onChange:be=>he({...De,lengthM:be})}),i.jsx(kl,{label:"العرض (متر) *",min:1,value:De.widthM,onChange:be=>he({...De,widthM:be})}),i.jsx(kl,{label:"الارتفاع (متر) *",min:1,value:De.heightM,onChange:be=>he({...De,heightM:be})})]})}),i.jsx(Qo,{open:M,onOpenChange:S,title:"إضافة غرفة إلى المصنع",submitLabel:"إضافة الغرفة",onSubmit:()=>d&&jr.mutate({...qe,factoryProjectId:d}),className:"sm:max-w-2xl",children:i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsx(Vt,{label:"اسم الغرفة *",children:i.jsx(Ee,{value:qe.name,onChange:be=>Ge({...qe,name:be.target.value})})}),i.jsx(Vt,{label:"نوع الغرفة",children:i.jsx(Ee,{value:qe.roomType,onChange:be=>Ge({...qe,roomType:be.target.value})})}),i.jsx(kl,{label:"موضع X (متر)",value:qe.xM,onChange:be=>Ge({...qe,xM:be})}),i.jsx(kl,{label:"موضع Z (متر)",value:qe.zM,onChange:be=>Ge({...qe,zM:be})}),i.jsx(kl,{label:"الطول (متر)",min:.5,value:qe.lengthM,onChange:be=>Ge({...qe,lengthM:be})}),i.jsx(kl,{label:"العرض (متر)",min:.5,value:qe.widthM,onChange:be=>Ge({...qe,widthM:be})}),i.jsx(kl,{label:"الارتفاع (متر)",min:.5,value:qe.heightM,onChange:be=>Ge({...qe,heightM:be})}),i.jsx(Vt,{label:"لون الغرفة",children:i.jsx(Ee,{type:"color",value:qe.color,onChange:be=>Ge({...qe,color:be.target.value}),className:"h-10 p-1"})})]})}),i.jsxs(Qo,{open:A,onOpenChange:E,title:"ملاحظات تظهر للعميل",submitLabel:"حفظ الملاحظات",onSubmit:ii,className:"sm:max-w-2xl",children:[i.jsx(Vt,{label:"الملاحظات",children:i.jsx("textarea",{value:P,onChange:be=>G(be.target.value),placeholder:"مثل: مسار دخول الشاحنات، متطلبات السلامة، مرحلة المشروع...",className:"min-h-40 w-full rounded-lg border border-slate-200 bg-slate-50 p-3 text-sm text-slate-900 outline-none focus:border-primary focus:ring-2 focus:ring-primary/20"})}),i.jsx("p",{className:"text-xs leading-6 text-slate-500",children:"تظهر هذه الملاحظات بوضوح في رابط العميل ولا تمنح أي صلاحية تعديل."})]}),i.jsx(Qo,{open:C,onOpenChange:I,title:"إضافة آلة من ملف CAD",submitLabel:Yt.isPending||or.isPending?"جارٍ رفع الملف...":"رفع ووضع الآلة",onSubmit:Cs,className:"sm:max-w-2xl",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(Vt,{label:"اسم الآلة",children:i.jsx(Ee,{value:U,onChange:be=>$(be.target.value),placeholder:"مثال: خط تغليف أوتوماتيكي"})}),i.jsx(Vt,{label:"ملف CAD",children:i.jsx(Ee,{type:"file",accept:".dxf,.dwg,.step,.stp,.iges,.igs,.glb,.gltf",onChange:be=>V(be.target.files?.[0]||null)})}),i.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-3 text-xs leading-6 text-slate-600",children:[i.jsx("b",{className:"text-primary",children:"DXF وGLB/GLTF"})," يعرضان داخل المشهد. تحفظ ملفات DWG وSTEP وIGES الأصلية بأمان ضمن بطاقة الآلة، ويمكن إرفاق تحويل GLB عند الحاجة إلى نموذج ثلاثي الأبعاد دقيق."]}),k&&i.jsxs("div",{className:"rounded-lg bg-slate-100 px-3 py-2 text-xs text-slate-700",children:["الملف المختار: ",i.jsx("b",{children:k.name})," · ",(k.size/1024/1024).toFixed(2)," MB"]})]})})]})}const IB={machineRotation:[0,0,0],isExploded:!1,explodeAmount:1,processPipeEnabled:!1,processPipeTargetPartId:"",materialType:"chocolate",materialLabel:"شوكولا",flowColor:"#5B2C1E",flowSpeed:1,flowDirection:1,flowMode:"continuous",particleCount:12,isFlowing:!0,isLooping:!0,partStates:{}},BB=["step","stp","iges","igs","dxf","dwg","stl","obj","fbx","glb","gltf"],B0e=["step","stp","dxf","glb","gltf"],lj=["X","Y","Z"],L0e=n=>{try{const e=JSON.parse(String(n||"{}"));return{...IB,...e,machineRotation:e.machineRotation||[0,0,0],partStates:e.partStates||{}}}catch{return IB}},LB=n=>Math.round(n*180/Math.PI),cj=n=>
5186n*Math.PI/180;function O0e(){const n=Pe.useUtils(),{data:e,isLoading:t}=Pe.machineLab.list.useQuery(),[r,s]=T.useState(null),[a,o]=T.useState(null),[l,u]=T.useState([]),[d,h]=T.useState(null),[p,x]=T.useState(0),[y,v]=T.useState(null),[_,M]=T.useState(!1),[S,A]=T.useState(!0),[E,C]=T.useState(0),[I,D]=T.useState(!1),B=T.useRef(null),P=Pe.machineLab.uploadAndCreate.useMutation({onSuccess:async Q=>{await n.machineLab.list.invalidate(),s(Q.id),_e.success("تم حفظ الملف في مكتبة مختبر CAD")},onError:Q=>_e.error(Q.message)}),G=Pe.machineLab.update.useMutation({onSuccess:()=>{n.machineLab.list.invalidate()},onError:Q=>_e.error(Q.message)}),k=Pe.machineLab.delete.useMutation({onSuccess:async()=>{await n.machineLab.list.invalidate(),s(null),_e.success("تم حذف سجل المكنة من المختبر")}}),V=T.useMemo(()=>(e||[]).find(Q=>Number(Q.id)===(r??Number(e?.[0]?.id||0)))??null,[e,r]),U=T.useMemo(()=>L0e(a??V?.settingsJson),[a,V?.settingsJson]);T.useEffect(()=>{o(null),u([]),h(null),x(0)},[V?.id]);const $=Q=>{if(!V)return;const ne=JSON.stringify({...U,...Q});o(ne),G.mutate({id:V.id,data:{settingsJson:ne}})};T.useEffect(()=>{d&&U.processPipeEnabled&&U.processPipeTargetPartId!==d&&$({processPipeTargetPartId:d})},[d,U.processPipeEnabled,U.processPipeTargetPartId]);const X=d?U.partStates[d]||{}:{},ee=T.useMemo(()=>l.find(Q=>Q.id===d)??null,[l,d]),z=d?U.partAnimation?.partId===d?U.partAnimation:{partId:d,action:"rotate",axis:"y",speedRpm:30,durationSeconds:10,enabled:!1,loop:!0,keyframes:[]}:null,K=Q=>{d&&$({partStates:{...U.partStates,[d]:{...X,...Q}}})},ae=Q=>{z&&$({partAnimation:{...z,...Q}})},oe=(Q,ne,Z)=>{const se=[...X[Z]||[0,0,0]];se[Q]=Z==="rotation"?cj(ne):ne,K({[Z]:se})},re=(Q,ne)=>{const Z=[...U.machineRotation];Z[Q]+=cj(ne),$({machineRotation:Z})},F=Q=>{if(!z)return;const ne={time:Number(Q.toFixed(1)),position:X.position||[0,0,0],rotation:X.rotation||[0,0,0],scale:Number(X.scale||1)};ae({enabled:!0,keyframes:[...z.keyframes.filter(Z=>Z.time!==ne.time),ne].sort((Z,se)=>Z.time-se.time)}),_e.success(`تم حفظ إطار عند ${ne.time} ثانية`)},O=T.useMemo(()=>V?{project:{id:V.id,name:V.name,lengthM:12,widthM:12,heightM:6,defaultGridM:.5},rooms:[],sceneObjects:[],animationTracks:[],placements:[{id:V.id,machineModelId:V.id,name:V.name,xM:3.5,yM:0,zM:4,lengthM:5,widthM:4,heightM:3.5,rotationX:0,rotationY:0,rotationZ:0,scaleX:1,scaleY:1,scaleZ:1,metadataJson:a??V.settingsJson??"{}"}],machineModels:[{id:V.id,name:V.name,modelUrl:V.modelUrl,cadFileType:V.cadFileType,cadFileName:V.cadFileName}]}:null,[V,a]),J=T.useCallback(Q=>{if(!Q)return;const ne=Q.name.split(".").pop()?.toLowerCase()||"";if(!BB.includes(ne))return _e.error("صيغة CAD غير مدعومة");if(Q.size>12*1024*1024)return _e.error("الحد الأقصى لحجم الملف 12 ميغابايت");const Z=new FileReader;Z.onload=()=>P.mutate({fileBase64:String(Z.result),fileName:Q.name,mimeType:Q.type||"application/octet-stream",name:Q.name.replace(/\.[^.]+$/,"")}),Z.onerror=()=>_e.error("تعذر قراءة الملف"),Z.readAsDataURL(Q)},[P]),q=()=>{if(!y||!y.captureStream||typeof MediaRecorder>"u")return _e.error("لا يدعم المتصفح تسجيل المشهد");const Q=y.captureStream(30),ne=MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm",Z=new MediaRecorder(Q,{mimeType:ne}),se=[];Z.ondataavailable=me=>{me.data.size&&se.push(me.data)},Z.onstop=()=>{Q.getTracks().forEach(ze=>ze.stop()),M(!1);const me=document.createElement("a");me.href=URL.createObjectURL(new Blob(se,{type:ne})),me.download=`${V?.name||"machine"}-simulation.webm`,me.click(),window.setTimeout(()=>URL.revokeObjectURL(me.href),1e3)},M(!0),C(me=>me+1),A(!0),Z.start(200),window.setTimeout(()=>Z.state!=="inactive"&&Z.stop(),5e3)};return t?i.jsx("div",{className:"flex min-h-[480px] items-center justify-center text-sm font-bold text-slate-500",children:"جارٍ تحميل مكتبة مختبر CAD…"}):i.jsxs("section",{dir:"rtl",className:"space-y-5",children:[i.jsxs("header",{className:"rounded-3xl bg-gradient-to-l from-[#061c23] via-[#07636f] to-[#0c9ead] p-5 text-white shadow-xl",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"inline-flex items-center gap-2 rounded-full border border-white/20 bg-white/10 px-3 py-1 text-[10px] font-bold tracking-[.12em]",children:[i.jsx(wF,{className:"h-3.5 w-3.5"}),"INDEPENDENT CAD LAB"]}),i.jsx("h1",{className:"mt-3 text-2xl font-black",children:"مختبر تحريك ونمذجة المكنات"}),i.jsx("p",{className:"mt-2 max-w-2xl text-sm text-cyan-50",children:"ارفع ملف مكنة، حرّك أجزاءه بكامل الحرية، اقلب جسمه، ثم وجّه الشوكولا أو أي مادة إلى الجزء الذي تختاره."})]}),i.jsxs(ke,{className:"bg-white font-extrabold text-primary hover:bg-cyan-50",onClick:()=>B.current?.click(),children:[i.jsx($D,{className:"ml-2 h-4 w-4"}),"رفع ملف CAD"]})]}),i.jsx("input",{ref:B,className:"hidden",type:"file",accept:BB.map(Q=>`.${Q}`).join(","),onChange:Q=>J(Q.target.files?.[0])})]}),i.jsxs("div",{className:"grid gap-5 xl:grid-cols-[260px_minmax(0,1fr)_320px]",children:[i.jsxs("aside",{className:"space-y-4",children:[i.jsxs(bn,{className:`border-2 border-dashed p-4 text-center ${I?"border-primary bg-primary/10":"border-cyan-200 bg-cyan-50/50"}`,onDragEnter:Q=>{Q.preventDefault(),D(!0)},onDragOver:Q=>Q.preventDefault(),onDragLeave:()=>D(!1),onDrop:Q=>{Q.preventDefault(),D(!1),J(Q.dataTransfer.files?.[0])},children:[i.jsx(WS,{className:"mx-auto h-7 w-7 text-primary"}),i.jsx("p",{className:"mt-2 text-xs font-extrabold",children:"اسحب ملف CAD هنا"}),i.jsx("p",{className:"mt-1 text-[9px] text-slate-500",children:"STEP · DXF · DWG · STL · OBJ · FBX · GLB"})]}),i.jsxs(bn,{className:"p-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Bj,{className:"h-4 w-4 text-primary"}),i.jsx("b",{className:"text-sm",children:"مكتبة المختبر"}),i.jsx("span",{className:"mr-auto rounded-full bg-primary/10 px-2 py-0.5 text-[10px] text-primary",children:e?.length||0})]}),i.jsx("div",{className:"mt-3 max-h-[520px] space-y-1 overflow-y-auto",children:e?.length?e.map(Q=>i.jsxs("button",{onClick:()=>s(Q.id),className:`flex w-full items-center gap-2 rounded-xl border p-2 text-right ${V?.id===Q.id?"border-primary bg-primary text-primary-foreground":"border-slate-200 hover:bg-slate-50"}`,children:[i.jsx(dy,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("b",{className:"block truncate text-xs",children:Q.name}),i.jsxs("small",{className:"text-[9px] opacity-75",children:[String(Q.cadFileType).toUpperCase()," · ",(Number(Q.fileSize||0)/1024/1024).toFixed(1)," MB"]})]}),i.jsx(Qm,{className:"h-3.5 w-3.5"})]},Q.id)):i.jsx("p",{className:"p-4 text-center text-xs leading-6 text-slate-500",children:"لا توجد ملفات بعد."})})]})]}),i.jsxs(bn,{className:"min-h-[630px] overflow-hidden bg-[#edf4f5]",children:[i.jsxs("div",{className:"flex items-center justify-between border-b bg-white px-4 py-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-bold tracking-widest text-primary",children:"MODEL MOTION VIEWER"}),i.jsx("h2",{className:"text-sm font-extrabold",children:V?.name||"اختر ملفاً"})]}),V&&i.jsxs(ke,{size:"sm",variant:"outline",className:"border-primary/30 text-primary",onClick:()=>{A(Q=>!Q),C(Q=>Q+1)},children:[i.jsx(L2,{className:"ml-1 h-3.5 w-3.5"}),S?"إيقاف":"تشغيل"]})]}),V&&O?B0e.includes(String(V.cadFileType).toLowerCase())?i.jsxs("div",{className:"relative h-[565px]",children:[i.jsx(YR,{workspace:O,labMode:!0,interactive:!0,playSimulation:S,simulationRunId:E,selection:{type:"placement",id:V.id},selectedCadPartId:d,onCadParts:(Q,ne)=>u(ne),onCadPartSelect:(Q,ne)=>h(ne),onSelect:Q=>!Q&&h(null),onCanvasReady:v}),i.jsx("p",{className:"pointer-events-none absolute bottom-3 right-3 rounded-lg bg-white/90 px-3 py-2 text-[10px] font-bold text-slate-600 shadow",children:"Shift + سحب لتحريك الكاميرا"})]}):i.jsxs("div",{className:"flex h-[565px] flex-col items-center justify-center p-8 text-center",children:[i.jsx(dy,{className:"h-12 w-12 text-amber-500"}),i.jsx("b",{className:"mt-4",children:"الملف محفوظ في مكتبة المختبر"}),i.jsx("p",{className:"mt-2 max-w-sm text-sm leading-6 text-slate-500",children:"يتطلب هذا النوع محولاً قبل عرضه في المتصفح. يعرض المختبر STEP/STP وDXF وGLB/GLTF مباشرة."})]}):i.jsxs("div",{className:"flex h-[565px] flex-col items-center justify-center text-slate-500",children:[i.jsx($D,{className:"h-10 w-10 text-primary"}),i.jsx("p",{className:"mt-3 text-sm font-bold",children:"ارفع مكنة لبدء النمذجة"})]})]}),i.jsx("aside",{className:"space-y-4",children:V?i.jsxs(i.Fragment,{children:[i.jsx(bn,{className:"p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{children:[i.jsx("b",{className:"text-sm",children:V.name}),i.jsxs("p",{className:"mt-1 text-[10px] text-slate-500",children:[V.cadFileName," · مشروع مستقل"]})]}),i.jsx(ke,{size:"icon",variant:"outline",className:"h-8 w-8 border-rose-200 text-rose-600",onClick:()=>window.confirm("حذف سجل المكنة من المختبر؟")&&k.mutate({id:V.id}),children:i.jsx(Ar,{className:"h-3.5 w-3.5"})})]})}),i.jsxs(bn,{className:"border-orange-200 bg-orange-50/50 p-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(sQ,{className:"h-4 w-4 text-orange-700"}),i.jsx("b",{className:"text-sm",children:"قلب ودوران المكنة"})]}),i.jsx("p",{className:"mt-1 text-[10px] text-orange-800",children:"زوايا مستقلة لجسم المكنة كاملاً."}),i.jsx("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[0,1,2].map(Q=>i.jsxs("div",{className:"rounded-lg border border-orange-200 bg-white p-1.5 text-center",children:[i.jsx("b",{className:"text-[10px] text-orange-800",children:lj[Q]}),i.jsx(Ee,{type:"number",step:"5",value:LB(U.machineRotation[Q]),onChange:ne=>{const Z=[...U.machineRotation];Z[Q]=cj(Number(ne.target.value)||0),$({machineRotation:Z})},className:"mt-1 h-7 px-1 text-center text-[10px]"}),i.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-0.5",children:[i.jsx("button",{className:"rounded bg-orange-100 py-1 text-[9px]",onClick:()=>re(Q,-90),children:"−90"}),i.jsx("button",{className:"rounded bg-orange-100 py-1 text-[9px]",onClick:()=>re(Q,90),children:"+90"}),i.jsx("button",{className:"rounded bg-orange-200 py-1 text-[9px]",onClick:()=>re(Q,180),children:"180"})]})]},Q))}),i.jsx(ke,{size:"sm",variant:"outline",className:"mt-3 h-8 w-full border-orange-300 text-xs text-orange-800",onClick:()=>$({machineRotation:[0,0,0]}),children:"إعادة الوضع القائم"})]}),i.jsxs(bn,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(dy,{className:"h-4 w-4 text-primary"}),i.jsx("b",{className:"text-sm",children:"الأجزاء والتفكيك"}),i.jsxs("span",{className:"mr-auto text-[10px] text-slate-400",children:[l.length," Mesh"]})]}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[i.jsx(ke,{size:"sm",className:"bg-primary text-primary-foreground",onClick:()=>$({isExploded:!0}),children:"فكّك"}),i.jsx(ke,{size:"sm",variant:"outline",onClick:()=>$({isExploded:!1}),children:"ركّب"})]}),i.jsxs("label",{className:"mt-3 block text-[10px] font-bold",children:["مسافة التفكيك ",i.jsxs("b",{className:"float-left text-primary",children:[U.explodeAmount.toFixed(1),"×"]}),i.jsx("input",{className:"mt-1 w-full accent-[var(--primary)]",type:"range",min:"0.25",max:"3",step:"0.25",value:U.explodeAmount,onChange:Q=>$({explodeAmount:Number(Q.target.value)})})]}),i.jsx("div",{className:"mt-3 max-h-40 space-y-1 overflow-y-auto",children:l.map(Q=>i.jsxs("button",{onClick:()=>h(Q.id),className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-right text-[11px] ${d===Q.id?"bg-primary text-primary-foreground":"hover:bg-slate-100"}`,children:[i.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:Q.color||"#0096A7"}}),i.jsx("span",{className:"flex-1",children:Q.name}),U.partStates[Q.id]?.visible===!1&&i.jsx(Fj,{className:"h-3 w-3"})]},Q.id))})]}
5186),ee&&z&&i.jsxs(bn,{className:"border-violet-200 bg-violet-50/60 p-4",children:[i.jsx("p",{className:"text-[10px] font-bold text-violet-700",children:"مفتش القطعة"}),i.jsx("b",{className:"text-sm text-violet-950",children:ee.name}),i.jsx("div",{className:"mt-3 grid grid-cols-3 gap-1.5",children:[0,1,2].map(Q=>i.jsxs("label",{className:"text-[9px]",children:["موضع ",lj[Q],i.jsx(Ee,{type:"number",step:"0.1",value:X.position?.[Q]||0,onChange:ne=>oe(Q,Number(ne.target.value)||0,"position"),className:"mt-1 h-7 px-1 text-[10px]"})]},Q))}),i.jsx("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[0,1,2].map(Q=>i.jsxs("label",{className:"text-[9px]",children:["دوران ",lj[Q],"°",i.jsx(Ee,{type:"number",step:"5",value:LB(X.rotation?.[Q]||0),onChange:ne=>oe(Q,Number(ne.target.value)||0,"rotation"),className:"mt-1 h-7 px-1 text-[10px]"})]},Q))}),i.jsxs("div",{className:"mt-2 grid grid-cols-[1fr_auto] gap-2",children:[i.jsxs("label",{className:"text-[10px]",children:["المقياس",i.jsx(Ee,{type:"number",min:"0.1",step:"0.1",value:X.scale||1,onChange:Q=>K({scale:Math.max(.1,Number(Q.target.value)||1)}),className:"mt-1 h-7 px-1 text-[10px]"})]}),i.jsx(Ee,{type:"color","aria-label":"لون القطعة",value:X.color||ee.color||"#0096A7",onChange:Q=>K({color:Q.target.value}),className:"mt-4 h-7 w-9 p-1"})]}),i.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-1",children:[i.jsx(ke,{size:"sm",variant:"outline",className:"h-7 px-1 text-[10px]",onClick:()=>K({visible:X.visible===!1}),children:X.visible===!1?i.jsx(jc,{className:"h-3 w-3"}):i.jsx(Fj,{className:"h-3 w-3"})}),i.jsx(ke,{size:"sm",variant:"outline",className:"h-7 px-1 text-[10px]",onClick:()=>$({partStates:Object.fromEntries(l.map(Q=>[Q.id,{...U.partStates[Q.id]||{},visible:Q.id===d}]))}),children:"عزل"}),i.jsx(ke,{size:"sm",variant:"outline",className:"h-7 px-1 text-[10px]",onClick:()=>$({partStates:Object.fromEntries(l.map(Q=>[Q.id,{...U.partStates[Q.id]||{},visible:!0}]))}),children:"الكل"})]}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[i.jsxs("select",{value:z.action,onChange:Q=>ae({action:Q.target.value,enabled:!0}),className:"h-8 rounded border border-violet-200 bg-white px-1 text-[10px]",children:[i.jsx("option",{value:"rotate",children:"دوران"}),i.jsx("option",{value:"oscillate",children:"تذبذب"})]}),i.jsxs("select",{value:z.axis,onChange:Q=>ae({axis:Q.target.value,enabled:!0}),className:"h-8 rounded border border-violet-200 bg-white px-1 text-[10px]",children:[i.jsx("option",{value:"x",children:"محور X"}),i.jsx("option",{value:"y",children:"محور Y"}),i.jsx("option",{value:"z",children:"محور Z"})]})]}),i.jsxs("label",{className:"mt-2 block text-[10px]",children:["السرعة ",i.jsxs("b",{className:"float-left",children:[z.speedRpm," RPM"]}),i.jsx("input",{className:"mt-1 w-full accent-violet-700",type:"range",min:"1",max:"1500",value:z.speedRpm,onChange:Q=>ae({speedRpm:Number(Q.target.value),enabled:!0})})]})]}),i.jsxs(bn,{className:"border-cyan-200 bg-cyan-50/60 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(LY,{className:"h-4 w-4 text-cyan-700"}),i.jsx("b",{className:"text-sm text-cyan-950",children:"تدفق المادة"})]}),i.jsx("p",{className:"text-[10px] text-cyan-800",children:"اختر القطعة التي تريد المادة داخلها."})]}),i.jsx("input",{type:"checkbox",checked:U.processPipeEnabled,onChange:Q=>$({processPipeEnabled:Q.target.checked}),className:"accent-cyan-700"})]}),U.processPipeEnabled&&i.jsxs("div",{className:"mt-3 space-y-2",children:[i.jsxs("select",{value:U.processPipeTargetPartId||"machine",onChange:Q=>$({processPipeTargetPartId:Q.target.value==="machine"?"":Q.target.value}),className:"h-8 w-full rounded border border-cyan-200 bg-white px-2 text-[10px]",children:[i.jsx("option",{value:"machine",children:"داخل جسم المكنة"}),l.map(Q=>i.jsxs("option",{value:Q.id,children:["داخل ",Q.name]},Q.id))]}
5186),i.jsxs("select",{value:U.materialType,onChange:Q=>{const ne=Q.target.value;$({materialType:ne,...ne==="water"?{materialLabel:"مياه",flowColor:"#38BDF8"}:ne==="chocolate"?{materialLabel:"شوكولا",flowColor:"#5B2C1E"}:{materialLabel:"مادة مخصصة",flowColor:"#A855F7"}})},className:"h-8 w-full rounded border border-cyan-200 bg-white px-2 text-[10px]",children:[i.jsx("option",{value:"chocolate",children:"شوكولا"}),i.jsx("option",{value:"water",children:"مياه"}),i.jsx("option",{value:"custom",children:"مادة مخصصة"})]}),i.jsx(Ee,{value:U.materialLabel,onChange:Q=>$({materialLabel:Q.target.value||"مادة"}),className:"h-8 bg-white text-[10px]"}),i.jsxs("select",{value:U.flowMode,onChange:Q=>$({flowMode:Q.target.value}),className:"h-8 w-full rounded border border-cyan-200 bg-white px-2 text-[10px]",children:[i.jsx("option",{value:"continuous",children:"تدفق مستمر"}),i.jsx("option",{value:"pulse",children:"نبضات"}),i.jsx("option",{value:"batch",children:"دفعات"})]}),i.jsxs("label",{className:"block text-[10px]",children:["سرعة التدفق ",i.jsxs("b",{className:"float-left",children:[U.flowSpeed.toFixed(2),"×"]}),i.jsx("input",{className:"mt-1 w-full accent-cyan-700",type:"range",min:"0.25",max:"4",step:"0.25",value:U.flowSpeed,onChange:Q=>$({flowSpeed:Number(Q.target.value)})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(ke,{size:"sm",className:"h-8 bg-cyan-700 px-1 text-[10px]",onClick:()=>$({isFlowing:!U.isFlowing}),children:U.isFlowing?"إيقاف التدفق":"تشغيل التدفق"}),i.jsx(ke,{size:"sm",variant:"outline",className:"h-8 border-cyan-300 px-1 text-[10px] text-cyan-800",onClick:()=>$({flowDirection:U.flowDirection===1?-1:1}),children:U.flowDirection===1?"اتجاه أمامي":"اتجاه عكسي"})]})]})]}),i.jsxs(bn,{className:"border-primary/20 bg-primary/5 p-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(UY,{className:"h-4 w-4 text-primary"}),i.jsxs("div",{children:[i.jsx("b",{className:"text-sm",children:"فيديو المحاكاة"}),i.jsx("p",{className:"text-[10px] text-slate-600",children:"تسجيل مباشر 5 ثوانٍ بصيغة WebM."})]})]}),i.jsx(ke,{size:"sm",className:"mt-3 w-full bg-primary text-primary-foreground",disabled:_,onClick:q,children:_?"جارٍ التسجيل…":"تصدير فيديو"})]})]}):i.jsx(bn,{className:"p-6 text-center text-sm text-slate-500",children:"ارفع مكنة CAD لتفعيل أدوات النمذجة."})})]}),ee&&z&&i.jsxs(bn,{className:"border-slate-700 bg-[#132227] p-4 text-white",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-bold tracking-widest text-cyan-300",children:"ANIMATION TIMELINE"}),i.jsxs("b",{className:"text-sm",children:["مسار حركة ",ee.name]})]}),i.jsxs("label",{className:"text-[10px]",children:[i.jsx("input",{className:"ml-1 accent-cyan-400",type:"checkbox",checked:z.loop,onChange:Q=>ae({loop:Q.target.checked})}),"تكرار الحركة"]})]}),i.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-[180px_1fr_220px]",children:[i.jsxs("label",{className:"text-[10px] text-slate-300",children:["المدة (ث)",i.jsx(Ee,{type:"number",min:"1",max:"120",value:z.durationSeconds,onChange:Q=>{const ne=Math.max(1,Number(Q.target.value)||10);x(Z=>Math.min(Z,ne)),ae({durationSeconds:ne})},className:"mt-1 h-8 border-white/15 bg-white/10 text-white"})]}),i.jsxs("label",{className:"text-[10px] text-slate-300",children:["موضع الإطار الحالي ",i.jsxs("b",{className:"float-left text-cyan-300",children:[p.toFixed(1)," ث"]}),i.jsx("input",{className:"mt-2 w-full accent-cyan-400",type:"range",min:"0",max:z.durationSeconds,step:"0.1",value:p,onChange:Q=>x(Number(Q.target.value))})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[i.jsx(ke,{size:"sm",variant:"outline",className:"border-white/20 bg-white/5 text-[10px] text-white hover:bg-white/10 hover:text-white",onClick:()=>F(0),children:"بداية"}),i.jsx(ke,{size:"sm",className:"bg-cyan-400 text-[10px] text-slate-950 hover:bg-cyan-300",onClick:()=>F(p),children:"حفظ الإطار"}),i.jsx(ke,{size:"sm",variant:"outline",className:"border-white/20 bg-white/5 text-[10px] text-white hover:bg-white/10 hover:text-white",onClick:()=>F(z.durationSeconds),children:"نهاية"})]})]}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:z.keyframes.map(Q=>i.jsxs("span",{className:"rounded-full border border-cyan-300/30 bg-cyan-400/10 px-2 py-1 text-[10px] text-cyan-100",children:["إطار ",Q.time," ث"]},Q.time))}),i.jsx("p",{className:"mt-3 text-[10px] leading-5 text-slate-300",children:"حرّك أو دوّر أو كبّر الجزء من المفتش، اختر أي لحظة في الخط الزمني، ثم احفظ الإطار. ينفذ العارض الاستيفاء بين جميع الإطارات المحفوظة."})]})]})}const OB=Pe,FB=[{title:"الرئيسية",icon:"📊",items:[{id:"dashboard",label:"لوحة المعلومات",icon:"📊"}]},{title:"المبيعات",icon:"🏷️",items:[{id:"price-quotations",label:"عروض الأسعار",icon:"📋"},{id:"sales-invoices",label:"فواتير المبيعات",icon:"🧾"},{id:"official-invoices",label:"الفواتير الرسمية",icon:"🧾"},{id:"packing-lists",label:"بيانات التعبئة",icon:"📦"},{id:"reports",label:"التقارير والطباعة",icon:"🖨️"}]},{title:"المشتريات والمخزون",icon:"🛒",items:[{id:"purchase-requests",label:"طلبات الشراء",icon:"📝"},{id:"purchase-quotations",label:"عروض الشراء",icon:"💰"},{id:"purchase-invoices",label:"فواتير الشراء",icon:"📄"},{id:"raw-materials",label:"مخزون المواد الأولية",icon:"🔩"},{id:"material-categories",label:"تصنيفات المواد",icon:"📁"},{id:"inventory-adjustments",label:"جردة المخزون",icon:"⚖️"},{id:"material-movements",label:"حركة المواد",icon:"🔄"}]},{title:"الإنتاج",icon:"🏭",items:[{id:"production-orders",label:"أوامر الإنتاج",icon:"⚙️"},{id:"factory-planner",label:"تخطيط المصانع",icon:"🏭"},{id:"factory-cad-modeling",label:"نمذجة CAD",icon:"🧩"}]},{title:"إدارة الموقع",icon:"⚙️",items:[{id:"quote-requests",label:"طلبات الأسعار",icon:"💬"},{id:"clients",label:"إدارة العملاء",icon:"👥"},{id:"products",label:"المنتجات",icon:"📦"},{id:"product-categories",label:"تصنيفات المنتجات",icon:"🏷️"},{id:"receipt-vouchers",label:"سندات الدفع والقبض",icon:"💳"}
5186,{id:"cash-boxes",label:"الصناديق",icon:"🏦"},{id:"settings",label:"الإعدادات",icon:"⚙️"},{id:"public-home",label:"الصفحة العامة",icon:"🌐"},{id:"employees",label:"الموظفون وأمناء المستودع",icon:"👷"}]}];function F0e(){const[n,e]=T.useState(""),[t,r]=T.useState(""),[s,a]=T.useState(!1),o=OB.auth.login.useMutation(),l=OB.useUtils(),u=async()=>{if(t){a(!0);try{await o.mutateAsync({username:n.trim()||void 0,password:t}),await l.auth.me.invalidate(),await l.auth.me.refetch(),_e.success("تم تسجيل الدخول بنجاح")}catch(d){_e.error(d?.message||"فشل تسجيل الدخول")}finally{a(!1)}}};return i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",dir:"rtl",children:i.jsx("div",{className:"w-full max-w-md px-4",children:i.jsxs(bn,{className:"bg-card border-border p-8 shadow-2xl",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-gradient-to-br from-[#0096a7] to-[#006069] flex items-center justify-center",children:i.jsx($Y,{className:"w-8 h-8 text-primary-foreground"})}),i.jsx("h1",{className:"text-2xl font-bold text-card-foreground mb-2",style:{fontFamily:"'Cairo', sans-serif"},children:"نظام إدارة الإنتاج والمبيعات"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"AMZ Production Management"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-card-foreground mb-2",children:"اسم المستخدم (لأمين المستودع فقط)"}),i.jsx(Ee,{value:n,onChange:d=>e(d.target.value),placeholder:"اتركه فارغاً لدخول المدير",className:"bg-input border-border text-foreground placeholder:text-muted-foreground focus:border-primary focus:ring-primary",dir:"rtl"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-card-foreground mb-2",children:"كلمة المرور"}),i.jsx(Ee,{type:"password",value:t,onChange:d=>r(d.target.value),onKeyDown:d=>d.key==="Enter"&&u(),placeholder:"أدخل كلمة المرور",className:"bg-input border-border text-foreground placeholder:text-muted-foreground focus:border-primary focus:ring-primary",dir:"rtl"})]}),i.jsx(ke,{onClick:u,disabled:s||!t,className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground font-semibold py-6",style:{fontFamily:"'Cairo', sans-serif"},children:s?"جاري الدخول...":"تسجيل الدخول"})]})]})})})}function U0e({activeTab:n,onNavigate:e}){const{data:t}=Pe.dashboard.stats.useQuery(),r=Pe.useUtils(),[s,a]=T.useState(!1),o=Pe.dashboard.markQuoteResponded.useMutation(),l=t?.unreadQuoteRequestsCount||0,u=t?.recentQuoteRequestsAll||[],d=async h=>{try{await o.mutateAsync({id:h}),await r.dashboard.stats.invalidate(),_e.success("تم تمييز الطلب كمقروء")}catch{_e.error("حدث خطأ")}};return i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>a(!s),className:"relative p-2 rounded-lg hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"الإشعارات",children:[i.jsx(EY,{className:"w-5 h-5"}),l>0&&i.jsx("span",{className:"absolute -top-1 -left-1 w-5 h-5 bg-red-500 text-white text-[10px] font-bold rounded-full flex items-center justify-center",children:l})]}),s&&i.jsxs("div",{className:"absolute top-full right-0 mt-2 w-80 max-w-[calc(100vw-1rem)] bg-popover border border-border rounded-xl shadow-2xl z-50 overflow-hidden sm:right-auto sm:left-0",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[i.jsx("span",{className:"text-sm font-bold text-popover-foreground",children:"الإشعارات"}),l>0&&i.jsxs("span",{className:"text-xs text-primary",children:[l," غير مقروء"]})]}),i.jsx("div",{className:"max-h-72 overflow-y-auto",children:u.length===0?i.jsx("p",{className:"text-muted-foreground text-sm text-center py-6",children:"لا توجد إشعارات"}):u.map(h=>i.jsxs("div",{className:`px-4 py-3 border-b border-border/50 hover:bg-accent/30 transition-colors ${h.status==="new"?"bg-primary/5":""}`,children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("p",{className:"text-sm text-popover-foreground",children:["طلب سعر من ",i.jsx("span",{className:"text-primary font-medium",children:h.customerName||"عميل مجهول"})]}),h.status==="new"&&i.jsx("span",{className:"w-2 h-2 rounded-full bg-primary shrink-0"})]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:h.notes||"بدون ملاحظات"})]}),h.status==="new"&&i.jsx("button",{onClick:()=>d(h.id),className:"p-1.5 rounded-lg hover:bg-primary/20 text-primary transition-colors",title:"تمييز كمقروء",children:i.jsx(jc,{className:"w-3.5 h-3.5"})})]}),i.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:new Date(h.createdAt).toLocaleDateString("ar")}
5186)]},h.id))}),u.length>0&&i.jsx("button",{onClick:()=>{e("quote-requests"),a(!1)},className:"w-full text-center text-xs text-primary py-2 hover:bg-accent/30 transition-colors",children:"عرض كل طلبات الأسعار"})]})]})}function UB(){const{user:n,loading:e,isAuthenticated:t,logout:r}=GK(),[s]=pv(),a=()=>VK(`${s}${window.location.search}`),o=n?.role==="cashier",[l,u]=T.useState(o?"employees":a()),d=WK(),[h,p]=T.useState(!0),{theme:x,toggleTheme:y}=DF();if(T.useEffect(()=>{d&&p(!1)},[d]),T.useEffect(()=>{u(o?"employees":a())},[s,o]),e&&!n)return i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:i.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"})});if(!t)return i.jsx(F0e,{});const v=()=>{if(o)return i.jsx(WI,{cashierMode:!0});switch(l){case"dashboard":return i.jsx(yk,{onNavigate:_=>u(_)});case"price-quotations":return i.jsx(lZ,{});case"sales-invoices":return i.jsx(mZ,{});case"official-invoices":return i.jsx(gZ,{});case"packing-lists":return i.jsx(xZ,{});case"purchase-requests":return i.jsx(bZ,{});case"purchase-quotations":return i.jsx(wZ,{});case"purchase-invoices":return i.jsx(yse,{});case"raw-materials":return i.jsx(vse,{});case"material-categories":return i.jsx(wse,{});case"inventory-adjustments":return i.jsx(Sse,{});case"material-movements":return i.jsx(_se,{});case"production-orders":return i.jsx(Ase,{});case"factory-planner":return i.jsx(I0e,{});case"factory-cad-modeling":return i.jsx(O0e,{});case"receipt-vouchers":return i.jsx(VI,{});case"payment-vouchers":return i.jsx(VI,{});case"cash-boxes":return i.jsx(Cse,{});case"clients":return i.jsx(Ese,{});case"products":return i.jsx(Tse,{});case"product-categories":return i.jsx(Rse,{});case"employees":return i.jsx(WI,{});case"reports":return i.jsx(Dse,{});case"settings":return i.jsx(mie,{});case"public-home":return i.jsx(gie,{});case"quote-requests":return i.jsx(eae,{});default:return i.jsx(yk,{onNavigate:_=>u(_)})}};return i.jsxs("div",{className:"min-h-screen min-w-0 overflow-x-hidden bg-background text-foreground flex",dir:"rtl",children:[i.jsxs("aside",{className:`fixed top-0 right-0 h-screen bg-sidebar border-l border-sidebar-border z-40 transition-all duration-300 overflow-y-auto ${h?"w-64 max-w-[calc(100vw-1rem)]":"w-0 -mr-64"}`,style:{fontFamily:"'Cairo', sans-serif"},children:[i.jsxs("div",{className:"p-4 border-b border-sidebar-border flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-[#0096a7] to-[#006069] flex items-center justify-center",children:i.jsx("span",{className:"text-primary-foreground font-bold text-sm",children:"AMZ"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-sm font-bold text-sidebar-foreground",children:"نظام إدارة الإنتاج"}),i.jsx("p",{className:"text-[10px] text-muted-foreground",children:"AMZ Production"})]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[y&&i.jsx("button",{onClick:y,className:"p-2 rounded-lg hover:bg-sidebar-accent transition-colors text-muted-foreground hover:text-foreground",title:x==="dark"?"الوضع النهاري":"الوضع الليلي","aria-label":x==="dark"?"الوضع النهاري":"الوضع الليلي",children:x==="dark"?i.jsx($j,{className:"w-4 h-4"}):i.jsx(Vj,{className:"w-4 h-4"})}),i.jsx("button",{type:"button",onClick:()=>p(!1),className:"md:hidden p-2 rounded-lg bg-sidebar-accent text-sidebar-foreground hover:bg-sidebar-primary/20 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-primary","aria-label":"إغلاق القائمة الجانبية",title:"إغلاق القائمة",children:i.jsx(Mr,{className:"w-5 h-5"})})]})]}),i.jsx("nav",{className:"p-3 space-y-1",children:(o?[{title:"أمين المستودع",icon:"📦",items:[{id:"employees",label:"سحب المواد",icon:"📤"}]}]:FB).map(_=>i.jsxs("div",{className:"mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs font-semibold text-sidebar-primary uppercase tracking-wider",children:[i.jsx("span",{children:_.icon}),i.jsx("span",{children:_.title})]}),_.items.map(M=>i.jsxs("button",{onClick:()=>{u(M.id),d&&p(!1)},className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm transition-all duration-200 mb-0.5 ${l===M.id?"bg-sidebar-accent text-sidebar-primary font-semibold":"text-muted-foreground hover:text-foreground hover:bg-sidebar-accent/50"}`,children:[i.jsx("span",{className:"text-base",children:M.icon}),i.jsx("span",{children:M.label})]},M.id))]},_.title))}),i.jsx("div",{className:"p-4 border-t border-sidebar-border mt-auto",children:i.jsxs("button",{onClick:async()=>{await r(),window.location.reload()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-lg transition-colors",children:[i.jsx(XY,{className:"w-4 h-4"}),i.jsx("span",{children:"تسجيل الخروج"})]})})]}),h&&d&&i.jsx("button",{type:"button","aria-label":"إغلاق القائمة الجانبية",onClick:()=>p(!1),className:"fixed inset-0 z-30 bg-black/45 md:hidden"}),i.jsxs("main",{className:`min-w-0 flex-1 overflow-x-hidden transition-all duration-300 ${h?"md:mr-64":"mr-0"}`,children:[i.jsxs("header",{className:"sticky top-0 z-30 flex min-w-0 items-center justify-between gap-2 border-b border-border bg-background/95 px-2.5 py-2.5 backdrop-blur-sm sm:px-4 sm:py-3",children:[i.jsx("button",{onClick:()=>p(_=>!_),className:"p-2 rounded-lg hover:bg-accent text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary","aria-label":h?"إغلاق القائمة الجانبية":"فتح القائمة الجانبية","aria-expanded":h,children:h?i.jsx(Mr,{className:"w-5 h-5"}):i.jsx(YY,{className:"w-5 h-5"})}),i.jsx("h1",{className:"min-w-0 flex-1 truncate text-center text-sm font-bold text-foreground sm:text-lg",style:{fontFamily:"'Cairo', sans-serif"},children:FB.flatMap(_=>_.items).find(_=>_.id===l)?.label||"لوحة المعلومات"}),i.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-1.5 sm:gap-3",children:[!
5186o&&i.jsx(U0e,{activeTab:l,onNavigate:_=>u(_)}),i.jsxs("div",{className:"hidden max-w-[9rem] truncate text-sm text-muted-foreground sm:block",children:["مرحباً، ",n?.name||(o?"أمين المستودع":"المدير")]})]})]}),i.jsx("div",{className:"min-w-0 p-2.5 sm:p-4",children:v()})]}),!o&&i.jsx(z0e,{activeTab:l,onNavigate:_=>u(_)})]})}function z0e({activeTab:n,onNavigate:e}){const[t,r]=T.useState(!1),s=[{icon:i.jsx(Ki,{className:"w-5 h-5"}),label:"عرض سعر",tab:"price-quotations"},{icon:i.jsx(zj,{className:"w-5 h-5"}),label:"أمر إنتاج",tab:"production-orders"},{icon:i.jsx(TY,{className:"w-5 h-5"}),label:"موظف",tab:"employees"},{icon:i.jsx(zj,{className:"w-5 h-5"}),label:"فاتورة رسمية",tab:"official-invoices"},{icon:i.jsx(cQ,{className:"w-5 h-5"}),label:"فاتورة شراء",tab:"purchase-invoices"},{icon:i.jsx(_c,{className:"w-5 h-5"}),label:"عميل",tab:"clients"},{icon:i.jsx(Jb,{className:"w-5 h-5"}),label:"مادة أولية",tab:"raw-materials"},{icon:i.jsx(ma,{className:"w-5 h-5"}),label:"منتج",tab:"products"},{icon:i.jsx(Lj,{className:"w-5 h-5"}),label:"سند قبض",tab:"receipt-vouchers"},{icon:i.jsx(Lj,{className:"w-5 h-5"}),label:"سند صرف",tab:"payment-vouchers"},{icon:i.jsx(__,{className:"w-5 h-5"}),label:"صندوق نقدي",tab:"cash-boxes"}],a=o=>{r(!1),e(o),_e.success("تم فتح القسم - يمكنك الآن إنشاء عنصر جديد")};return i.jsxs("div",{className:"fixed bottom-6 left-6 z-50",children:[t&&i.jsx("div",{className:"absolute bottom-16 left-0 flex flex-col gap-2 items-end",children:s.map((o,l)=>i.jsxs("button",{onClick:()=>a(o.tab),className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-card border border-border shadow-lg hover:bg-accent text-foreground transition-all duration-200 text-sm",style:{animationDelay:`${l*30}ms`},children:[i.jsx("span",{className:"text-primary",children:o.icon}),i.jsx("span",{children:o.label})]},l))}),i.jsx("button",{onClick:()=>r(!t),className:"w-14 h-14 rounded-full bg-primary text-primary-foreground shadow-lg hover:bg-primary/90 flex items-center justify-center transition-all duration-300 hover:scale-105 active:scale-95",style:{transform:t?"rotate(45deg)":"rotate(0deg)"},children:i.jsx(Nn,{className:"w-7 h-7"})})]})}const FS=n=>`$ ${Math.abs(n||0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`,zB={client:"زبون",supplier:"مورد",both:"زبون ومورد"};function G0e(){const[,n]=TF("/admin/clients/:id"),e=Number(n?.id),[,t]=pv(),[r,s]=T.useState("overview"),[a,o]=T.useState(!1),[l,u]=T.useState({method:"phone",content:""}),[d,h]=T.useState(!1),[p,x]=T.useState({title:"",docType:"contract",fileUrl:"",fileName:"",fileType:""}),[y,v]=T.useState(!1),[_,M]=T.useState({}),[S,A]=T.useState(null),E=Pe.useUtils(),C=Pe.productionOrders.uploadFile.useMutation(),{data:I}=Pe.rawMaterials.list.useQuery(),{data:D,isLoading:B}=Pe.clientProfile.get.useQuery({clientId:e},{enabled:!!e&&!Number.isNaN(e)}),P=Pe.clientCommLogs.create.useMutation(),G=Pe.clientCommLogs.delete.useMutation(),k=Pe.clientDocuments.create.useMutation(),V=Pe.clientDocuments.delete.useMutation(),U=Pe.clients.update.useMutation(),$=Pe.clients.delete.useMutation();T.useEffect(()=>{D&&(A(D),M(D.client))},[D]);const X=async()=>{try{const pe=await E.clientProfile.get.fetch({clientId:e});A(pe)}catch{}},[ee,z]=T.useState({kind:"receipt",open:!1}),[K,ae]=T.useState({}),[oe,re]=T.useState(!1),[F,O]=T.useState({}),[J,q]=T.useState([]),[Q,ne]=T.useState(!1),[Z,se]=T.useState({}),[me,ze]=T.useState([]),[Be,ye]=T.useState(!1),[Le,Ce]=T.useState({}),[Re,De]=T.useState([]),he=Pe.receiptVouchers.create.useMutation(),le=Pe.paymentVouchers.create.useMutation(),Xe=Pe.officialInvoices.create.useMutation(),qe=Pe.purchaseInvoices.create.useMutation(),Ge=Pe.priceQuotations.create.useMutation(),ot=()=>new Date().toISOString().slice(0,10),ve=pe=>{z({kind:pe,open:!0}),ae({clientId:e,clientName:ie.name||"",amount:0,date:ot(),paymentMethod:"cash",bankName:"",checkNumber:"",referenceNumber:"",invoiceNumber:"",description:""})},mt=()=>{O({customerId:e,customerName:ie.name||"",customerPhone:ie.phone||"",customerAddress:ie.address||"",withTax:!1}),q([]),re(!0)},xt=()=>{Ce({supplierId:e,supplierName:ie.name||"",invoiceDate:ot(),notes:""}),De([]),ye(!0)},ge=()=>{se({customerName:ie.name||"",customerPhone:ie.phone||"",customerAddress:ie.address||"",paymentTerms:"",deliveryMethod:"",notes:""}),ze([]),ne(!0)},Y=async()=>
5186{if(!K.amount||K.amount<=0){_e.error("أدخل مبلغاً صحيحاً");return}try{const pe={...K,clientId:Number(e),cashBoxId:0};ee.kind==="receipt"?await he.mutateAsync(pe):await le.mutateAsync(pe),_e.success("تم إنشاء السند"),z({...ee,open:!1}),X()}catch{_e.error("حدث خطأ أثناء الحفظ")}},je=(pe,Ke)=>{const Ne=pe.reduce((Te,st)=>Te+(st.totalPrice||0),0),Ye=Ke?Ne*.15:0;return{subtotal:Ne,taxAmount:Ye,totalAmount:Ne+Ye}},Ie=async()=>{if(!F.customerName?.trim()){_e.error("اسم العميل مطلوب");return}if(J.length===0){_e.error("أضف بنداً واحداً على الأقل");return}try{await Xe.mutateAsync({data:{...F,status:"draft",...je(J,F.withTax)},items:J}),_e.success("تم إنشاء الفاتورة"),re(!1),X()}catch{_e.error("حدث خطأ أثناء الحفظ")}},Ve=async()=>{if(Re.length===0){_e.error("أضف مادة أولية واحدة على الأقل");return}try{const pe=Re.map(Ke=>({...Ke,totalPrice:(Number(Ke.quantity)||0)*(Number(Ke.unitPrice)||0)}));await qe.mutateAsync({data:{supplierId:e,supplierName:Le.supplierName||ie.name||"",invoiceDate:new Date(Le.invoiceDate||ot()),notes:Le.n
5186otes||""},items:pe}),_e.success("تم إنشاء فاتورة المشتريات"),ye(!1),X()}catch(pe){_e.error(pe?.message||"حدث خطأ أثناء إنشاء فاتورة المشتريات")}},ft=async()=>{if(!Z.customerName?.trim()){_e.error("اسم العميل مطلوب");return}if(me.length===0){_e.error("أضف بنداً واحداً على الأقل");return}try{await Ge.mutateAsync({data:{...Z,discountType:"percent",discountValue:0,withTax:!1,currency:"USD",exchangeRate:1},items:me}),_e.success("تم إنشاء عرض السعر"),ne(!1),X()}catch{_e.error("حدث خطأ أثناء الحفظ")}},vt=K.paymentMethod==="check"||K.paymentMethod==="transfer",ce=[{id:"overview",label:"نظرة عامة",icon:jc},{id:"sales_invoices",label:"فواتير مبيعات",icon:JD},{id:"receipt_vouchers",label:"سندات قبض",icon:fF},{id:"payment_vouchers",label:"سندات دفع",icon:N_},{id:"purchase_invoices",label:"فواتير مشتريات",icon:JD},{id:"quotations",label:"عروض أسعار المبيعات",icon:Ki},{id:"documents",label:"المستندات",icon:__},{id:"communication",label:"سجل التواصل",icon:Cu},{id:"statement",label:"كشف حساب تفصيلي",icon:S_}],Me=()=>{t("/admin?tab=clients")},Fe=()=>{const pe=[];S.invoices?.forEach(Ne=>{pe.push(`<tr><td>فاتورة مبيعات</td><td>${Ne.invoiceNumber||""}</td><td>${Number(Ne.totalAmount||0).toLocaleString()}</td><td>-</td><td>${Ne.createdAt?new Date(Ne.createdAt).toLocaleDateString("en-US"):"-"}</td></tr>`)}),S.receipts?.forEach(Ne=>{pe.push(`<tr><td>سند قبض</td><td>${Ne.voucherNumber||""}</td><td>-</td><td>${Number(Ne.amount||0).toLocaleString()}</td><td>${Ne.date||"-"}</td></tr>`)}),S.payments?.forEach(Ne=>{pe.push(`<tr><td>سند صرف</td><td>${Ne.voucherNumber||""}</td><td>${Number(Ne.amount||0).toLocaleString()}</td><td>-</td><td>${Ne.date||"-"}</td></tr>`)});const Ke=`<!DOCTYPE html><html dir="rtl" lang="ar"><head><meta charset="UTF-8"><title>كشف حساب - ${ie.name||""}</title>
5187    <style>@page{margin:0}*{print-color-adjust:exact;-webkit-print-color-adjust:exact}@media print{*{print-color-adjust:exact !important;-webkit-print-color-adjust:exact !important}}body{font-family:'Cairo',sans-serif;padding:30px;color:#1a1a2e}.header{text-align:center;border-bottom:3px solid #0096a7;padding-bottom:15px;margin-bottom:20px}.header h1{color:#0096a7;margin:0}table{width:100%;border-collapse:collapse;margin:15px 0}th{background:#0096a7;color:white;padding:10px;text-align:right;font-size:13px}td{padding:8px 10px;border-bottom:1px solid #d4f0f4;font-size:13px}.info-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin:15px 0}.info-item{background:#f0fbfc;padding:8px 12px;border-radius:6px;border:1px solid #b8e6ec}.info-label{font-weight:600;color:#0096a7;font-size:13px}.info-value{font-size:14px}</style></head><body>
5188    <div class="header"><h1>كشف حساب تفصيلي</h1><p>${ie.name||""}</p></div>
5189    <div class="info-grid">
5190      <div class="info-item"><div class="info-label">تاريخ السجل</div><div class="info-value">${new Date().toLocaleDateString("en-US")}</div></div>
5191      <div class="info-item"><div class="info-label">الرصيد الحالي</div><div class="info-value">${FS(Se)}${Se<0?"-":""}</div></div>
5192      <div class="info-item"><div class="info-label">الهاتف</div><div class="info-value">${ie.phone||"-"}</div></div>
5193    </div>
5194    <table><thead><tr><th>النوع</th><th>المرجع</th><th>مدين (له)</th><th>دائن (عليه)</th><th>التاريخ</th></tr></thead>
5195    <tbody>${pe.length?pe.join(""):'<tr><td colspan="5" style="text-align:center;padding:20px">لا توجد حركات</td></tr>'}</tbody></table>
5196    </body></html>`;Gd(Ke,`كشف حساب - ${ie.name||""}`)};if(Number.isNaN(e))return i.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[i.jsx(_c,{className:"w-8 h-8 mb-2"}),i.jsx("p",{children:"لا يوجد عميل محدد"}),i.jsx(ke,{variant:"outline",size:"sm",className:"mt-3",onClick:Me,children:"العودة إلى العملاء"})]});if(B||!S)return i.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[i.jsx("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent roun
5196ded-full animate-spin mb-3"}),i.jsx("p",{className:"text-sm",children:"جاري تحميل ملف العميل..."})]});const ie=S.client||{},Se=Number(ie.balance||0),Ae=ie.createdAt?new Date(ie.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).replace(/\//g," / "):"-",at=[{label:"عرض سعر",emoji:"📋",action:()=>ge()},{label:"سند قبض",emoji:"💵",action:()=>ve("receipt")},{label:"سند صرف",emoji:"💸",action:()=>ve("payment")},{label:"فاتورة رسمية",emoji:"🧾",action:()=>mt()},{label:"فاتورة مشتريات",emoji:"📄",action:()=>xt()}];return i.jsxs("div",{children:[i.jsxs("button",{onClick:Me,className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-4 transition-colors",children:[i.jsx(D2,{className:"w-4 h-4"}),"العودة إلى قائمة العملاء"]}),i.jsxs(bn,{className:"bg-card border-border p-5 mb-5",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center",children:i.jsx(_c,{className:"w-7 h-7 text-primary"})}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("h1",{className:"text-2xl font-bold text-foreground",children:ie.name||"-"}),ie.type&&i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:zB[ie.type]||ie.type})]}),i.jsxs("p",{className:"text-sm text-muted-foreground mt-1 flex items-center gap-1",children:[i.jsx(w_,{className:"w-3.5 h-3.5"}),"تاريخ التسجيل: ",Ae]})]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"text-left",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"الرصيد"}),i.jsxs("div",{className:`text-2xl font-bold ${Se>0?"text-red-500":Se<0?"text-green-600":"text-muted-foreground"}`,children:[FS(Se),Se<0?"-":""]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>{M(ie),v(!0)},children:[i.jsx(hh,{className:"w-4 h-4 ml-1"})," تعديل"]}),i.jsx(ke,{variant:"outline",size:"sm",className:"text-red-500 border-red-500/30 hover:bg-red-500/10",onClick:async()=>{if(confirm("هل أنت متأكد من حذف هذا العميل؟"))try{await $.mutateAsync({id:e}),_e.success("تم الحذف"),t("/admin?tab=clients")}catch{_e.error("حدث خطأ")}},children:i.jsx(Ar,{className:"w-4 h-4"})})]})]})]}),i.jsx("div",{className:"flex flex-wrap gap-2 mt-4 pt-4 border-t border-border/50",children:at.map(pe=>i.jsxs(ke,{size:"sm",variant:"outline",onClick:pe.action,className:"bg-muted/50 border-border text-foreground text-xs hover:bg-accent",children:[pe.emoji," ",pe.label]},pe.label))})]}),i.jsx("div",{className:"flex border-b border-border mb-5 overflow-x-auto",children:ce.map(pe=>i.jsxs("button",{onClick:()=>s(pe.id),className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap transition-colors flex items-center gap-1.5 ${r===pe.id?"text-primary font-bold border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:[i.jsx(pe.icon,{className:"w-4 h-4"}),pe.label]},pe.id))}),i.jsxs("div",{children:[r==="overview"&&i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:[i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("h3",{className:"font-bold text-foreground mb-4 flex items-center gap-2",children:[i.jsx(_c,{className:"w-4 h-4 text-primary"})," ملخص العميل"]}),i.jsxs("div",{className:"space-y-3 text-sm",children:[i.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border/50",children:[i.jsx("span",{className:"text-muted-foreground",children:"النوع"}),i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs bg-primary/10 text-primary",children:zB[ie.type]||"-"})]}),i.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border/50",children:[i.jsx("span",{className:"text-muted-foreground",children:"الرصيد"}),i.jsxs("span",{className:`font-bold ${Se>0?"text-red-500":Se<0?"text-green-600":"text-foreground"}`,children:[FS(Se),Se<0?"-":""]})]}),i.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border/50",children:[i.jsx("span",{className:"text-muted-foreground",children:"المستندات"}),i.jsx("span",{className:"font-medium text-foreground",children:S.documents?.length||0})]}),i.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border/50",children:[i.jsx("span",{className:"text-muted-foreground",children:"سجلات التواصل"}),i.jsx("span",{className:"font-medium text-foreground",children:S.commLogs?.length||0})]}),i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-muted-foreground",children:"تاريخ التسجيل"}),i.jsx("span",{className:"font-medium text-foreground",children:Ae})]})]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("h3",{className:"font-bold text-foreground mb-4 flex items-center gap-2",children:[i.jsx(Cu,{className:"w-4 h-4 text-primary"})," آخر سجلات التواصل"]}),S.commLogs?.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground
5196/60 text-sm",children:[i.jsx(Cu,{className:"w-6 h-6 mb-2"}),"لا توجد سجلات"]}):i.jsx("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:S.commLogs?.slice(0,5).map(pe=>i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"text-foreground",children:pe.content}),i.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[pe.method," • ",new Date(pe.createdAt).toLocaleString("ar")]})]},pe.id))}),i.jsxs(ke,{size:"sm",variant:"outline",className:"w-full mt-3 bg-muted/50 text-foreground text-xs",onClick:()=>o(!0),children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة تواصل"]})]}),i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("h3",{className:"font-bold text-foreground mb-4 flex items-center gap-2",children:[i.jsx(__,{className:"w-4 h-4 text-primary"})," آخر المستندات"]}),S.documents?.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/60 text-sm",children:[i.jsx(Ki,{className:"w-6 h-6 mb-2"}),"لا توجد مستندات"]}):i.jsx("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:S.documents?.slice(0,5).map(pe=>i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ki,{className:"w-4 h-4 text-primary"}),i.jsx("span",{className:"text-foreground",children:pe.title})]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:pe.type})]},pe.id))}),i.jsxs(ke,{size:"sm",variant:"outline",className:"w-full mt-3 bg-muted/50 text-foreground text-xs",onClick:()=>h(!0),children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة مستند"]})]})]}),r==="sales_invoices"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex justify-end mb-1",children:i.jsxs(ke,{size:"sm",onClick:()=>mt(),className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," فاتورة مبيعات جديدة"]})}),(S.invoices?.length||0)===0?i.jsx(qf,{label:"لا توجد فواتير مبيعات"}):i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-muted-foreground text-right",children:[i.jsx("th",{className:"py-2 px-3",children:"رقم الفاتورة"}),i.jsx("th",{className:"py-2 px-3",children:"المبلغ"}),i.jsx("th",{className:"py-2 px-3",children:"التاريخ"}),i.jsx("th",{className:"py-2 px-3",children:"الحالة"})]})}),i.jsx("tbody",{children:S.invoices?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:pe.invoiceNumber}),i.jsxs("td",{className:"py-2 px-3 text-primary font-medium",children:[Number(pe.totalAmount||0).toLocaleString()," $"]}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.createdAt?new Date(pe.createdAt).toLocaleDateString("ar"):"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.status||"-"})]},pe.id))})]})]}),r==="receipt_vouchers"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex justify-end mb-1",children:i.jsxs(ke,{size:"sm",onClick:()=>ve("receipt"),className:"bg-green-600 hover:bg-green-700 text-white text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," سند قبض جديد"]})}),(S.receipts?.length||0)===0?i.jsx(qf,{label:"لا توجد سندات قبض"}):i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-muted-foreground text-right",children:[i.jsx("th",{className:"py-2 px-3",children:"رقم السند"}),i.jsx("th",{className:"py-2 px-3",children:"المبلغ"}),i.jsx("th",{className:"py-2 px-3",children:"طريقة الدفع"}),i.jsx("th",{className:"py-2 px-3",children:"التاريخ"})]})}),i.jsx("tbody",{children:S.receipts?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:pe.voucherNumber}),i.jsxs("td",{className:"py-2 px-3 text-green-600 font-medium",children:[Number(pe.amount||0).toLocaleStr
5196ing()," $"]}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.cashBoxName||pe.cashBoxId||"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.date||"-"})]},pe.id))})]})]}),r==="payment_vouchers"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex justify-end mb-1",children:i.jsxs(ke,{size:"sm",onClick:()=>ve("payment"),className:"bg-red-500 hover:bg-red-600 text-white text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," سند صرف جديد"]})}),(S.payments?.length||0)===0?i.jsx(qf,{label:"لا توجد سندات صرف"}):i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-muted-foreground text-right",children:[i.jsx("th",{className:"py-2 px-3",children:"رقم السند"}),i.jsx("th",{className:"py-2 px-3",children:"المبلغ"}),i.jsx("th",{className:"py-2 px-3",children:"طريقة الدفع"}),i.jsx("th",{className:"py-2 px-3",children:"التاريخ"})]})}),i.jsx("tbody",{children:S.payments?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:pe.voucherNumber}),i.jsxs("td",{className:"py-2 px-3 text-red-500 font-medium",children:[Number(pe.amount||0).toLocaleString()," $"]}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.cashBoxName||pe.cashBoxId||"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.date||"-"})]},pe.id))})]})]}),r==="purchase_invoices"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex justify-end mb-1",children:i.jsxs(ke,{size:"sm",onClick:()=>xt(),className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إنشاء فاتورة مشتريات"]})}),(S.supplierInvoices?.length||0)===0?i.jsx(qf,{label:"لا توجد فواتير مشتريات"}):i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-muted-foreground text-right",children:[i.jsx("th",{className:"py-2 px-3",children:"رقم الفاتورة"}),i.jsx("th",{className:"py-2 px-3",children:"المبلغ"}),i.jsx("th",{className:"py-2 px-3",children:"طريقة الدفع"}),i.jsx("th",{className:"py-2 px-3",children:"التاريخ"})]})}),i.jsx("tbody",{children:S.supplierInvoices?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:pe.invoiceNumber}),i.jsxs("td",{className:"py-2 px-3 text-purple-500 font-medium",children:[Number(pe.totalAmount||0).toLocaleString()," $"]}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.paymentMethod||"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.invoiceDate||(pe.createdAt?new Date(pe.createdAt).toLocaleDateString("ar"):"-")})]},pe.id))})]})]}),r==="quotations"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex justify-end mb-1",children:i.jsxs(ke,{size:"sm",onClick:()=>ge(),className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," عرض سعر جديد"]})}),(S.quotations?.length||0)===0?i.jsx(qf,{label:"لا توجد عروض أسعار"}):i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-muted-foreground text-right",children:[i.jsx("th",{className:"py-2 px-3",children:"رقم العرض"}),i.jsx("th",{className:"py-2 px-3",children:"الإجمالي"}),i.jsx("th",{className:"py-2 px-3",children:"الحالة"}),i.jsx("th",{className:"py-2 px-3",children:"التاريخ"})]})}),i.jsx("tbody",{children:S.quotations?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:pe.quotationNumber}),i.jsxs("td",{className:"py-2 px-3 text-primary font-medium",children:[Number(pe.totalAmount||0).toLocaleString()," ",pe.currency||"$"]}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.status||"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.quotationDate||(pe.createdAt?new Date(pe.createdAt).toLocaleDateString("ar"):"-")})]},pe.id))})]})]}),r==="documents"&&i.jsxs("div",{children:[i.jsx("div",{className:"flex justify-end mb-3",children:i.jsxs(ke,{size:"sm",onClick:()=>h(!0),className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة مستند"]})}),(S.documents?.length||0)===0?i.jsx(qf,{label:"لا توجد مستندات"}):i.jsx("div",{className:"space-y-2",children:S.documents?.map(pe=>i.jsxs("div",{className:"bg-muted/50 border border-border/50 rounded-lg p-3 flex justify-between items-center",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Ki,{className:"w-4 h-4 text-primary"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground font-medium",children:pe.name||pe.title}),i.jsxs("div",{className:"text-xs text-muted-foreground",children:[pe.fileType||pe.type||"",pe.fileType&&pe.type?" • ":"",pe.fileType?pe.type:""," • ",pe.createdAt?new Date(pe.createdAt).toLocaleDateString("ar"):""]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[pe.fileUrl?i.jsx("a",{href:pe.fileUrl,target:"_blank",rel:"noreferrer",className:"text-primary hover:text-primary/80 text-xs underline",children:"معاينة"}):null,i.jsx("button",{onClick:async()=>{await V.mutateAsync({id:pe.id}),_e.success("تم الحذف"),X()},className:"text-red-500 hover:text-red-600",children:i.jsx(Ar,{className:"w-4 h-4"})})]})]},pe.id))})]}),r==="communication"&&i.jsxs("div",{children:[i.jsx("div",{className:"flex justify-end mb-3",children:i.jsxs(ke,{size:"sm",onClick:()=>o(!0),className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," إضافة تواصل"]})}),(S.commLogs?.length||0)===0?i.jsx(qf,{label:"لا يوجد سجل تواصل"}):i.jsx("div",{className:"space-y-2",children:S.commLogs?.map(pe=>i.jsxs("div",{className:"bg-muted/50 border border-border/50 rounded-lg p-3 flex justify-between items-center",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Cu,{className:"w-4 h-4 text-primary"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm text-foreground",children:pe.content}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[pe.method," • ",new Date(pe.createdAt).toLocaleStr
5196ing("ar")]})]})]}),i.jsx("button",{onClick:async()=>{await G.mutateAsync({id:pe.id}),_e.success("تم الحذف"),X()},className:"text-red-500 hover:text-red-600",children:i.jsx(Ar,{className:"w-4 h-4"})})]},pe.id))})]}),r==="statement"&&i.jsx("div",{className:"space-y-5",children:i.jsxs(bn,{className:"bg-card border-border p-5",children:[i.jsxs("h3",{className:"font-bold text-foreground mb-4 flex items-center gap-2",children:[i.jsx(S_,{className:"w-4 h-4 text-primary"})," كشف حساب تفصيلي"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-4",children:[i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"الرصيد الحالي"}),i.jsxs("div",{className:`text-xl font-bold mt-1 ${Se>0?"text-red-500":Se<0?"text-green-600":"text-foreground"}`,children:[FS(Se),Se<0?"-":""]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"إجمالي فواتير المبيعات"}),i.jsxs("div",{className:"text-lg font-medium text-foreground mt-1",children:[(S.invoices?.reduce((pe,Ke)=>pe+Number(Ke.totalAmount||0),0)||0).toLocaleString()," $"]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"إجمالي سندات القبض"}),i.jsxs("div",{className:"text-lg font-medium text-green-600 mt-1",children:[(S.receipts?.reduce((pe,Ke)=>pe+Number(Ke.amount||0),0)||0).toLocaleString()," $"]})]}),i.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"إجمالي سندات الصرف"}),i.jsxs("div",{className:"text-lg font-medium text-red-500 mt-1",children:[(S.payments?.reduce((pe,Ke)=>pe+Number(Ke.amount||0),0)||0).toLocaleString()," $"]})]})]}),i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border text-muted-foreground text-right",children:[i.jsx("th",{className:"py-2 px-3",children:"النوع"}),i.jsx("th",{className:"py-2 px-3",children:"المرجع"}),i.jsx("th",{className:"py-2 px-3",children:"مدين (له)"}),i.jsx("th",{className:"py-2 px-3",children:"دائن (عليه)"}),i.jsx("th",{className:"py-2 px-3",children:"التاريخ"})]})}),i.jsxs("tbody",{children:[S.invoices?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:"فاتورة مبيعات"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.invoiceNumber}),i.jsx("td",{className:"py-2 px-3 text-foreground",children:Number(pe.totalAmount||0).toLocaleString()}),i.jsx("td",{className:"py-2 px-3",children:"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.createdAt?new Date(pe.createdAt).toLocaleDateString("ar"):"-"})]},`inv-${pe.id}`)),S.receipts?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:"سند قبض"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.voucherNumber}),i.jsx("td",{className:"py-2 px-3",children:"-"}),i.jsx("td",{className:"py-2 px-3 text-green-600",children:Number(pe.amount||0).toLocaleString()}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.date||"-"})]},`rc-${pe.id}`)),S.payments?.map(pe=>i.jsxs("tr",{className:"border-b border-border/50",children:[i.jsx("td",{className:"py-2 px-3 text-foreground",children:"سند صرف"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.voucherNumber}),i.jsx("td",{className:"py-2 px-3 text-red-500",children:Number(pe.amount||0).toLocaleString()}),i.jsx("td",{className:"py-2 px-3",children:"-"}),i.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:pe.date||"-"})]},`pm-${pe.id}`))]})]}),(S.invoices?.length||0)+(S.receipts?.length||0)+(S.payments?.length||0)===0&&i.jsx(qf,{label:"لا توجد حركات لعرضها"}),i.jsx("div",{className:"flex justify-end mt-4",children:i.jsxs(ke,{size:"sm",onClick:Fe,className:"bg-primary text-primary-foreground text-xs",children:[i.jsx(nl,{className:"w-3.5 h-3.5 ml-1"})," طباعة كشف الحساب"]})})]})})]}),i.jsx(Qa,{open:ee.open,onOpenChange:pe=>!pe&&z({...ee,open:!1}),children:i.jsxs(Ka,{className:"bg-muted/50 border-border max-w-md",dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",children:ee.kind==="receipt"?"سند قبض":"سند صرف"})}),i.jsxs("div",{className:"space-y-3 mt-2",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"text-xs text-muted-foreground mb-1 block",children:[ee.kind==="receipt"?"العميل":"المورد"," *"]}),i.jsx(Ee,{value:K.clientName||"",onChange:pe=>ae({...K,clientName:pe.target.value}),readOnly:!0,className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"المبلغ ($) *"}),i.jsx(Ee,{type:"number",step:"0.01",value:K.amount||"",onChange:pe=>ae({...K,amount:parseFloat(pe.target.value)||0}),placeholder:"0.00",className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"التاريخ"}),i.jsx(Ee,{type:"date",value:K.date||"",onChange:pe=>ae({...K,date:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"طريقة الدفع"}),i.jsxs(En,{value:K.paymentMethod||"cash",onValueChange:pe=>ae({...K,paymentMethod:pe}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",dir:"rtl",children:[i.jsx(bt,{value:"cash",children:"نقدي"}),i.jsx(bt,{value:"check",children:"شيك"}),i.jsx(bt,{value:"transfer",children:"تحويل بنكي"}),i.jsx(bt,{value:"card",children:"بطاقة"})]})]})]}),vt&&i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم البنك"}),i.jsx(Ee,{value:K.bankName||"",onChange:pe=>ae({...K,bankName:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:K.paymentMethod==="check"?"رقم الشيك":"رقم الحوالة"}),i.jsx(Ee,{value:K.checkNumber||"",onChange:pe=>ae({...K,checkNumber:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الوصف / البيان"}),i.jsx(ni,{value:K.description||"",onChange:pe=>ae({...K,description:pe.target.value}),placeholder:"وصف إضافي (اختياري)",rows:2,className:"bg-muted/50 border-border text-foreground"})]})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>z({...ee,open:!1}),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:Y,className:"bg-primary text-primary-foreground",disabled:he.isPending||le.isPending,children:"حفظ السند"})]})]})}),i.jsx(Qa,{open:Be,onOpenChange:ye,children:i.jsxs(Ka,{className:"bg-white border-border max-w-3xl",dir:"rtl",children:[i.jsx(Ja,{children:i.jsxs(Za,{className:"text-slate-900",children:["فاتورة مشتريات جديدة — ",ie.name||""]})}),i.jsxs("div",{className:"space-y-3 mt-2 max-h-[65vh] overflow-y-auto",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-slate-700 mb-1 block",children:"المورد"}),i.jsx(Ee,{value:Le.supplierName||ie.name||"",onChange:pe=>Ce({...Le,supplierName:pe.target.value}),className:"bg-white border-slate-300 text-slate-900"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-slate-700 mb-1 block",children:"تاريخ الفاتورة"}),i.jsx(Ee,{type:"date",value:Le.invoiceDate||ot(),onChange:pe=>Ce({...Le,invoiceDate:pe.target.value}),className:"bg-white border-slate-300 text-slate-900"})]})]}),i.jsxs("div",{className:"rounded-lg border border-slate-200 p-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs font-semibold text-primary",children:"المواد الأولية"}),i.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>De([...Re,{rawMaterialId:0,rawMaterialName:"",quantity:1,unitPrice:0,totalPrice:0,machineId:"",machineName:"",manufacturingQty:0}]),className:"bg-white border-slate-300 text-slate-900 text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," مادة"]})]}),i.jsxs("div",{className:"space-y-2",children:[Re.map((pe,Ke)=>i.jsxs("div",{className:"grid grid-cols-12 gap-2 items-end",children:[i.jsxs("div",{className:"col-span-6",children:[i.jsx("label",{className:"text-[11px] text-slate-700 mb-1 block",children:"المادة"}),i.jsxs("select",{value:String(pe.rawMaterialId||"none"),onChange:Ne=>{const Ye=(I||[]).find(st=>Number(st.id)===Number(Ne.target.value)),Te=[...Re];Te[Ke]={...Te[Ke],rawMaterialId:Ye?.id||0,rawMaterialName:Ye?.name||"",unitPrice:Number(Ye?.purchasePrice||0),totalPrice:(Number(Te[Ke].quantity)||0)*Number(Ye?.purchasePrice||0)},De(Te)},className:"h-9 w-full rounded-md border border-slate-300 bg-white px-2 text-xs text-slate-900",children:[i.jsx("option",{value:"none",children:"اختر المادة الأولية"}),(I||[]).map(Ne=>i.jsx("option",{value:String(Ne.id),children:Ne.name},Ne.id))]})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:"text-[11px] text-slate-700 mb-1 block",children:"الكمية"}),i.jsx(Ee,{type:"number",min:"0",value:pe.quantity,onChange:Ne=>{const Ye=Number(Ne.target.value)||0,Te=[...Re];Te[Ke]={...Te[Ke],quantity:Ye,totalPrice:Ye*(Number(Te[Ke].unitPrice)||0)},De(Te)},className:"bg-white border-slate-300 text-slate-900 text-xs"})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("label",{className:"text-[11px] text-slate-700 mb-1 block",children:"سعر الوحدة"}),i.jsx(Ee,{type:"number",min:"0",step:"0.01",value:pe.unitPrice,onChange:Ne=>{const Ye=Number(Ne.target.value)||0,Te=[...Re];Te[Ke]={...Te[Ke],unitPrice:Ye,totalPrice:Ye*(Number(Te[Ke].quantity)||0)},De(Te)},className:"bg-white border-slate-300 text-slate-900 text-xs"})]}),i.jsx("div",{className:"col-span-1 text-xs font-bold text-slate-900",children:Number(pe.totalPrice||0).toLocaleStr
5196ing()}),i.jsx("div",{className:"col-span-1",children:i.jsx("button",{type:"button",onClick:()=>De(Re.filter((Ne,Ye)=>Ye!==Ke)),className:"rounded p-1 text-red-600 hover:bg-red-50",children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})})]},Ke)),Re.length===0&&i.jsx("p",{className:"py-4 text-center text-xs text-slate-500",children:"أضف مادة أولية واحدة على الأقل"})]}),i.jsxs("div",{className:"mt-3 flex justify-end border-t border-slate-200 pt-3 text-sm font-bold text-slate-900",children:["الإجمالي: ",Re.reduce((pe,Ke)=>pe+Number(Ke.totalPrice||0),0).toLocaleString()," $"]})]}),i.jsx(ni,{value:Le.notes||"",onChange:pe=>Ce({...Le,notes:pe.target.value}),placeholder:"ملاحظات الفاتورة",className:"bg-white border-slate-300 text-slate-900"})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>ye(!1),className:"border-slate-300 text-slate-900",children:"إلغاء"}),i.jsx(ke,{onClick:Ve,className:"bg-primary text-primary-foreground",disabled:qe.isPending,children:"حفظ فاتورة المشتريات"})]})]})}),i.jsx(Qa,{open:oe,onOpenChange:re,children:i.jsxs(Ka,{className:"bg-muted/50 border-border max-w-3xl",dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",children:"فاتورة رسمية جديدة"})}),i.jsxs("div",{className:"space-y-3 mt-2 max-h-[60vh] overflow-y-auto",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم العميل *"}),i.jsx(Ee,{value:F.customerName||"",onChange:pe=>O({...F,customerName:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الهاتف"}),i.jsx(Ee,{value:F.customerPhone||"",onChange:pe=>O({...F,customerPhone:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"العنوان"}),i.jsx(Ee,{value:F.customerAddress||"",onChange:pe=>O({...F,customerAddress:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]}),i.jsx("div",{className:"flex items-end",children:i.jsxs("label",{className:"flex items-center gap-2 text-xs text-foreground",children:[i.jsx("input",{type:"checkbox",checked:F.withTax||!1,onChange:pe=>O({...F,withTax:pe.target.checked}),className:"accent-primary"}),"شامل الضريبة (15%)"]})})]}),i.jsxs("div",{className:"border border-border rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs font-semibold text-primary",children:"البنود"}),i.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>q([...J,{productName:"",specs:"",quantity:1,unitPrice:0,totalPrice:0}]),className:"bg-muted/50 border-border text-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," بند"]})]}),i.jsxs("div",{className:"space-y-2",children:[J.map((pe,Ke)=>i.jsxs("div",{className:"grid grid-cols-12 gap-2 items-end",children:[i.jsx("div",{className:"col-span-4",children:i.jsx(Ee,{value:pe.productName,onChange:Ne=>{const Ye=[...J];Ye[Ke]={...Ye[Ke],productName:Ne.target.value},q(Ye)},placeholder:"اسم المنتج",className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-3",children:i.jsx(Ee,{value:pe.specs,onChange:Ne=>{const Ye=[...J];Ye[Ke]={...Ye[Ke],specs:Ne.target.value},q(Ye)},placeholder:"المواصفات",className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-1",children:i.jsx(Ee,{type:"number",value:pe.quantity,onChange:Ne=>{const Ye=parseFloat(Ne.target.value)||0,Te=[...J];Te[Ke]={...Te[Ke],quantity:Ye,totalPrice:Ye*(Te[Ke].unitPrice||0)},q(Te)},className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-2",children:i.jsx(Ee,{type:"number",step:"0.01",value:pe.unitPrice,onChange:Ne=>{const Ye=parseFloat(Ne.target.value)||0,Te=[...J];Te[Ke]={...Te[Ke],unitPrice:Ye,totalPrice:Ye*(Te[Ke].quantity||0)},q(Te)},placeholder:"السعر",className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-1 text-xs text-foreground pt-2",children:(pe.totalPrice||0).toLocaleStr
5196ing()}),i.jsx("div",{className:"col-span-1",children:i.jsx("button",{type:"button",onClick:()=>q(J.filter((Ne,Ye)=>Ye!==Ke)),className:"p-1 rounded text-red-500 hover:bg-red-500/10",children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})})]},Ke)),J.length===0&&i.jsx("p",{className:"text-xs text-muted-foreground/70 text-center py-3",children:"لا توجد بنود — أضف بنداً واحداً على الأقل"})]}),i.jsxs("div",{className:"flex justify-end gap-4 mt-3 pt-3 border-t border-border text-xs",children:[i.jsxs("span",{className:"text-muted-foreground",children:["المجموع: ",i.jsxs("span",{className:"text-foreground font-bold",children:[je(J,F.withTax).subtotal.toLocaleString()," $"]})]}),F.withTax&&i.jsxs("span",{className:"text-muted-foreground",children:["الضريبة: ",i.jsxs("span",{className:"text-foreground font-bold",children:[je(J,F.withTax).taxAmount.toLocaleString()," $"]})]}),i.jsxs("span",{className:"text-muted-foreground",children:["الإجمالي: ",i.jsxs("span",{className:"text-primary font-bold",children:[je(J,F.withTax).totalAmount.toLocaleString()," $"]})]})]})]})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>re(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:Ie,className:"bg-primary text-primary-foreground",disabled:Xe.isPending,children:"حفظ الفاتورة"})]})]})}),i.jsx(Qa,{open:Q,onOpenChange:ne,children:i.jsxs(Ka,{className:"bg-muted/50 border-border max-w-3xl",dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",children:"عرض سعر جديد"})}),i.jsxs("div",{className:"space-y-3 mt-2 max-h-[60vh] overflow-y-auto",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"اسم العميل *"}),i.jsx(Ee,{value:Z.customerName||"",onChange:pe=>se({...Z,customerName:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"الهاتف"}),i.jsx(Ee,{value:Z.customerPhone||"",onChange:pe=>se({...Z,customerPhone:pe.target.value}),className:"bg-muted/50 border-border text-foreground"})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs font-semibold text-primary",children:"البنود"}),i.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>ze([...me,{productName:"",specs:"",quantity:1,unitPrice:0,totalPrice:0}]),className:"bg-muted/50 border-border text-foreground text-xs",children:[i.jsx(Nn,{className:"w-3.5 h-3.5 ml-1"})," بند"]})]}),i.jsxs("div",{className:"space-y-2",children:[me.map((pe,Ke)=>i.jsxs("div",{className:"grid grid-cols-12 gap-2 items-end",children:[i.jsx("div",{className:"col-span-4",children:i.jsx(Ee,{value:pe.productName,onChange:Ne=>{const Ye=[...me];Ye[Ke]={...Ye[Ke],productName:Ne.target.value},ze(Ye)},placeholder:"اسم المنتج",className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-3",children:i.jsx(Ee,{value:pe.specs,onChange:Ne=>{const Ye=[...me];Ye[Ke]={...Ye[Ke],specs:Ne.target.value},ze(Ye)},placeholder:"المواصفات",className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-1",children:i.jsx(Ee,{type:"number",value:pe.quantity,onChange:Ne=>{const Ye=parseFloat(Ne.target.value)||0,Te=[...me];Te[Ke]={...Te[Ke],quantity:Ye,totalPrice:Ye*(Te[Ke].unitPrice||0)},ze(Te)},className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-2",children:i.jsx(Ee,{type:"number",step:"0.01",value:pe.unitPrice,onChange:Ne=>{const Ye=parseFloat(Ne.target.value)||0,Te=[...me];Te[Ke]={...Te[Ke],unitPrice:Ye,totalPrice:Ye*(Te[Ke].quantity||0)},ze(Te)},placeholder:"السعر",className:"bg-muted/50 border-border text-foreground text-xs"})}),i.jsx("div",{className:"col-span-1 text-xs text-foreground pt-2",children:(pe.totalPrice||0).toLocaleStr
5196ing()}),i.jsx("div",{className:"col-span-1",children:i.jsx("button",{type:"button",onClick:()=>ze(me.filter((Ne,Ye)=>Ye!==Ke)),className:"p-1 rounded text-red-500 hover:bg-red-500/10",children:i.jsx(Ar,{className:"w-3.5 h-3.5"})})})]},Ke)),me.length===0&&i.jsx("p",{className:"text-xs text-muted-foreground/70 text-center py-3",children:"لا توجد بنود — أضف بنداً واحداً على الأقل"})]}),i.jsxs("div",{className:"flex justify-end mt-3 pt-3 border-t border-border text-xs text-muted-foreground",children:["الإجمالي: ",i.jsxs("span",{className:"text-primary font-bold mr-1",children:[me.reduce((pe,Ke)=>pe+(Ke.totalPrice||0),0).toLocaleString()," $"]})]})]})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>ne(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:ft,className:"bg-primary text-primary-foreground",disabled:Ge.isPending,children:"حفظ العرض"})]})]})}),i.jsx(Qa,{open:a,onOpenChange:o,children:i.jsxs(Ka,{className:"bg-muted/50 border-border max-w-md",dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",children:"إضافة سجل تواصل"})}),i.jsxs("div",{className:"space-y-3 mt-2",children:[i.jsxs(En,{value:l.method,onValueChange:pe=>u({...l,method:pe}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"phone",children:"مكالمة هاتفية"}),i.jsx(bt,{value:"whatsapp",children:"واتساب"}),i.jsx(bt,{value:"email",children:"بريد إلكتروني"}),i.jsx(bt,{value:"visit",children:"زيارة"}),i.jsx(bt,{value:"other",children:"أخرى"})]})]}),i.jsx(ni,{value:l.content,onChange:pe=>u({...l,content:pe.target.value}),placeholder:"محتوى التواصل...",className:"bg-muted/50 border-border text-foreground min-h-24"})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>o(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:async()=>{try{await P.mutateAsync({clientId:e,method:l.method,content:l.content}),_e.success("تم الإضافة"),o(!1),X()}catch{_e.error("حدث خطأ")}},className:"bg-primary text-primary-foreground",children:"حفظ"})]})]})}),i.jsx(Qa,{open:d,onOpenChange:h,children:i.jsxs(Ka,{className:"bg-muted/50 border-border max-w-md",dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",children:"إضافة مستند"})}),i.jsxs("div",{className:"space-y-3 mt-2",children:[i.jsx(Ee,{value:p.title,onChange:pe=>x({...p,title:pe.target.value}),placeholder:"عنوان المستند",className:"bg-muted/50 border-border text-foreground"}),i.jsxs(En,{value:p.docType,onValueChange:pe=>x({...p,docType:pe}),children:[i.jsx(Tn,{className:"bg-muted/50 border-border text-foreground",children:i.jsx(jn,{})}),i.jsxs(Rn,{className:"bg-muted/50 border-border",children:[i.jsx(bt,{value:"contract",children:"عقد"}),i.jsx(bt,{value:"id_card",children:"بطاقة هوية"}),i.jsx(bt,{value:"commercial_registration",children:"سجل تجاري"}),i.jsx(bt,{value:"tax_certificate",children:"شهادة ضريبية"}),i.jsx(bt,{value:"other",children:"أخرى"})]})]})]}),i.jsxs("div",{className:"mt-2",children:[i.jsx("label",{className:"text-sm text-muted-foreground mb-1 block",children:"ملف المستند (اختياري)"}),i.jsx(Ee,{type:"file",onChange:async pe=>{const Ke=pe.target.files?.[0];if(Ke)try{const Ne=await new Promise(Te=>{const st=new FileReader;st.onload=()=>Te(st.result),st.readAsDataURL(Ke)}),Ye=await C.mutateAsync({fileBase64:Ne,fileName:Ke.name});x({...p,title:p.title||Ke.name,fileUrl:Ye.url,fileName:Ye.fileName,fileType:Ye.fileType}),_e.success("تم رفع الملف")}catch{_e.error("فشل رفع الملف")}},className:"bg-muted/50 border-border text-foreground"}),p.fileUrl&&i.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-primary",children:[i.jsx(Ki,{className:"w-3.5 h-3.5"}),i.jsx("span",{className:"truncate",children:p.fileName}),i.jsx("a",{href:p.fileUrl,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"معاينة"})]})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>h(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:async()=>{try{await k.mutateAsync({clientId:e,name:p.title||p.fileName||"مستند",type:p.docType,fileUrl:p.fileUrl,fileType:p.fileType}),_e.success("تم الإضافة"),h(!1),x({title:"",docType:"contract",f
5196ileUrl:"",fileName:"",fileType:""}),X()}catch{_e.error("حدث خطأ")}},className:"bg-primary text-primary-foreground",children:"حفظ"})]})]})}),i.jsx(Qa,{open:y,onOpenChange:v,children:i.jsxs(Ka,{className:"bg-muted/50 border-border max-w-lg",dir:"rtl",children:[i.jsx(Ja,{children:i.jsx(Za,{className:"text-foreground",children:"تعديل بيانات العميل"})}),i.jsxs("div",{className:"space-y-3 mt-2",children:[i.jsx(Ee,{value:_.name||"",onChange:pe=>M({..._,name:pe.target.value}),placeholder:"الاسم",className:"bg-muted/50 border-border text-foreground"}),i.jsx(Ee,{value:_.phone||"",onChange:pe=>M({..._,phone:pe.target.value}),placeholder:"الهاتف",className:"bg-muted/50 border-border text-foreground"}),i.jsx(Ee,{value:_.email||"",onChange:pe=>M({..._,email:pe.target.value}),placeholder:"البريد",className:"bg-muted/50 border-border text-foreground"}),i.jsx(Ee,{value:_.address||"",onChange:pe=>M({..._,address:pe.target.value}),placeholder:"العنوان",className:"bg-muted/50 border-border text-foreground"}),i.jsx(ni,{value:_.notes||"",onChange:pe=>M({..._,notes:pe.target.value}),placeholder:"ملاحظات",className:"bg-muted/50 border-border text-foreground"})]}),i.jsxs(Qf,{children:[i.jsx(ke,{variant:"outline",onClick:()=>v(!1),className:"border-border text-foreground",children:"إلغاء"}),i.jsx(ke,{onClick:async()=>{try{await U.mutateAsync({id:e,data:_}),_e.success("تم التحديث"),v(!1),X()}catch{_e.error("حدث خطأ")}},className:"bg-primary text-primary-foreground",children:"حفظ"})]})]})})]})}function qf({label:n}){return i.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-muted-foreground/60 text-sm bg-muted/30 rounded-lg border border-border/50",children:[i.jsx(Ki,{className:"w-6 h-6 mb-2"}),n]})}function GB({onCatalogClick:n,theme:e,toggleTheme:t}){const[r,s]=T.useState(!1),[a,o]=T.useState(!1);return T.useEffect(()=>{const l=()=>o(window.scrollY>20);return window.addEventListener("scroll",l),()=>window.removeEventListener("scroll",l)},[]),i.jsxs("header",{className:`sticky top-0 z-50 transition-all duration-300 ${a?e==="dark"?"bg-[#1a1a2e]/95 backdrop-blur-md shadow-lg":"bg-white/95 backdrop-blur-md shadow-lg":e==="dark"?"bg-transparent":"bg-white/90 backdrop-blur-sm"}`,dir:"rtl",children:[i.jsx("div",{className:"container mx-auto px-4 md:px-6",children:i.jsxs("div",{className:"flex items-center justify-between h-16 md:h-20",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-[#0096a7] to-[#006069] flex items-center justify-center",children:i.jsx("span",{className:"text-white font-bold text-sm",children:"AMZ"})}),i.jsx("span",{className:`font-bold text-lg ${e==="dark"?"text-white":"text-gray-900"}`,children:"AMZ MAKiNA"})]}),i.jsxs("nav",{className:"hidden md:flex items-center gap-8",children:[i.jsx("button",{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:`text-sm font-medium transition-colors hover:text-[#0096a7] ${e==="dark"?"text-white/90":"text-gray-700"}`,children:"الرئيسية"}),i.jsx("button",{onClick:n,className:`text-sm font-medium transition-colors hover:text-[#0096a7] ${e==="dark"?"text-white/90":"text-gray-700"}`,children:"الكتالوج"}),i.jsx("button",{onClick:()=>document.getElementById("contact")?.scrollIntoView({behavior:"smooth"}),className:`text-sm font-medium transition-colors hover:text-[#0096a7] ${e==="dark"?"text-white/90":"text-gray-700"}`,children:"تواصل معنا"}),t&&i.jsx("button",{onClick:t,className:`p-2 rounded-lg transition-colors ${e==="dark"?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"}`,children:e==="dark"?i.jsx($j,{className:"w-4 h-4"}):i.jsx(Vj,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[t&&i.jsx("button",{onClick:t,className:`p-2 rounded-lg ${e==="dark"?"text-white":"text-gray-700"}`,children:e==="dark"?i.jsx($j,{className:"w-4 h-4"}):i.jsx(Vj,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>s(!r),className:`p-2 rounded-lg ${e==="dark"?"text-white":"text-gray-700"}`,children:r?i.jsx(Mr,{className:"w-6 h-6"}):i.jsx(H0e,{})})]})]})}),i.jsx(zm,{children:r&&i.jsx(Gs.div,{initial:{height:0,opacity:0}
5196,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`md:hidden overflow-hidden border-t ${e==="dark"?"border-white/10 bg-[#1a1a2e]/95":"border-gray-200 bg-white/95"}`,children:i.jsxs("div",{className:"container mx-auto px-4 py-4 space-y-3",children:[i.jsx("button",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),s(!1)},className:`block w-full text-right text-sm font-medium py-2 ${e==="dark"?"text-white":"text-gray-700"}`,children:"الرئيسية"}),i.jsx("button",{onClick:()=>{n(),s(!1)},className:`block w-full text-right text-sm font-medium py-2 ${e==="dark"?"text-white":"text-gray-700"}`,children:"الكتالوج"}),i.jsx("button",{onClick:()=>{document.getElementById("contact")?.scrollIntoView({behavior:"smooth"}),s(!1)},className:`block w-full text-right text-sm font-medium py-2 ${e==="dark"?"text-white":"text-gray-700"}`,children:"تواصل معنا"})]})})})]})}function H0e(){return i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),i.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),i.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]})}function V0e({onCatalogClick:n,theme:e}){return i.jsx("section",{className:"relative overflow-hidden",dir:"rtl",children:i.jsxs("div",{className:`relative py-20 md:py-32 ${e==="dark"?"bg-[#1a1a2e]":"bg-gradient-to-b from-[#1a1a2e] to-white"}`,children:[i.jsx("div",{className:"absolute top-10 left-10 w-40 h-40 border border-white/5 rounded-full"}),i.jsx("div",{className:"absolute bottom-20 right-20 w-60 h-60 border border-white/5 rounded-full"}),i.jsx("div",{className:"absolute top-1/2 left-1/3 w-20 h-20 border border-white/5 rounded-full"}),i.jsxs("div",{className:"container mx-auto px-4 text-center relative z-10",children:[i.jsx(Gs.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:i.jsx("div",{className:"w-24 h-24 md:w-32 md:h-32 rounded-2xl bg-gradient-to-br from-[#0096a7] to-[#006069] flex items-center justify-center mx-auto mb-8 shadow-2xl",children:i.jsx("span",{className:"text-white font-bold text-2xl md:text-3xl",children:"AMZ"})})}),i.jsxs(Gs.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"text-3xl md:text-5xl lg:text-6xl font-bold text-white mb-4",children:["حلول الآلات الصناعية",i.jsx("br",{}),i.jsx("span",{className:"text-[#0096a7]",children:"المتكاملة"})]}),i.jsxs(Gs.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.6},className:"text-white/70 text-base md:text-lg max-w-2xl mx-auto mb-10",children:["اكتشف مجموعتنا الواسعة من الآلات الصناعية عالية الجودة",i.jsx("br",{}),"مع إمكانية الحصول على عروض أسعار فورية عبر واتساب"]}),i.jsx(Gs.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.8},children:i.jsxs(ke,{onClick:n,className:"px-8 py-6 text-lg bg-[#0096a7] hover:bg-[#007d8c] text-white rounded-xl shadow-lg transition-all hover:scale-105",children:[i.jsx(Vl,{className:"w-5 h-5 ml-2"}),"تصفح الكتالوج"]})})]}),i.jsx("div",{className:"absolute bottom-0 left-0 right-0",children:i.jsx("svg",{viewBox:"0 0 1440 120",className:`w-full ${e==="dark"?"text-[#0f0f1a]":"text-white"}`,children:i.jsx("path",{fill:"currentColor",d:"M0,40 C360,120 720,0 1080,80 C1260,120 1380,100 1440,80 L1440,120 L0,120 Z"})})})]})})}function W0e({theme:n}){const e=[{icon:Vl,value:"50+",label:"آلة صناعية"},{icon:BY,value:"10+",label:"سنوات خبرة"},{icon:_c,value:"500+",label:"عميل راضٍ"},{icon:mF,value:"24/7",label:"دعم فني"}];return i.jsx("section",{className:`py-16 ${n==="dark"?"bg-[#0f0f1a]":"bg-gray-50"}`,dir:"rtl",children:i.jsx("div",{className:"container mx-auto px-4",children:i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 md:gap-8",children:e.map((t,r)=>i.jsxs(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},transition:{delay:r*.1},viewport:{once:!0},className:`text-center p-6 rounded-2xl ${n==="dark"?"bg-[#1a1a2e]":"bg-white shadow-md"}`,children:[i.jsx(t.icon,{className:"w-8 h-8 mx-auto mb-3 text-[#0096a7]"}),i.jsx("div",{className:`text-2xl md:text-3xl font-bold mb-1 ${n==="dark"?"text-white":"text-gray-900"}`,children:t.value}),i.jsx("div",{className:`text-sm ${n==="dark"?"text-gray-400":"text-gray-600"}`,children:t.label})]},t.label))})})})}function $0e({theme:n,products:e,categories:t,onMachineClick:r}){const[s,a]=T.useState(""),[o,l]=T.useState(null),[u,d]=T.useState(6),h=e.filter(x=>{const y=x.name.toLowerCase().includes(s.toLowerCase())||x.description?.toLowerCase().includes(s.toLowerCase()),v=!o||x.categoryId===o;return y&&v&&x.showOnWebsite}),p=h.slice(0,u);return i.jsx("section",{className:`py-20 ${n==="dark"?"bg-[#0f0f1a]":"bg-white"}`,dir:"rtl",id:"catalog",children:i.jsxs("div",{className:"container mx-auto px-4",children:[i.jsxs(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},className:"text-center mb-12",children:[i.jsx("h2",{className:`text-3xl md:text-4xl font-bold mb-4 ${n==="dark"?"text-white":"text-gray-900"}`,children:"الكتالوج الإلكتروني"}),i.jsx("p",{className:`text-lg ${n==="dark"?"text-gray-400":"text-gray-600"}`,children:"تصفح مجموعتنا المتنوعة من الآلات الصناعية"})]}),i.jsx("div",{className:"max-w-xl mx-auto mb-8",children:i.jsxs("div",{className:"relative",children:[i.jsx(si,{className:`absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 ${n==="dark"?"text-gray-500":"text-gray-400"}`}),i.jsx(Ee,{type:"text",placeholder:"ابحث عن آلة...",value:s,onChange:x=>a(x.target.value),className:`pr-12 ${n==="dark"?"bg-[#1a1a2e] border-[#2a2a3a] text-white placeholder:text-gray-500":"bg-gray-50 border-gray-200 text-gray-900"}`})]})}),i.jsxs("div",{className:"flex flex-wrap justify-center gap-3 mb-10",children:[i.jsx("button",{onClick:()=>l(null),className:`px-4 py-2 rounded-full text-sm font-medium transition-all ${o===null?"bg-[#0096a7] text-white":n==="dark"?"bg-[#1a1a2e] text-gray-400 hover:text-white border border-[#2a2a3a]":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"الكل"}),t.map(x=>i.jsx("button",{onClick:()=>l(x.id),className:`px-4 py-2 rounded-full text-sm font-medium transition-all ${o===x.id?"bg-[#0096a7] text-white":n==="dark"?"bg-[#1a1a2e] text-gray-400 hover:text-white border border-[#2a2a3a]":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:x.name},x.id))]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8",children:p.map((x,y)=>i.jsxs(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},transition:{delay:y*.05},viewport:{once:!0},className:`rounded-2xl overflow-hidden transition-all hover:scale-[1.02] hover:shadow-xl ${n==="dark"?"bg-[#1a1a2e] border border-[#2a2a3a]":"bg-white shadow-md border border-gray-100"}`,children:[i.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden",children:[x.images&&x.images.length>0?i.jsx("img",{src:x.images[0].url,alt:x.name,className:"w-full h-full object-cover"}):i.jsx("div",{className:`w-full h-full flex items-center justify-center ${n==="dark"?"bg-[#0a0a15]":"bg-gray-100"}`,children:i.jsx(Vl,{className:`w-16 h-16 ${n==="dark"?"text-gray-700":"text-gray-300"}`})}),i.jsx("div",{className:"absolute top-3 right-3 flex gap-2",children:x.categoryName&&i.jsx("span",{className:"px-2 py-1 rounded-full text-xs bg-[#0096a7]/80 text-white",children:x.categoryName})}),x.videoUrl1&&i.jsxs("div",{className:"absolute bottom-3 left-3 flex items-center gap-1 px-2 py-1 rounded-full bg-black/50 text-white text-xs",children:[i.jsx(L2,{className:"w-3 h-3"}),"فيديو"]}),x.images&&x.images.length>0&&i.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-1 px-2 py-1 rounded-full bg-black/50 text-white text-xs",children:[i.jsx(tN,{className:"w-3 h-3"}),x.images.length]})]}),i.jsxs("div",{className:"p-5",children:[i.jsx("h3",{className:`text-lg font-bold mb-2 ${n==="dark"?"text-white":"text-gray-900"}`,children:x.name}),i.jsx("p",{className:`text-sm mb-4 line-clamp-2 ${n==="dark"?"text-gray-400":"text-gray-600"}`,children:x.description||"لا يوجد وصف"}),i.jsx(ke,{onClick:()=>r(x),className:"w-full bg-[#0096a7] hover:bg-[#007d8c] text-white",children:"عرض التفاصيل"})]})]},x.id))}),p.length===0&&i.jsxs("div",{className:`text-center py-20 ${n==="dark"?"text-gray-500":"text-gray-400"}`,children:[i.jsx(Vl,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),i.jsx("p",{className:"text-lg",children:"لا توجد آلات متاحة حالياً"})]}),u<h.length&&i.jsx("div",{className:"text-center mt-10",children:i.jsxs(ke,{onClick:()=>d(x=>x+6),variant:"outline",className:`px-8 ${n==="dark"?"border-[#2a2a3a] text-white hover:bg-[#1a1a2e]":"border-gray-300 text-gray-700 hover:bg-gray-50"}`,children:["عرض المزيد (",h.length-u," متبقي)"]})}),i.jsxs("p",{className:`text-center mt-6 text-sm ${n==="dark"?"text-gray-500":"text-gray-400"}`,children:["عرض ",p.length," من ",h.length," آلة"]})]})})}function X0e({theme:n}){const e=[{icon:CY,title:"جودة عالية",desc:"آلات من أفضل المصنعين العالميين مع ضمان الجودة"},{icon:pQ,title:"أسعار تنافسية",desc:"أفضل الأسعار مع خيارات دفع مرنة"},{icon:mF,title:"دعم فني متواصل",desc:"فريق دعم متخصص متاح 24/7"},{icon:lQ,title:"ضمان شامل",desc:"ضمان على جميع المنتجات مع صيانة دورية"}];return i.jsx("section",{className:`py-20 ${n==="dark"?"bg-[#1a1a2e]":"bg-gray-50"}`,dir:"rtl",children:i.jsxs("div",{className:"container mx-auto px-4",children:[i.jsx(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},className:"text-center mb-14",children:i.jsx("h2",{className:`text-3xl md:text-4xl font-bold mb-4 ${n==="dark"?"text-white":"text-gray-900"}`,children:"لماذا AMZ MAKiNA؟"})}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 md:gap-8",children:e.map((t,r)=>i.jsxs(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},transition:{delay:r*.1},viewport:{once:!0},className:`text-center p-8 rounded-2xl transition-all hover:scale-[1.02] ${n==="dark"?"bg-[#0f0f1a] border border-[#2a2a3a]":"bg-white shadow-md border border-gray-100"}
5196`,children:[i.jsx("div",{className:"w-14 h-14 rounded-xl bg-[#0096a7]/10 flex items-center justify-center mx-auto mb-5",children:i.jsx(t.icon,{className:"w-7 h-7 text-[#0096a7]"})}),i.jsx("h3",{className:`text-lg font-bold mb-3 ${n==="dark"?"text-white":"text-gray-900"}`,children:t.title}),i.jsx("p",{className:`text-sm leading-relaxed ${n==="dark"?"text-gray-400":"text-gray-600"}`,children:t.desc})]},t.title))})]})})}function q0e({theme:n}){return i.jsx("section",{className:`py-20 ${n==="dark"?"bg-[#0f0f1a]":"bg-white"}`,dir:"rtl",id:"contact",children:i.jsxs("div",{className:"container mx-auto px-4",children:[i.jsx(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},className:"text-center mb-14",children:i.jsx("h2",{className:`text-3xl md:text-4xl font-bold mb-4 ${n==="dark"?"text-white":"text-gray-900"}`,children:"تواصل معنا"})}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-8 max-w-4xl mx-auto",children:[{icon:sN,label:"الهاتف",value:"+213 555 000 000"},{icon:rN,label:"البريد",value:"[email protected]"},{icon:I2,label:"العنوان",value:"الجزائر العاصمة"}].map((e,t)=>i.jsxs(Gs.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},transition:{delay:t*.1},viewport:{once:!0},className:`text-center p-8 rounded-2xl ${n==="dark"?"bg-[#1a1a2e] border border-[#2a2a3a]":"bg-gray-50 border border-gray-100"}`,children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#0096a7]/10 flex items-center justify-center mx-auto mb-4",children:i.jsx(e.icon,{className:"w-6 h-6 text-[#0096a7]"})}),i.jsx("h3",{className:`font-bold mb-2 ${n==="dark"?"text-white":"text-gray-900"}`,children:e.label}),i.jsx("p",{className:`text-sm ${n==="dark"?"text-gray-400":"text-gray-600"}`,children:e.value})]},e.label))})]})})}function Y0e({theme:n}){return i.jsx("footer",{className:`${n==="dark"?"bg-[#1a1a2e] border-t border-[#2a2a3a]":"bg-gray-900"}`,dir:"rtl",children:i.jsxs("div",{className:"container mx-auto px-4 py-12",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 mb-8",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-[#0096a7] to-[#006069] flex items-center justify-center",children:i.jsx("span",{className:"text-white font-bold text-sm",children:"AMZ"})}),i.jsx("span",{className:"text-white font-bold text-lg",children:"AMZ MAKiNA"})]}),i.jsx("p",{className:"text-gray-400 text-sm leading-relaxed",children:"شريكك الموثوق في عالم الآلات الصناعية"})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-white font-bold mb-4",children:"روابط سريعة"}),i.jsxs("ul",{className:"space-y-2",children:[i.jsx("li",{children:i.jsx("button",{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:"text-gray-400 text-sm hover:text-[#0096a7] transition-colors",children:"الرئيسية"})}),i.jsx("li",{children:i.jsx("button",{onClick:()=>document.getElementById("catalog")?.scrollIntoView({behavior:"smooth"}),className:"text-gray-400 text-sm hover:text-[#0096a7] transition-colors",children:"الكتالوج"})}),i.jsx("li",{children:i.jsx("button",{onClick:()=>document.getElementById("contact")?.scrollIntoView({behavior:"smooth"}),className:"text-gray-400 text-sm hover:text-[#0096a7] transition-colors",children:"تواصل معنا"})})]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-white font-bold mb-4",children:"تواصل معنا"}),i.jsxs("ul",{className:"space-y-2 text-sm text-gray-400",children:[i.jsxs("li",{className:"flex items-center gap-2",children:[i.jsx(sN,{className:"w-4 h-4 text-[#0096a7]"})," +213 555 000 000"]}),i.jsxs("li",{className:"flex items-center gap-2",children:[i.jsx(rN,{className:"w-4 h-4 text-[#0096a7]"})," [email protected]"]}),i.jsxs("li",{className:"flex items-center gap-2",children:[i.jsx(I2,{className:"w-4 h-4 text-[#0096a7]"})," الجزائر العاصمة"]})]})]})]}),i.jsx("div",{className:"border-t border-gray-800 pt-6 text-center",children:i.jsxs("p",{className:"text-gray-500 text-sm",children:["© ",new Date().getFullYear()," AMZ MAKiNA. جميع الحقوق محفوظة."]})})]})})}function Q0e({product:n,onBack:e,theme:t}){const[r,s]=T.useState(0),[a,o]=T.useState(!1),[l,u]=T.useState(!1),[d,h]=T.useState({name:"",phone:"",email:"",company:"",quantity:1,notes:""}),[p,x]=T.useState(!1),y=n.images||[],_=Pe.settings.list.useQuery().data?.whatsapp_number||"213555000000",M=Pe.websiteQuotes.create.useMutation({onSuccess:()=>{const A=encodeURIComponent(`طلب عرض سعر جديد
5197الآلة: ${n.name}
5198التصنيف: ${n.categoryName||""}
5199
5200بيانات العميل:
5201الاسم: ${d.name}
5202الهاتف: ${d.phone}
5203البريد: ${d.email}
5204الشركة: ${d.company}
5205الكمية: ${d.quantity}
5206ملاحظات: ${d.notes}
5207
5208أرسل عبر كتالوج AMZ MAKiNA`);window.open(`https://wa.me/${_}?text=${A}`,"_blank"),_e.success("تم إرسال طلب التسعير بنجاح"),u(!1)},onError:()=>_e.error("حدث خطأ في إرسال الطلب")}),S=async()=>
5208{if(!d.name||!d.phone){_e.error("يرجى ملء الحقول المطلوبة");return}x(!0);try{await M.mutateAsync({productName:n.name,productNameId:n.id,customerName:d.name,phone:d.phone,email:d.email,company:d.company,quantity:d.quantity,notes:d.notes})}catch{_e.error("حدث خطأ")}x(!1)};return i.jsxs("div",{className:"min-h-screen",dir:"rtl",children:[i.jsx("div",{className:`sticky top-16 md:top-20 z-40 py-4 ${t==="dark"?"bg-[#0f0f1a]/95 backdrop-blur-md":"bg-white/95 backdrop-blur-md"}`,children:i.jsxs("div",{className:"container mx-auto px-4 flex items-center justify-between",children:[i.jsxs(ke,{onClick:e,variant:"outline",className:t==="dark"?"border-[#2a2a3a] text-white":"",children:[i.jsx(Qm,{className:"w-4 h-4 ml-1 rotate-180"}),"العودة للكتالوج"]}),n.categoryName&&i.jsx("span",{className:"px-3 py-1 rounded-full text-xs bg-[#0096a7]/20 text-[#0096a7] font-medium",children:n.categoryName})]})}),i.jsxs("div",{className:"container mx-auto px-4 pb-20",children:[i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4 mb-10",children:[i.jsx("div",{className:"lg:col-span-4",children:i.jsxs("div",{className:`relative aspect-[16/9] rounded-2xl overflow-hidden cursor-pointer ${t==="dark"?"bg-[#1a1a2e]":"bg-gray-100"}`,onClick:()=>o(!0),children:[y[r]?i.jsx("img",{src:y[r].url,alt:n.name,className:"w-full h-full object-cover"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx(Vl,{className:`w-24 h-24 ${t==="dark"?"text-gray-700":"text-gray-300"}`})}),y.length>1&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:A=>{A.stopPropagation(),s(E=>(E-1+y.length)%y.length)},className:"absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-black/30 flex items-center justify-center text-white hover:bg-black/50 transition-colors",children:i.jsx(WD,{className:"w-5 h-5"})}),i.jsx("button",{onClick:A=>{A.stopPropagation(),s(E=>(E+1)%y.length)},className:"absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-black/30 flex items-center justify-center text-white hover:bg-black/50 transition-colors",children:i.jsx(Qm,{className:"w-5 h-5"})})]}),y.length>0&&i.jsxs("div",{className:"absolute bottom-4 right-4 px-3 py-1 rounded-full bg-black/50 text-white text-sm",children:["📷 ",r+1,"/",y.length]})]})}),y.length>1&&i.jsx("div",{className:"hidden lg:flex flex-col gap-2 max-h-[450px] overflow-y-auto custom-scrollbar",children:y.map((A,E)=>i.jsx("button",{onClick:()=>s(E),className:`w-full aspect-square rounded-xl overflow-hidden border-2 transition-all ${E===r?"border-[#0096a7]":t==="dark"?"border-transparent opacity-60 hover:opacity-100":"border-gray-200 opacity-60 hover:opacity-100"}`,children:i.jsx("img",{src:A.url,alt:"",className:"w-full h-full object-cover"})},A.id))})]}),y.length>1&&i.jsx("div",{className:"lg:hidden flex gap-2 overflow-x-auto pb-4 mb-6 custom-scrollbar",children:y.map((A,E)=>i.jsx("button",{onClick:()=>s(E),className:`w-16 h-16 rounded-xl overflow-hidden border-2 flex-shrink-0 transition-all ${E===r?"border-[#0096a7]":t==="dark"?"border-transparent opacity-60":"border-gray-200 opacity-60"}`,children:i.jsx("img",{src:A.url,alt:"",className:"w-full h-full object-cover"})},A.id))}),i.jsxs("div",{className:"mb-10",children:[i.jsx("h1",{className:`text-3xl md:text-5xl font-bold mb-4 ${t==="dark"?"text-white":"text-gray-900"}`,children:n.name}),n.description&&i.jsx("p",{className:`text-lg leading-relaxed max-w-3xl ${t==="dark"?"text-gray-300":"text-gray-600"}`,children:n.description}),(n.websitePrice??0)>0&&i.jsxs("div",{className:"mt-4 text-2xl font-bold text-[#0096a7]",children:[n.websitePrice||0," ر.س"]})]}),n.videoUrl1&&i.jsxs("div",{className:"mb-10",children:[i.jsx("h2",{className:`text-2xl font-bold mb-4 ${t==="dark"?"text-white":"text-gray-900"}`,children:"فيديو"}),i.jsx("div",{className:"aspect-video rounded-2xl overflow-hidden",children:n.videoUrl1.includes("youtube")||n.videoUrl1.includes("youtu.be")?i.jsx("iframe",{src:n.videoUrl1.replace("watch?v=","embed/").replace("youtu.be/","youtube.com/embed/"),className:"w-full h-full",allowFullScreen:!0,title:"فيديو المنتج"}
5208):n.videoUrl1.includes("vimeo")?i.jsx("iframe",{src:`https://player.vimeo.com/video/${n.videoUrl1.split("/").pop()}`,className:"w-full h-full",allowFullScreen:!0,title:"فيديو المنتج"}):i.jsx("video",{src:n.videoUrl1,controls:!0,className:"w-full h-full object-cover"})})]}),n.specs&&n.specs.length>0&&i.jsxs("div",{className:"mb-10",children:[i.jsx("h2",{className:`text-2xl font-bold mb-6 ${t==="dark"?"text-white":"text-gray-900"}`,children:"المواصفات الفنية"}),i.jsx("div",{className:`p-4 rounded-xl ${t==="dark"?"bg-[#1a1a2e] border border-[#2a2a3a]":"bg-gray-50 border border-gray-100"}`,children:i.jsx("p",{className:`text-base whitespace-pre-line ${t==="dark"?"text-gray-300":"text-gray-700"}`,children:n.specs})})]}),n.features&&n.features.length>0&&i.jsxs("div",{className:"mb-10",children:[i.jsx("h2",{className:`text-2xl font-bold mb-6 ${t==="dark"?"text-white":"text-gray-900"}`,children:"المميزات"}),i.jsx("div",{className:"space-y-2",children:n.features.split(`
5209`).filter(A=>A.trim()).map((A,E)=>i.jsxs(Gs.div,{initial:{opacity:0,y:5},whileInView:{opacity:1,y:0},transition:{delay:E*.03},viewport:{once:!0},className:`flex items-start gap-2 p-3 rounded-lg ${t==="dark"?"bg-[#1a1a2e]":"bg-gray-50"}`,children:[i.jsx("span",{className:"text-[#0096a7] mt-0.5",children:"✓"}),i.jsx("span",{className:`text-sm ${t==="dark"?"text-gray-300":"text-gray-700"}`,children:A.trim()})]},E))})]}),i.jsx("div",{className:"text-center mb-10",children:i.jsxs(ke,{onClick:()=>u(!0),className:"px-10 py-6 text-lg bg-green-600 hover:bg-green-700 text-white rounded-xl shadow-lg transition-all hover:scale-105",children:[i.jsx(ek,{className:"w-5 h-5 ml-2"}),"طلب عرض سعر"]})})]}),i.jsx(zm,{children:a&&i.jsxs(Gs.div,{initial:{opacity:0}
5209,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] bg-black/90 flex items-center justify-center p-4",onClick:()=>o(!1),children:[i.jsx("button",{onClick:()=>o(!1),className:"absolute top-4 left-4 w-10 h-10 rounded-full bg-white/10 flex items-center justify-center text-white hover:bg-white/20",children:i.jsx(Mr,{className:"w-6 h-6"})}),y.length>1&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:A=>{A.stopPropagation(),s(E=>(E-1+y.length)%y.length)},className:"absolute right-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-white/10 flex items-center justify-center text-white",children:i.jsx(WD,{className:"w-6 h-6"})}),i.jsx("button",{onClick:A=>{A.stopPropagation(),s(E=>(E+1)%y.length)},className:"absolute left-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-white/10 flex items-center justify-center text-white",children:i.jsx(Qm,{className:"w-6 h-6"})})]}),i.jsx("img",{src:y[r]?.url,alt:n.name,className:"max-w-[90vw] max-h-[85vh] object-contain rounded-lg",onClick:A=>A.stopPropagation()}),i.jsxs("div",{className:"absolute bottom-6 text-white text-sm",children:[r+1," / ",y.length]})]})}),i.jsx(zm,{children:l&&i.jsx(Gs.div,{initial:{opacity:0}
5209,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] bg-black/60 flex items-center justify-center p-4",onClick:()=>u(!1),children:i.jsxs(Gs.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:`w-full max-w-lg rounded-2xl p-6 ${t==="dark"?"bg-[#1a1a2e]":"bg-white"}`,onClick:A=>A.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h3",{className:`text-xl font-bold ${t==="dark"?"text-white":"text-gray-900"}`,children:"💬 طلب عرض سعر"}),i.jsx("button",{onClick:()=>u(!1),className:"text-gray-400 hover:text-gray-600",children:i.jsx(Mr,{className:"w-5 h-5"})})]}),i.jsx("p",{className:`text-sm mb-6 ${t==="dark"?"text-gray-400":"text-gray-500"}`,children:n.name}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(Ee,{placeholder:"الاسم الكامل *",value:d.name,onChange:A=>h(E=>({...E,name:A.target.value})),className:t==="dark"?"bg-[#0f0f1a] border-[#2a2a3a] text-white":""}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsx(Ee,{placeholder:"رقم الهاتف *",dir:"ltr",value:d.phone,onChange:A=>h(E=>({...E,phone:A.target.value})),className:t==="dark"?"bg-[#0f0f1a] border-[#2a2a3a] text-white":""}),i.jsx(Ee,{placeholder:"البريد الإلكتروني",type:"email",dir:"ltr",value:d.email,onChange:A=>h(E=>({...E,email:A.target.value})),className:t==="dark"?"bg-[#0f0f1a] border-[#2a2a3a] text-white":""})]}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[i.jsx(Ee,{placeholder:"اسم الشركة",value:d.company,onChange:A=>h(E=>({...E,company:A.target.value})),className:t==="dark"?"bg-[#0f0f1a] border-[#2a2a3a] text-white":""}),i.jsx(Ee,{type:"number",min:1,placeholder:"الكمية",value:d.quantity,onChange:A=>h(E=>({...E,quantity:parseInt(A.target.value)||1})),className:t==="dark"?"bg-[#0f0f1a] border-[#2a2a3a] text-white":""})]}),i.jsx("textarea",{placeholder:"ملاحظات إضافية (أي تفاصيل أو متطلبات خاصة...)",rows:3,value:d.notes,onChange:A=>h(E=>({...E,notes:A.target.value})),className:`w-full px-4 py-3 rounded-lg border text-sm resize-none ${t==="dark"?"bg-[#0f0f1a] border-[#2a2a3a] text-white placeholder:text-gray-500":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"}`}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ke,{onClick:()=>u(!1),variant:"outline",className:`flex-1 ${t==="dark"?"border-[#2a2a3a] text-white":""}`,children:"إلغاء"}),i.jsxs(ke,{onClick:S,disabled:p,className:"flex-1 bg-green-600 hover:bg-green-700 text-white",children:[p?i.jsx(WY,{className:"w-4 h-4 animate-spin"}):i.jsx(ek,{className:"w-4 h-4 ml-1"}),"إرسال عبر واتساب"]})]})]})]})})})]})}function K0e(){const{theme:n,toggleTheme:e}=DF(),[t,r]=T.useState(null),s=T.useRef(null),o=Pe.products.websiteList.useQuery().data||[],l=o,u=T.useMemo(()=>{const h=new Map;return o.forEach(p=>{p.categoryId&&h.set(p.categoryId,p.categoryName||"")}),Array.from(h.entries()).map(([p,x])=>({id:p,name:x}))},[o]),d=()=>{s.current?.scrollIntoView({behavior:"smooth"})};return t?i.jsxs(i.Fragment,{children:[i.jsx(GB,{onCatalogClick:d,theme:n,toggleTheme:e}),i.jsx(Q0e,{product:t,onBack:()=>r(null),theme:n})]}):i.jsxs("div",{className:"min-h-screen",children:[i.jsx(GB,{onCatalogClick:d,theme:n,toggleTheme:e}),i.jsx(V0e,{onCatalogClick:d,theme:n}),i.jsx(W0e,{theme:n}),i.jsx("div",{ref:s,children:i.jsx($0e,{theme:n,products:l,categories:u,onMachineClick:r})}),i.jsx(X0e,{theme:n}),i.jsx(q0e,{theme:n}),i.jsx(Y0e,{theme:n})]})}function o2(n){return String(n||"").split(`
5210`).map(e=>e.trim()).filter(Boolean)}function J0e(n){try{const e=JSON.parse(n||"");if(Array.isArray(e))return e.map(t=>({key:String(t.key||t.name||""),value:String(t.value||"")})).filter(t=>t.key||t.value)}catch{}return o2(n).map(e=>{const[t,...r]=e.split(":");return{key:r.length?t.trim():"",value:(r.length?r.join(":"):e).trim()}})}function Z0e({product:n,whatsapp:e}){const t=n.images||[],r=n.websitePrice??n.salePrice??n.sellingPrice,s=e?`https://wa.me/${e}?text=${encodeURIComponent(`أرغب بالحصول على عرض سعر للآلة: ${n.name}`)}`:"#contact",a=[{key:"الوزن",value:n.weight},{key:"الأبعاد",value:n.dimensions},...J0e(n.specs)].filter(o=>o.value);return i.jsxs("div",{dir:"rtl",className:"max-h-[82vh] overflow-y-auto bg-white text-slate-900",children:[i.jsx(Ja,{className:"border-b border-slate-100 px-4 py-4 sm:px-6 sm:py-5",children:i.jsxs(Za,{className:"break-words text-xl font-black text-slate-900 sm:text-2xl",children:["تفاصيل ",n.name]})}),i.jsxs("div",{className:"grid gap-5 p-4 sm:gap-7 sm:p-6 md:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"overflow-hidden rounded-2xl bg-slate-100",children:t[0]?.url?i.jsx("img",{src:t[0].url,alt:n.name,className:"h-52 w-full object-contain sm:h-72"}):i.jsx("div",{className:"flex h-52 items-center justify-center sm:h-72",children:i.jsx(Vl,{className:"h-16 w-16 text-[#0096a7] sm:h-20 sm:w-20"})})}),t.length>1&&i.jsx("div",{className:"mt-3 grid grid-cols-4 gap-2",children:t.map((o,l)=>i.jsx("img",{src:o.url,alt:`${n.name} ${l+1}`,className:"h-16 w-full rounded-lg object-cover"},`${o.url}-${l}`))})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-bold text-[#0096a7]",children:n.categoryName||"آلة صناعية"}),i.jsx("h3",{className:"mt-2 break-words text-2xl font-black sm:text-3xl",children:n.name}),n.description&&i.jsx("p",{className:"mt-4 whitespace-pre-line break-words leading-8 text-slate-600",children:n.description}),r?i.jsxs("p",{className:"mt-5 text-xl font-black text-[#0096a7]",children:[r," ",n.unit||""]}):i.jsx("p",{className:"mt-5 font-bold text-[#0096a7]",children:"السعر عند الطلب"}),i.jsx("a",{href:s,target:e?"_blank":void 0,rel:"noreferrer",className:"mt-6 inline-flex max-w-full rounded-xl bg-[#0096a7] px-5 py-3 font-bold text-white",children:"طلب عرض سعر"})]})]}),i.jsxs("div",{className:"grid gap-6 border-t border-slate-100 px-4 py-5 sm:px-6 sm:py-6 md:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"mb-3 text-lg font-black",children:"المواصفات الفنية"}),i.jsx("div",{className:"space-y-2",children:a.map((o,l)=>i.jsxs("div",{className:"flex flex-col gap-1 rounded-lg bg-slate-50 px-3 py-2 text-sm sm:flex-row sm:justify-between sm:gap-4",children:[i.jsx("span",{className:"font-bold",children:o.key||"تفصيل"}),i.jsx("span",{className:"break-words text-slate-600 sm:text-left",children:o.value})]},`${o.key}-${l}`))})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"mb-3 text-lg font-black",children:"المميزات"}),o2(n.features).length?i.jsx("ul",{className:"list-disc space-y-2 pr-5 leading-7 text-slate-600",children:o2(n.features).map((o,l)=>i.jsx("li",{children:o},l))}):i.jsx("p",{className:"text-slate-500",children:"لا توجد مميزات إضافية مسجلة."}
5210),[n.videoUrl1,n.videoUrl2].filter(Boolean).map((o,l)=>i.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:"mt-3 flex items-center gap-2 break-words text-sm font-bold text-[#0096a7]",children:[i.jsx(DY,{className:"h-5 w-5 shrink-0"}),"مشاهدة فيديو الآلة ",l+1]},l))]})]})]})}function ebe({brand:n,logo:e}){return i.jsx("header",{className:"sticky top-0 z-30 border-b border-slate-200/80 bg-white/95 backdrop-blur",dir:"rtl",children:i.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-3 px-3 py-3 sm:px-5 sm:py-4",children:[i.jsxs("a",{href:"#top",className:"flex min-w-0 items-center gap-2 font-bold text-slate-900 sm:gap-3",children:[e?i.jsx("img",{src:e,alt:n,onError:t=>{t.currentTarget.style.display="none"},className:"h-9 w-12 shrink-0 object-contain sm:h-10 sm:w-14"}):i.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[#0096a7] text-xs text-white sm:h-10 sm:w-10",children:"AMZ"}),i.jsx("span",{className:"max-w-[12rem] truncate sm:max-w-none",children:n||"AMZ MAKiNA"})]}),i.jsxs("nav",{className:"hidden gap-7 text-sm font-semibold text-slate-600 md:flex",children:[i.jsx("a",{href:"#catalog",children:"الكتالوج"}),i.jsx("a",{href:"#features",children:"لماذا نحن"}),i.jsx("a",{href:"#contact",children:"تواصل معنا"})]})]})})}function ux({section:n,children:e,id:t}){return i.jsx("section",{id:t||n.id,className:"overflow-hidden px-4 py-12 sm:px-5 sm:py-16 md:py-24",style:{background:n.background||"#fff"},dir:"rtl",children:i.jsx("div",{className:"mx-auto max-w-7xl",children:e})})}function tbe(){const{data:n}=Pe.website.homeContent.useQuery(),{data:e}=Pe.website.branding.useQuery(),{data:t=[]}=Pe.products.websiteList.useQuery(),r=T.useMemo(()=>{if(!n)return ep;try{return JSON.parse(n)}catch{return ep}},[n]),s=T.useMemo(()=>O6(r),[r]),a=e?.companyName||"AMZ MAKiNA",o=e?.companyLogo||"",l=String(e?.whatsappNumber||"").replace(/\D/g,""),[u,d]=T.useState(null);return i.jsxs("div",{id:"top",className:"min-h-screen bg-white text-slate-900",children:[i.jsx(ebe,{brand:a,logo:o}),s.filter(h=>h.enabled).map(h=>h.type==="hero"?i.jsx(ux,{section:h,children:i.jsxs("div",{className:"grid items-center gap-10 py-10 text-center md:grid-cols-2 md:text-right",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-4 font-bold text-[#0096a7]",children:a}),i.jsx("h1",{className:"break-words text-3xl font-black leading-tight text-white sm:text-4xl md:text-6xl",children:h.title}),i.jsxs("p",{className:"mt-5 text-lg leading-8 text-white/80",children:[h.subtitle,i.jsx("br",{}),h.body]}),h.buttonText&&i.jsx("a",{href:h.buttonUrl||"#catalog",className:"mt-8 inline-flex rounded-xl bg-[#0096a7] px-7 py-3 font-bold text-white shadow-lg",children:h.buttonText})]}),h.imageUrl?i.jsx("img",{src:h.imageUrl,alt:h.title,className:"mx-auto max-h-64 w-full max-w-md rounded-3xl object-contain sm:max-h-80"}):i.jsx("div",{className:"mx-auto flex h-64 w-64 items-center justify-center rounded-[2.5rem] bg-gradient-to-br from-[#0096a7] to-[#006069] text-5xl font-black text-white shadow-2xl",children:"AMZ"})]})},h.id):h.type==="stats"?i.jsxs(ux,{section:h,children:[i.jsxs("div",{className:"mb-10 text-center",children:[i.jsx("h2",{className:"text-2xl font-black sm:text-3xl",children:h.title}),i.jsx("p",{className:"mt-2 text-slate-500",children:h.subtitle})]}),i.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:h.items.map(p=>i.jsxs("div",{className:"rounded-2xl bg-white p-4 text-center shadow-lg ring-1 ring-slate-100 sm:p-6",children:[i.jsx(_c,{className:"mx-auto mb-3 h-8 w-8 text-[#0096a7]"}),i.jsx("div",{className:"text-3xl font-black text-[#0096a7]",children:p.value}),i.jsx("div",{className:"mt-1 font-semibold text-slate-600",children:p.title})]},p.id))})]},h.id):h.type==="features"?i.jsxs(ux,{section:h,id:"features",children:[i.jsxs("div",{className:"mb-10 text-center",children:[i.jsx("h2",{className:"text-2xl font-black sm:text-3xl",children:h.title}),i.jsx("p",{className:"mt-2 text-slate-500",children:h.subtitle})]}),i.jsx("div",{className:"grid gap-5 md:grid-cols-3",children:h.items.map(p=>i.jsxs("article",{className:"rounded-2xl border border-slate-100 bg-white p-5 shadow-sm sm:p-7",children:[i.jsx(xF,{className:"mb-5 h-9 w-9 text-[#0096a7]"}),i.jsx("h3",{className:"text-xl font-black",children:p.title}),i.jsx("p",{className:"mt-3 leading-7 text-slate-500",children:p.text})]}
5210,p.id))})]},h.id):h.type==="catalog"?i.jsxs(ux,{section:h,id:"catalog",children:[i.jsxs("div",{className:"mb-10 flex flex-wrap items-end justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-black sm:text-3xl",children:h.title}),i.jsx("p",{className:"mt-2 text-slate-500",children:h.subtitle})]}),i.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-slate-100 px-4 py-2 text-slate-500",children:[i.jsx(si,{className:"h-4 w-4"}),t.length," منتج متاح"]})]}),i.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:t.map(p=>{const x=p.images?.[0]?.url,y=p.websitePrice??p.salePrice??p.sellingPrice;return i.jsx("article",{className:"overflow-hidden rounded-2xl border border-slate-100 bg-white shadow-sm transition hover:-translate-y-1 hover:shadow-xl",children:i.jsxs("button",{type:"button",onClick:()=>d(p),className:"block w-full text-right",children:[x?i.jsx("img",{src:x,alt:p.name,className:"h-44 w-full object-cover sm:h-52"}):i.jsx("div",{className:"flex h-52 items-center justify-center bg-slate-100",children:i.jsx(Vl,{className:"h-14 w-14 text-[#0096a7]"})}),i.jsxs("div",{className:"p-4 sm:p-5",children:[i.jsx("p",{className:"text-xs font-bold text-[#0096a7]",children:p.categoryName||"آلة صناعية"}),i.jsx("h3",{className:"mt-2 break-words text-lg font-black sm:text-xl",children:p.name}),i.jsx("p",{className:"mt-2 line-clamp-2 text-sm leading-6 text-slate-500",children:p.description||"حل صناعي متكامل من AMZ."}),i.jsxs("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-3",children:[i.jsx("span",{className:"font-bold text-[#0096a7]",children:y?`${y}`:"اطلب السعر"}),i.jsx("span",{className:"rounded-lg border border-[#0096a7] px-4 py-2 text-sm font-bold text-[#0096a7]",children:"عرض التفاصيل"})]})]})]})},p.id)})})]},h.id):h.type==="contact"?i.jsx(ux,{section:h,id:"contact",children:i.jsxs("div",{className:"rounded-3xl bg-slate-950 p-6 text-center text-white sm:p-8 md:p-14",children:[i.jsx(rN,{className:"mx-auto mb-5 h-10 w-10 text-[#0096a7]"}),i.jsx("h2",{className:"text-2xl font-black sm:text-3xl",children:h.title}),i.jsxs("p",{className:"mx-auto mt-4 max-w-2xl leading-8 text-white/70",children:[h.subtitle,i.jsx("br",{}),h.body]}),h.buttonText&&i.jsx("a",{href:h.buttonUrl||"#catalog",className:"mt-7 inline-block rounded-xl bg-[#0096a7] px-7 py-3 font-bold",children:h.buttonText}),i.jsxs("div",{className:"mt-8 flex flex-wrap justify-center gap-5 text-sm text-white/70",children:[i.jsxs("span",{children:[i.jsx(I2,{className:"ml-1 inline h-4 w-4"}),e?.companyAddress||""]}),i.jsxs("span",{children:[i.jsx(sN,{className:"ml-1 inline h-4 w-4"}),e?.whatsappNumber||""]})]})]})},h.id):i.jsx(ux,{section:h,children:i.jsxs("div",{className:"mx-auto max-w-4xl text-center",children:[i.jsx("h2",{className:"text-2xl font-black sm:text-3xl",children:h.title}),i.jsxs("p",{className:"mt-4 whitespace-pre-line break-words leading-8 text-slate-600",children:[h.subtitle,h.subtitle&&h.body?`
5211`:"",h.body]}),h.items.length>0&&i.jsx("div",{className:"mt-8 grid gap-4 md:grid-cols-3",children:h.items.map(p=>i.jsxs("div",{className:"rounded-xl bg-white p-5 shadow-sm",children:[i.jsx(Wj,{className:"mx-auto mb-2 h-6 w-6 text-[#0096a7]"}),i.jsx("h3",{className:"font-bold",children:p.title}),i.jsx("p",{className:"mt-2 text-sm text-slate-500",children:p.text||p.value})]},p.id))})]})},h.id)),i.jsx("footer",{className:"bg-slate-950 px-5 py-8 text-center text-sm text-white/60",children:s.find(h=>h.type==="custom"&&h.id==="footer")?.body||`© ${new Date().getFullYear()} ${a} - جميع الحقوق محفوظة`}),i.jsx(Qa,{open:!!u,onOpenChange:h=>!h&&d(null),children:u&&i.jsx(Ka,{className:"max-w-4xl overflow-hidden border-0 bg-white p-0",children:i.jsx(Z0e,{product:u,whatsapp:l})})})]})}function rs(n){return Number(n||0)}function nbe({workspace:n,playSimulation:e}){const t=Math.max(rs(n.project.lengthM),1),r=Math.max(rs(n.project.widthM),1);return i.jsxs("div",{className:"relative h-[560px] overflow-hidden rounded-2xl border border-cyan-100 bg-white shadow-[0_22px_44px_rgba(15,23,42,.14)]",children:[i.jsx("div",{className:"absolute right-5 top-5 z-10 rounded-full border border-cyan-200 bg-white/95 px-3 py-1 text-xs font-bold text-cyan-700 shadow",children:"موقع 3D · للقراءة فقط"}),i.jsx(YR,{workspace:n,interactive:!1,playSimulation:e}),i.jsxs("div",{className:"absolute bottom-5 left-5 z-10 rounded-md border border-slate-200 bg-white/95 px-3 py-2 text-[11px] text-slate-600 shadow",children:[t," م × ",r," م · مشاهدة وتكبير ودوران فقط"]})]})}function rbe({workspace:n}){const e=n.project,t=Math.max(rs(e.lengthM),1),r=Math.max(rs(e.widthM),1),s=780/Math.max(t,r);return i.jsx("div",{className:"h-[560px] overflow-auto rounded-2xl border border-cyan-100 bg-slate-100 p-8 shadow-[0_22px_44px_rgba(15,23,42,.14)]",children:i.jsxs("div",{className:"relative mx-auto origin-top-left bg-white shadow-xl",style:{width:t*s,height:r*s,border:"3px solid #0F766E",backgroundImage:"linear-gradient(rgba(14,116,144,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(14,116,144,.15) 1px, transparent 1px)",backgroundSize:`${Math.max(rs(e.defaultGridM),.5)*s}px ${Math.max(rs(e.defaultGridM),.5)*s}px`},children:[i.jsx("div",{className:"absolute -top-7 right-0 rounded bg-cyan-700 px-3 py-1 text-[10px] font-bold text-white",children:"مخطط 2D · للقراءة فقط"}),(n.rooms||[]).map(a=>i.jsx("div",{className:"absolute overflow-hidden border border-slate-700/40 px-2 py-1 text-[11px] font-bold text-slate-800",style:{left:rs(a.xM)*s,top:rs(a.zM)*s,width:Math.max(24,rs(a.lengthM)*s),height:Math.max(24,rs(a.widthM)*s),background:`${a.color||"#38BDF8"}55`},children:a.name},a.id)),(n.placements||[]).map(a=>i.jsx("div",{className:"absolute flex flex-col items-center justify-center overflow-hidden border-2 border-cyan-800 bg-cyan-500/75 px-1 text-center text-[10px] font-bold text-slate-950",
5211style:{left:rs(a.xM)*s,top:rs(a.zM)*s,width:Math.max(20,rs(a.lengthM)*s),height:Math.max(20,rs(a.widthM)*s)},children:a.name},a.id)),(n.sceneObjects||[]).filter(a=>a.isVisible!==!1).map(a=>i.jsx("div",{className:"absolute rounded-sm border border-teal-800/40 bg-teal-500/60 px-1 text-center text-[8px] font-bold text-slate-950",style:{left:rs(a.xM)*s,top:rs(a.zM)*s,width:Math.max(10,rs(a.lengthM)*s),height:Math.max(10,rs(a.widthM)*s)},children:a.labelText||a.name},`scene-${a.id}`))]})})}function sbe(){const[,n]=TF("/factory-preview/:token"),e=n?.token||"",{data:t,isLoading:r,error:s}=Pe.factoryPlanner.publicPreview.useQuery({shareToken:e},{enabled:!!e,retry:!1}),[a,o]=T.useState("three"),[l,u]=T.useState(!1),d=T.useMemo(()=>t?OG(rs(t.project.lengthM),rs(t.project.widthM),rs(t.project.heightM)):null,[t]),h=T.useMemo(()=>t&&d?UG(d.floorAreaM2,t.rooms||[],t.placements||[]):null,[t,d]),p=T.useMemo(()=>t?FG(t.placements||[],rs(t.project.lengthM),rs(t.project.widthM)):[],[t]);if(r)return i.jsx("main",{dir:"rtl",className:"flex min-h-screen items-center justify-center bg-[#07101d] font-[Cairo] text-slate-100",children:i.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-4 border-cyan-400 border-t-transparent"})});if(s||!t)return i.jsx("main",{dir:"rtl",className:"flex min-h-screen items-center justify-center bg-[#07101d] p-6 font-[Cairo]",children:i.jsxs("section",{className:"max-w-md rounded-2xl border border-rose-400/30 bg-slate-900 p-8 text-center text-slate-100",children:[i.jsx(up,{className:"mx-auto h-10 w-10 text-rose-300"}),i.jsx("h1",{className:"mt-4 text-xl font-bold",children:"رابط المعاينة غير متاح"}),i.jsx("p",{className:"mt-3 text-sm leading-7 text-slate-300",children:"قد يكون الرابط غير صحيح أو تم إلغاؤه من قبل إدارة المشروع. يرجى طلب رابط جديد من الجهة المرسلة."})]})});const x=t.project,y=t.animationTracks||[];return i.jsxs("main",{dir:"rtl",className:"min-h-screen bg-[#07101d] font-[Cairo] text-slate-100",children:[i.jsx("header",{className:"border-b border-slate-800 bg-[#0a1627]/95",children:i.jsxs("div",{className:"mx-auto flex max-w-7xl flex-col gap-4 px-5 py-5 md:flex-row md:items-center md:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"rounded-xl bg-cyan-400 p-2 text-slate-950",children:i.jsx(Vl,{className:"h-6 w-6"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-bold tracking-[.16em] text-cyan-300",children:"AMZ · FACTORY PREVIEW"}),i.jsx("h1",{className:"text-xl font-extrabold",children:x.name})]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-300",children:[i.jsx(xF,{className:"h-4 w-4 text-emerald-300"}),"عرض آمن للقراءة فقط"]})]})}),i.jsxs("section",{className:"mx-auto max-w-7xl px-5 py-8",children:[i.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-[1.4fr_.6fr]",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm leading-7 text-slate-300",children:x.description||"معاينة تفاعلية للمخطط الهندسي ومكونات المصنع."}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-slate-400",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(qY,{className:"h-3.5 w-3.5 text-cyan-300"}),x.location||"الموقع غير محدد"]}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(fh,{className:"h-3.5 w-3.5 text-cyan-300"}),x.factoryType||"مصنع"]})]})]}),i.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-2",children:[{label:"مساحة الأرض",value:`${d?.floorAreaM2.toLocaleString()} م²`,icon:B2},{label:"الاستغلال",value:`${h?.usedPercent||0}%`,icon:fh},{label:"الآلات",value:t.placements.length,icon:Vl},{label:"تنبيهات السلامة",value:p.length,icon:up}].map(v=>i.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/70 p-3",children:[i.jsx(v.icon,{className:"h-4 w-4 text-cyan-300"}),i.jsx("p",{className:"mt-2 text-lg font-extrabold",children:v.value}),i.jsx("p",{className:"text-[11px] text-slate-400",children:v.label})]},v.label))})]}),x.clientNotes&&i.jsxs("section",{className:"mb-5 rounded-2xl border border-cyan-400/20 bg-cyan-400/5 p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 font-bold text-cyan-200",children:[i.jsx(iN,{className:"h-4 w-4"}),"ملاحظات المشروع"]}),i.jsx("p",{className:"mt-2 whitespace-pre-wrap text-sm leading-7 text-slate-300",children:x.clientNotes})]}),i.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-800 bg-slate-900/70 p-2",children:[i.jsxs("div",{className:"flex gap-1",children:[i.jsx("button",{type:"button",onClick:()=>o("three"),className:`rounded-lg px-4 py-2 text-xs font-bold ${a==="three"?"bg-cyan-500 text-slate-950":"text-slate-300 hover:bg-slate-800"}`,children:"الموقع 3D"}),i.jsx("button",{type:"button",onClick:()=>o("two"),className:`rounded-lg px-4 py-2 text-xs font-bold ${a==="two"?"bg-cyan-500 text-slate-950":"text-slate-300 hover:bg-slate-800"}`,children:"المخطط 2D"})]}),y.length>0&&i.jsxs("button",{type:"button",onClick:()=>{o("three"),u(v=>!v)},className:`flex items-center gap-2 rounded-lg px-4 py-2 text-xs font-bold ${l?"bg-cyan-400 text-slate-950":"border border-cyan-400/30 text-cyan-200 hover:bg-cyan-400/10"}`,children:[i.jsx(L2,{className:"h-3.5 w-3.5"}),l?"إيقاف المحاكاة":"تشغيل المحاكاة الحية"]})]}),a==="three"?i.jsx(nbe,{workspace:t,playSimulation:l}):i.jsx(rbe,{workspace:t}),i.jsxs("section",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[i.jsxs("article",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[i.jsx("h2",{className:"font-bold text-cyan-200",children:"المناطق التشغيلية"}),i.jsx("div",{className:"mt-4 space-y-2",children:t.rooms.length?t.rooms.map(v=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-slate-800/70 px-3 py-2 text-sm",children:[i.jsx("span",{children:v.name}),i.jsxs("span",{className:"text-xs text-slate-400",children:[rs(v.lengthM)," × ",rs(v.widthM)," م"]})]},v.id)):i.jsx("p",{className:"text-sm text-slate-400",children:"لا توجد مناطق مسجلة."})})]}),i.jsxs("article",{className:"rounded-2xl border border-slate-800 bg-slate-900/70 p-5",children:[i.jsx("h2",{className:"font-bold text-cyan-200",children:"الآلات والمعدات"}),i.jsx("div",{className:"mt-4 space-y-2",children:t.placements.length?t.placements.map(v=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-slate-800/70 px-3 py-2 text-sm",children:[i.jsx("span",{children:v.name}),i.jsxs("span",{className:"text-xs text-slate-400",children:[rs(v.lengthM)," × ",rs(v.widthM)," م"]})]},v.id)):i.jsx("p",{className:"text-sm text-slate-400",children:"لا توجد آلات مرئية ضمن هذا المخطط."})})]})]})]})]})}function ibe(){return i.jsxs(BQ,{children:[i.jsx(Lf,{path:"/",component:tbe}),i.jsx(Lf,{path:"/react",component:K0e}),i.jsx(Lf,{path:"/admin",component:UB}),i.jsx(Lf,{path:"/admin/login",component:UB}),i.jsx(Lf,{path:"/admin/clients/:id",component:G0e}),i.jsx(Lf,{path:"/factory-preview/:token",component:sbe}),i.jsx(Lf,{path:"/404",component:dk}),i.jsx(Lf,{component:dk})]})}function abe(){return i.jsx(LQ,{children:i.jsx(OQ,{defaultTheme:"dark",switchable:!0,children:i.jsxs(ZM,{children:[i.jsx(e$,{}),i.jsx(ibe,{})]})})})}const HB="https://manus-analytics.com".trim(),VB="5f747688-4ea9-4d85-b904-d50de2c93a5f".trim();if(HB&&VB&&typeof document<"u"){const n=document.createElement("script");n.defer=!0,n.src=`${HB.replace(/\/$/,"")}/umami`,n.dataset.websiteId=VB,document.head.appendChild(n)}const IM=new nV;IM.getQueryCache().subscribe(n=>{if(n.type==="updated"&&n.action.type==="error"){const e=n.query.state.error;console.error("[API Query Error]",e)}});IM.getMutationCache().subscribe(n=>{if(n.type==="updated"&&n.action.type==="error"){const e=n.mutation.state.error;console.error("[API Mutation Error]",e)}});const obe=Pe.createClient({links:[c7({url:"/api/trpc",transformer:Wd,headers(){try{const n=sessionStorage.getItem("admin-session");if(n)return{Authorization:`Bearer ${n}`}}catch{}return{}},fetch(n,e){return globalThis.fetch(n,{...e??{},credentials:"include"})}})]});U7.createRoot(document.getElementById("root")).render(i.jsx(Pe.Provider,{client:obe,queryClient:IM,children:i.jsx(jH,{client:IM,children:i.jsx(abe,{})})}));export{LM as a,cbe as g};

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.