PageSourceSearch

https://www.beeline.life/_next/static/chunks/80260-4ea68206ac7ce5f9.js

js beeline.life collected 2026-10-01 15:00:20 UTC 15,160 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e930158f-0954-478c-8ed7-4ef4a21621fb",e._sentryDebugIdIdentifier="sentry-dbid-e930158f-0954-478c-8ed7-4ef4a21621fb")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[80260],{339068:(e,t,r)=>{r.d(t,{$J:()=>l});var n=r(269684),o=r(760364);class s{createNodeLookup(e){return new Map(e.map(e=>[e.cell_id,e]))}createOutgoingEdgeMap(e){let t=new Map;for(let r of e)t.has(r.source)||t.set(r.source,[]),t.get(r.source).push(r);return t}createIncomingEdgeMap(e){let t=new Map;for(let r of e)t.has(r.target)||t.set(r.target,[]),t.get(r.target).push(r);return t}topologicalSort(e,t){let r=new Map;for(let n of(e.forEach(e=>r.set(e,new Set)),t))if(e.includes(n.source)&&e.includes(n.target)){let e=r.get(n.source);e&&e.add(n.target)}let n=new Set,o=new Set,s=[],i=e=>{if(o.has(e))return!1;if(n.has(e))return!0;for(let t of(o.add(e),r.get(e)||new Set))if(!i(t))return!1;return o.delete(e),n.add(e),s.push(e),!0};for(let t of e)if(!n.has(t)&&!i(t))return[];return s.reverse()}}class i extends s{constructor(e={}){super(),this.options={validateAfterOperation:!0,...e}}createEmptyGraph(){return{sections:[],content_nodes:[],structure:[]}}validateGraph(e){return(0,o.F4)(e)}getSortedSections(e){return[...e.sections].sort((e,t)=>e.order-t.order)}getSectionContents(e,t){let r=this.createNodeLookup(e.content_nodes),o=new Set;for(let r of e.structure)r.type===n.az.CONTAINS&&r.source===t&&o.add(r.target);if(0===o.size)return[];let s=[...o].map(e=>r.get(e)).filter(e=>void 0!==e);s.sort((e,t)=>e.order-t.order);let i=e.structure.filter(e=>e.type===n.az.SEQUENCE&&o.has(e.source)&&o.has(e.target));if(i.length>0){let e=[...o],t=this.topologicalSort(e,i);if(t.length>0)return t.map(e=>r.get(e)).filter(e=>void 0!==e)}return s}addSection(e,t){let r={...e,sections:[...e.sections]},n=r.sections.length>0?Math.max(...r.sections.map(e=>e.order)):-1;return r.sections.push({...t,order:n+1}),this.options.validateAfterOperation&&this.validateGraph(r).length,r}addContent(e,t,r,o){if(!e.sections.some(e=>e.cell_id===r))throw Error(`Section ${r} not found`);let s={...e,content_nodes:[...e.content_nodes],structure:[...e.structure]},i=s.content_nodes.length>0?Math.max(...s.content_nodes.map(e=>e.order)):-1,a={...t,order:i+1};if(s.content_nodes.push(a),s.structure.push({source:r,target:a.cell_id,type:n.az.CONTAINS,metadata:{}}),void 0!==o){let e=this.getSectionContents(s,r),t=Math.min(o,e.length);if(e.length>0){if(t>0){let r=e[t-1];s.structure.push({source:r.cell_id,target:a.cell_id,type:n.az.SEQUENCE,metadata:{}})}if(t<e.length){let r=e[t];if(s.structure.push({source:a.cell_id,target:r.cell_id,type:n.az.SEQUENCE,metadata:{}}),t>0){let o=e[t-1];s.structure=s.structure.filter(e=>e.type!==n.az.SEQUENCE||e.source!==o.cell_id||e.target!==r.cell_id)}}}}return this.options.validateAfterOperation&&this.validateGraph(s).length,s}reorderSections(e,t){let r=new Set(e.sections.map(e=>e.cell_id));if(!t.every(e=>r.has(e)))throw Error("Some section IDs do not exist in graph");let n=this.createNodeLookup(e.sections),o={...e,sections:[...e.sections]};return t.forEach((e,t)=>{let r=n.get(e);r&&(r.order=t)}),this.options.validateAfterOperation&&this.validateGraph(o).length,o}reorderSectionContents(e,t,r){if(!e.sections.some(e=>e.cell_id===t))throw Error(`Section ${t} does not exist`);let o=new Set(this.getSectionContents(e,t).map(e=>e.cell_id)),s=r.filter(e=>o.has(e));s.length!==r.length&&(r=s);let i={...e,content_nodes:[...e.content_nodes],structure:[...e.structure]},a=this.createNodeLookup(i.content_nodes);r.forEach((e,t)=>{let r=a.get(e);r&&(r.order=t)}),i.structure=i.structure.filter(e=>!(e.type===n.az.SEQUENCE&&o.has(e.source)&&o.has(e.target)));for(let e=0;e<r.length-1;e++)i.structure.push({source:r[e],target:r[e+1],type:n.az.SEQUENCE,metadata:{order:e}});return this.options.validateAfterOperation&&this.validateGraph(i).length,i}moveContent(e,t,r,o){if(!e.content_nodes.some(e=>e.cell_id===t))return e;if(!e.sections.some(e=>e.cell_id===r))throw Error(`Target section ${r} does not exist`);let s=null;for(let r of e.structure)if(r.type===n.az.CONTAINS&&r.target===t){s=r.source;break}if(s===r&&void 0===o)return e;let i={...e,structure:[...e.structure]};if(s!==r&&(i.structure=i.structure.filter(e=>e.type!==n.az.CONTAINS||e.target!==t),i.structure.push({source:r,target:t,type:n.az.CONTAINS,metadata:{}}),i.structure=i.structure.filter(e=>e.type!==n.az.SEQUENCE||e.source!==t&&e.target!==t),null!==s)){let e=this.getSectionContents(i,s).sort((e,t)=>
1e.order-t.order).map(e=>e.cell_id);if(e.length>1)for(let t=0;t<e.length-1;t++)i.structure.push({source:e[t],target:e[t+1],type:n.az.SEQUENCE,metadata:{order:t}})}if(void 0!==o){let e=this.getSectionContents(i,r).map(e=>e.cell_id),n=e.indexOf(t),s=Math.min(o,e.length),a=e.filter(e=>e!==t);return -1!==n&&n<s&&(s-=1),s=Math.max(0,Math.min(s,a.length)),a.splice(s,0,t),this.reorderSectionContents(i,r,a)}return this.options.validateAfterOperation&&this.validateGraph(i).length,i}removeSection(e,t){if(!e.sections.some(e=>e.cell_id===t))throw Error(`Section ${t} does not exist`);let r=new Set;for(let o of e.structure)o.type===n.az.CONTAINS&&o.source===t&&r.add(o.target);let o={...e,sections:e.sections.filter(e=>e.cell_id!==t),content_nodes:e.content_nodes.filter(e=>!r.has(e.cell_id)),structure:e.structure.filter(e=>!(e.source===t||e.target===t||r.has(e.source)||r.has(e.target)))};return this.options.validateAfterOperation&&this.validateGraph(o).length,o}removeContent(e,t){if(!e.content_nodes.some(e=>e.cell_id===t))throw Error(`Content ${t} does not exist`);let r=null;for(let o of e.structure)if(o.type===n.az.CONTAINS&&o.target===t){r=o.source;break}let o={...e,content_nodes:e.content_nodes.filter(e=>e.cell_id!==t),structure:e.structure.filter(e=>e.source!==t&&e.target!==t)};if(null!==r&&o.sections.some(e=>e.cell_id===r)){let e=new Set;for(let t of o.structure)t.type===n.az.CONTAINS&&t.source===r&&e.add(t.target);let t=o.content_nodes.filter(t=>e.has(t.cell_id)).sort((e,t)=>e.order-t.order).map(e=>e.cell_id);t.length>0&&(o=this.reorderSectionContents(o,r,t))}return this.options.validateAfterOperation&&this.validateGraph(o).length,o}getSection(e,t){return e.sections.find(e=>e.cell_id===t)}getContent(e,t){return e.content_nodes.find(e=>e.cell_id===t)}updateSection(e,t,r){let n=e.sections.findIndex(e=>e.cell_id===t);if(-1===n)throw Error(`Section ${t} does not exist`);let o={...e,sections:[...e.sections]};return o.sections[n]={...o.sections[n],...r},this.options.validateAfterOperation&&this.validateGraph(o).length,o}updateContent(e,t,r){let n=e.content_nodes.findIndex(e=>e.cell_id===t);if(-1===n)throw Error(`Content ${t} does not exist`);let o={...e,content_nodes:[...e.content_nodes]};return o.content_nodes[n]={...o.content_nodes[n],...r},this.options.validateAfterOperation&&this.validateGraph(o).length,o}insertSectionAt(e,t,r){let n=this.addSection(e,t),o=n.sections.find(t=>!e.sections.some(e=>e.cell_id===t.cell_id));if(!o)throw Error("Failed to identify newly added section");let s=this.getSortedSections(n).filter(e=>e.cell_id!==o.cell_id).map(e=>e.cell_id);return s.splice(Math.min(r,s.length),0,o.cell_id),this.reorderSections(n,s)}moveSection(e,t,r){if(!e.sections.some(e=>e.cell_id===t))throw Error(`Section ${t} does not exist`);let n=this.getSortedSections(e).filter(e=>e.cell_id!==t).map(e=>e.cell_id);return n.splice(Math.min(r,n.length),0,t),this.reorderSections(e,n)}}class a extends i{constructor(e={}){super(e)}createEmptyGraph(){return{sections:[],content_nodes:[],structure:[]}}getAssessments(e){return e.content_nodes.filter(e=>e.type===n.vZ.ASSES)}}class c extends i{constructor(e={}){super(e)}createEmptyGraph(){return{sections:[],content_nodes:[],structure:[]}}}function l(e,t){switch(e){case n.bE.COURSE:return new a(t);case n.bE.WIKI:return new c(t);default:return new i(t)}}},480260:(e,t,r)=>{r.d(t,{PM:()=>c});var n=r(212115),o=r(339068),s=r(760364);class i{constructor(e){this.saveTimeout=null,this.saveQueue=Promise.resolve(),"string"==typeof e?this.config={apiEndpoint:e}:this.config=e}setBeelineSlug(e){this.config.beelineSlug=e}async saveGraph(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{debounceMs:n=500,validateBeforeSave:o=!0}=r;return this.saveTimeout&&clearTimeout(this.saveTimeout),new Promise(t=>{this.saveTimeout=setTimeout(()=>{let r=this.saveQueue.then(()=>this.performSave(e,o));this.saveQueue=r.catch(()=>void 0),t(r.catch(()=>!1))},n)})}async performSave(e,t){if(!(e&&Array.isArray(e.sections)&&Array.isArray(e.content_nodes)&&Array.isArray(e.structure)))return!0;if(t&&(0,s.F4)(e).length>0||!this.config.beelineSlug)return!1;try{let t=`${this.config.apiEndpoint}/beeline/${this.config.beelineSlug}/graph/mutate/`,r={"Content-Type":"application/json"};this.config.getAuthHeaders&&Object.assign(r,this.config.getAuthHeaders());let n=this.config.getGraphVersion?.(),o=JSON.stringify({graph:e,...void 0!==n?{graph_version:n}:{}}),s=await fetch(t,{method:"PUT",headers:r,credentials:"include",body:o});if(!s.ok){if(409===s.status){let e={};try{e=await s.json()}catch{}let t=e?.errors;return t?.error_type==="version_conflict"&&this.config.onVersionConflict&&this.config.onVersionConflict(t.current_version,t.expected_ver
1sion),!1}let e=s.statusText;try{let t=await s.json();e=JSON.stringify(t)}catch{try{e=await s.text()}catch{}}throw Error(`Failed to save graph: ${e||s.statusText}`)}if(this.config.onVersionAccepted)try{let e=await s.json(),t=e?.beeline?.graph_version;"number"==typeof t&&this.config.onVersionAccepted(t)}catch{}return!0}catch(e){return!1}}}function a(e,t){void 0!==t&&(e.current=t)}function c(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"linear",s=arguments.length>3?arguments[3]:void 0,c=(0,n.useCallback)(e=>!!e&&"object"==typeof e&&Array.isArray(e.sections)&&Array.isArray(e.content_nodes)&&Array.isArray(e.structure),[]),l=(0,n.useCallback)(()=>({sections:[],content_nodes:[],structure:[]}),[]),[u,d]=(0,n.useState)(()=>c(e)?e:t&&!e||t&&e&&!c(e)?l():void 0),[h,f]=(0,n.useState)(!1),p=(0,n.useRef)(u),g=(0,n.useRef)(u),S=(0,n.useCallback)(e=>{var t=p,r=d,n=e;let o=t.current,s="function"==typeof n?n(o):n;t.current=s,r(s)},[]),v=(0,n.useRef)(c(e)?(0,o.$J)(r,{validateAfterOperation:s?.validateChanges??!0}):null);(0,n.useEffect)(()=>{if(!h){let n;c(e)?n=e:t&&(n=l(),e&&c(e)),n&&(a(g,n),S(n),v.current=(0,o.$J)(r,{validateAfterOperation:s?.validateChanges??!0}),f(!0))}},[e,h,t,r,s?.validateChanges,S,c,l]),(0,n.useEffect)(()=>{!s.disableInitialGraphSync&&e&&h&&c(e)&&(a(g,e),S(e))},[e,h,S,c,s.disableInitialGraphSync]);let[_]=(0,n.useState)(()=>new i({apiEndpoint:s.apiEndpoint,beelineSlug:s.beelineSlug,getGraphVersion:s.getGraphVersion,onVersionConflict:s.onVersionConflict,onVersionAccepted:s.onVersionAccepted}));(0,n.useEffect)(()=>{s.beelineSlug&&_.setBeelineSlug(s.beelineSlug)},[s.beelineSlug,_]);
1let[y,m]=(0,n.useState)(!1),[E,C]=(0,n.useState)(null),b=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]),(0,n.useEffect)(()=>{if(s.autosave&&u&&t){if((void 0===g.current||g.current!==u||(g.current=void 0,0))&&c(u))return b.current&&clearTimeout(b.current),b.current=setTimeout(async()=>{try{if(m(!0),!await _.saveGraph(u,t))throw Error("Failed to save graph");C(null),s.onSaveSuccess?.()}catch(e){C(e),s.onSaveError?.(e)}finally{m(!1)}},s.debounceMs||500),()=>{b.current&&clearTimeout(b.current)}}},[u,t,s.autosave,s.debounceMs,c]);let A=(0,n.useCallback)(e=>{S(e)},[]),w=(0,n.useCallback)(e=>!!c(e)&&(a(g,e),S(e),!0),[S,c]),N=(0,n.useCallback)(e=>{S(t=>t?v.current.addSection(t,e):t)},[]),k=(0,n.useCallback)((e,t,r)=>{S(n=>n?v.current.addContent(n,t,e,r):n)},[]),O=(0,n.useCallback)(e=>{S(t=>{if(!t||!v.current)return t;let r=t.sections;return Array.isArray(r)&&!r.some(t=>t?.cell_id===e)?t:v.current.removeSection(t,e)})},[]),I=(0,n.useCallback)(e=>{S(t=>{if(!t||!v.current)return t;let r=t.content_nodes;return Array.isArray(r)&&!r.some(t=>t?.cell_id===e)?t:v.current.removeContent(t,e)})},[]),T=(0,n.useCallback)(e=>{S(t=>t?v.current.reorderSections(t,e):t)},[]),x=(0,n.useCallback)((e,t)=>{S(r=>r?v.current.reorderSectionContents(r,e,t):r)},[]),z=(0,n.useCallback)((e,t,r)=>{S(n=>n?v.current.moveContent(n,e,t,r):n)},[]),G=(0,n.useCallback)((e,t)=>{S(r=>{if(!r)return r;let n=r.sections;return Array.isArray(n)&&!n.some(t=>t?.cell_id===e)?r:v.current.updateSection(r,e,t)})},[]),$=(0,n.useCallback)((e,t)=>{S(r=>{if(!r)return r;let n=r.content_nodes;return Array.isArray(n)&&!n.some(t=>t?.cell_id===e)?r:v.current.updateContent(r,e,t)})},[]),M=(0,n.useCallback)(async()=>{b.current&&(clearTimeout(b.current),b.current=null);try{let e=p.current;if(!e||!t||!c(e))return!1;m(!0);let r=await _.saveGraph(e,t,{debounceMs:0});if(!r){let e=Error("Failed to save graph");return C(e),s.onSaveError?.(e),!1}return C(null),s.onSaveSuccess?.(),r}catch(e){return C(e),s.onSaveError?.(e),!1}finally{m(!1)}},[t,_,c]);return{graph:u,isInitialized:h,...h&&{updateGraph:A,adoptServerGraph:w,addSection:N,addContent:k,removeSection:O,removeContent:I,reorderSections:T,reorderSectionContents:x,moveContent:z,updateSection:G,updateContent:$,saveGraph:M,isSaving:y,lastSaveError:E,getOperations:()=>v.current}}}},760364:(e,t,r)=>{r.d(t,{F4:()=>p});var n=r(541797),o=r(204402),s=r(269684);let i=n.Ik({type:n.fc(s.TQ),startDate:n.Yj().nullable().optional(),endDate:n.Yj().nullable().optional(),available:n.zM().nullable().optional(),prerequisites:n.YO(n.ai().int()).nullable().optional()}),a=n.Ik({cell_id:n.ai(),type:n.fc(s.vZ),status:n.fc(s.Qk),availability:i.nullable().optional(),metadata:n.g1(n.bz()).default({})}),c=a.extend({type:n.eu(s.vZ.FRAME),order:n.ai().int().nonnegative()}),l=a.extend({type:n.k5([s.vZ.SLATE,s.vZ.DIRES,s.vZ.BEELI,s.vZ.ASSES,s.vZ.SCORM,s.vZ.FDBK,s.vZ.PERF,s.vZ.PRACT,s.vZ.SURV,s.vZ.CHECK]),order:n.ai().int().nonnegative()}),u=n.Ik({source:n.ai(),target:n.ai(),type:n.eu(s.az.CONTAINS),metadata:n.g1(n.bz()).default({})}),d=n.Ik({source:n.ai(),target:n.ai(),type:n.eu(s.az.SEQUENCE),metadata:n.g1(n.bz()).default({})}),h=n.KC([u,d]),f=n.Ik({sections:n.YO(c),content_nodes:n.YO(l),structure:n.YO(h)});function p(e){try{f.parse(e);let t=[],r=new Set(e.content_nodes.map(e=>e.cell_id)),n=new Set(e.sections.map(e=>e.cell_id)),o=new Set;for(let i of e.structure)if(i.type===s.az.CONTAINS)n.has(i.source)||t.push(`Contains edge source must be a section: ${i.source}`),r.has(i.target)||t.push(`Contains edge target must be content: ${i.target}`),o.has(i.target)&&t.push(`Content node ${i.target} belongs to multiple sections`),o.add(i.target);else if(i.type===s.az.SEQUENCE){let e=r.has(i.source)||n.has(i.source),o=r.has(i.target)||n.has(i.target);e&&o||t.push(`Sequence edge ${i.source}->${i.target} must connect known nodes`)}let i=[...r].filter(e=>!o.has(e));return i.length>0&&t.push(`Content nodes not in any section: ${i.join(", ")}`),t}catch(e){if(e instanceof o.G)return e.errors.map(e=>`${e.path.join(".")}: ${e.message}`);return[e.message]}}f.extend({}),f.extend({})}}]);

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.