PageSourceSearch

https://wewere.online/assets/train-ice-6j0r5CQQ.js

js wewere.online collected 2026-10-08 09:22:19 UTC 12,022 bytes, 17 lines download raw bytes

1import{r as n,j as B}from"./client-CUTvk0f7.js";import{e as X,p as c,T as le,g as z}from"./index-B8a2M02w.js";function U(e,t){if(typeof e=="function")throw new Error(`[@playhtml/react] ${t} must be a value, not a function. Derive it from React props before passing it, or use withSharedState(props => config).`);return e}function ue(e,t){return X.get(e)?.get(t)}function de(e){return typeof e.type=="string"}function _(e){if(!e||typeof e!="object"||!e.type)return!1;const t=e.type;if(t===n.Fragment||t===Symbol.for("react.fragment"))return!0;if(typeof t=="symbol"){const s=t.toString();if(s==="Symbol(react.fragment)"||s==="Symbol.for(react.fragment)")return!0}return!1}function fe(e,t,{fragmentId:s}={}){if(_(e)){if(!s)throw new Error("Fragments must have an id attribute");return B.jsxs(B.Fragment,{children:[B.jsx("div",{id:s,...t}),n.Children.toArray(e.props.children||[])]})}else if(!de(e))return V(e,t);return n.cloneElement(e,t)}function V(e,t,s=!1){if(!n.isValidElement(e))return e;if(typeof e.type=="string")return n.cloneElement(e,t);let o=!1;const a=n.Children.map(e.props.children,l=>{if(!n.isValidElement(l))return l;if(!o&&typeof l.type=="string")return o=!0,V(l,t,!0);if(!o&&typeof l.type!="string")try{const p=V(l,t,!0);if(p!==l)return o=!0,p}catch{}return l});if(!o&&!s)throw new Error(`[@playhtml/react] no DOM element found in children of ${e}. Please ensure that your component has a direct DOM child.`);return n.cloneElement(e,{...o?{}:t,children:a?.length===1?a[0]:a})}function J(){return{pathname:window.location.pathname,search:window.location.search}}function ye(){const[{pathname:e,search:t},s]=n.useState(J());n.useEffect(()=>(window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)),[]);function o(){s(J())}return{pathname:e,search:t}}function pe(e){if(e){if(typeof e=="object"&&"current"in e){const t=e;return()=>t.current}return e}}function me(e){return typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"}const D=n.createContext({setupPlayElements:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},dispatchPlayEvent:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},registerPlayEventListener:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},removePlayEventListener:()=>{},hasSynced:!1,isLoading:!0,isProviderMissing:!0,configureCursors:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},getMyPlayerIdentity:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},triggerCursorAnimation:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},deleteElementData:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},registerCursorZone:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},unregisterCursorZone:()=>{throw new Error("[@playhtml/react]: PlayProvider element missing. please render it at the top-level or use the `standalone` prop")},cursors:{allColors:[],color:"",name:void 0},cursorPresences:new Map});function Se({children:e,initOptions:t,pathname:s}){const o=n.useRef(s);n.useEffect(()=>{if(o.current===void 0){o.current=s;return}o.current!==s&&(o.current=s,c.handleNavigation())},[s]);const{pathname:a,search:u}=ye();n.useEffect(()=>{c.setupPlayElements()},[a,u]);const[l,p]=n.useState(c.isLoading===!1),[v,L]=n.useState(null);if(v)throw v;const A=n.useMemo(()=>!t||!t.cursors?t:{...t,cursors:{...t.cursors,container:pe(t.cursors.container)}},[t]);n.useEffect(()=>{let d=!1;A&&c.configure(A);const m=c.init(A);return(me(c.ready)?c.ready:m).then(()=>{d||p(!0)},f=>{console.error(f),d||L(f)}),()=>{d=!0}},[]);const b=d=>{c.cursorClient?c.cursorClient.configure(d):console.warn("[@playhtml/react]: Cursor client not initialized. Make sure cursors are enabled in initOptions.")},I=()=>c.cursorClient?.getMyPlayerIdentity()??null,M=(d,m,g)=>
1c.cursorClient?c.cursorClient.triggerCursorAnimation(d,m,g):!1,h=n.useCallback((d,m)=>{c.cursorClient?.registerZone(d,m)},[]),E=n.useCallback(d=>{c.cursorClient?.unregisterZone(d)},[]),[R,O]=n.useState({allColors:[],color:"",name:void 0}),j=n.useRef(new Map);n.useEffect(()=>{if(l)return c.users.onChange(d=>{const m=c.users.me,g={allColors:Array.from(new Set(d.map(f=>f.color))),color:m.color,name:m.name};O(f=>f.color===g.color&&f.name===g.name&&f.allColors.length===g.allColors.length&&f.allColors.every(($,x)=>$===g.allColors[x])?f:g)})},[l]),n.useEffect(()=>{const d=c.cursorClient;if(!d)return;const m=g=>{const f=j.current;f.clear();for(const[$,x]of g)f.set($,x)};return m(d.getCursorPresences()),d.onCursorPresencesChange(m)},[l]);const F=n.useMemo(()=>({setupPlayElements:c.setupPlayElements,dispatchPlayEvent:c.dispatchPlayEvent,registerPlayEventListener:c.registerPlayEventListener,removePlayEventListener:c.removePlayEventListener,deleteElementData:c.deleteElementData,hasSynced:l,isLoading:!l,isProviderMissing:!1,configureCursors:b,getMyPlayerIdentity:I,triggerCursorAnimation:M,registerCursorZone:h,unregisterCursorZone:E,cursors:R,cursorPresences:j.current}),[l,R,h,E]);return B.jsx(D.Provider,{value:F,children:e})}function Ae(){return n.useContext(D)}function he(e,t,s,o){const[a,u]=n.useState(t);return n.useEffect(()=>{if(u(t()),!e)return s(u)},[e,...o]),a}function be(e,t){const{registerCursorZone:s,unregisterCursorZone:o}=n.useContext(D);n.useEffect(()=>{const a=e.current;if(!a||!a.id)return;const u=a.id;return s(a,t),()=>{o(u)}},[e,t,s,o])}function Ie(){const{isLoading:e}=n.useContext(D);return he(e,()=>[],t=>c.users.onChange(t),[])}const ge=typeof window>"u"?n.useEffect:n.useLayoutEffect;function C(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((a,u)=>C(a,t[u]));if(e instanceof Map||t instanceof Map){if(!(e instanceof Map)||!(t instanceof Map)||e.size!==t.size)return!1;for(const[a,u]of e)if(!t.has(a)||!C(u,t.get(a)))return!1;return!0}const s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(a=>Object.prototype.hasOwnProperty.call(t,a)&&C(e[a],t[a]))}function ve(e){if(!e)return;const[,t]=e.split("#");return t||void 0}function T(e,t){const s=z(e);if(s)return{effectiveId:s,domId:e.id,dataSource:e.getAttribute("data-source"),shared:e.getAttribute("shared"),tags:[...t].sort().join(" ")}}function Q(e,t){return e.effectiveId===t.effectiveId&&e.dataSource===t.dataSource&&e.shared===t.shared&&e.tags===t.tags}function Ee(e,t,s){const o=e.id,a=e.getAttribute("data-source"),u=e.getAttribute("shared");e.id=t.domId||o,t.dataSource===null?e.removeAttribute("data-source"):e.setAttribute("data-source",t.dataSource),t.shared===null?e.removeAttribute("shared"):e.setAttribute("shared",t.shared);try{s()}finally{e.id=o,a===null?e.removeAttribute("data-source"):e.setAttribute("data-source",a),u===null?e.removeAttribute("shared"):e.setAttribute("shared",u)}}function we({children:e,id:t,standalone:s=!1,loading:o,...a}){const u=n.useContext(D);u.isProviderMissing&&!s&&console.error(`[@playhtml/react] No PlayProvider found in the component tree. Make sure to wrap your app with <PlayProvider>.
2      Without a PlayProvider, playhtml components won't work correctly.
3
4      Add this to your app:
5
6      import { PlayProvider } from "@playhtml/react";
7
8      function App() {
9        return (
10          <PlayProvider>
11            {/* your app content */}
12          </PlayProvider>
13        );
14      }
15
16      Alternatively, you can use the 'standalone' prop on individual components
17      `),n.useEffect(()=>{s&&u.isProviderMissing&&c.init().catch(r=>console.error("Error initializing playhtml in standalone mode:",r))},[s,u.isProviderMissing]);const{tagInfo:l={"can-play":""},...p}={tagInfo:void 0,...a},v=a?.dataSource,L=a?.shared,A=a?.dataSourceReadOnly,b=l?Array.isArray(l)?Object.fromEntries(l.map(r=>[r,""])):l:{"can-play":""},I=Object.keys(b)[0]??le.CanPlay,M={};o?.behavior&&(M["loading-behavior"]=o.behavior),o?.customClass&&(M["loading-class"]=o.customClass),o?.style&&(M["loading-style"]=o.style);const h=n.useRef(null),E=n.useRef(void 0),R=n.useRef(new Set),{defaultData:O,live:j,myDefaultAwareness:F}=p;U(O,"defaultData"),U(j,"live"),U(F,"myDefaultAwareness");const d=j!==void 0?j:F,[m,g]=n.useState(()=>O),[f,$]=n.useState(d===void 0?[]:[d]),[x,ee]=n.useState(new Map),[q,te]=n.useState(()=>
17d),[re,ne]=n.useState([]),se=p.update??p.updateElement,oe=p.updateElementAwareness,K=r=>{g(i=>C(i,r.data)?i:r.data),$(i=>C(i,r.awareness)?i:r.awareness),ee(i=>C(i,r.awarenessByStableId)?i:r.awarenessByStableId),te(i=>C(i,r.live)?i:r.live),ne(i=>C(i,r.users)?i:r.users)},ae=r=>{K(r),se?.(r)},ie=r=>{K(r),oe?.(r)},Z=Object.keys(b),N=()=>{const r=h.current;if(!r)return;const i=T(r,Z);if(!i)return;const P=E.current;if(P&&!Q(P,i))return;const y=ue(I,i.effectiveId);if(!(!y||y.element!==r))return E.current=i,y};ge(()=>{if(h.current){const r=h.current;for(const[y,w]of Object.entries(p))y==="update"||y==="updateElement"||y==="updateElementAwareness"||(r[y]=w);delete r.update,r.updateElement=ae,r.updateElementAwareness=ie;const i=z(r),P=X;if(i&&P instanceof Map)for(const y of Object.keys(b)){const w=P.get(y)?.get(i);!w||w.element!==r||w.setEventHandlers({onClick:p.onClick,onDrag:p.onDrag,onDragStart:p.onDragStart})}try{const y=T(r,Z),w=E.current;w&&(!y||!Q(w,y))&&(Ee(r,w,()=>{c.removePlayElement(r)}),E.current=void 0),c.setupPlayElement(r,{ignoreIfAlreadySetup:!0});const ce=T(r,Z);E.current=ce}catch(y){console.warn("[@playhtml/react] Failed to setup play element:",y)}}}),n.useEffect(()=>{const r=h.current;return()=>{r&&(c.removePlayElement(r),E.current=void 0)}},[]);const S=e({data:m,live:q,users:re,awareness:f,awarenessByStableId:x,setData:r=>{const i=h.current?z(h.current):void 0;if(!i){console.warn("[@playhtml/react] No effective id for element",h.current);return}const P=N();if(!P){console.warn(`[@playhtml/react] No handler registered for this element ${i}`);return}P.setData(r)},setLive:r=>{N()?.setLive(r)},setMyAwareness:r=>{N()?.setLive(r)},myAwareness:q,ref:h});if(_(S)&&!t)throw new Error("If you pass a single React Fragment as the children, you must also specify 'id' in the props");const H=S?.props,k=H?.id,W=t!==void 0,Y=W&&t!=="",G=(r,i)=>{R.current.has(r)||(R.current.add(r),console.warn(i))};if(W&&t===""&&G("empty-id",`[@playhtml/react] <${I}> received an empty id prop. Pass a non-empty id to bind shared state to a configured element id.`),Y&&k&&t!==k){const r=ve(v),i=r?`Using data-source="${v}" with shared state id="${r}".`:`Using id="${t}" for shared state.`;G(`id-conflict:${t}:${k}:${v??""}`,`[@playhtml/react] <${I}> received id="${t}" but its child element has id="${k}". `+i)}if(!t&&!k&&!v){const r=typeof S?.type=="string"?`<${S.type}>`:S?.type?.name?`<${S.type.name}>`:"<unknown>",i=H?.className?` (className="${H.className}")`:"";console.warn(`[@playhtml/react] <${I}> wrapping ${r}${i} has no "id" prop. Cross-browser sync requires a stable id. Add an id to your child element, e.g. <div id="my-element">`)}return fe(n.Children.only(S),{ref:h,...b,...M,...v?{"data-source":v}:{},...A?{"data-source-read-only":A}:{},...L?typeof L=="string"?{shared:L}:{shared:""}:{},...Y?{id:t}:{}},{fragmentId:t})}function Me(e,t,s){return a=>{const u=typeof e=="function"?e(a):e;return B.jsx(we,{standalone:s?.standalone,loading:u.loading,...u,...s,children:l=>t(l,a)})}}const je="/assets/train-ice-2bYgR1Nw.png";export{Se as P,be as a,Ie as b,je as t,Ae as u,Me as w};

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.