@gui-chat-plugin/template 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![npm version](https://badge.fury.io/js/%40gui-chat-plugin%2Ftemplate.svg)](https://badge.fury.io/js/%40gui-chat-plugin%2Ftemplate)
1
2
  # GUIChat Plugin Template
2
3
 
3
4
  A plugin template for GUIChat/MulmoChat with **integrated chat demo environment**.
@@ -16,6 +17,12 @@ This template is designed for junior engineers to learn plugin development with
16
17
  - **TypeScript**: Full type safety
17
18
  - **Tailwind CSS 4**: Modern styling
18
19
 
20
+ > **⚠️ Important: No Arbitrary Values**
21
+ >
22
+ > Do NOT use Tailwind's arbitrary values (e.g., `bg-[#1a1a2e]`, `w-[137px]`) in plugin code.
23
+ > MulmoChat uses `@source` directive to scan plugins, which only supports standard Tailwind classes.
24
+ > Use standard classes like `bg-slate-900` instead.
25
+
19
26
  ## Quick Start
20
27
 
21
28
  ```bash
@@ -245,4 +252,4 @@ After developing your plugin:
245
252
 
246
253
  ## License
247
254
 
248
- MIT
255
+ MIT
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i="putQuestions",o={type:"function",name:i,description:"Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.",parameters:{type:"object",properties:{title:{type:"string",description:"Optional title for the quiz (e.g., 'JavaScript Basics Quiz')"},questions:{type:"array",description:"Array of multiple choice questions",items:{type:"object",properties:{question:{type:"string",description:"The question text"},choices:{type:"array",description:"Array of answer choices (2-6 choices)",items:{type:"string"},minItems:2,maxItems:6},correctAnswer:{type:"number",description:"Optional: The index of the correct answer (0-based). Include this if you want to track correct answers."}},required:["question","choices"]},minItems:1}},required:["questions"]}},n=[{name:"JavaScript Quiz",args:{title:"JavaScript Basics",questions:[{question:"What does 'const' do in JavaScript?",choices:["Declares a constant variable","Declares a mutable variable","Creates a function","Imports a module"],correctAnswer:0},{question:"Which method adds an element to the end of an array?",choices:["pop()","shift()","push()","unshift()"],correctAnswer:2},{question:"What is the output of: typeof null?",choices:['"null"','"undefined"','"object"','"boolean"'],correctAnswer:2}]}},{name:"World Capitals",args:{title:"World Capitals Quiz",questions:[{question:"What is the capital of Japan?",choices:["Osaka","Kyoto","Tokyo","Hiroshima"],correctAnswer:2},{question:"What is the capital of Australia?",choices:["Sydney","Melbourne","Canberra","Brisbane"],correctAnswer:2}]}},{name:"Simple Yes/No",args:{questions:[{question:"Is the Earth round?",choices:["Yes","No"],correctAnswer:0}]}}],a=async(l,c)=>{try{const{title:s,questions:e}=c;if(!e||!Array.isArray(e)||e.length===0)throw new Error("At least one question is required");for(let t=0;t<e.length;t++){const r=e[t];if(!r.question||typeof r.question!="string")throw new Error(`Question ${t+1} must have a question text`);if(!Array.isArray(r.choices)||r.choices.length<2)throw new Error(`Question ${t+1} must have at least 2 choices`);if(r.choices.length>6)throw new Error(`Question ${t+1} cannot have more than 6 choices`)}const u={title:s,questions:e};return{toolName:o.name,message:`Quiz presented with ${e.length} question${e.length>1?"s":""}`,jsonData:u,instructions:"The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format."}}catch(s){return console.error("Quiz creation error",s),{toolName:o.name,message:`Quiz error: ${s instanceof Error?s.message:"Unknown error"}`,instructions:"Acknowledge that there was an error creating the quiz and suggest trying again."}}},h={toolDefinition:o,execute:a,generatingMessage:"Preparing quiz...",isEnabled:()=>!0,samples:n};exports.SAMPLES=n;exports.TOOL_DEFINITION=o;exports.TOOL_NAME=i;exports.executeQuiz=a;exports.pluginCore=h;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./plugin-D6BGReRV.cjs`);exports.SAMPLES=e.r,exports.TOOL_DEFINITION=e.i,exports.TOOL_NAME=e.a,exports.executeQuiz=e.t,exports.pluginCore=e.n;
package/dist/core.js CHANGED
@@ -1,146 +1,2 @@
1
- const a = "putQuestions", o = {
2
- type: "function",
3
- name: a,
4
- description: "Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.",
5
- parameters: {
6
- type: "object",
7
- properties: {
8
- title: {
9
- type: "string",
10
- description: "Optional title for the quiz (e.g., 'JavaScript Basics Quiz')"
11
- },
12
- questions: {
13
- type: "array",
14
- description: "Array of multiple choice questions",
15
- items: {
16
- type: "object",
17
- properties: {
18
- question: {
19
- type: "string",
20
- description: "The question text"
21
- },
22
- choices: {
23
- type: "array",
24
- description: "Array of answer choices (2-6 choices)",
25
- items: {
26
- type: "string"
27
- },
28
- minItems: 2,
29
- maxItems: 6
30
- },
31
- correctAnswer: {
32
- type: "number",
33
- description: "Optional: The index of the correct answer (0-based). Include this if you want to track correct answers."
34
- }
35
- },
36
- required: ["question", "choices"]
37
- },
38
- minItems: 1
39
- }
40
- },
41
- required: ["questions"]
42
- }
43
- }, c = [
44
- {
45
- name: "JavaScript Quiz",
46
- args: {
47
- title: "JavaScript Basics",
48
- questions: [
49
- {
50
- question: "What does 'const' do in JavaScript?",
51
- choices: [
52
- "Declares a constant variable",
53
- "Declares a mutable variable",
54
- "Creates a function",
55
- "Imports a module"
56
- ],
57
- correctAnswer: 0
58
- },
59
- {
60
- question: "Which method adds an element to the end of an array?",
61
- choices: ["pop()", "shift()", "push()", "unshift()"],
62
- correctAnswer: 2
63
- },
64
- {
65
- question: "What is the output of: typeof null?",
66
- choices: ['"null"', '"undefined"', '"object"', '"boolean"'],
67
- correctAnswer: 2
68
- }
69
- ]
70
- }
71
- },
72
- {
73
- name: "World Capitals",
74
- args: {
75
- title: "World Capitals Quiz",
76
- questions: [
77
- {
78
- question: "What is the capital of Japan?",
79
- choices: ["Osaka", "Kyoto", "Tokyo", "Hiroshima"],
80
- correctAnswer: 2
81
- },
82
- {
83
- question: "What is the capital of Australia?",
84
- choices: ["Sydney", "Melbourne", "Canberra", "Brisbane"],
85
- correctAnswer: 2
86
- }
87
- ]
88
- }
89
- },
90
- {
91
- name: "Simple Yes/No",
92
- args: {
93
- questions: [
94
- {
95
- question: "Is the Earth round?",
96
- choices: ["Yes", "No"],
97
- correctAnswer: 0
98
- }
99
- ]
100
- }
101
- }
102
- ], u = async (h, i) => {
103
- try {
104
- const { title: s, questions: e } = i;
105
- if (!e || !Array.isArray(e) || e.length === 0)
106
- throw new Error("At least one question is required");
107
- for (let t = 0; t < e.length; t++) {
108
- const r = e[t];
109
- if (!r.question || typeof r.question != "string")
110
- throw new Error(`Question ${t + 1} must have a question text`);
111
- if (!Array.isArray(r.choices) || r.choices.length < 2)
112
- throw new Error(`Question ${t + 1} must have at least 2 choices`);
113
- if (r.choices.length > 6)
114
- throw new Error(`Question ${t + 1} cannot have more than 6 choices`);
115
- }
116
- const n = {
117
- title: s,
118
- questions: e
119
- };
120
- return {
121
- toolName: o.name,
122
- message: `Quiz presented with ${e.length} question${e.length > 1 ? "s" : ""}`,
123
- jsonData: n,
124
- instructions: "The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format."
125
- };
126
- } catch (s) {
127
- return console.error("Quiz creation error", s), {
128
- toolName: o.name,
129
- message: `Quiz error: ${s instanceof Error ? s.message : "Unknown error"}`,
130
- instructions: "Acknowledge that there was an error creating the quiz and suggest trying again."
131
- };
132
- }
133
- }, l = {
134
- toolDefinition: o,
135
- execute: u,
136
- generatingMessage: "Preparing quiz...",
137
- isEnabled: () => !0,
138
- samples: c
139
- };
140
- export {
141
- c as SAMPLES,
142
- o as TOOL_DEFINITION,
143
- a as TOOL_NAME,
144
- u as executeQuiz,
145
- l as pluginCore
146
- };
1
+ import { a as e, i as t, n, r, t as i } from "./plugin-BSCUtyrI.js";
2
+ export { r as SAMPLES, t as TOOL_DEFINITION, e as TOOL_NAME, i as executeQuiz, n as pluginCore };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./core.cjs");exports.SAMPLES=e.SAMPLES;exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.default=e.pluginCore;exports.executeQuiz=e.executeQuiz;exports.pluginCore=e.pluginCore;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./plugin-D6BGReRV.cjs`);require(`./core.cjs`),exports.SAMPLES=e.r,exports.TOOL_DEFINITION=e.i,exports.TOOL_NAME=e.a,exports.default=e.n,exports.pluginCore=e.n,exports.executeQuiz=e.t;
package/dist/index.d.ts CHANGED
@@ -15,5 +15,5 @@
15
15
  * import "@mulmochat-plugin/quiz/style.css";
16
16
  * ```
17
17
  */
18
- export * from "./core";
19
- export { pluginCore as default } from "./core";
18
+ export * from "./core/index";
19
+ export { pluginCore as default } from "./core/index";
package/dist/index.js CHANGED
@@ -1,9 +1,3 @@
1
- import { SAMPLES as O, TOOL_DEFINITION as o, TOOL_NAME as r, pluginCore as i, executeQuiz as l, pluginCore as p } from "./core.js";
2
- export {
3
- O as SAMPLES,
4
- o as TOOL_DEFINITION,
5
- r as TOOL_NAME,
6
- i as default,
7
- l as executeQuiz,
8
- p as pluginCore
9
- };
1
+ import { a as e, i as t, n, r, t as i } from "./plugin-BSCUtyrI.js";
2
+ import "./core.js";
3
+ export { r as SAMPLES, t as TOOL_DEFINITION, e as TOOL_NAME, n as default, n as pluginCore, i as executeQuiz };
@@ -0,0 +1,149 @@
1
+ //#region src/core/definition.ts
2
+ var e = "putQuestions", t = {
3
+ type: "function",
4
+ name: e,
5
+ description: "Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.",
6
+ parameters: {
7
+ type: "object",
8
+ properties: {
9
+ title: {
10
+ type: "string",
11
+ description: "Optional title for the quiz (e.g., 'JavaScript Basics Quiz')"
12
+ },
13
+ questions: {
14
+ type: "array",
15
+ description: "Array of multiple choice questions",
16
+ items: {
17
+ type: "object",
18
+ properties: {
19
+ question: {
20
+ type: "string",
21
+ description: "The question text"
22
+ },
23
+ choices: {
24
+ type: "array",
25
+ description: "Array of answer choices (2-6 choices)",
26
+ items: { type: "string" },
27
+ minItems: 2,
28
+ maxItems: 6
29
+ },
30
+ correctAnswer: {
31
+ type: "number",
32
+ description: "Optional: The index of the correct answer (0-based). Include this if you want to track correct answers."
33
+ }
34
+ },
35
+ required: ["question", "choices"]
36
+ },
37
+ minItems: 1
38
+ }
39
+ },
40
+ required: ["questions"]
41
+ }
42
+ }, n = [
43
+ {
44
+ name: "JavaScript Quiz",
45
+ args: {
46
+ title: "JavaScript Basics",
47
+ questions: [
48
+ {
49
+ question: "What does 'const' do in JavaScript?",
50
+ choices: [
51
+ "Declares a constant variable",
52
+ "Declares a mutable variable",
53
+ "Creates a function",
54
+ "Imports a module"
55
+ ],
56
+ correctAnswer: 0
57
+ },
58
+ {
59
+ question: "Which method adds an element to the end of an array?",
60
+ choices: [
61
+ "pop()",
62
+ "shift()",
63
+ "push()",
64
+ "unshift()"
65
+ ],
66
+ correctAnswer: 2
67
+ },
68
+ {
69
+ question: "What is the output of: typeof null?",
70
+ choices: [
71
+ "\"null\"",
72
+ "\"undefined\"",
73
+ "\"object\"",
74
+ "\"boolean\""
75
+ ],
76
+ correctAnswer: 2
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ {
82
+ name: "World Capitals",
83
+ args: {
84
+ title: "World Capitals Quiz",
85
+ questions: [{
86
+ question: "What is the capital of Japan?",
87
+ choices: [
88
+ "Osaka",
89
+ "Kyoto",
90
+ "Tokyo",
91
+ "Hiroshima"
92
+ ],
93
+ correctAnswer: 2
94
+ }, {
95
+ question: "What is the capital of Australia?",
96
+ choices: [
97
+ "Sydney",
98
+ "Melbourne",
99
+ "Canberra",
100
+ "Brisbane"
101
+ ],
102
+ correctAnswer: 2
103
+ }]
104
+ }
105
+ },
106
+ {
107
+ name: "Simple Yes/No",
108
+ args: { questions: [{
109
+ question: "Is the Earth round?",
110
+ choices: ["Yes", "No"],
111
+ correctAnswer: 0
112
+ }] }
113
+ }
114
+ ], r = async (e, n) => {
115
+ try {
116
+ let { title: e, questions: r } = n;
117
+ if (!r || !Array.isArray(r) || r.length === 0) throw Error("At least one question is required");
118
+ for (let e = 0; e < r.length; e++) {
119
+ let t = r[e];
120
+ if (!t.question || typeof t.question != "string") throw Error(`Question ${e + 1} must have a question text`);
121
+ if (!Array.isArray(t.choices) || t.choices.length < 2) throw Error(`Question ${e + 1} must have at least 2 choices`);
122
+ if (t.choices.length > 6) throw Error(`Question ${e + 1} cannot have more than 6 choices`);
123
+ }
124
+ let i = {
125
+ title: e,
126
+ questions: r
127
+ };
128
+ return {
129
+ toolName: t.name,
130
+ message: `Quiz presented with ${r.length} question${r.length > 1 ? "s" : ""}`,
131
+ jsonData: i,
132
+ instructions: "The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format."
133
+ };
134
+ } catch (e) {
135
+ return console.error("Quiz creation error", e), {
136
+ toolName: t.name,
137
+ message: `Quiz error: ${e instanceof Error ? e.message : "Unknown error"}`,
138
+ instructions: "Acknowledge that there was an error creating the quiz and suggest trying again."
139
+ };
140
+ }
141
+ }, i = {
142
+ toolDefinition: t,
143
+ execute: r,
144
+ generatingMessage: "Preparing quiz...",
145
+ isEnabled: () => !0,
146
+ samples: n
147
+ };
148
+ //#endregion
149
+ export { e as a, t as i, i as n, n as r, r as t };
@@ -0,0 +1 @@
1
+ var e=`putQuestions`,t={type:`function`,name:e,description:`Present a set of multiple choice questions to test the user's knowledge or abilities. Each question should have 2-6 answer choices.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Optional title for the quiz (e.g., 'JavaScript Basics Quiz')`},questions:{type:`array`,description:`Array of multiple choice questions`,items:{type:`object`,properties:{question:{type:`string`,description:`The question text`},choices:{type:`array`,description:`Array of answer choices (2-6 choices)`,items:{type:`string`},minItems:2,maxItems:6},correctAnswer:{type:`number`,description:`Optional: The index of the correct answer (0-based). Include this if you want to track correct answers.`}},required:[`question`,`choices`]},minItems:1}},required:[`questions`]}},n=[{name:`JavaScript Quiz`,args:{title:`JavaScript Basics`,questions:[{question:`What does 'const' do in JavaScript?`,choices:[`Declares a constant variable`,`Declares a mutable variable`,`Creates a function`,`Imports a module`],correctAnswer:0},{question:`Which method adds an element to the end of an array?`,choices:[`pop()`,`shift()`,`push()`,`unshift()`],correctAnswer:2},{question:`What is the output of: typeof null?`,choices:[`"null"`,`"undefined"`,`"object"`,`"boolean"`],correctAnswer:2}]}},{name:`World Capitals`,args:{title:`World Capitals Quiz`,questions:[{question:`What is the capital of Japan?`,choices:[`Osaka`,`Kyoto`,`Tokyo`,`Hiroshima`],correctAnswer:2},{question:`What is the capital of Australia?`,choices:[`Sydney`,`Melbourne`,`Canberra`,`Brisbane`],correctAnswer:2}]}},{name:`Simple Yes/No`,args:{questions:[{question:`Is the Earth round?`,choices:[`Yes`,`No`],correctAnswer:0}]}}],r=async(e,n)=>{try{let{title:e,questions:r}=n;if(!r||!Array.isArray(r)||r.length===0)throw Error(`At least one question is required`);for(let e=0;e<r.length;e++){let t=r[e];if(!t.question||typeof t.question!=`string`)throw Error(`Question ${e+1} must have a question text`);if(!Array.isArray(t.choices)||t.choices.length<2)throw Error(`Question ${e+1} must have at least 2 choices`);if(t.choices.length>6)throw Error(`Question ${e+1} cannot have more than 6 choices`)}let i={title:e,questions:r};return{toolName:t.name,message:`Quiz presented with ${r.length} question${r.length>1?`s`:``}`,jsonData:i,instructions:`The quiz has been presented to the user. Wait for the user to submit their answers. They will tell you their answers in text format.`}}catch(e){return console.error(`Quiz creation error`,e),{toolName:t.name,message:`Quiz error: ${e instanceof Error?e.message:`Unknown error`}`,instructions:`Acknowledge that there was an error creating the quiz and suggest trying again.`}}},i={toolDefinition:t,execute:r,generatingMessage:`Preparing quiz...`,isEnabled:()=>!0,samples:n};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
package/dist/react.cjs CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */const h=require("./core.cjs"),w=require("react");var S={exports:{}},g={};var W;function ae(){if(W)return g;W=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function x(l,d,u){var p=null;if(u!==void 0&&(p=""+u),d.key!==void 0&&(p=""+d.key),"key"in d){u={};for(var v in d)v!=="key"&&(u[v]=d[v])}else u=d;return d=u.ref,{$$typeof:i,type:l,key:p,ref:d!==void 0?d:null,props:u}}return g.Fragment=c,g.jsx=x,g.jsxs=x,g}var T={};var Q;function oe(){return Q||(Q=1,process.env.NODE_ENV!=="production"&&(function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case k:return"Profiler";case y:return"StrictMode";case Z:return"Suspense";case K:return"SuspenseList";case re:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return"Portal";case H:return e.displayName||"Context";case P:return(e._context.displayName||"Context")+".Consumer";case B:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return r=e.displayName||null,r!==null?r:i(e.type)||"Memo";case C:r=e._payload,e=e._init;try{return i(e(r))}catch{}}return null}function c(e){return""+e}function x(e){try{c(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),c(e)}}function l(e){if(e===b)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var r=i(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function d(){var e=$.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function p(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function v(e,r){function n(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function O(){var e=i(this.type);return F[e]||(F[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function j(e,r,n,a,A,D){var o=n.ref;return e={$$typeof:f,type:e,key:r,props:n,_owner:a},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:O}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,r,n,a,A,D){var o=r.children;if(o!==void 0)if(a)if(ne(o)){for(a=0;a<o.length;a++)N(o[a]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(o);if(L.call(r,"key")){o=i(e);var E=Object.keys(r).filter(function(se){return se!=="key"});a=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",V[o+a]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);const t=require(`./plugin-D6BGReRV.cjs`);;/* empty css */let n=require(`react`);var r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),i=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,a,o,E,o),V[o+a]=!0)}if(o=null,n!==void 0&&(x(n),o=""+n),p(r)&&(x(r.key),o=""+r.key),"key"in r){n={};for(var Y in r)Y!=="key"&&(n[Y]=r[Y])}else n=r;return o&&v(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),j(e,o,n,d(),A,D)}function N(e){R(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===C&&(e._payload.status==="fulfilled"?R(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function R(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}var s=w,f=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),H=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),$=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,ne=Array.isArray,q=console.createTask?console.createTask:function(){return null};s={react_stack_bottom_frame:function(e){return e()}};var M,F={},z=s.react_stack_bottom_frame.bind(s,u)(),I=q(l(u)),V={};T.Fragment=b,T.jsx=function(e,r,n){var a=1e4>$.recentlyCreatedOwnerStacks++;return _(e,r,n,!1,a?Error("react-stack-top-frame"):z,a?q(l(e)):I)},T.jsxs=function(e,r,n){var a=1e4>$.recentlyCreatedOwnerStacks++;return _(e,r,n,!0,a?Error("react-stack-top-frame"):z,a?q(l(e)):I)}})()),T}var U;function le(){return U||(U=1,process.env.NODE_ENV==="production"?S.exports=ae():S.exports=oe()),S.exports}var t=le();function J({selectedResult:i,sendTextMessage:c,onUpdateResult:x}){const[l,d]=w.useState(null),[u,p]=w.useState([]);w.useEffect(()=>{if(i?.toolName===h.TOOL_NAME&&i.jsonData){const s=i.jsonData;d(s),i.viewState?.userAnswers?p(i.viewState.userAnswers):p(new Array(s.questions.length).fill(null))}},[i]);const v=w.useCallback(s=>{p(s),x&&x({viewState:{userAnswers:s}})},[x]),O=(s,f)=>{const m=[...u];m[s]=f,v(m)},j=u.filter(s=>s!==null).length,_=l&&j===l.questions.length,N=(s,f)=>u[s]===f?"border-blue-500 bg-blue-500/20":"border-[#4b4b6b] hover:border-[#6b6b8b] hover:bg-[#6b6b8b]/20",R=()=>{if(!l||!_)return;const f=`Here are my answers:
7
- ${u.map((m,b)=>{if(m===null)return null;const y=b+1,k=String.fromCharCode(65+m),P=l.questions[b].choices[m];return`Q${y}: ${k} - ${P}`}).filter(m=>m!==null).join(`
8
- `)}`;c(f)};return l?t.jsx("div",{className:"w-full min-h-[400px] overflow-y-auto p-8 bg-[#1a1a2e] rounded-lg",children:t.jsxs("div",{className:"max-w-3xl mx-auto",children:[l.title&&t.jsx("h2",{className:"text-[#f0f0f0] text-3xl font-bold mb-8 text-center",children:l.title}),t.jsx("div",{className:"flex flex-col gap-6",children:l.questions.map((s,f)=>t.jsxs("div",{className:"bg-[#2d2d44] rounded-lg p-6 border-2 border-[#3d3d5c]",children:[t.jsxs("div",{className:"text-white text-lg font-semibold mb-4",children:[t.jsxs("span",{className:"text-blue-400 mr-2",children:[f+1,"."]}),s.question]}),t.jsx("div",{className:"flex flex-col gap-3",children:s.choices.map((m,b)=>t.jsxs("label",{className:`flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${N(f,b)}`,children:[t.jsx("input",{type:"radio",name:`question-${f}`,value:b,checked:u[f]===b,onChange:()=>O(f,b),className:"mt-1 mr-3 size-4 shrink-0"}),t.jsxs("span",{className:"text-white flex-1",children:[t.jsxs("span",{className:"font-semibold mr-2",children:[String.fromCharCode(65+b),"."]}),m]})]},b))})]},f))}),t.jsx("div",{className:"mt-8 flex justify-center",children:t.jsx("button",{onClick:R,disabled:!_,className:`py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${_?"bg-blue-600 hover:bg-blue-700":"bg-gray-600 cursor-not-allowed opacity-50"}`,children:"Submit Answers"})}),t.jsxs("div",{className:"mt-4 text-center text-gray-400 text-sm",children:[j," / ",l.questions.length," questions answered"]})]})}):null}function G({result:i}){const c=i.jsonData;return c?t.jsx("div",{className:"p-3 bg-blue-50 rounded-md",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("div",{className:"text-sm font-semibold text-gray-800 text-center",children:c.title||"Quiz"}),t.jsx("div",{className:"text-center",children:t.jsxs("span",{className:"inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full",children:[c.questions.length," ",c.questions.length===1?"Question":"Questions"]})}),t.jsx("div",{className:"text-xs text-gray-600 overflow-hidden line-clamp-2",children:c.questions[0]?.question}),t.jsxs("div",{className:"flex justify-center gap-1",children:[Array.from({length:Math.min(c.questions[0]?.choices.length||0,4)}).map((x,l)=>t.jsx("div",{className:"size-2 bg-gray-400 rounded-full"},l)),(c.questions[0]?.choices.length||0)>4&&t.jsxs("span",{className:"text-xs text-gray-500",children:["+",c.questions[0].choices.length-4]})]})]})}):null}const X={...h.pluginCore,ViewComponent:J,PreviewComponent:G},ie={plugin:X};exports.SAMPLES=h.SAMPLES;exports.TOOL_DEFINITION=h.TOOL_DEFINITION;exports.TOOL_NAME=h.TOOL_NAME;exports.executeQuiz=h.executeQuiz;exports.pluginCore=h.pluginCore;exports.Preview=G;exports.View=J;exports.default=ie;exports.plugin=X;
6
+ <%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),a=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=r():t.exports=i()}))();function o({selectedResult:e,sendTextMessage:t,onUpdateResult:r}){let[i,o]=(0,n.useState)(null),[s,c]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(e?.toolName===`putQuestions`&&e.jsonData){let t=e.jsonData;o(t),e.viewState?.userAnswers?c(e.viewState.userAnswers):c(Array(t.questions.length).fill(null))}},[e]);let l=(0,n.useCallback)(e=>{c(e),r&&r({viewState:{userAnswers:e}})},[r]),u=(e,t)=>{let n=[...s];n[e]=t,l(n)},d=s.filter(e=>e!==null).length,f=i&&d===i.questions.length,p=(e,t)=>s[e]===t?`border-blue-500 bg-blue-500/20`:`border-slate-600 hover:border-slate-500 hover:bg-slate-500/20`;return i?(0,a.jsx)(`div`,{className:`w-full min-h-96 overflow-y-auto p-8 bg-slate-900 rounded-lg`,children:(0,a.jsxs)(`div`,{className:`max-w-3xl mx-auto`,children:[i.title&&(0,a.jsx)(`h2`,{className:`text-gray-100 text-3xl font-bold mb-8 text-center`,children:i.title}),(0,a.jsx)(`div`,{className:`flex flex-col gap-6`,children:i.questions.map((e,t)=>(0,a.jsxs)(`div`,{className:`bg-slate-800 rounded-lg p-6 border-2 border-slate-700`,children:[(0,a.jsxs)(`div`,{className:`text-white text-lg font-semibold mb-4`,children:[(0,a.jsxs)(`span`,{className:`text-blue-400 mr-2`,children:[t+1,`.`]}),e.question]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.choices.map((e,n)=>(0,a.jsxs)(`label`,{className:`flex items-start p-4 rounded-lg cursor-pointer transition-all duration-200 border-2 ${p(t,n)}`,children:[(0,a.jsx)(`input`,{type:`radio`,name:`question-${t}`,value:n,checked:s[t]===n,onChange:()=>u(t,n),className:`mt-1 mr-3 size-4 shrink-0`}),(0,a.jsxs)(`span`,{className:`text-white flex-1`,children:[(0,a.jsxs)(`span`,{className:`font-semibold mr-2`,children:[String.fromCharCode(65+n),`.`]}),e]})]},n))})]},t))}),(0,a.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,a.jsx)(`button`,{onClick:()=>{!i||!f||t(`Here are my answers:\n${s.map((e,t)=>e===null?null:`Q${t+1}: ${String.fromCharCode(65+e)} - ${i.questions[t].choices[e]}`).filter(e=>e!==null).join(`
7
+ `)}`)},disabled:!f,className:`py-3 px-8 rounded-lg text-white font-semibold text-lg transition-colors border-none cursor-pointer ${f?`bg-blue-600 hover:bg-blue-700`:`bg-gray-600 cursor-not-allowed opacity-50`}`,children:`Submit Answers`})}),(0,a.jsxs)(`div`,{className:`mt-4 text-center text-gray-400 text-sm`,children:[d,` / `,i.questions.length,` questions answered`]})]})}):null}function s({result:e}){let t=e.jsonData;return t?(0,a.jsx)(`div`,{className:`p-3 bg-blue-50 rounded-md`,children:(0,a.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold text-gray-800 text-center`,children:t.title||`Quiz`}),(0,a.jsx)(`div`,{className:`text-center`,children:(0,a.jsxs)(`span`,{className:`inline-block bg-blue-600 text-white text-xs font-bold py-1 px-3 rounded-full`,children:[t.questions.length,` `,t.questions.length===1?`Question`:`Questions`]})}),(0,a.jsx)(`div`,{className:`text-xs text-gray-600 overflow-hidden line-clamp-2`,children:t.questions[0]?.question}),(0,a.jsxs)(`div`,{className:`flex justify-center gap-1`,children:[Array.from({length:Math.min(t.questions[0]?.choices.length||0,4)}).map((e,t)=>(0,a.jsx)(`div`,{className:`size-2 bg-gray-400 rounded-full`},t)),(t.questions[0]?.choices.length||0)>4&&(0,a.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`+`,t.questions[0].choices.length-4]})]})]})}):null}var c={...t.n,ViewComponent:o,PreviewComponent:s},l={plugin:c};exports.Preview=s,exports.SAMPLES=t.r,exports.TOOL_DEFINITION=t.i,exports.TOOL_NAME=t.a,exports.View=o,exports.default=l,exports.executeQuiz=t.t,exports.plugin=c,exports.pluginCore=t.n;