@blockly/field-multilineinput 6.0.2 → 6.0.3

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"),require("blockly/javascript"),require("blockly/dart"),require("blockly/lua"),require("blockly/php"),require("blockly/python"));else if("function"==typeof define&&define.amd)define(["blockly/core","blockly/javascript","blockly/dart","blockly/lua","blockly/php","blockly/python"],e);else{var i="object"==typeof exports?e(require("blockly/core"),require("blockly/javascript"),require("blockly/dart"),require("blockly/lua"),require("blockly/php"),require("blockly/python")):e(t.Blockly,t["Blockly.JavaScript"],t["Blockly.Dart"],t["Blockly.Lua"],t["Blockly.PHP"],t["Blockly.Python"]);for(var l in i)("object"==typeof exports?exports:t)[l]=i[l]}}(this,((t,e,i,l,o,s)=>(()=>{"use strict";var r={127:t=>{t.exports=e},157:t=>{t.exports=l},370:e=>{e.exports=t},379:t=>{t.exports=i},537:t=>{t.exports=o},557:t=>{t.exports=s}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={exports:{}};return r[t](i,i.exports,a),i.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};a.r(u),a.d(u,{FieldMultilineInput:()=>f,installAllBlocks:()=>R,registerFieldMultilineInput:()=>y,textMultiline:()=>d});var d={};a.r(d),a.d(d,{BLOCK_NAME:()=>g,blockDefinition:()=>k,installBlock:()=>v,toDart:()=>I,toJavascript:()=>m,toLua:()=>x,toPhp:()=>D,toPython:()=>b});var c=a(370),h=a(127),p=a(379),_=a(157),T=a(537),E=a(557);class f extends c.FieldTextInput{constructor(t,e,i){super(c.Field.SKIP_SETUP),this.textGroup=null,this.maxLines_=1/0,this.isOverflowedY_=!1,t!==c.Field.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(t),e&&this.setValidator(e))}configure_(t){super.configure_(t),t.maxLines&&this.setMaxLines(t.maxLines)}toXml(t){return t.textContent=this.getValue().replace(/\n/g,"&#10;"),t}fromXml(t){this.setValue(t.textContent.replace(/&#10;/g,"\n"))}saveState(){const t=this.saveLegacyState(f);return null!==t?t:this.getValue()}loadState(t){this.loadLegacyState(c.Field,t)||this.setValue(t)}initView(){this.createBorderRect_(),this.textGroup=c.utils.dom.createSvgElement(c.utils.Svg.G,{class:"blocklyEditableField"},this.fieldGroup_)}getDisplayText_(){const t=this.getSourceBlock();if(!t)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let e=this.getText();if(!e)return c.Field.NBSP;const i=e.split("\n");e="";const l=this.isOverflowedY_?this.maxLines_:i.length;for(let t=0;t<l;t++){let o=i[t];o.length>this.maxDisplayLength?o=o.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&t===l-1&&(o=o.substring(0,o.length-3)+"..."),o=o.replace(/\s/g,c.Field.NBSP),e+=o,t!==l-1&&(e+="\n")}return t.RTL&&(e+="‏"),e}doValueUpdate_(t){super.doValueUpdate_(t),null!==this.value_&&(this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_)}render_(){const t=this.getSourceBlock();if(!t)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let e;const i=this.textGroup;for(;e=i.firstChild;)i.removeChild(e);const l=this.getConstants();if(!l)throw Error("Constants not found");const o=this.getDisplayText_().split("\n");let s=0;for(let t=0;t<o.length;t++){const e=l.FIELD_TEXT_HEIGHT+l.FIELD_BORDER_RECT_Y_PADDING;c.utils.dom.createSvgElement(c.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText",x:l.FIELD_BORDER_RECT_X_PADDING,y:s+l.FIELD_BORDER_RECT_Y_PADDING,dy:l.FIELD_TEXT_BASELINE},i).appendChild(document.createTextNode(o[t])),s+=e}if(this.isBeingEdited_){const t=this.htmlInput_;this.isOverflowedY_?c.utils.dom.addClass(t,"blocklyHtmlTextAreaInputOverflowedY"):c.utils.dom.removeClass(t,"blocklyHtmlTextAreaInputOverflowedY")}if(this.updateSize_(),this.isBeingEdited_){t.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();const e=this.htmlInput_;this.isTextValid_?(c.utils.dom.removeClass(e,"blocklyInvalidInput"),c.utils.aria.setState(e,c.utils.aria.State.INVALID,!1)):(c.utils.dom.addClass(e,"blocklyInvalidInput"),c.utils.aria.setState(e,c.utils.aria.State.INVALID,!0))}}updateSize_(){const t=this.getConstants();if(!t)throw Error("Constants not found");const e=this.textGroup.childNodes,i=t.FIELD_TEXT_FONTSIZE,l=t.FIELD_TEXT_FONTWEIGHT,o=t.FIELD_TEXT_FONTFAMILY;let s=0,r=0;for(let n=0;n<e.length;n++){const a=e[n],u=c.utils.dom.getFastTextWidth(a,i,l,o);u>s&&(s=u),r+=t.FIELD_TEXT_HEIGHT+(n>0?t.FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){const t=String(this.value_).split("\n"),e=c.utils.dom.createSvgElement(c.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText"});for(let r=0;r<t.length;r++){t[r].length>this.maxDisplayLength&&(t[r]=t[r].substring(0,this.maxDisplayLength)),e.textContent=t[r];const n=c.utils.dom.getFastTextWidth(e,i,l,o);n>s&&(s=n)}const r=this.htmlInput_;s+=r.offsetWidth-r.clientWidth}this.borderRect_&&(r+=2*t.FIELD_BORDER_RECT_Y_PADDING,s+=2*t.FIELD_BORDER_RECT_X_PADDING+1,this.borderRect_.setAttribute("width",`${s}`),this.borderRect_.setAttribute("height",`${r}`)),this.size_.width=s,this.size_.height=r,this.positionBorderRect_()}showEditor_(t,e){super.showEditor_(t,e),this.forceRerender()}widgetCreate_(){const t=c.WidgetDiv.getDiv(),e=this.workspace_.getScale(),i=this.getConstants();if(!i)throw Error("Constants not found");const l=document.createElement("textarea");l.className="blocklyHtmlInput blocklyHtmlTextAreaInput",l.setAttribute("spellcheck",String(this.spellcheck_));const o=i.FIELD_TEXT_FONTSIZE*e+"pt";t.style.fontSize=o,l.style.fontSize=o;const s=c.FieldTextInput.BORDERRADIUS*e+"px";l.style.borderRadius=s;const r=i.FIELD_BORDER_RECT_X_PADDING*e,n=i.FIELD_BORDER_RECT_Y_PADDING*e/2;l.style.padding=n+"px "+r+"px "+n+"px "+r+"px";const a=i.FIELD_TEXT_HEIGHT+i.FIELD_BORDER_RECT_Y_PADDING;return l.style.lineHeight=a*e+"px",t.appendChild(l),l.value=l.defaultValue=this.getEditorText_(this.value_),l.setAttribute("data-untyped-default-value",String(this.value_)),l.setAttribute("data-old-value",""),c.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(l),l}setMaxLines(t){"number"==typeof t&&t>0&&t!==this.maxLines_&&(this.maxLines_=t,this.forceRerender())}getMaxLines(){return this.maxLines_}onHtmlInputKeyDown_(t){"Enter"!==t.key&&super.onHtmlInputKeyDown_(t)}static fromJson(t){return new this(c.utils.parsing.replaceMessageReferences(t.text),void 0,t)}}function y(){c.fieldRegistry.register("field_multilinetext",f)}c.Css.register("\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n");const g="text_multiline",A={type:g,message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]};function m(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("+")?h.Order.ADDITION:h.Order.ATOMIC;return[i,l]}function I(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("+")?p.Order.ADDITIVE:p.Order.ATOMIC;return[i,l]}function x(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("..")?_.Order.CONCATENATION:_.Order.ATOMIC;return[i,l]}function D(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf(".")?T.Order.STRING_CONCAT:T.Order.ATOMIC;return[i,l]}function b(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("+")?E.Order.ADDITIVE:E.Order.ATOMIC;return[i,l]}const O=c.common.createBlockDefinitionsFromJsonArray([A]),k=O[g];function v(t={}){y(),c.common.defineBlocks(O),t.javascript&&(t.javascript.forBlock[g]=m),t.dart&&(t.dart.forBlock[g]=I),t.lua&&(t.lua.forBlock[g]=x),t.php&&(t.php.forBlock[g]=D),t.python&&(t.python.forBlock[g]=b)}const R=v;return u})()));
2
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"),require("blockly/javascript"),require("blockly/dart"),require("blockly/lua"),require("blockly/php"),require("blockly/python"));else if("function"==typeof define&&define.amd)define(["blockly/core","blockly/javascript","blockly/dart","blockly/lua","blockly/php","blockly/python"],e);else{var i="object"==typeof exports?e(require("blockly/core"),require("blockly/javascript"),require("blockly/dart"),require("blockly/lua"),require("blockly/php"),require("blockly/python")):e(t.Blockly,t["Blockly.JavaScript"],t["Blockly.Dart"],t["Blockly.Lua"],t["Blockly.PHP"],t["Blockly.Python"]);for(var l in i)("object"==typeof exports?exports:t)[l]=i[l]}}(this,(t,e,i,l,o,s)=>(()=>{"use strict";var r={127:t=>{t.exports=e},157:t=>{t.exports=l},370:e=>{e.exports=t},379:t=>{t.exports=i},537:t=>{t.exports=o},557:t=>{t.exports=s}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={exports:{}};return r[t](i,i.exports,a),i.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};a.r(u),a.d(u,{FieldMultilineInput:()=>f,installAllBlocks:()=>R,registerFieldMultilineInput:()=>y,textMultiline:()=>d});var d={};a.r(d),a.d(d,{BLOCK_NAME:()=>g,blockDefinition:()=>k,installBlock:()=>v,toDart:()=>I,toJavascript:()=>m,toLua:()=>x,toPhp:()=>D,toPython:()=>b});var c=a(370),h=a(127),p=a(379),_=a(157),T=a(537),E=a(557);class f extends c.FieldTextInput{constructor(t,e,i){super(c.Field.SKIP_SETUP),this.textGroup=null,this.maxLines_=1/0,this.isOverflowedY_=!1,t!==c.Field.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(t),e&&this.setValidator(e))}configure_(t){super.configure_(t),t.maxLines&&this.setMaxLines(t.maxLines)}toXml(t){return t.textContent=this.getValue().replace(/\n/g,"&#10;"),t}fromXml(t){this.setValue(t.textContent.replace(/&#10;/g,"\n"))}saveState(){const t=this.saveLegacyState(f);return null!==t?t:this.getValue()}loadState(t){this.loadLegacyState(c.Field,t)||this.setValue(t)}initView(){this.createBorderRect_(),this.textGroup=c.utils.dom.createSvgElement(c.utils.Svg.G,{class:"blocklyEditableField"},this.fieldGroup_)}getDisplayText_(){const t=this.getSourceBlock();if(!t)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let e=this.getText();if(!e)return c.Field.NBSP;const i=e.split("\n");e="";const l=this.isOverflowedY_?this.maxLines_:i.length;for(let t=0;t<l;t++){let o=i[t];o.length>this.maxDisplayLength?o=o.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&t===l-1&&(o=o.substring(0,o.length-3)+"..."),o=o.replace(/\s/g,c.Field.NBSP),e+=o,t!==l-1&&(e+="\n")}return t.RTL&&(e+="‏"),e}doValueUpdate_(t){super.doValueUpdate_(t),null!==this.value_&&(this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_)}render_(){const t=this.getSourceBlock();if(!t)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let e;const i=this.textGroup;for(;e=i.firstChild;)i.removeChild(e);const l=this.getConstants();if(!l)throw Error("Constants not found");const o=this.getDisplayText_().split("\n");let s=0;for(let t=0;t<o.length;t++){const e=l.FIELD_TEXT_HEIGHT+l.FIELD_BORDER_RECT_Y_PADDING;c.utils.dom.createSvgElement(c.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText",x:l.FIELD_BORDER_RECT_X_PADDING,y:s+l.FIELD_BORDER_RECT_Y_PADDING,dy:l.FIELD_TEXT_BASELINE},i).appendChild(document.createTextNode(o[t])),s+=e}if(this.isBeingEdited_){const t=this.htmlInput_;this.isOverflowedY_?c.utils.dom.addClass(t,"blocklyHtmlTextAreaInputOverflowedY"):c.utils.dom.removeClass(t,"blocklyHtmlTextAreaInputOverflowedY")}if(this.updateSize_(),this.isBeingEdited_){t.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();const e=this.htmlInput_;this.isTextValid_?(c.utils.dom.removeClass(e,"blocklyInvalidInput"),c.utils.aria.setState(e,c.utils.aria.State.INVALID,!1)):(c.utils.dom.addClass(e,"blocklyInvalidInput"),c.utils.aria.setState(e,c.utils.aria.State.INVALID,!0))}}updateSize_(){const t=this.getConstants();if(!t)throw Error("Constants not found");const e=this.textGroup.childNodes,i=t.FIELD_TEXT_FONTSIZE,l=t.FIELD_TEXT_FONTWEIGHT,o=t.FIELD_TEXT_FONTFAMILY;let s=0,r=0;for(let n=0;n<e.length;n++){const a=e[n],u=c.utils.dom.getFastTextWidth(a,i,l,o);u>s&&(s=u),r+=t.FIELD_TEXT_HEIGHT+(n>0?t.FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){const t=String(this.value_).split("\n"),e=c.utils.dom.createSvgElement(c.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText"});for(let r=0;r<t.length;r++){t[r].length>this.maxDisplayLength&&(t[r]=t[r].substring(0,this.maxDisplayLength)),e.textContent=t[r];const n=c.utils.dom.getFastTextWidth(e,i,l,o);n>s&&(s=n)}const r=this.htmlInput_;s+=r.offsetWidth-r.clientWidth}this.borderRect_&&(r+=2*t.FIELD_BORDER_RECT_Y_PADDING,s+=2*t.FIELD_BORDER_RECT_X_PADDING+1,this.borderRect_.setAttribute("width",`${s}`),this.borderRect_.setAttribute("height",`${r}`)),this.size_.width=s,this.size_.height=r,this.positionBorderRect_()}showEditor_(t,e){super.showEditor_(t,e),this.forceRerender()}widgetCreate_(){const t=c.WidgetDiv.getDiv(),e=this.workspace_.getScale(),i=this.getConstants();if(!i)throw Error("Constants not found");const l=document.createElement("textarea");l.className="blocklyHtmlInput blocklyHtmlTextAreaInput",l.setAttribute("spellcheck",String(this.spellcheck_));const o=i.FIELD_TEXT_FONTSIZE*e+"pt";t.style.fontSize=o,l.style.fontSize=o;const s=c.FieldTextInput.BORDERRADIUS*e+"px";l.style.borderRadius=s;const r=i.FIELD_BORDER_RECT_X_PADDING*e,n=i.FIELD_BORDER_RECT_Y_PADDING*e/2;l.style.padding=n+"px "+r+"px "+n+"px "+r+"px";const a=i.FIELD_TEXT_HEIGHT+i.FIELD_BORDER_RECT_Y_PADDING;return l.style.lineHeight=a*e+"px",t.appendChild(l),l.value=l.defaultValue=this.getEditorText_(this.value_),l.setAttribute("data-untyped-default-value",String(this.value_)),l.setAttribute("data-old-value",""),c.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(l),l}setMaxLines(t){"number"==typeof t&&t>0&&t!==this.maxLines_&&(this.maxLines_=t,this.forceRerender())}getMaxLines(){return this.maxLines_}onHtmlInputKeyDown_(t){"Enter"!==t.key&&super.onHtmlInputKeyDown_(t)}static fromJson(t){return new this(c.utils.parsing.replaceMessageReferences(t.text),void 0,t)}}function y(){c.fieldRegistry.register("field_multilinetext",f)}c.Css.register("\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n");const g="text_multiline",A={type:g,message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]};function m(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("+")?h.Order.ADDITION:h.Order.ATOMIC;return[i,l]}function I(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("+")?p.Order.ADDITIVE:p.Order.ATOMIC;return[i,l]}function x(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("..")?_.Order.CONCATENATION:_.Order.ATOMIC;return[i,l]}function D(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf(".")?T.Order.STRING_CONCAT:T.Order.ATOMIC;return[i,l]}function b(t,e){const i=e.multiline_quote_(t.getFieldValue("TEXT")),l=-1!==i.indexOf("+")?E.Order.ADDITIVE:E.Order.ATOMIC;return[i,l]}const O=c.common.createBlockDefinitionsFromJsonArray([A]),k=O[g];function v(t={}){y(),c.common.defineBlocks(O),t.javascript&&(t.javascript.forBlock[g]=m),t.dart&&(t.dart.forBlock[g]=I),t.lua&&(t.lua.forBlock[g]=x),t.php&&(t.php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MJ,EAAKI,KAAKD,SAASnC,GAAcqB,GAC5CW,EAAKK,MAAKL,EAAKK,IAAIF,SAASnC,GAAcuB,GAC1CS,EAAKM,MAAKN,EAAKM,IAAIH,SAASnC,GAAcyB,GAC1CO,EAAKO,SAAQP,EAAKO,OAAOJ,SAASnC,GAAc2B,EACtD,CCzJO,MAAMa,EAAmB","sources":["webpack://@blockly/field-multilineinput/webpack/universalModuleDefinition","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.JavaScript\",\"commonjs\":\"blockly/javascript\",\"commonjs2\":\"blockly/javascript\",\"amd\":\"blockly/javascript\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.Lua\",\"commonjs\":\"blockly/lua\",\"commonjs2\":\"blockly/lua\",\"amd\":\"blockly/lua\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly\",\"commonjs\":\"blockly/core\",\"commonjs2\":\"blockly/core\",\"amd\":\"blockly/core\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.Dart\",\"commonjs\":\"blockly/dart\",\"commonjs2\":\"blockly/dart\",\"amd\":\"blockly/dart\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.PHP\",\"commonjs\":\"blockly/php\",\"commonjs2\":\"blockly/php\",\"amd\":\"blockly/php\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.Python\",\"commonjs\":\"blockly/python\",\"commonjs2\":\"blockly/python\",\"amd\":\"blockly/python\"}","webpack://@blockly/field-multilineinput/webpack/bootstrap","webpack://@blockly/field-multilineinput/webpack/runtime/define property getters","webpack://@blockly/field-multilineinput/webpack/runtime/hasOwnProperty shorthand","webpack://@blockly/field-multilineinput/webpack/runtime/make namespace object","webpack://@blockly/field-multilineinput/./src/field_multilineinput.ts","webpack://@blockly/field-multilineinput/./src/blocks/textMultiline.ts","webpack://@blockly/field-multilineinput/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"blockly/core\"), require(\"blockly/javascript\"), require(\"blockly/dart\"), require(\"blockly/lua\"), require(\"blockly/php\"), require(\"blockly/python\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"blockly/core\", \"blockly/javascript\", \"blockly/dart\", \"blockly/lua\", \"blockly/php\", \"blockly/python\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"blockly/core\"), require(\"blockly/javascript\"), require(\"blockly/dart\"), require(\"blockly/lua\"), require(\"blockly/php\"), require(\"blockly/python\")) : factory(root[\"Blockly\"], root[\"Blockly.JavaScript\"], root[\"Blockly.Dart\"], root[\"Blockly.Lua\"], root[\"Blockly.PHP\"], root[\"Blockly.Python\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__370__, __WEBPACK_EXTERNAL_MODULE__127__, __WEBPACK_EXTERNAL_MODULE__379__, __WEBPACK_EXTERNAL_MODULE__157__, __WEBPACK_EXTERNAL_MODULE__537__, __WEBPACK_EXTERNAL_MODULE__557__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__127__;","module.exports = __WEBPACK_EXTERNAL_MODULE__157__;","module.exports = __WEBPACK_EXTERNAL_MODULE__370__;","module.exports = __WEBPACK_EXTERNAL_MODULE__379__;","module.exports = __WEBPACK_EXTERNAL_MODULE__537__;","module.exports = __WEBPACK_EXTERNAL_MODULE__557__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Multiline text input field.\n */\n\nimport * as Blockly from 'blockly/core';\n\n/**\n * Class for an editable text area input field.\n */\nexport class FieldMultilineInput extends Blockly.FieldTextInput {\n /**\n * The SVG group element that will contain a text element for each text row\n * when initialized.\n */\n textGroup: SVGGElement | null = null;\n\n /**\n * Defines the maximum number of lines of field.\n * If exceeded, scrolling functionality is enabled.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected maxLines_ = Infinity;\n\n /** Whether Y overflow is currently occurring. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected isOverflowedY_ = false;\n\n /**\n * @param value The initial content of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param validator An optional function that is called to validate any\n * constraints on what the user entered. Takes the new text as an\n * argument and returns either the accepted text, a replacement text, or\n * null to abort the change.\n * @param config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n value?: string | typeof Blockly.Field.SKIP_SETUP,\n validator?: FieldMultilineInputValidator,\n config?: FieldMultilineInputConfig,\n ) {\n super(Blockly.Field.SKIP_SETUP);\n\n if (value === Blockly.Field.SKIP_SETUP) return;\n if (config) {\n this.configure_(config);\n }\n this.setValue(value);\n if (validator) {\n this.setValidator(validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override configure_(config: FieldMultilineInputConfig) {\n super.configure_(config);\n if (config.maxLines) this.setMaxLines(config.maxLines);\n }\n\n /**\n * Serializes this field's value to XML.\n * Should only be called by Blockly.Xml.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n */\n override toXml(fieldElement: Element): Element {\n // Replace '\\n' characters with HTML-escaped equivalent '&#10'. This is\n // needed so the plain-text representation of the XML produced by\n // `Blockly.Xml.domToText` will appear on a single line (this is a\n // limitation of the plain-text format).\n fieldElement.textContent = (this.getValue() as string).replace(\n /\\n/g,\n '&#10;',\n );\n return fieldElement;\n }\n\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n */\n override fromXml(fieldElement: Element) {\n this.setValue((fieldElement.textContent as string).replace(/&#10;/g, '\\n'));\n }\n\n /**\n * Saves this field's value.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @returns The state of this field.\n */\n override saveState() {\n const legacyState = this.saveLegacyState(FieldMultilineInput);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValue();\n }\n\n /**\n * Sets the field's value based on the given state.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @param state The state of the variable to assign to this variable field.\n */\n override loadState(state: unknown) {\n if (this.loadLegacyState(Blockly.Field, state)) {\n return;\n }\n this.setValue(state);\n }\n\n /**\n * Create the block UI for this field.\n */\n override initView() {\n this.createBorderRect_();\n this.textGroup = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.G,\n {\n class: 'blocklyEditableField',\n },\n this.fieldGroup_,\n );\n }\n\n /**\n * Get the text from this field as displayed on screen. May differ from\n * getText due to ellipsis, and other formatting.\n *\n * @returns Currently displayed text.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override getDisplayText_(): string {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.',\n );\n }\n let textLines = this.getText();\n if (!textLines) {\n // Prevent the field from disappearing if empty.\n return Blockly.Field.NBSP;\n }\n const lines = textLines.split('\\n');\n textLines = '';\n const displayLinesNumber = this.isOverflowedY_\n ? this.maxLines_\n : lines.length;\n for (let i = 0; i < displayLinesNumber; i++) {\n let text = lines[i];\n if (text.length > this.maxDisplayLength) {\n // Truncate displayed string and add an ellipsis ('...').\n text = text.substring(0, this.maxDisplayLength - 4) + '...';\n } else if (this.isOverflowedY_ && i === displayLinesNumber - 1) {\n text = text.substring(0, text.length - 3) + '...';\n }\n // Replace whitespace with non-breaking spaces so the text doesn't\n // collapse.\n text = text.replace(/\\s/g, Blockly.Field.NBSP);\n\n textLines += text;\n if (i !== displayLinesNumber - 1) {\n textLines += '\\n';\n }\n }\n if (block.RTL) {\n // The SVG is LTR, force value to be RTL.\n textLines += '\\u200F';\n }\n return textLines;\n }\n\n /**\n * Called by setValue if the text input is valid. Updates the value of the\n * field, and updates the text of the field if it is not currently being\n * edited (i.e. handled by the htmlInput_). Is being redefined here to update\n * overflow state of the field.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override doValueUpdate_(newValue: string) {\n super.doValueUpdate_(newValue);\n if (this.value_ !== null) {\n this.isOverflowedY_ = this.value_.split('\\n').length > this.maxLines_;\n }\n }\n\n /** Updates the text of the textElement. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override render_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.',\n );\n }\n // Remove all text group children.\n let currentChild;\n const textGroup = this.textGroup as SVGElement;\n while ((currentChild = textGroup.firstChild)) {\n textGroup.removeChild(currentChild);\n }\n\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n // Add in text elements into the group.\n const lines = this.getDisplayText_().split('\\n');\n let y = 0;\n for (let i = 0; i < lines.length; i++) {\n const lineHeight =\n constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;\n const span = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.TEXT,\n {\n class: 'blocklyText blocklyMultilineText',\n x: constants.FIELD_BORDER_RECT_X_PADDING,\n y: y + constants.FIELD_BORDER_RECT_Y_PADDING,\n dy: constants.FIELD_TEXT_BASELINE,\n },\n textGroup,\n );\n span.appendChild(document.createTextNode(lines[i]));\n y += lineHeight;\n }\n\n if (this.isBeingEdited_) {\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (this.isOverflowedY_) {\n Blockly.utils.dom.addClass(\n htmlInput,\n 'blocklyHtmlTextAreaInputOverflowedY',\n );\n } else {\n Blockly.utils.dom.removeClass(\n htmlInput,\n 'blocklyHtmlTextAreaInputOverflowedY',\n );\n }\n }\n\n this.updateSize_();\n\n if (this.isBeingEdited_) {\n if (block.RTL) {\n // in RTL, we need to let the browser reflow before resizing\n // in order to get the correct bounding box of the borderRect\n // avoiding issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (!this.isTextValid_) {\n Blockly.utils.dom.addClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(\n htmlInput,\n Blockly.utils.aria.State.INVALID,\n true,\n );\n } else {\n Blockly.utils.dom.removeClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(\n htmlInput,\n Blockly.utils.aria.State.INVALID,\n false,\n );\n }\n }\n }\n\n /** Updates the size of the field based on the text. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override updateSize_() {\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n const nodes = (this.textGroup as SVGElement).childNodes;\n const fontSize = constants.FIELD_TEXT_FONTSIZE;\n const fontWeight = constants.FIELD_TEXT_FONTWEIGHT;\n const fontFamily = constants.FIELD_TEXT_FONTFAMILY;\n let totalWidth = 0;\n let totalHeight = 0;\n for (let i = 0; i < nodes.length; i++) {\n const tspan = nodes[i] as SVGTextElement;\n const textWidth = Blockly.utils.dom.getFastTextWidth(\n tspan,\n fontSize,\n fontWeight,\n fontFamily,\n );\n if (textWidth > totalWidth) {\n totalWidth = textWidth;\n }\n totalHeight +=\n constants.FIELD_TEXT_HEIGHT +\n (i > 0 ? constants.FIELD_BORDER_RECT_Y_PADDING : 0);\n }\n if (this.isBeingEdited_) {\n // The default width is based on the longest line in the display text,\n // but when it's being edited, width should be calculated based on the\n // absolute longest line, even if it would be truncated after editing.\n // Otherwise we would get wrong editor width when there are more\n // lines than this.maxLines_.\n const actualEditorLines = String(this.value_).split('\\n');\n const dummyTextElement = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.TEXT,\n {class: 'blocklyText blocklyMultilineText'},\n );\n\n for (let i = 0; i < actualEditorLines.length; i++) {\n if (actualEditorLines[i].length > this.maxDisplayLength) {\n actualEditorLines[i] = actualEditorLines[i].substring(\n 0,\n this.maxDisplayLength,\n );\n }\n dummyTextElement.textContent = actualEditorLines[i];\n const lineWidth = Blockly.utils.dom.getFastTextWidth(\n dummyTextElement,\n fontSize,\n fontWeight,\n fontFamily,\n );\n if (lineWidth > totalWidth) {\n totalWidth = lineWidth;\n }\n }\n\n const htmlInput = this.htmlInput_ as HTMLElement;\n const scrollbarWidth = htmlInput.offsetWidth - htmlInput.clientWidth;\n totalWidth += scrollbarWidth;\n }\n if (this.borderRect_) {\n totalHeight += constants.FIELD_BORDER_RECT_Y_PADDING * 2;\n // NOTE: Adding 1 extra px to prevent wrapping. Based on browser zoom,\n // the rounding of the calculated value can result in the line wrapping\n // unintentionally.\n totalWidth += constants.FIELD_BORDER_RECT_X_PADDING * 2 + 1;\n this.borderRect_.setAttribute('width', `${totalWidth}`);\n this.borderRect_.setAttribute('height', `${totalHeight}`);\n }\n this.size_.width = totalWidth;\n this.size_.height = totalHeight;\n\n this.positionBorderRect_();\n }\n\n /**\n * Show the inline free-text editor on top of the text.\n * Overrides the default behaviour to force rerender in order to\n * correct block size, based on editor text.\n *\n * @param e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @param quietInput True if editor should be created without focus.\n * Defaults to false.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n override showEditor_(e?: Event, quietInput?: boolean) {\n super.showEditor_(e, quietInput);\n this.forceRerender();\n }\n\n /**\n * Create the text input editor widget.\n *\n * @returns The newly created text input editor.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override widgetCreate_(): HTMLTextAreaElement {\n const div = Blockly.WidgetDiv.getDiv() as HTMLDivElement;\n const scale = (this.workspace_ as Blockly.WorkspaceSvg).getScale();\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n\n const htmlInput = document.createElement('textarea');\n htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';\n htmlInput.setAttribute('spellcheck', String(this.spellcheck_));\n const fontSize = constants.FIELD_TEXT_FONTSIZE * scale + 'pt';\n div.style.fontSize = fontSize;\n htmlInput.style.fontSize = fontSize;\n const borderRadius = Blockly.FieldTextInput.BORDERRADIUS * scale + 'px';\n htmlInput.style.borderRadius = borderRadius;\n const paddingX = constants.FIELD_BORDER_RECT_X_PADDING * scale;\n const paddingY = (constants.FIELD_BORDER_RECT_Y_PADDING * scale) / 2;\n htmlInput.style.padding =\n paddingY + 'px ' + paddingX + 'px ' + paddingY + 'px ' + paddingX + 'px';\n const lineHeight =\n constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;\n htmlInput.style.lineHeight = lineHeight * scale + 'px';\n\n div.appendChild(htmlInput);\n\n htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);\n htmlInput.setAttribute('data-untyped-default-value', String(this.value_));\n htmlInput.setAttribute('data-old-value', '');\n if (Blockly.utils.userAgent.GECKO) {\n // In FF, ensure the browser reflows before resizing to avoid issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n\n this.bindInputEvents_(htmlInput);\n\n return htmlInput;\n }\n\n /**\n * Sets the maxLines config for this field.\n *\n * @param maxLines Defines the maximum number of lines allowed, before\n * scrolling functionality is enabled.\n */\n setMaxLines(maxLines: number) {\n if (\n typeof maxLines === 'number' &&\n maxLines > 0 &&\n maxLines !== this.maxLines_\n ) {\n this.maxLines_ = maxLines;\n this.forceRerender();\n }\n }\n\n /**\n * Returns the maxLines config of this field.\n *\n * @returns The maxLines config value.\n */\n getMaxLines(): number {\n return this.maxLines_;\n }\n\n /**\n * Handle key down to the editor. Override the text input definition of this\n * so as to not close the editor when enter is typed in.\n *\n * @param e Keyboard event.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override onHtmlInputKeyDown_(e: KeyboardEvent) {\n if (e.key !== 'Enter') {\n super.onHtmlInputKeyDown_(e);\n }\n }\n\n /**\n * Construct a FieldMultilineInput from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and spellcheck).\n * @returns The new field instance.\n * @nocollapse\n */\n static override fromJson(\n options: FieldMultilineInputFromJsonConfig,\n ): FieldMultilineInput {\n const text = Blockly.utils.parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldMultilineInput if that class doesn't\n // override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\n/**\n * Register the field and any dependencies.\n */\nexport function registerFieldMultilineInput() {\n Blockly.fieldRegistry.register('field_multilinetext', FieldMultilineInput);\n}\n\n/**\n * CSS for multiline field.\n */\nBlockly.Css.register(`\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n`);\n\n/**\n * Config options for the multiline input field.\n */\nexport interface FieldMultilineInputConfig\n extends Blockly.FieldTextInputConfig {\n maxLines?: number;\n}\n\n/**\n * fromJson config options for the multiline input field.\n */\nexport interface FieldMultilineInputFromJsonConfig\n extends FieldMultilineInputConfig {\n text?: string;\n}\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldMultilineInputValidator = Blockly.FieldTextInputValidator;\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Block, common as BlocklyCommon} from 'blockly/core';\nimport {\n JavascriptGenerator,\n Order as JavascriptOrder,\n} from 'blockly/javascript';\nimport {DartGenerator, Order as DartOrder} from 'blockly/dart';\nimport {LuaGenerator, Order as LuaOrder} from 'blockly/lua';\nimport {PhpGenerator, Order as PhpOrder} from 'blockly/php';\nimport {PythonGenerator, Order as PythonOrder} from 'blockly/python';\nimport {registerFieldMultilineInput} from '../field_multilineinput';\nimport {Generators} from './generatorsType';\n\n/** The name this block is registered under. */\nexport const BLOCK_NAME = 'text_multiline';\n\n// Block for multiline text input.\nconst jsonDefinition = {\n type: BLOCK_NAME,\n message0: '%1 %2',\n args0: [\n {\n type: 'field_image',\n src:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpP' +\n 'U2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0' +\n 'U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjm' +\n 'RIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z88' +\n '73zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5luj' +\n 'nYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiD' +\n 'MYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYX' +\n 'fwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4z' +\n 'wA5X2Z9AYnQrEAAAAASUVORK5CYII=',\n width: 12,\n height: 17,\n alt: '\\u00B6',\n },\n {\n type: 'field_multilinetext',\n name: 'TEXT',\n text: '',\n },\n ],\n output: 'String',\n style: 'text_blocks',\n helpUrl: '%{BKY_TEXT_TEXT_HELPURL}',\n tooltip: '%{BKY_TEXT_TEXT_TOOLTIP}',\n extensions: ['parent_tooltip_when_inline'],\n};\n\n/**\n * Javascript block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The JavascriptGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toJavascript(\n block: Block,\n generator: JavascriptGenerator,\n): [string, JavascriptOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('+') !== -1\n ? JavascriptOrder.ADDITION\n : JavascriptOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * Dart block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The DartGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toDart(\n block: Block,\n generator: DartGenerator,\n): [string, DartOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('+') !== -1 ? DartOrder.ADDITIVE : DartOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * Lua block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The LuaGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toLua(\n block: Block,\n generator: LuaGenerator,\n): [string, LuaOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('..') !== -1 ? LuaOrder.CONCATENATION : LuaOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * PHP block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The PhpGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toPhp(\n block: Block,\n generator: PhpGenerator,\n): [string, PhpOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('.') !== -1 ? PhpOrder.STRING_CONCAT : PhpOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * Python block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The PythonGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toPython(\n block: Block,\n generator: PythonGenerator,\n): [string, PythonOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('+') !== -1 ? PythonOrder.ADDITIVE : PythonOrder.ATOMIC;\n return [code, order];\n}\n\nconst definitionsDict = BlocklyCommon.createBlockDefinitionsFromJsonArray([\n jsonDefinition,\n]);\n\n/** The text_multiline BlockDefinition. */\nexport const blockDefinition = definitionsDict[BLOCK_NAME];\n\n/**\n * Install the `text_multiline` block and all of its dependencies.\n *\n * @param gens The CodeGenerators to install per-block\n * generators on.\n */\nexport function installBlock(gens: Generators = {}) {\n registerFieldMultilineInput();\n BlocklyCommon.defineBlocks(definitionsDict);\n if (gens.javascript) gens.javascript.forBlock[BLOCK_NAME] = toJavascript;\n if (gens.dart) gens.dart.forBlock[BLOCK_NAME] = toDart;\n if (gens.lua) gens.lua.forBlock[BLOCK_NAME] = toLua;\n if (gens.php) gens.php.forBlock[BLOCK_NAME] = toPhp;\n if (gens.python) gens.python.forBlock[BLOCK_NAME] = toPython;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as textMultiline from './blocks/textMultiline';\n\nexport * from './field_multilineinput';\n\n// Re-export all parts of the block definition.\nexport * as textMultiline from './blocks/textMultiline';\n\n// This package currently exports a single block. More may\n// be added later.\nexport const installAllBlocks = textMultiline.installBlock;\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__370__","__WEBPACK_EXTERNAL_MODULE__127__","__WEBPACK_EXTERNAL_MODULE__379__","__WEBPACK_EXTERNAL_MODULE__157__","__WEBPACK_EXTERNAL_MODULE__537__","__WEBPACK_EXTERNAL_MODULE__557__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","FieldMultilineInput","constructor","validator","config","super","SKIP_SETUP","textGroup","maxLines_","Infinity","isOverflowedY_","configure_","setValue","setValidator","maxLines","setMaxLines","toXml","fieldElement","textContent","getValue","replace","fromXml","saveState","legacyState","saveLegacyState","loadState","state","loadLegacyState","initView","createBorderRect_","dom","createSvgElement","Svg","G","class","fieldGroup_","getDisplayText_","block","getSourceBlock","Error","textLines","getText","NBSP","lines","split","displayLinesNumber","length","text","maxDisplayLength","substring","RTL","doValueUpdate_","newValue","value_","render_","currentChild","firstChild","removeChild","constants","getConstants","y","lineHeight","FIELD_TEXT_HEIGHT","FIELD_BORDER_RECT_Y_PADDING","TEXT","x","FIELD_BORDER_RECT_X_PADDING","dy","FIELD_TEXT_BASELINE","appendChild","document","createTextNode","isBeingEdited_","htmlInput","htmlInput_","addClass","removeClass","updateSize_","setTimeout","resizeEditor_","bind","isTextValid_","aria","setState","State","INVALID","nodes","childNodes","fontSize","FIELD_TEXT_FONTSIZE","fontWeight","FIELD_TEXT_FONTWEIGHT","fontFamily","FIELD_TEXT_FONTFAMILY","totalWidth","totalHeight","tspan","textWidth","getFastTextWidth","actualEditorLines","String","dummyTextElement","lineWidth","offsetWidth","clientWidth","borderRect_","setAttribute","size_","width","height","positionBorderRect_","showEditor_","e","quietInput","forceRerender","widgetCreate_","div","getDiv","scale","workspace_","getScale","createElement","className","spellcheck_","style","borderRadius","BORDERRADIUS","paddingX","paddingY","padding","defaultValue","getEditorText_","userAgent","GECKO","bindInputEvents_","getMaxLines","onHtmlInputKeyDown_","fromJson","options","parsing","replaceMessageReferences","registerFieldMultilineInput","register","BLOCK_NAME","jsonDefinition","type","message0","args0","src","alt","name","output","helpUrl","tooltip","extensions","toJavascript","generator","code","multiline_quote_","getFieldValue","order","indexOf","ADDITION","ATOMIC","toDart","ADDITIVE","toLua","CONCATENATION","toPhp","STRING_CONCAT","toPython","definitionsDict","createBlockDefinitionsFromJsonArray","blockDefinition","installBlock","gens","defineBlocks","javascript","forBlock","dart","lua","php","python","installAllBlocks"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":";CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,gBAAiBA,QAAQ,sBAAuBA,QAAQ,gBAAiBA,QAAQ,eAAgBA,QAAQ,eAAgBA,QAAQ,wBAC9J,GAAqB,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,eAAgB,qBAAsB,eAAgB,cAAe,cAAe,kBAAmBJ,OAC3G,CACJ,IAAIM,EAAuB,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,QAAQ,KAAc,QAAUI,SAAW,QAAUF,OAC5D,MAAO,CAACN,EAAMG,EAChB,CASO,SAASM,EACdjI,EACAuH,GAGA,MAAMC,EAAOD,EAAUE,iBAAiBzH,EAAM0H,cAAc,SACtDC,GACoB,IAAxBH,EAAKI,QAAQ,MAAe,QAASM,cAAgB,QAASJ,OAChE,MAAO,CAACN,EAAMG,EAChB,CASO,SAASQ,EACdnI,EACAuH,GAGA,MAAMC,EAAOD,EAAUE,iBAAiBzH,EAAM0H,cAAc,SACtDC,GACmB,IAAvBH,EAAKI,QAAQ,KAAc,QAASQ,cAAgB,QAASN,OAC/D,MAAO,CAACN,EAAMG,EAChB,CASO,SAASU,EACdrI,EACAuH,GAGA,MAAMC,EAAOD,EAAUE,iBAAiBzH,EAAM0H,cAAc,SACtDC,GACmB,IAAvBH,EAAKI,QAAQ,KAAc,QAAYI,SAAW,QAAYF,OAChE,MAAO,CAACN,EAAMG,EAChB,CAEA,MAAMW,EAAkB,SAAcC,oCAAoC,CACxE5B,IAIW6B,EAAkBF,EAAgB5B,GAQxC,SAAS+B,EAAaC,EAAmB,CAAC,GAC/ClC,IACA,SAAcmC,aAAaL,GACvBI,EAAKE,aAAYF,EAAKE,WAAWC,SAASnC,GAAcY,GACxDoB,EAAKI,OAAMJ,EAAKI,KAAKD,SAASnC,GAAcqB,GAC5CW,EAAKK,MAAKL,EAAKK,IAAIF,SAASnC,GAAcuB,GAC1CS,EAAKM,MAAKN,EAAKM,IAAIH,SAASnC,GAAcyB,GAC1CO,EAAKO,SAAQP,EAAKO,OAAOJ,SAASnC,GAAc2B,EACtD,CCzJO,MAAMa,EAAmB,E","sources":["webpack://@blockly/field-multilineinput/webpack/universalModuleDefinition","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.JavaScript\",\"commonjs\":\"blockly/javascript\",\"commonjs2\":\"blockly/javascript\",\"amd\":\"blockly/javascript\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.Lua\",\"commonjs\":\"blockly/lua\",\"commonjs2\":\"blockly/lua\",\"amd\":\"blockly/lua\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly\",\"commonjs\":\"blockly/core\",\"commonjs2\":\"blockly/core\",\"amd\":\"blockly/core\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.Dart\",\"commonjs\":\"blockly/dart\",\"commonjs2\":\"blockly/dart\",\"amd\":\"blockly/dart\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.PHP\",\"commonjs\":\"blockly/php\",\"commonjs2\":\"blockly/php\",\"amd\":\"blockly/php\"}","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly.Python\",\"commonjs\":\"blockly/python\",\"commonjs2\":\"blockly/python\",\"amd\":\"blockly/python\"}","webpack://@blockly/field-multilineinput/webpack/bootstrap","webpack://@blockly/field-multilineinput/webpack/runtime/define property getters","webpack://@blockly/field-multilineinput/webpack/runtime/hasOwnProperty shorthand","webpack://@blockly/field-multilineinput/webpack/runtime/make namespace object","webpack://@blockly/field-multilineinput/./src/field_multilineinput.ts","webpack://@blockly/field-multilineinput/./src/blocks/textMultiline.ts","webpack://@blockly/field-multilineinput/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"blockly/core\"), require(\"blockly/javascript\"), require(\"blockly/dart\"), require(\"blockly/lua\"), require(\"blockly/php\"), require(\"blockly/python\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"blockly/core\", \"blockly/javascript\", \"blockly/dart\", \"blockly/lua\", \"blockly/php\", \"blockly/python\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"blockly/core\"), require(\"blockly/javascript\"), require(\"blockly/dart\"), require(\"blockly/lua\"), require(\"blockly/php\"), require(\"blockly/python\")) : factory(root[\"Blockly\"], root[\"Blockly.JavaScript\"], root[\"Blockly.Dart\"], root[\"Blockly.Lua\"], root[\"Blockly.PHP\"], root[\"Blockly.Python\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__370__, __WEBPACK_EXTERNAL_MODULE__127__, __WEBPACK_EXTERNAL_MODULE__379__, __WEBPACK_EXTERNAL_MODULE__157__, __WEBPACK_EXTERNAL_MODULE__537__, __WEBPACK_EXTERNAL_MODULE__557__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__127__;","module.exports = __WEBPACK_EXTERNAL_MODULE__157__;","module.exports = __WEBPACK_EXTERNAL_MODULE__370__;","module.exports = __WEBPACK_EXTERNAL_MODULE__379__;","module.exports = __WEBPACK_EXTERNAL_MODULE__537__;","module.exports = __WEBPACK_EXTERNAL_MODULE__557__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Multiline text input field.\n */\n\nimport * as Blockly from 'blockly/core';\n\n/**\n * Class for an editable text area input field.\n */\nexport class FieldMultilineInput extends Blockly.FieldTextInput {\n /**\n * The SVG group element that will contain a text element for each text row\n * when initialized.\n */\n textGroup: SVGGElement | null = null;\n\n /**\n * Defines the maximum number of lines of field.\n * If exceeded, scrolling functionality is enabled.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected maxLines_ = Infinity;\n\n /** Whether Y overflow is currently occurring. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected isOverflowedY_ = false;\n\n /**\n * @param value The initial content of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param validator An optional function that is called to validate any\n * constraints on what the user entered. Takes the new text as an\n * argument and returns either the accepted text, a replacement text, or\n * null to abort the change.\n * @param config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n value?: string | typeof Blockly.Field.SKIP_SETUP,\n validator?: FieldMultilineInputValidator,\n config?: FieldMultilineInputConfig,\n ) {\n super(Blockly.Field.SKIP_SETUP);\n\n if (value === Blockly.Field.SKIP_SETUP) return;\n if (config) {\n this.configure_(config);\n }\n this.setValue(value);\n if (validator) {\n this.setValidator(validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override configure_(config: FieldMultilineInputConfig) {\n super.configure_(config);\n if (config.maxLines) this.setMaxLines(config.maxLines);\n }\n\n /**\n * Serializes this field's value to XML.\n * Should only be called by Blockly.Xml.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n */\n override toXml(fieldElement: Element): Element {\n // Replace '\\n' characters with HTML-escaped equivalent '&#10'. This is\n // needed so the plain-text representation of the XML produced by\n // `Blockly.Xml.domToText` will appear on a single line (this is a\n // limitation of the plain-text format).\n fieldElement.textContent = (this.getValue() as string).replace(\n /\\n/g,\n '&#10;',\n );\n return fieldElement;\n }\n\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n */\n override fromXml(fieldElement: Element) {\n this.setValue((fieldElement.textContent as string).replace(/&#10;/g, '\\n'));\n }\n\n /**\n * Saves this field's value.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @returns The state of this field.\n */\n override saveState() {\n const legacyState = this.saveLegacyState(FieldMultilineInput);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValue();\n }\n\n /**\n * Sets the field's value based on the given state.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @param state The state of the variable to assign to this variable field.\n */\n override loadState(state: unknown) {\n if (this.loadLegacyState(Blockly.Field, state)) {\n return;\n }\n this.setValue(state);\n }\n\n /**\n * Create the block UI for this field.\n */\n override initView() {\n this.createBorderRect_();\n this.textGroup = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.G,\n {\n class: 'blocklyEditableField',\n },\n this.fieldGroup_,\n );\n }\n\n /**\n * Get the text from this field as displayed on screen. May differ from\n * getText due to ellipsis, and other formatting.\n *\n * @returns Currently displayed text.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override getDisplayText_(): string {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.',\n );\n }\n let textLines = this.getText();\n if (!textLines) {\n // Prevent the field from disappearing if empty.\n return Blockly.Field.NBSP;\n }\n const lines = textLines.split('\\n');\n textLines = '';\n const displayLinesNumber = this.isOverflowedY_\n ? this.maxLines_\n : lines.length;\n for (let i = 0; i < displayLinesNumber; i++) {\n let text = lines[i];\n if (text.length > this.maxDisplayLength) {\n // Truncate displayed string and add an ellipsis ('...').\n text = text.substring(0, this.maxDisplayLength - 4) + '...';\n } else if (this.isOverflowedY_ && i === displayLinesNumber - 1) {\n text = text.substring(0, text.length - 3) + '...';\n }\n // Replace whitespace with non-breaking spaces so the text doesn't\n // collapse.\n text = text.replace(/\\s/g, Blockly.Field.NBSP);\n\n textLines += text;\n if (i !== displayLinesNumber - 1) {\n textLines += '\\n';\n }\n }\n if (block.RTL) {\n // The SVG is LTR, force value to be RTL.\n textLines += '\\u200F';\n }\n return textLines;\n }\n\n /**\n * Called by setValue if the text input is valid. Updates the value of the\n * field, and updates the text of the field if it is not currently being\n * edited (i.e. handled by the htmlInput_). Is being redefined here to update\n * overflow state of the field.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override doValueUpdate_(newValue: string) {\n super.doValueUpdate_(newValue);\n if (this.value_ !== null) {\n this.isOverflowedY_ = this.value_.split('\\n').length > this.maxLines_;\n }\n }\n\n /** Updates the text of the textElement. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override render_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.',\n );\n }\n // Remove all text group children.\n let currentChild;\n const textGroup = this.textGroup as SVGElement;\n while ((currentChild = textGroup.firstChild)) {\n textGroup.removeChild(currentChild);\n }\n\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n // Add in text elements into the group.\n const lines = this.getDisplayText_().split('\\n');\n let y = 0;\n for (let i = 0; i < lines.length; i++) {\n const lineHeight =\n constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;\n const span = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.TEXT,\n {\n class: 'blocklyText blocklyMultilineText',\n x: constants.FIELD_BORDER_RECT_X_PADDING,\n y: y + constants.FIELD_BORDER_RECT_Y_PADDING,\n dy: constants.FIELD_TEXT_BASELINE,\n },\n textGroup,\n );\n span.appendChild(document.createTextNode(lines[i]));\n y += lineHeight;\n }\n\n if (this.isBeingEdited_) {\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (this.isOverflowedY_) {\n Blockly.utils.dom.addClass(\n htmlInput,\n 'blocklyHtmlTextAreaInputOverflowedY',\n );\n } else {\n Blockly.utils.dom.removeClass(\n htmlInput,\n 'blocklyHtmlTextAreaInputOverflowedY',\n );\n }\n }\n\n this.updateSize_();\n\n if (this.isBeingEdited_) {\n if (block.RTL) {\n // in RTL, we need to let the browser reflow before resizing\n // in order to get the correct bounding box of the borderRect\n // avoiding issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (!this.isTextValid_) {\n Blockly.utils.dom.addClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(\n htmlInput,\n Blockly.utils.aria.State.INVALID,\n true,\n );\n } else {\n Blockly.utils.dom.removeClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(\n htmlInput,\n Blockly.utils.aria.State.INVALID,\n false,\n );\n }\n }\n }\n\n /** Updates the size of the field based on the text. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override updateSize_() {\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n const nodes = (this.textGroup as SVGElement).childNodes;\n const fontSize = constants.FIELD_TEXT_FONTSIZE;\n const fontWeight = constants.FIELD_TEXT_FONTWEIGHT;\n const fontFamily = constants.FIELD_TEXT_FONTFAMILY;\n let totalWidth = 0;\n let totalHeight = 0;\n for (let i = 0; i < nodes.length; i++) {\n const tspan = nodes[i] as SVGTextElement;\n const textWidth = Blockly.utils.dom.getFastTextWidth(\n tspan,\n fontSize,\n fontWeight,\n fontFamily,\n );\n if (textWidth > totalWidth) {\n totalWidth = textWidth;\n }\n totalHeight +=\n constants.FIELD_TEXT_HEIGHT +\n (i > 0 ? constants.FIELD_BORDER_RECT_Y_PADDING : 0);\n }\n if (this.isBeingEdited_) {\n // The default width is based on the longest line in the display text,\n // but when it's being edited, width should be calculated based on the\n // absolute longest line, even if it would be truncated after editing.\n // Otherwise we would get wrong editor width when there are more\n // lines than this.maxLines_.\n const actualEditorLines = String(this.value_).split('\\n');\n const dummyTextElement = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.TEXT,\n {class: 'blocklyText blocklyMultilineText'},\n );\n\n for (let i = 0; i < actualEditorLines.length; i++) {\n if (actualEditorLines[i].length > this.maxDisplayLength) {\n actualEditorLines[i] = actualEditorLines[i].substring(\n 0,\n this.maxDisplayLength,\n );\n }\n dummyTextElement.textContent = actualEditorLines[i];\n const lineWidth = Blockly.utils.dom.getFastTextWidth(\n dummyTextElement,\n fontSize,\n fontWeight,\n fontFamily,\n );\n if (lineWidth > totalWidth) {\n totalWidth = lineWidth;\n }\n }\n\n const htmlInput = this.htmlInput_ as HTMLElement;\n const scrollbarWidth = htmlInput.offsetWidth - htmlInput.clientWidth;\n totalWidth += scrollbarWidth;\n }\n if (this.borderRect_) {\n totalHeight += constants.FIELD_BORDER_RECT_Y_PADDING * 2;\n // NOTE: Adding 1 extra px to prevent wrapping. Based on browser zoom,\n // the rounding of the calculated value can result in the line wrapping\n // unintentionally.\n totalWidth += constants.FIELD_BORDER_RECT_X_PADDING * 2 + 1;\n this.borderRect_.setAttribute('width', `${totalWidth}`);\n this.borderRect_.setAttribute('height', `${totalHeight}`);\n }\n this.size_.width = totalWidth;\n this.size_.height = totalHeight;\n\n this.positionBorderRect_();\n }\n\n /**\n * Show the inline free-text editor on top of the text.\n * Overrides the default behaviour to force rerender in order to\n * correct block size, based on editor text.\n *\n * @param e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @param quietInput True if editor should be created without focus.\n * Defaults to false.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n override showEditor_(e?: Event, quietInput?: boolean) {\n super.showEditor_(e, quietInput);\n this.forceRerender();\n }\n\n /**\n * Create the text input editor widget.\n *\n * @returns The newly created text input editor.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override widgetCreate_(): HTMLTextAreaElement {\n const div = Blockly.WidgetDiv.getDiv() as HTMLDivElement;\n const scale = (this.workspace_ as Blockly.WorkspaceSvg).getScale();\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n\n const htmlInput = document.createElement('textarea');\n htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';\n htmlInput.setAttribute('spellcheck', String(this.spellcheck_));\n const fontSize = constants.FIELD_TEXT_FONTSIZE * scale + 'pt';\n div.style.fontSize = fontSize;\n htmlInput.style.fontSize = fontSize;\n const borderRadius = Blockly.FieldTextInput.BORDERRADIUS * scale + 'px';\n htmlInput.style.borderRadius = borderRadius;\n const paddingX = constants.FIELD_BORDER_RECT_X_PADDING * scale;\n const paddingY = (constants.FIELD_BORDER_RECT_Y_PADDING * scale) / 2;\n htmlInput.style.padding =\n paddingY + 'px ' + paddingX + 'px ' + paddingY + 'px ' + paddingX + 'px';\n const lineHeight =\n constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;\n htmlInput.style.lineHeight = lineHeight * scale + 'px';\n\n div.appendChild(htmlInput);\n\n htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);\n htmlInput.setAttribute('data-untyped-default-value', String(this.value_));\n htmlInput.setAttribute('data-old-value', '');\n if (Blockly.utils.userAgent.GECKO) {\n // In FF, ensure the browser reflows before resizing to avoid issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n\n this.bindInputEvents_(htmlInput);\n\n return htmlInput;\n }\n\n /**\n * Sets the maxLines config for this field.\n *\n * @param maxLines Defines the maximum number of lines allowed, before\n * scrolling functionality is enabled.\n */\n setMaxLines(maxLines: number) {\n if (\n typeof maxLines === 'number' &&\n maxLines > 0 &&\n maxLines !== this.maxLines_\n ) {\n this.maxLines_ = maxLines;\n this.forceRerender();\n }\n }\n\n /**\n * Returns the maxLines config of this field.\n *\n * @returns The maxLines config value.\n */\n getMaxLines(): number {\n return this.maxLines_;\n }\n\n /**\n * Handle key down to the editor. Override the text input definition of this\n * so as to not close the editor when enter is typed in.\n *\n * @param e Keyboard event.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override onHtmlInputKeyDown_(e: KeyboardEvent) {\n if (e.key !== 'Enter') {\n super.onHtmlInputKeyDown_(e);\n }\n }\n\n /**\n * Construct a FieldMultilineInput from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and spellcheck).\n * @returns The new field instance.\n * @nocollapse\n */\n static override fromJson(\n options: FieldMultilineInputFromJsonConfig,\n ): FieldMultilineInput {\n const text = Blockly.utils.parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldMultilineInput if that class doesn't\n // override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\n/**\n * Register the field and any dependencies.\n */\nexport function registerFieldMultilineInput() {\n Blockly.fieldRegistry.register('field_multilinetext', FieldMultilineInput);\n}\n\n/**\n * CSS for multiline field.\n */\nBlockly.Css.register(`\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n`);\n\n/**\n * Config options for the multiline input field.\n */\nexport interface FieldMultilineInputConfig\n extends Blockly.FieldTextInputConfig {\n maxLines?: number;\n}\n\n/**\n * fromJson config options for the multiline input field.\n */\nexport interface FieldMultilineInputFromJsonConfig\n extends FieldMultilineInputConfig {\n text?: string;\n}\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldMultilineInputValidator = Blockly.FieldTextInputValidator;\n","/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Block, common as BlocklyCommon} from 'blockly/core';\nimport {\n JavascriptGenerator,\n Order as JavascriptOrder,\n} from 'blockly/javascript';\nimport {DartGenerator, Order as DartOrder} from 'blockly/dart';\nimport {LuaGenerator, Order as LuaOrder} from 'blockly/lua';\nimport {PhpGenerator, Order as PhpOrder} from 'blockly/php';\nimport {PythonGenerator, Order as PythonOrder} from 'blockly/python';\nimport {registerFieldMultilineInput} from '../field_multilineinput';\nimport {Generators} from './generatorsType';\n\n/** The name this block is registered under. */\nexport const BLOCK_NAME = 'text_multiline';\n\n// Block for multiline text input.\nconst jsonDefinition = {\n type: BLOCK_NAME,\n message0: '%1 %2',\n args0: [\n {\n type: 'field_image',\n src:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpP' +\n 'U2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0' +\n 'U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjm' +\n 'RIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z88' +\n '73zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5luj' +\n 'nYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiD' +\n 'MYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYX' +\n 'fwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4z' +\n 'wA5X2Z9AYnQrEAAAAASUVORK5CYII=',\n width: 12,\n height: 17,\n alt: '\\u00B6',\n },\n {\n type: 'field_multilinetext',\n name: 'TEXT',\n text: '',\n },\n ],\n output: 'String',\n style: 'text_blocks',\n helpUrl: '%{BKY_TEXT_TEXT_HELPURL}',\n tooltip: '%{BKY_TEXT_TEXT_TOOLTIP}',\n extensions: ['parent_tooltip_when_inline'],\n};\n\n/**\n * Javascript block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The JavascriptGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toJavascript(\n block: Block,\n generator: JavascriptGenerator,\n): [string, JavascriptOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('+') !== -1\n ? JavascriptOrder.ADDITION\n : JavascriptOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * Dart block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The DartGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toDart(\n block: Block,\n generator: DartGenerator,\n): [string, DartOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('+') !== -1 ? DartOrder.ADDITIVE : DartOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * Lua block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The LuaGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toLua(\n block: Block,\n generator: LuaGenerator,\n): [string, LuaOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('..') !== -1 ? LuaOrder.CONCATENATION : LuaOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * PHP block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The PhpGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toPhp(\n block: Block,\n generator: PhpGenerator,\n): [string, PhpOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('.') !== -1 ? PhpOrder.STRING_CONCAT : PhpOrder.ATOMIC;\n return [code, order];\n}\n\n/**\n * Python block generator function.\n *\n * @param block The Block instance to generate code for.\n * @param generator The PythonGenerator calling the function.\n * @returns A tuple containing the code string and precedence.\n */\nexport function toPython(\n block: Block,\n generator: PythonGenerator,\n): [string, PythonOrder] {\n // Text value.\n const code = generator.multiline_quote_(block.getFieldValue('TEXT'));\n const order =\n code.indexOf('+') !== -1 ? PythonOrder.ADDITIVE : PythonOrder.ATOMIC;\n return [code, order];\n}\n\nconst definitionsDict = BlocklyCommon.createBlockDefinitionsFromJsonArray([\n jsonDefinition,\n]);\n\n/** The text_multiline BlockDefinition. */\nexport const blockDefinition = definitionsDict[BLOCK_NAME];\n\n/**\n * Install the `text_multiline` block and all of its dependencies.\n *\n * @param gens The CodeGenerators to install per-block\n * generators on.\n */\nexport function installBlock(gens: Generators = {}) {\n registerFieldMultilineInput();\n BlocklyCommon.defineBlocks(definitionsDict);\n if (gens.javascript) gens.javascript.forBlock[BLOCK_NAME] = toJavascript;\n if (gens.dart) gens.dart.forBlock[BLOCK_NAME] = toDart;\n if (gens.lua) gens.lua.forBlock[BLOCK_NAME] = toLua;\n if (gens.php) gens.php.forBlock[BLOCK_NAME] = toPhp;\n if (gens.python) gens.python.forBlock[BLOCK_NAME] = toPython;\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as textMultiline from './blocks/textMultiline';\n\nexport * from './field_multilineinput';\n\n// Re-export all parts of the block definition.\nexport * as textMultiline from './blocks/textMultiline';\n\n// This package currently exports a single block. More may\n// be added later.\nexport const installAllBlocks = textMultiline.installBlock;\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__370__","__WEBPACK_EXTERNAL_MODULE__127__","__WEBPACK_EXTERNAL_MODULE__379__","__WEBPACK_EXTERNAL_MODULE__157__","__WEBPACK_EXTERNAL_MODULE__537__","__WEBPACK_EXTERNAL_MODULE__557__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","FieldMultilineInput","constructor","validator","config","super","SKIP_SETUP","textGroup","maxLines_","Infinity","isOverflowedY_","configure_","setValue","setValidator","maxLines","setMaxLines","toXml","fieldElement","textContent","getValue","replace","fromXml","saveState","legacyState","saveLegacyState","loadState","state","loadLegacyState","initView","createBorderRect_","dom","createSvgElement","Svg","G","class","fieldGroup_","getDisplayText_","block","getSourceBlock","Error","textLines","getText","NBSP","lines","split","displayLinesNumber","length","text","maxDisplayLength","substring","RTL","doValueUpdate_","newValue","value_","render_","currentChild","firstChild","removeChild","constants","getConstants","y","lineHeight","FIELD_TEXT_HEIGHT","FIELD_BORDER_RECT_Y_PADDING","TEXT","x","FIELD_BORDER_RECT_X_PADDING","dy","FIELD_TEXT_BASELINE","appendChild","document","createTextNode","isBeingEdited_","htmlInput","htmlInput_","addClass","removeClass","updateSize_","setTimeout","resizeEditor_","bind","isTextValid_","aria","setState","State","INVALID","nodes","childNodes","fontSize","FIELD_TEXT_FONTSIZE","fontWeight","FIELD_TEXT_FONTWEIGHT","fontFamily","FIELD_TEXT_FONTFAMILY","totalWidth","totalHeight","tspan","textWidth","getFastTextWidth","actualEditorLines","String","dummyTextElement","lineWidth","offsetWidth","clientWidth","borderRect_","setAttribute","size_","width","height","positionBorderRect_","showEditor_","e","quietInput","forceRerender","widgetCreate_","div","getDiv","scale","workspace_","getScale","createElement","className","spellcheck_","style","borderRadius","BORDERRADIUS","paddingX","paddingY","padding","defaultValue","getEditorText_","userAgent","GECKO","bindInputEvents_","getMaxLines","onHtmlInputKeyDown_","fromJson","options","parsing","replaceMessageReferences","registerFieldMultilineInput","register","BLOCK_NAME","jsonDefinition","type","message0","args0","src","alt","name","output","helpUrl","tooltip","extensions","toJavascript","generator","code","multiline_quote_","getFieldValue","order","indexOf","ADDITION","ATOMIC","toDart","ADDITIVE","toLua","CONCATENATION","toPhp","STRING_CONCAT","toPython","definitionsDict","createBlockDefinitionsFromJsonArray","blockDefinition","installBlock","gens","defineBlocks","javascript","forBlock","dart","lua","php","python","installAllBlocks"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockly/field-multilineinput",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "A Blockly multilineinput field.",
5
5
  "scripts": {
6
6
  "audit:fix": "blockly-scripts auditFix",
@@ -41,7 +41,7 @@
41
41
  ],
42
42
  "devDependencies": {
43
43
  "@blockly/dev-scripts": "^4.0.9",
44
- "@blockly/dev-tools": "^9.0.2",
44
+ "@blockly/dev-tools": "^9.0.3",
45
45
  "chai": "^4.2.0",
46
46
  "sinon": "^9.0.1",
47
47
  "typescript": "^5.4.5"
@@ -56,5 +56,5 @@
56
56
  "engines": {
57
57
  "node": ">=8.0.0"
58
58
  },
59
- "gitHead": "46f98b7d49e6ef33f2a9337860c05675e789dbe4"
59
+ "gitHead": "9fd07afd85d02d9442d9e80d8f6538cba5e8b002"
60
60
  }