Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@netless/app-geogebra

Package Overview
Dependencies
0
Maintainers
10
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

2

dist/index.d.ts

@@ -9,3 +9,3 @@ import type { NetlessApp } from "@netless/window-manager";

* NOTE: GeoGebra is licensed under GPLv3 and is free only in non-commercial use.
* If you want to use it, please refer to their licence first:
* If you want to use it, please refer to their license first:
* https://www.geogebra.org/license

@@ -12,0 +12,0 @@ *

@@ -1,3 +0,3 @@

"use strict";var j=Object.defineProperty,V=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var O=(i,a,e)=>a in i?j(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,S=(i,a)=>{for(var e in a||(a={}))D.call(a,e)&&O(i,e,a[e]);if(G)for(var e of G(a))X.call(a,e)&&O(i,e,a[e]);return i},T=(i,a)=>V(i,N(a));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";class x{constructor(){this.disposers=new Map,this.disposerIDGenCount=-1}add(a,e=this.genDisposerID()){return this.flush(e),this.disposers.set(e,a()),e}addEventListener(a,e,s,t,n=this.genDisposerID()){return this.add(()=>(a.addEventListener(e,s,t),()=>a.removeEventListener(e,s,t)),n),n}setTimeout(a,e,s=this.genDisposerID()){return this.add(()=>{const t=window.setTimeout(()=>{this.remove(s),a()},e);return()=>window.clearTimeout(t)},s)}setInterval(a,e,s=this.genDisposerID()){return this.add(()=>{const t=window.setInterval(a,e);return()=>window.clearInterval(t)},s)}remove(a){const e=this.disposers.get(a);return this.disposers.delete(a),e}flush(a){const e=this.remove(a);if(e)try{e()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(a=>{try{a()}catch(e){console.error(e)}}),this.disposers.clear()}genDisposerID(){const{MAX_SAFE_INTEGER:a=9007199254740991}=Number;return this.disposerIDGenCount=(this.disposerIDGenCount+1)%a,`disposer-${this.disposerIDGenCount}`}}function B(i){return i!=null&&typeof i=="object"&&!Array.isArray(i)}function R(i,a){let e=i.getAttributes();if(e||(i.setAttributes(a),e=i.getAttributes()),!e)throw new Error("[NetlessAppMonaco] No attributes");return B(a)&&Object.keys(a).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||i.updateAttributes([s],a[s])}),e}let v;function _(i){if(window.GGBApplet)return Promise.resolve(window.GGBApplet);if(v)return v;{const a=document.createElement("script");if(v=new Promise((e,s)=>{a.onload=()=>e(window.GGBApplet),a.onerror=()=>{v=void 0,s()}}),i){const e=i.lastIndexOf("GeoGebra")+8;a.src=i.slice(0,e)+"/deployggb.js"}else a.src="https://www.geogebra.org/apps/deployggb.js";return document.head.appendChild(a),v}}const P={appName:"classic",showMenuBar:!0,showAlgebraInput:!0,showToolBar:!0,customToolBar:"0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6",showToolBarHelp:!1,showResetIcon:!1,enableFileFeatures:!1,enableLabelDrags:!1,enableShiftDragZoom:!0,enableRightClick:!0,errorDialogsActive:!1,allowStyleBar:!1,preventFocus:!1,useBrowserForJS:!0,language:"en",borderColor:"transparent"},L=class{constructor(i){var a;this.currentAnimations=[],this.embeds={},this.storageCallback=0,this.initAllEmbeds=()=>{for(const e of this.api.getAllObjectNames("embed"))this.initEmbed(e)},this.objectsInWaiting=[],this.updateCallback=0,this.dispatchUpdates=()=>{this.updateCallback||(this.updateCallback=setTimeout(this._dispatchUpdates,this.delay))},this._dispatchUpdates=()=>{const{objectsInWaiting:e}=this;this.objectsInWaiting=[];for(const s of e){const t=this.api.getEmbeddedCalculators(!0),n=t==null?void 0:t[s];(n==null?void 0:n.controller)&&this.sendEvent("evalGMContent",n.toJSON(),s);const o=this.api.getCommandString(s,!1);if(o){this.sendEvent("evalCommand",`${s} := ${o}`,s);const r=this.api.getObjectsOfItsGroup(s);(r==null?void 0:r.length)&&this.sendEvent("addToGroup",s,r)}if(!o||this.api.isMoveable(s)){const r=this.api.getXML(s);this.sendEvent("evalXML",r,s)}this.sendEvent("select",s,!0)}this.updateCallback=0},this.updateListener=e=>{(this.api.hasUnlabeledPredecessors(e)||this.api.isMoveable(e))&&!this.currentAnimations.includes(e)&&(this.objectsInWaiting.includes(e)||(this.objectsInWaiting.push(e),this.dispatchUpdates()))},this.addListener=e=>{const s=this.api.getImageFileName(e);if(s){const r=this.api.getFileJSON();for(const h of r.archive)h.fileName.includes(s)&&this.sendEvent("addImage",JSON.stringify(h))}const t=this.api.getXML(e),o=this.api.getCommandString(e)&&this.api.getAlgorithmXML(e);this.sendEvent("addObject",o||t,e),this.sendEvent("deselect"),this.sendEvent("select",e,!0),setTimeout(()=>this.initEmbed(e),500)},this.removeListener=e=>{this.sendEvent("deleteObject",e),delete this.embeds[e]},this.renameListener=(e,s)=>{this.sendEvent("renameObject",e,s)},this.isSyncingViewState=0,this.stopSyncViewState=()=>{this.isSyncingViewState=0},this._flushViewState=()=>{const{invXscale:e,invYscale:s,xMin:t,yMin:n}=JSON.parse(this.api.getViewProperties(0)),o=1/e,r=-t/e,h=-n/s;return this.viewState={scale:o,x:r,y:h},this.viewSyncCallback=0,this.viewState},this.clientListener=e=>{let s,t;const n=e.type;switch(n){case"updateStyle":s=e.target,t=this.api.getXML(s),this.sendEvent("evalXML",t);break;case"editorStart":this.lastEditingLabel=e.target;break;case"editorKeyTyped":t=this.api.getEditorState(),this.sendEvent("setEditorState",t,this.lastEditingLabel);break;case"editorStop":this.lastEditingLabel=void 0,this.sendEvent("setEditorState",JSON.stringify({content:""}));break;case"deselect":this.sendEvent("deselect",e.target);break;case"select":this.sendEvent("select",e.target);break;case"embeddedContentChanged":s=e[1],t=e[2],this.sendEvent("embeddedContentChanged",t,s);break;case"undo":case"redo":case"addPolygonComplete":t=this.api.getXML(),this.sendEvent("setXML",t);break;case"addSlide":this.sendEvent(n);break;case"removeSlide":case"moveSlide":case"selectSlide":case"clearSlide":case"orderingChange":t=e[2],this.sendEvent(n,t);break;case"pasteSlide":({cardIdx:t,ggbFile:s}=e),this.sendEvent(n,t,s);break;case"startAnimation":s=e[1],this.currentAnimations.push(s),this.sendEvent(n,s,s);break;case"stopAnimation":s=e[1],this.currentAnimations.splice(this.currentAnimations.indexOf(s),1),this.sendEvent(n,s,s);break;case"groupObjects":case"ungroupObjects":t=e.targets,this.sendEvent(n,t);break;case"pasteElmsComplete":t=e.targets.map(o=>this.api.getXML(o)).join(""),this.sendEvent("evalXML",t);break;case"addGeoToTV":case"removeGeoFromTV":t=e[1],this.sendEvent(n,t);break;case"setValuesOfTV":t=e[2],this.sendEvent(n,t);break;case"showPointsTV":({column:t,show:s}=e),this.sendEvent(n,t,s);break;case"lockTextElement":case"unlockTextElement":t=e[1],this.sendEvent(n,t);break;case"viewChanged2D":this.viewSyncCallback||(this.isSyncingViewState||this.viewState.scale===0?this.viewSyncCallback=setTimeout(this._flushViewState,this.delay):this.viewSyncCallback=setTimeout(this._sendViewSyncEvent,this.delay));break;case"mouseDown":case"deleteGeos":case"dragEnd":break;default:console.debug("[GeoGebra] unhandled event ",e.type,e)}},this.viewSyncCallback=0,this.viewState={scale:0,x:0,y:0},this._sendViewSyncEvent=()=>{this._flushViewState(),this.sendEvent("viewChanged2D",JSON.stringify(this.viewState)),this.viewSyncCallback=0},this._delayedRegisterListeners=()=>{this.registerListeners(),this.viewSyncCallback=0},this.conflictedObjects=[],this.dispatch=e=>{var h,p;if(this.conflictedObjects.includes(e.label)&&e.type!=="conflictResolution")return;const t=e.embedLabel?this.embeds[e.embedLabel]:this,n=e.type,o=e.label,r=e.content;if(console.debug("[GeoGebra] receive:",n,o,r),n==="addObject")if(t.api.exists(o))if(this.context.isDecider)if(this.context.isDecider(this.clientId)){let d=1,c;do c=`${o}_${d}`,d++;while(t.api.exists(c));this.unregisterListeners(),t.api.renameObject(o,c),this.registerListeners();const l=t.api.getAlgorithmXML(c)||t.api.getXML(c);this.sendEvent("conflictResolution",l,o)}else this.conflictedObjects.push(o);else t.evalXML(r),t.api.previewRefresh();else t.evalXML(r),t.api.previewRefresh();else if(n==="conflictResolution"){const d=this.conflictedObjects.indexOf(o);d!==-1&&this.conflictedObjects.splice(d,1),t.evalXML(r),t.api.previewRefresh()}else if(n==="evalXML")t.evalXML(r),t.api.previewRefresh();else if(n==="setXML")t.setXML(r);else if(n==="evalCommand")t.evalCommand(r),t.api.previewRefresh();else if(n==="deleteObject")t.unregisterListeners(),t===this&&delete this.embeds[r],t.api.deleteObject(r),t.registerListeners();else if(n==="setEditorState")t.unregisterListeners(),t.api.setEditorState(r,o),t.registerListeners();else if(n==="addImage"){const d=JSON.parse(r);t.api.addImage(d.fileName,d.fileContent)}else if(["addSlide","removeSlide","moveSlide","clearSlide"].includes(n))t.api.handleSlideAction(n,r);else if(n==="selectSlide")t.unregisterListeners(),t.api.selectSlide(r),t.registerListeners();else if(n==="renameObject")t.unregisterListeners(),t.api.renameObject(r,o),t.registerListeners();else if(n==="pasteSlide")t.api.handleSlideAction(n,r,o);else if(n==="evalGMContent"){const d=(t.api.getEmbeddedCalculators(!0)||{})[o];d&&d.loadFromJSON(r)}else if(n==="startAnimation")t.api.setAnimating(o,!0),t.api.startAnimation();else if(n==="stopAnimation")t.api.setAnimating(o,!1);else if(n==="select"){if(r){const d=((p=(h=this.context).getColor)==null?void 0:p.call(h,e.clientId))||"#80808080";t.api.addMultiuserSelection(String(e.nickName),d,r,!!o)}}else if(n==="deselect")t.api.removeMultiuserSelections(String(e.nickName));else if(n==="orderingChange")t.api.updateOrdering(r);else if(n==="groupObjects")t.api.groupObjects(r);else if(n==="ungroupObjects")t.api.ungroupObjects(r);else if(n==="addToGroup")t.api.addToGroup(r,o);else if(n==="embeddedContentChanged")t.api.setEmbedContent(o,r);else if(n==="addGeoToTV")t.api.addGeoToTV(r);else if(n==="setValuesOfTV")t.api.setValuesOfTV(r);else if(n==="removeGeoFromTV")t.api.removeGeoFromTV(r);else if(n==="showPointsTV")t.api.showPointsTV(r,o);else if(n==="lockTextElement")t.api.lockTextElement(r);else if(n==="unlockTextElement")t.api.unlockTextElement(r);else if(n==="viewChanged2D")if(t.viewState.scale===0)t.api.evalCommand("Pan(0,0)"),t.startSyncViewState();else{const{scale:d,x:c,y:l}=JSON.parse(r),g=t._flushViewState();t.startSyncViewState(),t.api.evalCommand(`Pan(${c-g.x},${l-g.y})`),t.api.evalCommand(`ZoomIn(${d/g.scale})`)}else console.debug("[GeoGebra] unknown event",n,r,o)},this.api=i.api,this.clientId=i.clientId,this.nickName=i.nickName,this.delay=(a=i.delay)!=null?a:200,this.context=i,setTimeout(()=>{this.api.evalCommand("Pan(0,0)")},this.delay)}createEvent(i,a,e){const s={type:i,content:a,clientId:this.clientId,nickName:this.nickName};return this.context.embedLabel&&(s.embedLabel=this.context.embedLabel),e&&(s.label=e),s}sendEvent(i,a,e){console.log("[GeoGebra] send:",i,e,a),this.context.postMessage(this.createEvent(i,a,e)),this.storageCallback||(this.storageCallback=setTimeout(()=>{this.context.save(this.api.getBase64()),this.storageCallback=0},this.delay))}evalCommand(i){this.unregisterListeners(),this.api.evalCommand(i),this.registerListeners()}evalXML(i){this.unregisterListeners(),this.api.evalXML(i),this.api.updateConstruction(),this.registerListeners(),setTimeout(this.initAllEmbeds,500)}setXML(i){this.unregisterListeners(),this.api.setXML(i),this.api.updateConstruction(),this.registerListeners()}initEmbed(i){if(this.embeds[i])return;const a=this.api.getEmbeddedCalculators();if(!a)return;const e=a[i];if(e&&"registerClientListener"in e){const s=new L(T(S({},this.context),{clientId:this.clientId,nickName:this.nickName,api:e,embedLabel:i}));s.registerListeners(),this.embeds[i]=s}}startSyncViewState(){clearTimeout(this.isSyncingViewState),this.isSyncingViewState=setTimeout(this.stopSyncViewState,1e3)}shouldSyncView(i,a,e,s){return Math.abs(a-i.scale)>L.Threshold/10||Math.abs(e-i.x)>L.Threshold||Math.abs(s-i.y)>L.Threshold}registerListeners(){this.api.registerUpdateListener(this.updateListener),this.api.registerRemoveListener(this.removeListener),this.api.registerAddListener(this.addListener),this.api.registerClientListener(this.clientListener),this.api.registerRenameListener(this.renameListener)}unregisterListeners(){this.api.unregisterUpdateListener(this.updateListener),this.api.unregisterRemoveListener(this.removeListener),this.api.unregisterAddListener(this.addListener),this.api.unregisterClientListener(this.clientListener),this.api.unregisterRenameListener(this.renameListener)}};let I=L;I.Threshold=20;var F=`.netless-app-geogebra{width:100%!important;height:100%!important;overflow:hidden}.netless-app-geogebra.loading{background-color:#fff}.netless-app-geogebra.readonly{user-select:none;pointer-events:none}
`;function J(i,a){const e=new ResizeObserver(()=>a(i));return e.observe(i),()=>e.disconnect()}function $(i,a,e){const s=i.getDisplayer(),t=i.getRoom();let n=[];const o=d=>{d.authorId!==s.observerId&&n.forEach(c=>c(d.payload))},r="sync--"+i.appId;return s.addMagixEventListener(r,o),{service:{addListener(d){n.push(d)},postMessage(d){t==null||t.dispatchMagixEvent(r,d)},load(){return a[e]},save(d){i.updateAttributes([e],d)}},disposer:()=>{n=[],s.removeMagixEventListener(r)}}}const U={kind:"GeoGebra",async setup(i){var y,C;const a=i.getDisplayer(),e=a.observerId,s=(y=a.state.roomMembers.find(u=>u.memberId===e))==null?void 0:y.payload,t=(s==null?void 0:s.uid)||"",n=(s==null?void 0:s.nickName)||t,o=(C=i.getAppOptions())==null?void 0:C.HTML5Codebase,r=R(i,{uid:"",ggbBase64:""}),h=i.getBox();h.mountStyles(F);const p=document.createElement("div");p.classList.add("netless-app-geogebra","loading"),t!==r.uid&&r.uid&&p.classList.add("netless-app-geogebra","readonly"),h.mountContent(p);const d=new x,c=S({},P);r.ggbBase64&&(c.ggbBase64=r.ggbBase64),c.id="ggb_"+i.appId;let l;const g=$(i,r,"ggbBase64");function w(){const{width:u,height:m}=p.getBoundingClientRect();l==null||l.setWidth(u),l==null||l.setHeight(m)}c.appletOnLoad=u=>{console.log(`[GeoGebra]: loaded ${JSON.stringify(c.id)}`),l=u,w(),p.classList.remove("loading");const m=i.getDisplayer(),k=new I(S({clientId:m.observerId,nickName:n,api:u,isDecider:b=>m.state.roomMembers.map(f=>f.memberId).every(f=>b<=f),getColor:b=>{const M=m.memberState(b).strokeColor;return"#"+M.map(f=>f.toString(16).padStart(2,"0")).join("")+"80"}},g.service));k.registerListeners(),g.service.addListener(b=>{k.dispatch(b),l==null||l.setUndoPoint()})},d.add(()=>J(p,w)),i.emitter.on("destroy",()=>{console.log("[GeoGebra]: destroy"),d.flushAll(),g.disposer(),l==null||l.remove()});const A=await _(o),E=new A(c);o&&E.setHTML5Codebase(o),E.inject(p)}};exports.default=U;
"use strict";var X=Object.defineProperty,x=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var A=(i,a,e)=>a in i?X(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,w=(i,a)=>{for(var e in a||(a={}))R.call(a,e)&&A(i,e,a[e]);if(T)for(var e of T(a))D.call(a,e)&&A(i,e,a[e]);return i},G=(i,a)=>x(i,B(a));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";const j="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",_=j.length,I=Array(20),v=()=>{for(let i=0;i<20;i++)I[i]=j.charAt(Math.random()*_);return I.join("")};class P{constructor(){this.disposers=new Map}add(a,e=v()){return this.flush(e),this.disposers.set(e,a()),e}addDisposer(a,e=v()){return this.flush(e),this.disposers.set(e,a),e}addEventListener(a,e,s,t,n=v()){return this.add(()=>(a.addEventListener(e,s,t),()=>a.removeEventListener(e,s,t)),n),n}setTimeout(a,e,s=v()){return this.add(()=>{const t=window.setTimeout(()=>{this.remove(s),a()},e);return()=>window.clearTimeout(t)},s)}setInterval(a,e,s=v()){return this.add(()=>{const t=window.setInterval(a,e);return()=>window.clearInterval(t)},s)}remove(a){const e=this.disposers.get(a);return this.disposers.delete(a),e}flush(a){const e=this.remove(a);if(e)try{e()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(a=>{try{a()}catch(e){console.error(e)}}),this.disposers.clear()}}function F(i){return i!=null&&typeof i=="object"&&!Array.isArray(i)}function J(i,a){let e=i.getAttributes();if(e||(i.setAttributes(a),e=i.getAttributes()),!e)throw new Error("[NetlessAppMonaco] No attributes");return F(a)&&Object.keys(a).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||i.updateAttributes([s],a[s])}),e}let L;function U(i){if(window.GGBApplet)return Promise.resolve(window.GGBApplet);if(L)return L;{const a=document.createElement("script");if(L=new Promise((e,s)=>{a.onload=()=>e(window.GGBApplet),a.onerror=()=>{L=void 0,s()}}),i){const e=i.lastIndexOf("GeoGebra")+8;a.src=i.slice(0,e)+"/deployggb.js"}else a.src="https://www.geogebra.org/apps/deployggb.js";return document.head.appendChild(a),L}}const $={appName:"classic",showMenuBar:!0,showAlgebraInput:!0,showToolBar:!0,customToolBar:"0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6",showToolBarHelp:!1,showResetIcon:!1,enableFileFeatures:!1,enableLabelDrags:!1,enableShiftDragZoom:!0,enableRightClick:!0,errorDialogsActive:!1,allowStyleBar:!1,preventFocus:!1,useBrowserForJS:!0,language:"en",borderColor:"transparent"},S=class{constructor(i){var a;this.currentAnimations=[],this.embeds={},this.storageCallback=0,this.initAllEmbeds=()=>{for(const e of this.api.getAllObjectNames("embed"))this.initEmbed(e)},this.objectsInWaiting=[],this.updateCallback=0,this.dispatchUpdates=()=>{this.updateCallback||(this.updateCallback=setTimeout(this._dispatchUpdates,this.delay))},this._dispatchUpdates=()=>{const{objectsInWaiting:e}=this;this.objectsInWaiting=[];for(const s of e){const t=this.api.getEmbeddedCalculators(!0),n=t==null?void 0:t[s];(n==null?void 0:n.controller)&&this.sendEvent("evalGMContent",n.toJSON(),s);const o=this.api.getCommandString(s,!1);if(o){this.sendEvent("evalCommand",`${s} := ${o}`,s);const r=this.api.getObjectsOfItsGroup(s);(r==null?void 0:r.length)&&this.sendEvent("addToGroup",s,r)}if(!o||this.api.isMoveable(s)){const r=this.api.getXML(s);this.sendEvent("evalXML",r,s)}this.sendEvent("select",s,!0)}this.updateCallback=0},this.updateListener=e=>{(this.api.hasUnlabeledPredecessors(e)||this.api.isMoveable(e))&&!this.currentAnimations.includes(e)&&(this.objectsInWaiting.includes(e)||(this.objectsInWaiting.push(e),this.dispatchUpdates()))},this.addListener=e=>{const s=this.api.getImageFileName(e);if(s){const r=this.api.getFileJSON();for(const h of r.archive)h.fileName.includes(s)&&this.sendEvent("addImage",JSON.stringify(h))}const t=this.api.getXML(e),o=this.api.getCommandString(e)&&this.api.getAlgorithmXML(e);this.sendEvent("addObject",o||t,e),this.sendEvent("deselect"),this.sendEvent("select",e,!0),setTimeout(()=>this.initEmbed(e),500)},this.removeListener=e=>{this.sendEvent("deleteObject",e),delete this.embeds[e]},this.renameListener=(e,s)=>{this.sendEvent("renameObject",e,s)},this.isSyncingViewState=0,this.stopSyncViewState=()=>{this.isSyncingViewState=0},this._flushViewState=()=>{const{invXscale:e,invYscale:s,xMin:t,yMin:n}=JSON.parse(this.api.getViewProperties(0)),o=1/e,r=-t/e,h=-n/s;return this.viewState={scale:o,x:r,y:h},this.viewSyncCallback=0,this.viewState},this.clientListener=e=>{let s,t;const n=e.type;switch(n){case"updateStyle":s=e.target,t=this.api.getXML(s),this.sendEvent("evalXML",t);break;case"editorStart":this.lastEditingLabel=e.target;break;case"editorKeyTyped":t=this.api.getEditorState(),this.sendEvent("setEditorState",t,this.lastEditingLabel);break;case"editorStop":this.lastEditingLabel=void 0,this.sendEvent("setEditorState",JSON.stringify({content:""}));break;case"deselect":this.sendEvent("deselect",e.target);break;case"select":this.sendEvent("select",e.target);break;case"embeddedContentChanged":s=e[1],t=e[2],this.sendEvent("embeddedContentChanged",t,s);break;case"undo":case"redo":case"addPolygonComplete":t=this.api.getXML(),this.sendEvent("setXML",t);break;case"addSlide":this.sendEvent(n);break;case"removeSlide":case"moveSlide":case"selectSlide":case"clearSlide":case"orderingChange":t=e[2],this.sendEvent(n,t);break;case"pasteSlide":({cardIdx:t,ggbFile:s}=e),this.sendEvent(n,t,s);break;case"startAnimation":s=e[1],this.currentAnimations.push(s),this.sendEvent(n,s,s);break;case"stopAnimation":s=e[1],this.currentAnimations.splice(this.currentAnimations.indexOf(s),1),this.sendEvent(n,s,s);break;case"groupObjects":case"ungroupObjects":t=e.targets,this.sendEvent(n,t);break;case"pasteElmsComplete":t=e.targets.map(o=>this.api.getXML(o)).join(""),this.sendEvent("evalXML",t);break;case"addGeoToTV":case"removeGeoFromTV":t=e[1],this.sendEvent(n,t);break;case"setValuesOfTV":t=e[2],this.sendEvent(n,t);break;case"showPointsTV":({column:t,show:s}=e),this.sendEvent(n,t,s);break;case"lockTextElement":case"unlockTextElement":t=e[1],this.sendEvent(n,t);break;case"viewChanged2D":this.viewSyncCallback||(this.isSyncingViewState||this.viewState.scale===0?this.viewSyncCallback=setTimeout(this._flushViewState,this.delay):this.viewSyncCallback=setTimeout(this._sendViewSyncEvent,this.delay));break;case"mouseDown":case"deleteGeos":case"dragEnd":break;default:console.debug("[GeoGebra] unhandled event ",e.type,e)}},this.viewSyncCallback=0,this.viewState={scale:0,x:0,y:0},this._sendViewSyncEvent=()=>{this._flushViewState(),this.sendEvent("viewChanged2D",JSON.stringify(this.viewState)),this.viewSyncCallback=0},this._delayedRegisterListeners=()=>{this.registerListeners(),this.viewSyncCallback=0},this.conflictedObjects=[],this.dispatch=e=>{var h,p;if(this.conflictedObjects.includes(e.label)&&e.type!=="conflictResolution")return;const t=e.embedLabel?this.embeds[e.embedLabel]:this,n=e.type,o=e.label,r=e.content;if(console.debug("[GeoGebra] receive:",n,o,r),n==="addObject")if(t.api.exists(o))if(this.context.isDecider)if(this.context.isDecider(this.clientId)){let l=1,c;do c=`${o}_${l}`,l++;while(t.api.exists(c));this.unregisterListeners(),t.api.renameObject(o,c),this.registerListeners();const d=t.api.getAlgorithmXML(c)||t.api.getXML(c);this.sendEvent("conflictResolution",d,o)}else this.conflictedObjects.push(o);else t.evalXML(r),t.api.previewRefresh();else t.evalXML(r),t.api.previewRefresh();else if(n==="conflictResolution"){const l=this.conflictedObjects.indexOf(o);l!==-1&&this.conflictedObjects.splice(l,1),t.evalXML(r),t.api.previewRefresh()}else if(n==="evalXML")t.evalXML(r),t.api.previewRefresh();else if(n==="setXML")t.setXML(r);else if(n==="evalCommand")t.evalCommand(r),t.api.previewRefresh();else if(n==="deleteObject")t.unregisterListeners(),t===this&&delete this.embeds[r],t.api.deleteObject(r),t.registerListeners();else if(n==="setEditorState")t.unregisterListeners(),t.api.setEditorState(r,o),t.registerListeners();else if(n==="addImage"){const l=JSON.parse(r);t.api.addImage(l.fileName,l.fileContent)}else if(["addSlide","removeSlide","moveSlide","clearSlide"].includes(n))t.api.handleSlideAction(n,r);else if(n==="selectSlide")t.unregisterListeners(),t.api.selectSlide(r),t.registerListeners();else if(n==="renameObject")t.unregisterListeners(),t.api.renameObject(r,o),t.registerListeners();else if(n==="pasteSlide")t.api.handleSlideAction(n,r,o);else if(n==="evalGMContent"){const l=(t.api.getEmbeddedCalculators(!0)||{})[o];l&&l.loadFromJSON(r)}else if(n==="startAnimation")t.api.setAnimating(o,!0),t.api.startAnimation();else if(n==="stopAnimation")t.api.setAnimating(o,!1);else if(n==="select"){if(r){const l=((p=(h=this.context).getColor)==null?void 0:p.call(h,e.clientId))||"#80808080";t.api.addMultiuserSelection(String(e.nickName),l,r,!!o)}}else if(n==="deselect")t.api.removeMultiuserSelections(String(e.nickName));else if(n==="orderingChange")t.api.updateOrdering(r);else if(n==="groupObjects")t.api.groupObjects(r);else if(n==="ungroupObjects")t.api.ungroupObjects(r);else if(n==="addToGroup")t.api.addToGroup(r,o);else if(n==="embeddedContentChanged")t.api.setEmbedContent(o,r);else if(n==="addGeoToTV")t.api.addGeoToTV(r);else if(n==="setValuesOfTV")t.api.setValuesOfTV(r);else if(n==="removeGeoFromTV")t.api.removeGeoFromTV(r);else if(n==="showPointsTV")t.api.showPointsTV(r,o);else if(n==="lockTextElement")t.api.lockTextElement(r);else if(n==="unlockTextElement")t.api.unlockTextElement(r);else if(n==="viewChanged2D")if(t.viewState.scale===0)t.api.evalCommand("Pan(0,0)"),t.startSyncViewState();else{const{scale:l,x:c,y:d}=JSON.parse(r),g=t._flushViewState();t.startSyncViewState(),t.api.evalCommand(`Pan(${c-g.x},${d-g.y})`),t.api.evalCommand(`ZoomIn(${l/g.scale})`)}else console.debug("[GeoGebra] unknown event",n,r,o)},this.api=i.api,this.clientId=i.clientId,this.nickName=i.nickName,this.delay=(a=i.delay)!=null?a:200,this.context=i,setTimeout(()=>{this.api.evalCommand("Pan(0,0)")},this.delay)}createEvent(i,a,e){const s={type:i,content:a,clientId:this.clientId,nickName:this.nickName};return this.context.embedLabel&&(s.embedLabel=this.context.embedLabel),e&&(s.label=e),s}sendEvent(i,a,e){console.log("[GeoGebra] send:",i,e,a),this.context.postMessage(this.createEvent(i,a,e)),this.storageCallback||(this.storageCallback=setTimeout(()=>{this.context.save(this.api.getBase64()),this.storageCallback=0},this.delay))}evalCommand(i){this.unregisterListeners(),this.api.evalCommand(i),this.registerListeners()}evalXML(i){this.unregisterListeners(),this.api.evalXML(i),this.api.updateConstruction(),this.registerListeners(),setTimeout(this.initAllEmbeds,500)}setXML(i){this.unregisterListeners(),this.api.setXML(i),this.api.updateConstruction(),this.registerListeners()}initEmbed(i){if(this.embeds[i])return;const a=this.api.getEmbeddedCalculators();if(!a)return;const e=a[i];if(e&&"registerClientListener"in e){const s=new S(G(w({},this.context),{clientId:this.clientId,nickName:this.nickName,api:e,embedLabel:i}));s.registerListeners(),this.embeds[i]=s}}startSyncViewState(){clearTimeout(this.isSyncingViewState),this.isSyncingViewState=setTimeout(this.stopSyncViewState,1e3)}shouldSyncView(i,a,e,s){return Math.abs(a-i.scale)>S.Threshold/10||Math.abs(e-i.x)>S.Threshold||Math.abs(s-i.y)>S.Threshold}registerListeners(){this.api.registerUpdateListener(this.updateListener),this.api.registerRemoveListener(this.removeListener),this.api.registerAddListener(this.addListener),this.api.registerClientListener(this.clientListener),this.api.registerRenameListener(this.renameListener)}unregisterListeners(){this.api.unregisterUpdateListener(this.updateListener),this.api.unregisterRemoveListener(this.removeListener),this.api.unregisterAddListener(this.addListener),this.api.unregisterClientListener(this.clientListener),this.api.unregisterRenameListener(this.renameListener)}};let V=S;V.Threshold=20;var W=`.netless-app-geogebra{width:100%!important;height:100%!important;overflow:hidden}.netless-app-geogebra.loading{background-color:#fff}.netless-app-geogebra.readonly{user-select:none;pointer-events:none}
`;function H(i,a){const e=new ResizeObserver(()=>a(i));return e.observe(i),()=>e.disconnect()}function z(i,a,e){const s=i.getDisplayer(),t=i.getRoom();let n=[];const o=l=>{l.authorId!==s.observerId&&n.forEach(c=>c(l.payload))},r="sync--"+i.appId;return s.addMagixEventListener(r,o),{service:{addListener(l){n.push(l)},postMessage(l){t==null||t.dispatchMagixEvent(r,l)},load(){return a[e]},save(l){i.updateAttributes([e],l)}},disposer:()=>{n=[],s.removeMagixEventListener(r)}}}const Z={kind:"GeoGebra",async setup(i){var C,k;const a=i.getDisplayer(),e=a.observerId,s=(C=a.state.roomMembers.find(u=>u.memberId===e))==null?void 0:C.payload,t=(s==null?void 0:s.uid)||"",n=(s==null?void 0:s.nickName)||t,o=(k=i.getAppOptions())==null?void 0:k.HTML5Codebase,r=J(i,{uid:"",ggbBase64:""}),h=i.getBox();h.mountStyles(W);const p=document.createElement("div");p.classList.add("netless-app-geogebra","loading"),t!==r.uid&&r.uid&&p.classList.add("netless-app-geogebra","readonly"),h.mountContent(p);const l=new P,c=w({},$);r.ggbBase64&&(c.ggbBase64=r.ggbBase64),c.id="ggb_"+i.appId;let d;const g=z(i,r,"ggbBase64");function y(){const{width:u,height:m}=p.getBoundingClientRect();d==null||d.setWidth(u),d==null||d.setHeight(m)}c.appletOnLoad=u=>{console.log(`[GeoGebra]: loaded ${JSON.stringify(c.id)}`),d=u,y(),p.classList.remove("loading");const m=i.getDisplayer(),M=new V(w({clientId:m.observerId,nickName:n,api:u,isDecider:b=>m.state.roomMembers.map(f=>f.memberId).every(f=>b<=f),getColor:b=>{const O=m.memberState(b).strokeColor;return"#"+O.map(f=>f.toString(16).padStart(2,"0")).join("")+"80"}},g.service));M.registerListeners(),g.service.addListener(b=>{M.dispatch(b),d==null||d.setUndoPoint()})},l.add(()=>H(p,y)),i.emitter.on("destroy",()=>{console.log("[GeoGebra]: destroy"),l.flushAll(),g.disposer(),d==null||d.remove()});const N=await U(o),E=new N(c);o&&E.setHTML5Codebase(o),E.inject(p)}};exports.default=Z;
//# sourceMappingURL=main.cjs.js.map

@@ -20,52 +20,56 @@ var __defProp = Object.defineProperty;

var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
class s {
const e = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", s = e.length, t = Array(20), r = () => {
for (let r2 = 0; r2 < 20; r2++)
t[r2] = e.charAt(Math.random() * s);
return t.join("");
};
class o {
constructor() {
this.disposers = new Map(), this.disposerIDGenCount = -1;
this.disposers = new Map();
}
add(s2, e = this.genDisposerID()) {
return this.flush(e), this.disposers.set(e, s2()), e;
add(e2, s2 = r()) {
return this.flush(s2), this.disposers.set(s2, e2()), s2;
}
addEventListener(s2, e, t, r, i = this.genDisposerID()) {
return this.add(() => (s2.addEventListener(e, t, r), () => s2.removeEventListener(e, t, r)), i), i;
addDisposer(e2, s2 = r()) {
return this.flush(s2), this.disposers.set(s2, e2), s2;
}
setTimeout(s2, e, t = this.genDisposerID()) {
addEventListener(e2, s2, t2, o2, i = r()) {
return this.add(() => (e2.addEventListener(s2, t2, o2), () => e2.removeEventListener(s2, t2, o2)), i), i;
}
setTimeout(e2, s2, t2 = r()) {
return this.add(() => {
const r = window.setTimeout(() => {
this.remove(t), s2();
}, e);
return () => window.clearTimeout(r);
}, t);
const r2 = window.setTimeout(() => {
this.remove(t2), e2();
}, s2);
return () => window.clearTimeout(r2);
}, t2);
}
setInterval(s2, e, t = this.genDisposerID()) {
setInterval(e2, s2, t2 = r()) {
return this.add(() => {
const t2 = window.setInterval(s2, e);
return () => window.clearInterval(t2);
}, t);
const t3 = window.setInterval(e2, s2);
return () => window.clearInterval(t3);
}, t2);
}
remove(s2) {
const e = this.disposers.get(s2);
return this.disposers.delete(s2), e;
remove(e2) {
const s2 = this.disposers.get(e2);
return this.disposers.delete(e2), s2;
}
flush(s2) {
const e = this.remove(s2);
if (e)
flush(e2) {
const s2 = this.remove(e2);
if (s2)
try {
e();
} catch (t) {
console.error(t);
s2();
} catch (t2) {
console.error(t2);
}
}
flushAll() {
this.disposers.forEach((s2) => {
this.disposers.forEach((e2) => {
try {
s2();
} catch (e) {
console.error(e);
e2();
} catch (s2) {
console.error(s2);
}
}), this.disposers.clear();
}
genDisposerID() {
const { MAX_SAFE_INTEGER: s2 = 9007199254740991 } = Number;
return this.disposerIDGenCount = (this.disposerIDGenCount + 1) % s2, `disposer-${this.disposerIDGenCount}`;
}
}

@@ -619,3 +623,3 @@ function isObject(val) {

box.mountContent(content);
const sideEffectManager = new s();
const sideEffectManager = new o();
const params = __spreadValues({}, defaultParameters);

@@ -653,4 +657,4 @@ if (attrs.ggbBase64) {

liveApp.registerListeners();
sync.service.addListener((e) => {
liveApp.dispatch(e);
sync.service.addListener((e2) => {
liveApp.dispatch(e2);
app == null ? void 0 : app.setUndoPoint();

@@ -657,0 +661,0 @@ });

@@ -1,3 +0,3 @@

(()=>{var F=Object.defineProperty,J=Object.defineProperties;var $=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var j=(h,p,g)=>p in h?F(h,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):h[p]=g,y=(h,p)=>{for(var g in p||(p={}))U.call(p,g)&&j(h,g,p[g]);if(A)for(var g of A(p))W.call(p,g)&&j(h,g,p[g]);return h},V=(h,p)=>J(h,$(p));var z=function(h){"use strict";class p{constructor(){this.disposers=new Map,this.disposerIDGenCount=-1}add(r,e=this.genDisposerID()){return this.flush(e),this.disposers.set(e,r()),e}addEventListener(r,e,s,t,i=this.genDisposerID()){return this.add(()=>(r.addEventListener(e,s,t),()=>r.removeEventListener(e,s,t)),i),i}setTimeout(r,e,s=this.genDisposerID()){return this.add(()=>{const t=window.setTimeout(()=>{this.remove(s),r()},e);return()=>window.clearTimeout(t)},s)}setInterval(r,e,s=this.genDisposerID()){return this.add(()=>{const t=window.setInterval(r,e);return()=>window.clearInterval(t)},s)}remove(r){const e=this.disposers.get(r);return this.disposers.delete(r),e}flush(r){const e=this.remove(r);if(e)try{e()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(r=>{try{r()}catch(e){console.error(e)}}),this.disposers.clear()}genDisposerID(){const{MAX_SAFE_INTEGER:r=9007199254740991}=Number;return this.disposerIDGenCount=(this.disposerIDGenCount+1)%r,`disposer-${this.disposerIDGenCount}`}}function g(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}function N(n,r){let e=n.getAttributes();if(e||(n.setAttributes(r),e=n.getAttributes()),!e)throw new Error("[NetlessAppMonaco] No attributes");return g(r)&&Object.keys(r).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||n.updateAttributes([s],r[s])}),e}let v;function D(n){if(window.GGBApplet)return Promise.resolve(window.GGBApplet);if(v)return v;{const r=document.createElement("script");if(v=new Promise((e,s)=>{r.onload=()=>e(window.GGBApplet),r.onerror=()=>{v=void 0,s()}}),n){const e=n.lastIndexOf("GeoGebra")+8;r.src=n.slice(0,e)+"/deployggb.js"}else r.src="https://www.geogebra.org/apps/deployggb.js";return document.head.appendChild(r),v}}const X={appName:"classic",showMenuBar:!0,showAlgebraInput:!0,showToolBar:!0,customToolBar:"0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6",showToolBarHelp:!1,showResetIcon:!1,enableFileFeatures:!1,enableLabelDrags:!1,enableShiftDragZoom:!0,enableRightClick:!0,errorDialogsActive:!1,allowStyleBar:!1,preventFocus:!1,useBrowserForJS:!0,language:"en",borderColor:"transparent"},L=class{constructor(n){var r;this.currentAnimations=[],this.embeds={},this.storageCallback=0,this.initAllEmbeds=()=>{for(const e of this.api.getAllObjectNames("embed"))this.initEmbed(e)},this.objectsInWaiting=[],this.updateCallback=0,this.dispatchUpdates=()=>{this.updateCallback||(this.updateCallback=setTimeout(this._dispatchUpdates,this.delay))},this._dispatchUpdates=()=>{const{objectsInWaiting:e}=this;this.objectsInWaiting=[];for(const s of e){const t=this.api.getEmbeddedCalculators(!0),i=t==null?void 0:t[s];(i==null?void 0:i.controller)&&this.sendEvent("evalGMContent",i.toJSON(),s);const o=this.api.getCommandString(s,!1);if(o){this.sendEvent("evalCommand",`${s} := ${o}`,s);const a=this.api.getObjectsOfItsGroup(s);(a==null?void 0:a.length)&&this.sendEvent("addToGroup",s,a)}if(!o||this.api.isMoveable(s)){const a=this.api.getXML(s);this.sendEvent("evalXML",a,s)}this.sendEvent("select",s,!0)}this.updateCallback=0},this.updateListener=e=>{(this.api.hasUnlabeledPredecessors(e)||this.api.isMoveable(e))&&!this.currentAnimations.includes(e)&&(this.objectsInWaiting.includes(e)||(this.objectsInWaiting.push(e),this.dispatchUpdates()))},this.addListener=e=>{const s=this.api.getImageFileName(e);if(s){const a=this.api.getFileJSON();for(const u of a.archive)u.fileName.includes(s)&&this.sendEvent("addImage",JSON.stringify(u))}const t=this.api.getXML(e),o=this.api.getCommandString(e)&&this.api.getAlgorithmXML(e);this.sendEvent("addObject",o||t,e),this.sendEvent("deselect"),this.sendEvent("select",e,!0),setTimeout(()=>this.initEmbed(e),500)},this.removeListener=e=>{this.sendEvent("deleteObject",e),delete this.embeds[e]},this.renameListener=(e,s)=>{this.sendEvent("renameObject",e,s)},this.isSyncingViewState=0,this.stopSyncViewState=()=>{this.isSyncingViewState=0},this._flushViewState=()=>{const{invXscale:e,invYscale:s,xMin:t,yMin:i}=JSON.parse(this.api.getViewProperties(0)),o=1/e,a=-t/e,u=-i/s;return this.viewState={scale:o,x:a,y:u},this.viewSyncCallback=0,this.viewState},this.clientListener=e=>{let s,t;const i=e.type;switch(i){case"updateStyle":s=e.target,t=this.api.getXML(s),this.sendEvent("evalXML",t);break;case"editorStart":this.lastEditingLabel=e.target;break;case"editorKeyTyped":t=this.api.getEditorState(),this.sendEvent("setEditorState",t,this.lastEditingLabel);break;case"editorStop":this.lastEditingLabel=void 0,this.sendEvent("setEditorState",JSON.stringify({content:""}));break;case"deselect":this.sendEvent("deselect",e.target);break;case"select":this.sendEvent("select",e.target);break;case"embeddedContentChanged":s=e[1],t=e[2],this.sendEvent("embeddedContentChanged",t,s);break;case"undo":case"redo":case"addPolygonComplete":t=this.api.getXML(),this.sendEvent("setXML",t);break;case"addSlide":this.sendEvent(i);break;case"removeSlide":case"moveSlide":case"selectSlide":case"clearSlide":case"orderingChange":t=e[2],this.sendEvent(i,t);break;case"pasteSlide":({cardIdx:t,ggbFile:s}=e),this.sendEvent(i,t,s);break;case"startAnimation":s=e[1],this.currentAnimations.push(s),this.sendEvent(i,s,s);break;case"stopAnimation":s=e[1],this.currentAnimations.splice(this.currentAnimations.indexOf(s),1),this.sendEvent(i,s,s);break;case"groupObjects":case"ungroupObjects":t=e.targets,this.sendEvent(i,t);break;case"pasteElmsComplete":t=e.targets.map(o=>this.api.getXML(o)).join(""),this.sendEvent("evalXML",t);break;case"addGeoToTV":case"removeGeoFromTV":t=e[1],this.sendEvent(i,t);break;case"setValuesOfTV":t=e[2],this.sendEvent(i,t);break;case"showPointsTV":({column:t,show:s}=e),this.sendEvent(i,t,s);break;case"lockTextElement":case"unlockTextElement":t=e[1],this.sendEvent(i,t);break;case"viewChanged2D":this.viewSyncCallback||(this.isSyncingViewState||this.viewState.scale===0?this.viewSyncCallback=setTimeout(this._flushViewState,this.delay):this.viewSyncCallback=setTimeout(this._sendViewSyncEvent,this.delay));break;case"mouseDown":case"deleteGeos":case"dragEnd":break;default:console.debug("[GeoGebra] unhandled event ",e.type,e)}},this.viewSyncCallback=0,this.viewState={scale:0,x:0,y:0},this._sendViewSyncEvent=()=>{this._flushViewState(),this.sendEvent("viewChanged2D",JSON.stringify(this.viewState)),this.viewSyncCallback=0},this._delayedRegisterListeners=()=>{this.registerListeners(),this.viewSyncCallback=0},this.conflictedObjects=[],this.dispatch=e=>{var u,m;if(this.conflictedObjects.includes(e.label)&&e.type!=="conflictResolution")return;const t=e.embedLabel?this.embeds[e.embedLabel]:this,i=e.type,o=e.label,a=e.content;if(console.debug("[GeoGebra] receive:",i,o,a),i==="addObject")if(t.api.exists(o))if(this.context.isDecider)if(this.context.isDecider(this.clientId)){let d=1,c;do c=`${o}_${d}`,d++;while(t.api.exists(c));this.unregisterListeners(),t.api.renameObject(o,c),this.registerListeners();const l=t.api.getAlgorithmXML(c)||t.api.getXML(c);this.sendEvent("conflictResolution",l,o)}else this.conflictedObjects.push(o);else t.evalXML(a),t.api.previewRefresh();else t.evalXML(a),t.api.previewRefresh();else if(i==="conflictResolution"){const d=this.conflictedObjects.indexOf(o);d!==-1&&this.conflictedObjects.splice(d,1),t.evalXML(a),t.api.previewRefresh()}else if(i==="evalXML")t.evalXML(a),t.api.previewRefresh();else if(i==="setXML")t.setXML(a);else if(i==="evalCommand")t.evalCommand(a),t.api.previewRefresh();else if(i==="deleteObject")t.unregisterListeners(),t===this&&delete this.embeds[a],t.api.deleteObject(a),t.registerListeners();else if(i==="setEditorState")t.unregisterListeners(),t.api.setEditorState(a,o),t.registerListeners();else if(i==="addImage"){const d=JSON.parse(a);t.api.addImage(d.fileName,d.fileContent)}else if(["addSlide","removeSlide","moveSlide","clearSlide"].includes(i))t.api.handleSlideAction(i,a);else if(i==="selectSlide")t.unregisterListeners(),t.api.selectSlide(a),t.registerListeners();else if(i==="renameObject")t.unregisterListeners(),t.api.renameObject(a,o),t.registerListeners();else if(i==="pasteSlide")t.api.handleSlideAction(i,a,o);else if(i==="evalGMContent"){const d=(t.api.getEmbeddedCalculators(!0)||{})[o];d&&d.loadFromJSON(a)}else if(i==="startAnimation")t.api.setAnimating(o,!0),t.api.startAnimation();else if(i==="stopAnimation")t.api.setAnimating(o,!1);else if(i==="select"){if(a){const d=((m=(u=this.context).getColor)==null?void 0:m.call(u,e.clientId))||"#80808080";t.api.addMultiuserSelection(String(e.nickName),d,a,!!o)}}else if(i==="deselect")t.api.removeMultiuserSelections(String(e.nickName));else if(i==="orderingChange")t.api.updateOrdering(a);else if(i==="groupObjects")t.api.groupObjects(a);else if(i==="ungroupObjects")t.api.ungroupObjects(a);else if(i==="addToGroup")t.api.addToGroup(a,o);else if(i==="embeddedContentChanged")t.api.setEmbedContent(o,a);else if(i==="addGeoToTV")t.api.addGeoToTV(a);else if(i==="setValuesOfTV")t.api.setValuesOfTV(a);else if(i==="removeGeoFromTV")t.api.removeGeoFromTV(a);else if(i==="showPointsTV")t.api.showPointsTV(a,o);else if(i==="lockTextElement")t.api.lockTextElement(a);else if(i==="unlockTextElement")t.api.unlockTextElement(a);else if(i==="viewChanged2D")if(t.viewState.scale===0)t.api.evalCommand("Pan(0,0)"),t.startSyncViewState();else{const{scale:d,x:c,y:l}=JSON.parse(a),b=t._flushViewState();t.startSyncViewState(),t.api.evalCommand(`Pan(${c-b.x},${l-b.y})`),t.api.evalCommand(`ZoomIn(${d/b.scale})`)}else console.debug("[GeoGebra] unknown event",i,a,o)},this.api=n.api,this.clientId=n.clientId,this.nickName=n.nickName,this.delay=(r=n.delay)!=null?r:200,this.context=n,setTimeout(()=>{this.api.evalCommand("Pan(0,0)")},this.delay)}createEvent(n,r,e){const s={type:n,content:r,clientId:this.clientId,nickName:this.nickName};return this.context.embedLabel&&(s.embedLabel=this.context.embedLabel),e&&(s.label=e),s}sendEvent(n,r,e){console.log("[GeoGebra] send:",n,e,r),this.context.postMessage(this.createEvent(n,r,e)),this.storageCallback||(this.storageCallback=setTimeout(()=>{this.context.save(this.api.getBase64()),this.storageCallback=0},this.delay))}evalCommand(n){this.unregisterListeners(),this.api.evalCommand(n),this.registerListeners()}evalXML(n){this.unregisterListeners(),this.api.evalXML(n),this.api.updateConstruction(),this.registerListeners(),setTimeout(this.initAllEmbeds,500)}setXML(n){this.unregisterListeners(),this.api.setXML(n),this.api.updateConstruction(),this.registerListeners()}initEmbed(n){if(this.embeds[n])return;const r=this.api.getEmbeddedCalculators();if(!r)return;const e=r[n];if(e&&"registerClientListener"in e){const s=new L(V(y({},this.context),{clientId:this.clientId,nickName:this.nickName,api:e,embedLabel:n}));s.registerListeners(),this.embeds[n]=s}}startSyncViewState(){clearTimeout(this.isSyncingViewState),this.isSyncingViewState=setTimeout(this.stopSyncViewState,1e3)}shouldSyncView(n,r,e,s){return Math.abs(r-n.scale)>L.Threshold/10||Math.abs(e-n.x)>L.Threshold||Math.abs(s-n.y)>L.Threshold}registerListeners(){this.api.registerUpdateListener(this.updateListener),this.api.registerRemoveListener(this.removeListener),this.api.registerAddListener(this.addListener),this.api.registerClientListener(this.clientListener),this.api.registerRenameListener(this.renameListener)}unregisterListeners(){this.api.unregisterUpdateListener(this.updateListener),this.api.unregisterRemoveListener(this.removeListener),this.api.unregisterAddListener(this.addListener),this.api.unregisterClientListener(this.clientListener),this.api.unregisterRenameListener(this.renameListener)}};let C=L;C.Threshold=20;var x=`.netless-app-geogebra{width:100%!important;height:100%!important;overflow:hidden}.netless-app-geogebra.loading{background-color:#fff}.netless-app-geogebra.readonly{user-select:none;pointer-events:none}
`;function B(n,r){const e=new ResizeObserver(()=>r(n));return e.observe(n),()=>e.disconnect()}function R(n,r,e){const s=n.getDisplayer(),t=n.getRoom();let i=[];const o=d=>{d.authorId!==s.observerId&&i.forEach(c=>c(d.payload))},a="sync--"+n.appId;return s.addMagixEventListener(a,o),{service:{addListener(d){i.push(d)},postMessage(d){t==null||t.dispatchMagixEvent(a,d)},load(){return r[e]},save(d){n.updateAttributes([e],d)}},disposer:()=>{i=[],s.removeMagixEventListener(a)}}}const _={kind:"GeoGebra",async setup(n){var G,O;const r=n.getDisplayer(),e=r.observerId,s=(G=r.state.roomMembers.find(f=>f.memberId===e))==null?void 0:G.payload,t=(s==null?void 0:s.uid)||"",i=(s==null?void 0:s.nickName)||t,o=(O=n.getAppOptions())==null?void 0:O.HTML5Codebase,a=N(n,{uid:"",ggbBase64:""}),u=n.getBox();u.mountStyles(x);const m=document.createElement("div");m.classList.add("netless-app-geogebra","loading"),t!==a.uid&&a.uid&&m.classList.add("netless-app-geogebra","readonly"),u.mountContent(m);const d=new p,c=y({},X);a.ggbBase64&&(c.ggbBase64=a.ggbBase64),c.id="ggb_"+n.appId;let l;const b=R(n,a,"ggbBase64");function k(){const{width:f,height:S}=m.getBoundingClientRect();l==null||l.setWidth(f),l==null||l.setHeight(S)}c.appletOnLoad=f=>{console.log(`[GeoGebra]: loaded ${JSON.stringify(c.id)}`),l=f,k(),m.classList.remove("loading");const S=n.getDisplayer(),T=new C(y({clientId:S.observerId,nickName:i,api:f,isDecider:w=>S.state.roomMembers.map(E=>E.memberId).every(E=>w<=E),getColor:w=>{const I=S.memberState(w).strokeColor;return"#"+I.map(E=>E.toString(16).padStart(2,"0")).join("")+"80"}},b.service));T.registerListeners(),b.service.addListener(w=>{T.dispatch(w),l==null||l.setUndoPoint()})},d.add(()=>B(m,k)),n.emitter.on("destroy",()=>{console.log("[GeoGebra]: destroy"),d.flushAll(),b.disposer(),l==null||l.remove()});const P=await D(o),M=new P(c);o&&M.setHTML5Codebase(o),M.inject(m)}};return h.default=_,Object.defineProperty(h,"__esModule",{value:!0}),h[Symbol.toStringTag]="Module",h}({});})();
var W=Object.defineProperty,H=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var N=(p,c,g)=>c in p?W(p,c,{enumerable:!0,configurable:!0,writable:!0,value:g}):p[c]=g,C=(p,c)=>{for(var g in c||(c={}))Z.call(c,g)&&N(p,g,c[g]);if(V)for(var g of V(c))K.call(c,g)&&N(p,g,c[g]);return p},X=(p,c)=>H(p,z(c));var NetlessAppGeogebra=function(p){"use strict";const c="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",g=c.length,k=Array(20),v=()=>{for(let n=0;n<20;n++)k[n]=c.charAt(Math.random()*g);return k.join("")};class x{constructor(){this.disposers=new Map}add(r,e=v()){return this.flush(e),this.disposers.set(e,r()),e}addDisposer(r,e=v()){return this.flush(e),this.disposers.set(e,r),e}addEventListener(r,e,s,t,i=v()){return this.add(()=>(r.addEventListener(e,s,t),()=>r.removeEventListener(e,s,t)),i),i}setTimeout(r,e,s=v()){return this.add(()=>{const t=window.setTimeout(()=>{this.remove(s),r()},e);return()=>window.clearTimeout(t)},s)}setInterval(r,e,s=v()){return this.add(()=>{const t=window.setInterval(r,e);return()=>window.clearInterval(t)},s)}remove(r){const e=this.disposers.get(r);return this.disposers.delete(r),e}flush(r){const e=this.remove(r);if(e)try{e()}catch(s){console.error(s)}}flushAll(){this.disposers.forEach(r=>{try{r()}catch(e){console.error(e)}}),this.disposers.clear()}}function B(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}function R(n,r){let e=n.getAttributes();if(e||(n.setAttributes(r),e=n.getAttributes()),!e)throw new Error("[NetlessAppMonaco] No attributes");return B(r)&&Object.keys(r).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||n.updateAttributes([s],r[s])}),e}let L;function D(n){if(window.GGBApplet)return Promise.resolve(window.GGBApplet);if(L)return L;{const r=document.createElement("script");if(L=new Promise((e,s)=>{r.onload=()=>e(window.GGBApplet),r.onerror=()=>{L=void 0,s()}}),n){const e=n.lastIndexOf("GeoGebra")+8;r.src=n.slice(0,e)+"/deployggb.js"}else r.src="https://www.geogebra.org/apps/deployggb.js";return document.head.appendChild(r),L}}const _={appName:"classic",showMenuBar:!0,showAlgebraInput:!0,showToolBar:!0,customToolBar:"0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6",showToolBarHelp:!1,showResetIcon:!1,enableFileFeatures:!1,enableLabelDrags:!1,enableShiftDragZoom:!0,enableRightClick:!0,errorDialogsActive:!1,allowStyleBar:!1,preventFocus:!1,useBrowserForJS:!0,language:"en",borderColor:"transparent"},S=class{constructor(n){var r;this.currentAnimations=[],this.embeds={},this.storageCallback=0,this.initAllEmbeds=()=>{for(const e of this.api.getAllObjectNames("embed"))this.initEmbed(e)},this.objectsInWaiting=[],this.updateCallback=0,this.dispatchUpdates=()=>{this.updateCallback||(this.updateCallback=setTimeout(this._dispatchUpdates,this.delay))},this._dispatchUpdates=()=>{const{objectsInWaiting:e}=this;this.objectsInWaiting=[];for(const s of e){const t=this.api.getEmbeddedCalculators(!0),i=t==null?void 0:t[s];(i==null?void 0:i.controller)&&this.sendEvent("evalGMContent",i.toJSON(),s);const o=this.api.getCommandString(s,!1);if(o){this.sendEvent("evalCommand",`${s} := ${o}`,s);const a=this.api.getObjectsOfItsGroup(s);(a==null?void 0:a.length)&&this.sendEvent("addToGroup",s,a)}if(!o||this.api.isMoveable(s)){const a=this.api.getXML(s);this.sendEvent("evalXML",a,s)}this.sendEvent("select",s,!0)}this.updateCallback=0},this.updateListener=e=>{(this.api.hasUnlabeledPredecessors(e)||this.api.isMoveable(e))&&!this.currentAnimations.includes(e)&&(this.objectsInWaiting.includes(e)||(this.objectsInWaiting.push(e),this.dispatchUpdates()))},this.addListener=e=>{const s=this.api.getImageFileName(e);if(s){const a=this.api.getFileJSON();for(const u of a.archive)u.fileName.includes(s)&&this.sendEvent("addImage",JSON.stringify(u))}const t=this.api.getXML(e),o=this.api.getCommandString(e)&&this.api.getAlgorithmXML(e);this.sendEvent("addObject",o||t,e),this.sendEvent("deselect"),this.sendEvent("select",e,!0),setTimeout(()=>this.initEmbed(e),500)},this.removeListener=e=>{this.sendEvent("deleteObject",e),delete this.embeds[e]},this.renameListener=(e,s)=>{this.sendEvent("renameObject",e,s)},this.isSyncingViewState=0,this.stopSyncViewState=()=>{this.isSyncingViewState=0},this._flushViewState=()=>{const{invXscale:e,invYscale:s,xMin:t,yMin:i}=JSON.parse(this.api.getViewProperties(0)),o=1/e,a=-t/e,u=-i/s;return this.viewState={scale:o,x:a,y:u},this.viewSyncCallback=0,this.viewState},this.clientListener=e=>{let s,t;const i=e.type;switch(i){case"updateStyle":s=e.target,t=this.api.getXML(s),this.sendEvent("evalXML",t);break;case"editorStart":this.lastEditingLabel=e.target;break;case"editorKeyTyped":t=this.api.getEditorState(),this.sendEvent("setEditorState",t,this.lastEditingLabel);break;case"editorStop":this.lastEditingLabel=void 0,this.sendEvent("setEditorState",JSON.stringify({content:""}));break;case"deselect":this.sendEvent("deselect",e.target);break;case"select":this.sendEvent("select",e.target);break;case"embeddedContentChanged":s=e[1],t=e[2],this.sendEvent("embeddedContentChanged",t,s);break;case"undo":case"redo":case"addPolygonComplete":t=this.api.getXML(),this.sendEvent("setXML",t);break;case"addSlide":this.sendEvent(i);break;case"removeSlide":case"moveSlide":case"selectSlide":case"clearSlide":case"orderingChange":t=e[2],this.sendEvent(i,t);break;case"pasteSlide":({cardIdx:t,ggbFile:s}=e),this.sendEvent(i,t,s);break;case"startAnimation":s=e[1],this.currentAnimations.push(s),this.sendEvent(i,s,s);break;case"stopAnimation":s=e[1],this.currentAnimations.splice(this.currentAnimations.indexOf(s),1),this.sendEvent(i,s,s);break;case"groupObjects":case"ungroupObjects":t=e.targets,this.sendEvent(i,t);break;case"pasteElmsComplete":t=e.targets.map(o=>this.api.getXML(o)).join(""),this.sendEvent("evalXML",t);break;case"addGeoToTV":case"removeGeoFromTV":t=e[1],this.sendEvent(i,t);break;case"setValuesOfTV":t=e[2],this.sendEvent(i,t);break;case"showPointsTV":({column:t,show:s}=e),this.sendEvent(i,t,s);break;case"lockTextElement":case"unlockTextElement":t=e[1],this.sendEvent(i,t);break;case"viewChanged2D":this.viewSyncCallback||(this.isSyncingViewState||this.viewState.scale===0?this.viewSyncCallback=setTimeout(this._flushViewState,this.delay):this.viewSyncCallback=setTimeout(this._sendViewSyncEvent,this.delay));break;case"mouseDown":case"deleteGeos":case"dragEnd":break;default:console.debug("[GeoGebra] unhandled event ",e.type,e)}},this.viewSyncCallback=0,this.viewState={scale:0,x:0,y:0},this._sendViewSyncEvent=()=>{this._flushViewState(),this.sendEvent("viewChanged2D",JSON.stringify(this.viewState)),this.viewSyncCallback=0},this._delayedRegisterListeners=()=>{this.registerListeners(),this.viewSyncCallback=0},this.conflictedObjects=[],this.dispatch=e=>{var u,m;if(this.conflictedObjects.includes(e.label)&&e.type!=="conflictResolution")return;const t=e.embedLabel?this.embeds[e.embedLabel]:this,i=e.type,o=e.label,a=e.content;if(console.debug("[GeoGebra] receive:",i,o,a),i==="addObject")if(t.api.exists(o))if(this.context.isDecider)if(this.context.isDecider(this.clientId)){let l=1,h;do h=`${o}_${l}`,l++;while(t.api.exists(h));this.unregisterListeners(),t.api.renameObject(o,h),this.registerListeners();const d=t.api.getAlgorithmXML(h)||t.api.getXML(h);this.sendEvent("conflictResolution",d,o)}else this.conflictedObjects.push(o);else t.evalXML(a),t.api.previewRefresh();else t.evalXML(a),t.api.previewRefresh();else if(i==="conflictResolution"){const l=this.conflictedObjects.indexOf(o);l!==-1&&this.conflictedObjects.splice(l,1),t.evalXML(a),t.api.previewRefresh()}else if(i==="evalXML")t.evalXML(a),t.api.previewRefresh();else if(i==="setXML")t.setXML(a);else if(i==="evalCommand")t.evalCommand(a),t.api.previewRefresh();else if(i==="deleteObject")t.unregisterListeners(),t===this&&delete this.embeds[a],t.api.deleteObject(a),t.registerListeners();else if(i==="setEditorState")t.unregisterListeners(),t.api.setEditorState(a,o),t.registerListeners();else if(i==="addImage"){const l=JSON.parse(a);t.api.addImage(l.fileName,l.fileContent)}else if(["addSlide","removeSlide","moveSlide","clearSlide"].includes(i))t.api.handleSlideAction(i,a);else if(i==="selectSlide")t.unregisterListeners(),t.api.selectSlide(a),t.registerListeners();else if(i==="renameObject")t.unregisterListeners(),t.api.renameObject(a,o),t.registerListeners();else if(i==="pasteSlide")t.api.handleSlideAction(i,a,o);else if(i==="evalGMContent"){const l=(t.api.getEmbeddedCalculators(!0)||{})[o];l&&l.loadFromJSON(a)}else if(i==="startAnimation")t.api.setAnimating(o,!0),t.api.startAnimation();else if(i==="stopAnimation")t.api.setAnimating(o,!1);else if(i==="select"){if(a){const l=((m=(u=this.context).getColor)==null?void 0:m.call(u,e.clientId))||"#80808080";t.api.addMultiuserSelection(String(e.nickName),l,a,!!o)}}else if(i==="deselect")t.api.removeMultiuserSelections(String(e.nickName));else if(i==="orderingChange")t.api.updateOrdering(a);else if(i==="groupObjects")t.api.groupObjects(a);else if(i==="ungroupObjects")t.api.ungroupObjects(a);else if(i==="addToGroup")t.api.addToGroup(a,o);else if(i==="embeddedContentChanged")t.api.setEmbedContent(o,a);else if(i==="addGeoToTV")t.api.addGeoToTV(a);else if(i==="setValuesOfTV")t.api.setValuesOfTV(a);else if(i==="removeGeoFromTV")t.api.removeGeoFromTV(a);else if(i==="showPointsTV")t.api.showPointsTV(a,o);else if(i==="lockTextElement")t.api.lockTextElement(a);else if(i==="unlockTextElement")t.api.unlockTextElement(a);else if(i==="viewChanged2D")if(t.viewState.scale===0)t.api.evalCommand("Pan(0,0)"),t.startSyncViewState();else{const{scale:l,x:h,y:d}=JSON.parse(a),b=t._flushViewState();t.startSyncViewState(),t.api.evalCommand(`Pan(${h-b.x},${d-b.y})`),t.api.evalCommand(`ZoomIn(${l/b.scale})`)}else console.debug("[GeoGebra] unknown event",i,a,o)},this.api=n.api,this.clientId=n.clientId,this.nickName=n.nickName,this.delay=(r=n.delay)!=null?r:200,this.context=n,setTimeout(()=>{this.api.evalCommand("Pan(0,0)")},this.delay)}createEvent(n,r,e){const s={type:n,content:r,clientId:this.clientId,nickName:this.nickName};return this.context.embedLabel&&(s.embedLabel=this.context.embedLabel),e&&(s.label=e),s}sendEvent(n,r,e){console.log("[GeoGebra] send:",n,e,r),this.context.postMessage(this.createEvent(n,r,e)),this.storageCallback||(this.storageCallback=setTimeout(()=>{this.context.save(this.api.getBase64()),this.storageCallback=0},this.delay))}evalCommand(n){this.unregisterListeners(),this.api.evalCommand(n),this.registerListeners()}evalXML(n){this.unregisterListeners(),this.api.evalXML(n),this.api.updateConstruction(),this.registerListeners(),setTimeout(this.initAllEmbeds,500)}setXML(n){this.unregisterListeners(),this.api.setXML(n),this.api.updateConstruction(),this.registerListeners()}initEmbed(n){if(this.embeds[n])return;const r=this.api.getEmbeddedCalculators();if(!r)return;const e=r[n];if(e&&"registerClientListener"in e){const s=new S(X(C({},this.context),{clientId:this.clientId,nickName:this.nickName,api:e,embedLabel:n}));s.registerListeners(),this.embeds[n]=s}}startSyncViewState(){clearTimeout(this.isSyncingViewState),this.isSyncingViewState=setTimeout(this.stopSyncViewState,1e3)}shouldSyncView(n,r,e,s){return Math.abs(r-n.scale)>S.Threshold/10||Math.abs(e-n.x)>S.Threshold||Math.abs(s-n.y)>S.Threshold}registerListeners(){this.api.registerUpdateListener(this.updateListener),this.api.registerRemoveListener(this.removeListener),this.api.registerAddListener(this.addListener),this.api.registerClientListener(this.clientListener),this.api.registerRenameListener(this.renameListener)}unregisterListeners(){this.api.unregisterUpdateListener(this.updateListener),this.api.unregisterRemoveListener(this.removeListener),this.api.unregisterAddListener(this.addListener),this.api.unregisterClientListener(this.clientListener),this.api.unregisterRenameListener(this.renameListener)}};let M=S;M.Threshold=20;var P=`.netless-app-geogebra{width:100%!important;height:100%!important;overflow:hidden}.netless-app-geogebra.loading{background-color:#fff}.netless-app-geogebra.readonly{user-select:none;pointer-events:none}
`;function F(n,r){const e=new ResizeObserver(()=>r(n));return e.observe(n),()=>e.disconnect()}function J(n,r,e){const s=n.getDisplayer(),t=n.getRoom();let i=[];const o=l=>{l.authorId!==s.observerId&&i.forEach(h=>h(l.payload))},a="sync--"+n.appId;return s.addMagixEventListener(a,o),{service:{addListener(l){i.push(l)},postMessage(l){t==null||t.dispatchMagixEvent(a,l)},load(){return r[e]},save(l){n.updateAttributes([e],l)}},disposer:()=>{i=[],s.removeMagixEventListener(a)}}}const U={kind:"GeoGebra",async setup(n){var A,G;const r=n.getDisplayer(),e=r.observerId,s=(A=r.state.roomMembers.find(f=>f.memberId===e))==null?void 0:A.payload,t=(s==null?void 0:s.uid)||"",i=(s==null?void 0:s.nickName)||t,o=(G=n.getAppOptions())==null?void 0:G.HTML5Codebase,a=R(n,{uid:"",ggbBase64:""}),u=n.getBox();u.mountStyles(P);const m=document.createElement("div");m.classList.add("netless-app-geogebra","loading"),t!==a.uid&&a.uid&&m.classList.add("netless-app-geogebra","readonly"),u.mountContent(m);const l=new x,h=C({},_);a.ggbBase64&&(h.ggbBase64=a.ggbBase64),h.id="ggb_"+n.appId;let d;const b=J(n,a,"ggbBase64");function O(){const{width:f,height:w}=m.getBoundingClientRect();d==null||d.setWidth(f),d==null||d.setHeight(w)}h.appletOnLoad=f=>{console.log(`[GeoGebra]: loaded ${JSON.stringify(h.id)}`),d=f,O(),m.classList.remove("loading");const w=n.getDisplayer(),j=new M(C({clientId:w.observerId,nickName:i,api:f,isDecider:y=>w.state.roomMembers.map(E=>E.memberId).every(E=>y<=E),getColor:y=>{const I=w.memberState(y).strokeColor;return"#"+I.map(E=>E.toString(16).padStart(2,"0")).join("")+"80"}},b.service));j.registerListeners(),b.service.addListener(y=>{j.dispatch(y),d==null||d.setUndoPoint()})},l.add(()=>F(m,O)),n.emitter.on("destroy",()=>{console.log("[GeoGebra]: destroy"),l.flushAll(),b.disposer(),d==null||d.remove()});const $=await D(o),T=new $(h);o&&T.setHTML5Codebase(o),T.inject(m)}};return p.default=U,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module",p}({});
//# sourceMappingURL=main.iife.js.map
{
"name": "@netless/app-geogebra",
"version": "0.0.2",
"version": "0.0.3",
"main": "dist/main.cjs.js",
"module": "dist/main.es.js",
"unpkg": "dist/main.iife.js",
"jsdelivr": "dist/main.iife.js",
"types": "dist/index.d.ts",
"files": [
"src",
"dist"
],
"devDependencies": {
"@netless/app-shared": "0.1.1",
"side-effect-manager": "^0.1.3"
"@netless/app-shared": "0.1.2",
"side-effect-manager": "^0.1.5"
},

@@ -11,0 +17,0 @@ "scripts": {

@@ -32,3 +32,3 @@ import { ensureAttributes } from "@netless/app-shared";

* NOTE: GeoGebra is licensed under GPLv3 and is free only in non-commercial use.
* If you want to use it, please refer to their licence first:
* If you want to use it, please refer to their license first:
* https://www.geogebra.org/license

@@ -35,0 +35,0 @@ *

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc